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

rubicon_ip.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_IP
00014 #ifdef DEBUG
00015 #define DEBUG_IP DEBUG
00016 #else
00017 #define DEBUG_IP 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_IP>=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_IP_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_IP_NUM;
00069         ((*protop)->sProto)[0] = strdup_safe(PROTO_IP_NAME);
00070       }
00071     }
00072     pp = *protop;
00073   }
00074   else *protop = pp;
00075   return 0;
00076 }
00077 
00078 /****************************************************************************/
00083 /****************************************************************************/
00084 int pluginInit(int ct, char **inits){
00085   if(DEBUG_IP>=DEBUG_DO_ENTRY_ALL){
00086     printf("Enter pluginInit(int ct(%d),char**inits(%lx))\n", ct, inits);
00087   }
00088   return 0;
00089 }
00090 
00091 /****************************************************************************/
00100 /****************************************************************************/
00101 int pluginCleanup(int reason){
00102   if(DEBUG_IP>=DEBUG_DO_ENTRY_ALL){
00103     printf("Enter pluginCleanup(int reason(%d))\n", reason);
00104   }
00105   
00106   if(pp) free_safe(pp);
00107   pp = (PROTOPLUG*)0;
00108 
00109   return 0;
00110 }
00111 
00112 /****************************************************************************/
00124 /****************************************************************************/
00125 int pluginDecode(PACKET *p, PROTO protocol){
00126   if(DEBUG_IP>=DEBUG_DO_ENTRY_SOME){
00127     printf("Enter pluginDecode(PACKET*p(%lx),PROTO protocol(%lx))\n", p, protocol);
00128   }
00129   return 0;
00130 }
00131 
00132 /****************************************************************************/
00143 /****************************************************************************/
00144 int pluginTest(PACKET *p, char *arg, char *val){
00145   if(DEBUG_IP>=DEBUG_DO_ENTRY_ALL){
00146     printf("Enter pluginTest(PACKET*p(%lx),char*arg(%s), char*val(%s))\n", p, arg, val);
00147   }
00148   return 0;
00149 }
00150 
00151 /****************************************************************************/
00165 /****************************************************************************/
00166 int pluginPrint(PACKET *p, char *args,
00167                 int(*print)(char *fmt, ...)){
00168   if(DEBUG_IP>=DEBUG_DO_ENTRY_ALL){
00169     printf("Enter pluginPrint(PACKET*p(%lx),char*args(%s),print(%lx))\n", p, args, print);
00170   }
00171   return 0;
00172 }
00173 
00174 /****************************************************************************/
00188 /****************************************************************************/
00189 int pluginMkTest(PROTO p, char *val, char *test, char *field, POLICY_TEST *pTest){
00190   if(DEBUG_IP>=DEBUG_DO_ENTRY_ALL){
00191     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);
00192   }
00193 
00194   return 0;
00195 }

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