aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/commands/command_cache.c
blob: 124fcd761ca645591526a5087d21cfb2c1cf02ee (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
50
51
52
53
54
#include <math.h>
#include <hicn/ctrl/command.h>

/* Parameters */

#define serve                                                            \
  {                                                                      \
    .name = "serve",                                                     \
    .help =                                                              \
        "Enables/disables replies from local content store. Either the " \
        "string 'on' or 'off'",                                          \
    .type = TYPE_ON_OFF, .offset = offsetof(hc_cache_t, serve),          \
  }

#define store                                                                 \
  {                                                                           \
    .name = "store",                                                          \
    .help =                                                                   \
        "enables/disables the storage of incoming data packets in the local " \
        "content store. Either the string 'on' or 'off'",                     \
    .type = TYPE_ON_OFF, .offset = offsetof(hc_cache_t, store),               \
  }

/* Commands */

static const command_parser_t command_cache_set_serve = {
    .action = ACTION_SERVE,
    .object_type = OBJECT_TYPE_CACHE,
    .nparams = 1,
    .parameters = {serve},
};
COMMAND_REGISTER(command_cache_set_serve);

static const command_parser_t command_cache_set_store = {
    .action = ACTION_STORE,
    .object_type = OBJECT_TYPE_CACHE,
    .nparams = 1,
    .parameters = {store},
};
COMMAND_REGISTER(command_cache_set_store);

static const command_parser_t command_cache_clear = {
    .action = ACTION_CLEAR,
    .object_type = OBJECT_TYPE_CACHE,
    .nparams = 0,
};
COMMAND_REGISTER(command_cache_clear);

static const command_parser_t command_cache_list = {
    .action = ACTION_LIST,
    .object_type = OBJECT_TYPE_CACHE,
    .nparams = 0,
};
COMMAND_REGISTER(command_cache_list);