6 /* command type constants */
9 * FILE *f, *** only when WITHFILE
10 * int fd, *** only when WITHFD
11 * int|char *arg) *** when INTARG or STRARG */
12 /* if type==NOARG int doit(void)
13 * if type==INTARG int doit(int arg)
14 * if type==WITHFILE|WITHFD|STRARG int doit(FILE *f,int fd,char *arg)
15 * doit returns 0 on success otherwise it returns a valid errno code */
16 #define NOARG 0 /*the command require no args */
17 #define INTARG 1 /* arg is an integer */
18 #define STRARG 2 /* arg is a string */
19 #define WITHFILE 0x40 /* command needs to return text output.
20 (the output will be sent to the user using
21 "0000 DATA END WITH '.'") */
22 #define WITHFD 0x80 /* fd is the identifier of the mgmt connection issuing
23 the command. fd== -1 when the command is executed by
24 an rc file. Fd should not be considered a file
27 typedef int (*intfun
)();
29 /* command structure */
31 char *path
; /*pathname of the command: pathname structured */
32 char *syntax
; /*description of the syntax */
33 char *help
; /*description of the command for help listings */
34 int (*doit
)(); /* the call back to the command code */
35 unsigned char type
; /* types of command: see constants above */
36 /* the following field is for management. never set or change it*/
40 /* pre-defined TAGs */
41 #define D_PACKET 01000
54 /* debug/event structure */
56 char *path
; /* pathname structured debug/event request */
57 char *help
; /* description for debug options listing
58 if help==NULL the entry will be used only for
59 plugin event publish/subscribe not directly accessible
60 from the user interface */
61 int tag
; /* numerical tag of the debug/event */
62 /* the following fields are for management. never set or change them*/
68 unsigned short maxfds
;
69 unsigned short maxfun
;
73 /* plugin element: one element named "vde_plugin_data" must
74 * be defined otherwise the dynamic library will not be recognized
75 * as a vde plugin module */
77 /* name of the plugin, it should be unique, maybe pathname structured.
78 * it identifies the plugin for listing and unloading plugins */
80 /* description of the plugin for listings */
82 /* the following fields should never be set or changed by
88 /* this adds a new management fd */
89 void mgmtnewfd(int new);
91 #define ADDCL(CL) addcl(sizeof(CL)/sizeof(struct comlist),(CL))
92 #define ADDDBGCL(CL) adddbgcl(sizeof(CL)/sizeof(struct dbgcl),(CL))
93 #define DELCL(CL) delcl(sizeof(CL)/sizeof(struct comlist),(CL))
94 #define DELDBGCL(CL) deldbgcl(sizeof(CL)/sizeof(struct dbgcl),(CL))
95 #define DBGOUT(CL, FORMAT, ...) \
96 if (__builtin_expect(((CL)->nfds) > 0, 0)) debugout((CL), (FORMAT), __VA_ARGS__)
97 #define EVENTOUT(CL, ...) \
98 if (__builtin_expect(((CL)->nfun) > 0, 0)) eventout((CL), __VA_ARGS__)
101 int eventadd(int (*fun
)(struct dbgcl
*event
,void *arg
,va_list v
),char *path
,void *arg
);
102 int eventdel(int (*fun
)(struct dbgcl
*event
,void *arg
,va_list v
),char *path
,void *arg
);
104 void debugout(struct dbgcl
* cl
, const char *format
, ...);
106 void addcl(int ncl
,struct comlist
*cl
);
107 void delcl(int ncl
,struct comlist
*cl
);
110 void adddbgcl(int ncl
,struct dbgcl
*cl
);
111 void deldbgcl(int ncl
,struct dbgcl
*cl
);
114 void printoutc(FILE *f
, const char *format
, ...);
116 uid_t
port_user(int port
);