-
Notifications
You must be signed in to change notification settings - Fork 3
/
cliintf.h
executable file
·58 lines (47 loc) · 1.14 KB
/
cliintf.h
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
55
56
57
58
#ifndef __CLIINTF_H__
#define __CLIINTF_H__
#define CLI_COMMAND_RESP_LEN 1000
typedef enum {
CLI_INTF_CMD_REQ,
CLI_INTF_CMD_RESP,
} CliInterfaceType_t;
typedef enum {
CLI_COMMAND_RES_SUCCESS,
CLI_COMMAND_RES_FAIL,
} CliCommandRes_t;
typedef enum {
CLI_PRIV_NO_PRIV, // not privileged
CLI_PRIV_SU_PRIV, // privileged
} CliPriv_t;
typedef enum {
CLI_COMMAND_SHOW,
} CliCommands_t;
typedef enum {
CLI_SUBCOMMAND_SHOW_DATE,
CLI_SUBCOMMAND_SHOW_CLI_VER,
CLI_SUBCOMMAND_SHOW_INTERFACES,
CLI_SUBCOMMAND_SHOW_IF_IP,
} CliSubCommands_t;
struct cli_iflist {
char ifname[50];
} __attribute__((__packed__));
struct cli_interface_cmdreq {
CliCommands_t command;
CliSubCommands_t sub_command;
CliPriv_t priv;
uint16_t datalen;
uint8_t data[0];
} __attribute__((__packed__));
struct cli_interface_cmdresp {
CliCommands_t command;
CliSubCommands_t sub_command;
CliCommandRes_t res;
uint16_t datalen;
uint8_t data[0];
} __attribute__((__packed__));
struct cli_interface {
CliInterfaceType_t type;
uint16_t len;
uint8_t data[0];
} __attribute__((__packed__));
#endif