/usr/share/doc/vde2/examples/vdeplugin.h is in vde2 2.2.3-3build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | #ifndef _VDEPLUGIN_H
#define _VDEPLUGIN_H
#include <stdarg.h>
#include <stdio.h>
/* command type constants */
/* doit signature:
* int doit (
* FILE *f, *** only when WITHFILE
* int fd, *** only when WITHFD
* int|char *arg) *** when INTARG or STRARG */
/* if type==NOARG int doit(void)
* if type==INTARG int doit(int arg)
* if type==WITHFILE|WITHFD|STRARG int doit(FILE *f,int fd,char *arg)
* doit returns 0 on success otherwise it returns a valid errno code */
#define NOARG 0 /*the command require no args */
#define INTARG 1 /* arg is an integer */
#define STRARG 2 /* arg is a string */
#define WITHFILE 0x40 /* command needs to return text output.
(the output will be sent to the user using
"0000 DATA END WITH '.'") */
#define WITHFD 0x80 /* fd is the identifier of the mgmt connection issuing
the command. fd== -1 when the command is executed by
an rc file. Fd should not be considered a file
descriptor, */
typedef int (*intfun)();
/* command structure */
struct comlist {
char *path; /*pathname of the command: pathname structured */
char *syntax; /*description of the syntax */
char *help; /*description of the command for help listings */
int (*doit)(); /* the call back to the command code */
unsigned char type; /* types of command: see constants above */
/* the following field is for management. never set or change it*/
struct comlist *next;
};
/* pre-defined TAGs */
#define D_PACKET 01000
#define D_MGMT 02000
#define D_IN 01
#define D_OUT 02
#define D_PLUS 01
#define D_MINUS 02
#define D_DESCR 03
#define D_STATUS 04
#define D_ROOT 05
#define D_HASH 010
#define D_PORT 020
#define D_EP 030
#define D_FSTP 040
/* debug/event structure */
struct dbgcl {
char *path; /* pathname structured debug/event request */
char *help; /* description for debug options listing
if help==NULL the entry will be used only for
plugin event publish/subscribe not directly accessible
from the user interface */
int tag; /* numerical tag of the debug/event */
/* the following fields are for management. never set or change them*/
int *fds;
intfun (*fun);
void **funarg;
unsigned short nfds;
unsigned short nfun;
unsigned short maxfds;
unsigned short maxfun;
struct dbgcl *next;
};
/* plugin element: one element named "vde_plugin_data" must
* be defined otherwise the dynamic library will not be recognized
* as a vde plugin module */
struct plugin {
/* name of the plugin, it should be unique, maybe pathname structured.
* it identifies the plugin for listing and unloading plugins */
char *name;
/* description of the plugin for listings */
char *help;
/* the following fields should never be set or changed by
* plugin modules */
void *handle;
struct plugin *next;
};
/* this adds a new management fd */
void mgmtnewfd(int new);
#define ADDCL(CL) addcl(sizeof(CL)/sizeof(struct comlist),(CL))
#define ADDDBGCL(CL) adddbgcl(sizeof(CL)/sizeof(struct dbgcl),(CL))
#define DELCL(CL) delcl(sizeof(CL)/sizeof(struct comlist),(CL))
#define DELDBGCL(CL) deldbgcl(sizeof(CL)/sizeof(struct dbgcl),(CL))
#define DBGOUT(CL, FORMAT, ...) \
if (__builtin_expect(((CL)->nfds) > 0, 0)) debugout((CL), (FORMAT), __VA_ARGS__)
#define EVENTOUT(CL, ...) \
if (__builtin_expect(((CL)->nfun) > 0, 0)) eventout((CL), __VA_ARGS__)
int eventadd(int (*fun)(struct dbgcl *event,void *arg,va_list v),char *path,void *arg);
int eventdel(int (*fun)(struct dbgcl *event,void *arg,va_list v),char *path,void *arg);
void debugout(struct dbgcl* cl, const char *format, ...);
void addcl(int ncl,struct comlist *cl);
void delcl(int ncl,struct comlist *cl);
#ifdef DEBUGOPT
void adddbgcl(int ncl,struct dbgcl *cl);
void deldbgcl(int ncl,struct dbgcl *cl);
#endif
void printoutc(FILE *f, const char *format, ...);
#endif
|