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