00001
00002
00010
00011
00012 #include "types.h"
00013 #include "policy.h"
00014 #include "packet.h"
00015
00016 #ifndef PLUGIN_H
00017 #define PLUGIN_H
00018
00020 typedef struct INPLUG_S {
00021 char *name;
00022 long version;
00023 } INPLUG;
00024
00026 typedef struct OUTPLUG_S {
00027 char *name;
00028 long version;
00029 } OUTPLUG;
00030
00032 typedef struct ANPLUG_S {
00033 char *name;
00034 long version;
00035 } ANPLUG;
00036
00038 typedef struct PROTOPLUG_S {
00039 char *name;
00040 unsigned short nProto;
00041 PROTO *pProto;
00042 char **sProto;
00043 long version;
00044 } PROTOPLUG;
00045
00047 typedef struct PLUGIN_S {
00048 int (*pluginRegister)(INPLUG**, ANPLUG**, PROTOPLUG**, OUTPLUG**,
00049 int(*)(PACKET*,PROTO));
00050 int (*pluginInit)(int ct, char **inits);
00051 int (*pluginCleanup)(int reason);
00052
00053 INPLUG *inPlug;
00054 int (*pluginGetPacket)(int iSrc, char *sSrc, PACKET **);
00055
00056 OUTPLUG *outPlug;
00057 int (*pluginOutput)(PACKET *, char *args);
00058
00059 ANPLUG *anPlug;
00060 char *(*pluginAnalyse)(PACKET*, char *anType, char *args);
00061
00062 PROTOPLUG *protoPlug;
00063 int (*pluginDecode)(PACKET *, PROTO protocol);
00064 int (*pluginTest)(PACKET *, char *, char*);
00065 int (*pluginPrint)(PACKET *, char *args,
00066 int(*print)(char *fmt, ...));
00067 int (*pluginMkTest)(PROTO, char*, char*, char *, POLICY_TEST *);
00068
00069 struct PLUGIN_S *iNext;
00070 struct PLUGIN_S *aNext;
00071 struct PLUGIN_S *pNext;
00072 struct PLUGIN_S *oNext;
00073 struct PLUGIN_S *next;
00074 } PLUGIN;
00075
00076
00077
00078 int loadPlugins(char *dir);
00079 int initPlugin(PLUGIN *plug, int ct, char **inits);
00080 int cleanupPlugins(void);
00081 int decode(PACKET *, PROTO);
00082 int testVar(PROTO proto, PACKET *p,
00083 long offset, char varType, char testType, unsigned long val);
00084 int testMask(PROTO proto, PACKET *p,
00085 long offset, long len, BYTE *val, BYTE *mask, BOOL type);
00086 int testSpecial(PROTO proto, PACKET *p,
00087 char *test, char *val);
00088 char *analyse(PROTO proto, PACKET *p, char*,char*);
00089 int printVar(PROTO proto, PACKET *p,
00090 char *args, int(*printFn)(char *fmt, ...));
00091 int mkTest(PROTO proto, char *val, char *test, char *field, POLICY_TEST *pTest);
00092
00093 #endif
00094