aboutsummaryrefslogtreecommitdiff
path: root/harness/include/foreign_intf.h
blob: e0d178c907360311c0ad6901ec46a4a251841222 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Contains a structure, which contains functions to back-call into
 * the harness code. */

#ifndef __FOREIGN_INTERFACE
#define __FOREIGN_INTERFACE

#define EXPORT(a) a

typedef void *ctx_t;

typedef struct FOREIGN_INTERFACE {
  /* DO NOT ADD ANY UNEXPORTED VARIABLES HERE */

  /* The context, which needs to be passed to each function. This context is
   * opaque to the plugin and should not be changed. */
  EXPORT(ctx_t ctx);

  /* Requests the harness hot reload the current plugin. */
  EXPORT(void (*request_hot_reload)(ctx_t ctx));

  /* Requests the harness hot reload the current plugin. */
  EXPORT(void (*do_log)(ctx_t ctx, const char* str));

  /* Requestes that the whole system exit. Exits with the given return code. */
  EXPORT(void (*request_exit)(ctx_t ctx, int rc));
} foreign_interface_t;

#undef EXPORT

#endif /* __FOREIGN_INTERFACE */