00001
00002
00006
00007
00008 #include "../../main/anplug.h"
00009 #include "../../main/packet.h"
00010 #include "../../main/memory.h"
00011
00012 #ifndef DEBUG_FILE
00013 #ifdef DEBUG
00014 #define DEBUG_FILE DEBUG
00015 #else
00016 #define DEBUG_FILE 0
00017 #endif
00018 #endif
00019
00021 int (*Decode)(PACKET*, PROTO);
00022
00023 ANPLUG *ap = (ANPLUG*)0;
00024
00025
00038
00039 int pluginRegister(INPLUG **inp, ANPLUG **anp, PROTOPLUG **protop, OUTPLUG **outp,
00040 int(*DecodeCallback)(PACKET*,PROTO)){
00041 if(DEBUG_FILE>=DEBUG_DO_ENTRY_ALL){
00042 printf("Enter pluginRegister(inp(%lx),anp(%lx),protop(%lx),outp(%lx),DecodeCallback(%lx))\n", inp, anp, protop, outp, DecodeCallback);
00043 }
00044
00045 Decode = DecodeCallback;
00046 *inp = (INPLUG*)0;
00047
00048 *outp = (OUTPLUG*)0;
00049 *protop = (PROTOPLUG*)0;
00050
00051 if(!ap){
00052 ap = (ANPLUG*)malloc(sizeof(ANPLUG));
00053 if(!ap){
00054 printf("ERR: plugin register for ANPLUG failed\n");
00055 ap = (ANPLUG*)0;
00056 }
00057 else {
00058 ap->name = strdup_safe("SNORT");
00059 ap->version = 0x00010000;
00060 }
00061 }
00062 *anp = ap;
00063
00064 return 0;
00065 }
00066
00067
00072
00073 int pluginInit(int ct, char **inits){
00074 if(DEBUG_FILE>=DEBUG_DO_ENTRY_ALL){
00075 printf("Enter pluginInit(int ct(%d),char**inits(%lx))\n", ct, inits);
00076 }
00077 return 0;
00078 }
00079
00080
00089
00090 int pluginCleanup(int reason){
00091 if(DEBUG_FILE>=DEBUG_DO_ENTRY_ALL){
00092 printf("Enter pluginCleanup(int reason(%d))\n", reason);
00093 }
00094
00095 if(ap){
00096 free_safe(ap->name);
00097 free_safe(ap);
00098 }
00099 ap = (ANPLUG*)0;
00100
00101 return 0;
00102 }
00103
00104
00118
00119 char *pluginAnalyse(PACKET *p, char *anType, char *args){
00120 if(DEBUG_FILE>=DEBUG_DO_ENTRY_ALL){
00121 printf("Enter pluginAnalyse(PACKET*p(%lx),char*anType(%s),char*args(%s))\n",p,anType,args);
00122 }
00123
00124 return (char*)0;
00125 }