1 /* Copyright 2002 Jeff Dike
2 * Licensed under the GPL
24 void printlog(int priority
, const char *format
, ...);
25 void loadrcfile(void);
26 void setmgmtperm(char *path
);
28 void printoutc(FILE *fd
, const char *format
, ...);
29 void addcl(int ncl
,struct comlist
*cl
);
30 #define ADDCL(CL) addcl(sizeof(CL)/sizeof(struct comlist),(CL))
32 typedef int (*intfun
)();
34 #define D_PACKET 01000
48 char *path
; /* debug path for add/del */
49 char *help
; /* help string. just event mgmt when NULL */
50 int tag
; /* tag for event mgmt and simple parsing */
51 int *fds
; /* file descriptors for debug */
52 intfun (*fun
); /* function call dor plugin events */
53 void **funarg
; /* arg for function calls */
54 unsigned short nfds
; /* number of active fds */
55 unsigned short nfun
; /* number of active fun */
56 unsigned short maxfds
; /* current size of fds */
57 unsigned short maxfun
; /* current size of both fun and funarg */
60 void adddbgcl(int ncl
, struct dbgcl
* cl
);
61 #define ADDDBGCL(CL) adddbgcl(sizeof(CL)/sizeof(struct dbgcl),(CL))
62 void debugout(struct dbgcl
* cl
, const char *format
, ...);
63 void eventout(struct dbgcl
* cl
, ...);
64 int packetfilter(struct dbgcl
* cl
, ...);
65 #define DBGOUT(CL, ...) \
66 if (__builtin_expect(((CL)->nfds) > 0, 0)) debugout((CL), __VA_ARGS__)
67 #define EVENTOUT(CL, ...) \
68 if (__builtin_expect(((CL)->nfun) > 0, 0)) eventout((CL), __VA_ARGS__)
69 #define PACKETFILTER(CL, PORT, BUF, LEN) \
70 (__builtin_expect((((CL)->nfun) == 0 || ((LEN)=packetfilter((CL), (PORT), (BUF), (LEN)))), 1))
72 #define PACKETFILTER(CL, PORT, BUF, LEN) (LEN)
75 #define DBGOUT(CL, ...)
76 #define EVENTOUT(CL, ...)
77 #define PACKETFILTER(CL, PORT, BUF, LEN) (LEN)