aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/modules/hicn_light/base.h
blob: ea6fc1bc9659f203af5540ef3deddf88e185cbed (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef HICNCTRL_MODULES_HICNLIGHT_BASE_H
#define HICNCTRL_MODULES_HICNLIGHT_BASE_H

#include <hicn/ctrl/hicn-light.h>

#ifdef __APPLE__
#define RANDBYTE() (u8)(arc4random() & 0xFF)
#else
#define RANDBYTE() (u8)(random() & 0xFF)
#endif

// TODO: is this used?
#define foreach_hc_command     \
  _(connection_add)            \
  _(connection_remove)         \
  _(connection_list)           \
  _(listener_add)              \
  _(listener_remove)           \
  _(listener_list)             \
  _(route_add)                 \
  _(route_remove)              \
  _(route_list)                \
  _(cache_set_store)           \
  _(cache_set_serve)           \
  _(cache_clear)               \
  _(cache_list)                \
  _(strategy_set)              \
  _(strategy_add_local_prefix) \
  _(wldr_set)                  \
  _(punting_add)               \
  _(mapme_activator)           \
  _(mapme_timing)              \
  _(subscription_add)          \
  _(subscription_remove)

typedef union {
#define _(x) cmd_##x##_t x;
  foreach_hc_command
#undef _
} hc_msg_payload_t;

typedef cmd_header_t hc_msg_header_t;

typedef struct hc_msg_s {
  hc_msg_header_t header;
  hc_msg_payload_t payload;
} hc_msg_t;

#endif /* HICNCTRL_MODULES_HICNLIGHT_BASE_H */