4 #define NSCTL_PORT 1702
5 #define NSCTL_MAGIC 0x9013
8 #define NSCTL_REQUEST (1 << 4)
9 #define NSCTL_REQ_LOAD (NSCTL_REQUEST | 1)
10 #define NSCTL_REQ_UNLOAD (NSCTL_REQUEST | 2)
11 #define NSCTL_REQ_HELP (NSCTL_REQUEST | 3)
13 /* general control message, passed to plugins */
14 #define NSCTL_REQ_CONTROL (NSCTL_REQUEST | 4)
16 /* response messages */
17 #define NSCTL_RESPONSE (1 << 5)
18 #define NSCTL_RES_OK (NSCTL_RESPONSE | 1)
19 #define NSCTL_RES_ERR (NSCTL_RESPONSE | 2)
22 #define NSCTL_ERR_SHORT -1 // short packet
23 #define NSCTL_ERR_LONG -2 // packet exceeds max, or trailing cr*p
24 #define NSCTL_ERR_MAGIC -3 // invalid magic number
25 #define NSCTL_ERR_TYPE -4 // unrecognised type
27 #define NSCTL_MAX_PKT_SZ 4096
33 char argv
[NSCTL_MAX_PKT_SZ
- 4];
34 } __attribute__ ((packed
));
36 #define NSCTL_MAX_ARG_SZ 512
40 char value
[NSCTL_MAX_ARG_SZ
- 1];
41 } __attribute__ ((packed
));
50 int pack_control(char *data
, int len
, u8 type
, int argc
, char *argv
[]);
51 int unpack_control(struct nsctl
*packet
, char *data
, int len
);
52 void dump_control(struct nsctl
*control
, FILE *stream
);
54 #endif /* __CONTROL_H__ */