Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

rubicon_udp.c

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /*****************************************************************************/
00006 /*****************************************************************************/
00007 
00008 #include "../../main/protoplug.h"
00009 #include "../../main/types.h"
00010 #include "../../main/policy.h"
00011 #include "../../main/memory.h"
00012 
00013 #ifndef DEBUG_UDP
00014 #ifdef DEBUG
00015 #define DEBUG_UDP DEBUG
00016 #else
00017 #define DEBUG_UDP 0
00018 #endif
00019 #endif
00020 
00022 int (*Decode)(PACKET*, PROTO); 
00023 
00024 PROTOPLUG *pp = (PROTOPLUG*)0;
00025 
00026 /****************************************************************************/
00039 /****************************************************************************/
00040 int pluginRegister(INPLUG **inp, ANPLUG **anp, PROTOPLUG **protop, OUTPLUG **outp,
00041                    int(*DecodeCallback)(PACKET*,PROTO)){
00042   if(DEBUG_UDP>=DEBUG_DO_ENTRY_ALL){
00043     printf("Enter pluginRegister(inp(%lx),anp(%lx),protop(%lx),outp(%lx),DecodeCallback(%lx))\n", inp, anp, protop, outp, DecodeCallback);
00044   }
00045 
00046   Decode = DecodeCallback;
00047   *inp = (INPLUG*)0;
00048   *anp = (ANPLUG*)0;
00049   *outp = (OUTPLUG*)0;
00050 /*   *protop = &pp; */
00051 
00052   if(!pp){
00053     (*protop) = (PROTOPLUG*)malloc_safe(sizeof(PROTOPLUG));
00054     if(!(*protop)){
00055       printf("ERR: Malloc failed when registering ethernet plugin\n");
00056     }
00057     else {
00058       (*protop)->name = strdup(PROTO_UDP_NAME);
00059       (*protop)->nProto = 1;
00060       (*protop)->version = 0x00010000;
00061       (*protop)->pProto = (PROTO*)malloc_safe(sizeof(PROTO));
00062       (*protop)->sProto = (char**)malloc_safe(sizeof(char*));
00063       if(!((*protop)->name) || !((*protop)->pProto) || !((*protop)->sProto)){
00064         printf("ERR: Malloc failed when registering ethernet plugin\n");
00065         (*protop) = (PROTOPLUG*)0;
00066       }
00067       else {
00068         ((*protop)->pProto)[0] = PROTO_UDP_NUM;
00069         ((*protop)->sProto)[0] = strdup_safe(PROTO_UDP_NAME);
00070       }
00071     }
00072 
00073     pp = *protop;
00074   }
00075   else (*protop) = pp;
00076 
00077   return 0;
00078 }
00079 
00080 /****************************************************************************/
00085 /****************************************************************************/
00086 int pluginInit(int ct, char **inits){
00087   if(DEBUG_UDP>=DEBUG_DO_ENTRY_ALL){
00088     printf("Enter pluginInit(int ct(%d),char**inits(%lx))\n", ct, inits);
00089   }
00090   return 0;
00091 }
00092 
00093 /****************************************************************************/
00102 /****************************************************************************/
00103 int pluginCleanup(int reason){
00104   if(DEBUG_UDP>=DEBUG_DO_ENTRY_ALL){
00105     printf("Enter pluginCleanup(int reason(%d))\n", reason);
00106   }
00107   
00108   if(pp) free_safe(pp);
00109   pp = (PROTOPLUG*)0;
00110 
00111   return 0;
00112 }
00113 
00114 /****************************************************************************/
00126 /****************************************************************************/
00127 int pluginDecode(PACKET *p, PROTO protocol){
00128   if(DEBUG_UDP>=DEBUG_DO_ENTRY_SOME){
00129     printf("Enter pluginDecode(PACKET*p(%lx),PROTO protocol(%lx))\n", p, protocol);
00130   }
00131   return 0;
00132 }
00133 
00134 /****************************************************************************/
00145 /****************************************************************************/
00146 int pluginTest(PACKET *p, char *arg, char *val){
00147   if(DEBUG_UDP>=DEBUG_DO_ENTRY_ALL){
00148     printf("Enter pluginTest(PACKET*p(%lx),char*arg(%s), char*val(%s))\n", p, arg, val);
00149   }
00150   return 0;
00151 }
00152 
00153 /****************************************************************************/
00167 /****************************************************************************/
00168 int pluginPrint(PACKET *p, char *args,
00169                 int(*print)(char *fmt, ...)){
00170   if(DEBUG_UDP>=DEBUG_DO_ENTRY_ALL){
00171     printf("Enter pluginPrint(PACKET*p(%lx),char*args(%s),print(%lx))\n", p, args, print);
00172   }
00173   return 0;
00174 }
00175 
00176 /****************************************************************************/
00190 /****************************************************************************/
00191 int pluginMkTest(PROTO p, char *val, char *test, char *field, POLICY_TEST *pTest){
00192   if(DEBUG_UDP>=DEBUG_DO_ENTRY_ALL){
00193     printf("Enter pluginMkTest(PROTO p(%lx),char*val(%s),char*test(%s),char*field(%s),POLICY_TEST*pTest(%lx))\n", p, val, test, field, pTest);
00194   }
00195 
00196   return 0;
00197 }

Generated at Mon Jul 8 15:16:50 2002 for RUBICON by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000