Changeset 20 for trunk/src

Show
Ignore:
Timestamp:
11/22/06 14:04:22 (16 years ago)
Author:
andreu
Message:

new release 0.0.6, with CRIHAN compilation feature

Location:
trunk/src
Files:
16 added
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/Makefile.am

    r4 r20  
    1414renetcolSender_LDADD = -ldl -lc_p 
    1515$(PACKAGE)-$(VERSION).tar.gz: dist 
    16 AM_CFLAGS = -I/usr/local/include -ansi -Wall -D _SVID_SOURCE \ 
    17         -DSIGSETJMP_IS_BROKEN -fno-strict-aliasing \ 
    18         -D _XOPEN_SOURCE \ 
    19         -pedantic \ 
    20         -pg 
    2116.PHONY: clean 
    2217clean: 
  • trunk/src/Makefile.in

    r8 r20  
    1 # Makefile.in generated by automake 1.9.5 from Makefile.am. 
     1# Makefile.in generated by automake 1.9.6 from Makefile.am. 
    22# @configure_input@ 
    33 
     
    1414 
    1515@SET_MAKE@ 
    16  
    17 SOURCES = $(renetcol_SOURCES) $(renetcolMsgCtl_SOURCES) $(renetcolSender_SOURCES) 
    1816 
    1917srcdir = @srcdir@ 
     
    102100EGREP = @EGREP@ 
    103101EXEEXT = @EXEEXT@ 
     102GREP = @GREP@ 
    104103INSTALL_DATA = @INSTALL_DATA@ 
    105104INSTALL_PROGRAM = @INSTALL_PROGRAM@ 
     
    124123VERSION = @VERSION@ 
    125124ac_ct_CC = @ac_ct_CC@ 
    126 ac_ct_STRIP = @ac_ct_STRIP@ 
    127125am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 
    128126am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 
     
    135133build_alias = @build_alias@ 
    136134datadir = @datadir@ 
     135datarootdir = @datarootdir@ 
     136docdir = @docdir@ 
     137dvidir = @dvidir@ 
    137138exec_prefix = @exec_prefix@ 
    138139host_alias = @host_alias@ 
     140htmldir = @htmldir@ 
    139141includedir = @includedir@ 
    140142infodir = @infodir@ 
     
    142144libdir = @libdir@ 
    143145libexecdir = @libexecdir@ 
     146localedir = @localedir@ 
    144147localstatedir = @localstatedir@ 
    145148mandir = @mandir@ 
    146149mkdir_p = @mkdir_p@ 
    147150oldincludedir = @oldincludedir@ 
     151pdfdir = @pdfdir@ 
    148152prefix = @prefix@ 
    149153program_transform_name = @program_transform_name@ 
     154psdir = @psdir@ 
    150155sbindir = @sbindir@ 
    151156sharedstatedir = @sharedstatedir@ 
  • trunk/src/dataFlowSet.c

    r19 r20  
    6565  struct PrefixV4 prefixKey, *res; /* for bsearch */ 
    6666  struct AggCache agCache; 
     67#ifdef CRIHAN 
    6768  struct IPFLowCache ipFirstCache; /* CRI */ 
    6869  struct MPLSFlowCache mplsFirstCache; /* CRI */ 
    6970  unsigned long firstTime = 0; /* CRI */ 
    7071  unsigned long lastTime = 0; /* CRI */ 
     72#endif /* CRIHAN */ 
    7173  int bool = 0; 
    7274 
    73   /* CRI */ 
     75#ifdef CRIHAN 
    7476  ipFirstCache.ipProt = 0; 
    7577  ipFirstCache.bytes = 0; 
     
    8991  mplsFirstCache.v4AdS = 0; 
    9092  mplsFirstCache.v4AdD = 0; 
    91   mplsFirstCache.outSnmp = 0; 
    92   mplsFirstCache.inSnmp = 0; 
    9393  mplsFirstCache.routerAd = 0; 
    9494  mplsFirstCache.mplsLabel1 = 0; 
    95  
    96   /* CRI */ 
     95#endif /* CRIHAN */ 
    9796 
    9897  buffer2[1] = *(buf+(*offV9));(*offV9)++; 
     
    122121    /* end aggreg */ 
    123122 
    124     /* CRI */ 
     123#ifdef CRIHAN 
    125124    ipFirstCache.routerAd = pcktPtr->ipH->srcAdd; 
    126125    mplsFirstCache.routerAd = pcktPtr->ipH->srcAdd; 
    127     /* end CRI */ 
     126#endif /* CRIHAN */ 
    128127 
    129128    pftmp = tmp->lastField; 
     
    185184/*            } */ 
    186185              /* end aggregation */ 
    187               /* CRI */ 
     186#ifdef CRIHAN 
    188187              if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ 
    189188                ipFirstCache.maskS = *((unsigned char*)&buffer1); 
     
    199198                ipFirstCache.tProt = *((unsigned char*)&buffer1);  
    200199              } 
    201 /*            if (pftmp->fieldType==46){  */ 
    202 /*              mplsFirstCache.topLabelType = *((unsigned char*)&buffer1);  */ 
    203 /*            } */ 
    204               /* end CRI */ 
     200#endif /* CRIHAN */ 
    205201              break; 
    206202            case 2: 
     
    215211/*            } */ 
    216212              /* end aggregation */ 
    217               /* CRI */ 
     213#ifdef CRIHAN 
    218214              if (pftmp->fieldType==10){ 
    219215                ipFirstCache.inSnmp = *((unsigned short*)&buffer2); 
    220                 mplsFirstCache.inSnmp = *((unsigned short*)&buffer2); 
    221216              } 
    222217              if (pftmp->fieldType==14){ 
    223218                ipFirstCache.outSnmp = *((unsigned short*)&buffer2); 
    224                 mplsFirstCache.outSnmp = *((unsigned short*)&buffer2); 
    225219              } 
    226220              if (pftmp->fieldType==7){ 
     
    230224                ipFirstCache.dPort = *((unsigned short*)&buffer2); 
    231225              } 
    232               /* end CRI */  
     226#endif /* CRIHAN */  
    233227              break; 
    234228            case 3: 
     
    242236              /* aggregation */ 
    243237              /* end aggregation */ 
    244               /* CRI */ 
     238#ifdef CRIHAN 
    245239              if (pftmp->fieldType==70){ 
    246240                mplsFirstCache.mplsLabel1 = (*((unsigned long*)&buffer4))>>4; 
    247241              } 
    248               /* end CRI */ 
     242#endif /* CRIHAN */ 
    249243              break; 
    250244            case 4: 
     
    275269/*            } */ 
    276270              /* end aggregation */ 
    277               /* CRI */ 
     271#ifdef CRIHAN 
    278272              if (pftmp->fieldType==8){ 
    279273                ipFirstCache.v4AdS = *((unsigned long*)&buffer4); 
     
    296290                lastTime = *((unsigned long*)&buffer4); 
    297291              } 
    298               /* end CRI */ 
     292#endif /* CRIHAN */ 
    299293              break; 
    300294            case 16: 
     
    468462/*        }        */ 
    469463          /* end aggregation */ 
    470           /* CRI */ 
     464#ifdef CRIHAN 
    471465          if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ 
    472466            ipFirstCache.maskS = *((unsigned char*)&buffer1); 
     
    482476            ipFirstCache.tProt = *((unsigned char*)&buffer1);  
    483477          } 
    484 /*        if (pftmp->fieldType==46){  */ 
    485 /*          mplsFirstCache.topLabelType = *((unsigned char*)&buffer1);  */ 
    486 /*        } */ 
     478#endif /* CRIHAN */ 
    487479          break; 
    488480        case 2: 
     
    494486          }        
    495487          /* end aggregation */ 
    496           /* CRI */ 
     488#ifdef CRIHAN 
    497489          if (pftmp->fieldType==10){ 
    498490            ipFirstCache.inSnmp = *((unsigned short*)&buffer2); 
    499             mplsFirstCache.inSnmp = *((unsigned short*)&buffer2); 
    500491          } 
    501492          if (pftmp->fieldType==14){ 
    502493            ipFirstCache.outSnmp = *((unsigned short*)&buffer2); 
    503             mplsFirstCache.outSnmp = *((unsigned short*)&buffer2); 
    504494          } 
    505495          if (pftmp->fieldType==7){ 
     
    509499            ipFirstCache.dPort = *((unsigned short*)&buffer2); 
    510500          } 
    511           /* end CRI */  
     501#endif /* CRIHAN */ 
    512502          break; 
    513503        case 3: 
     
    518508          /* aggregation */ 
    519509          /* end aggregation */ 
    520           /* CRI */ 
     510#ifdef CRIHAN 
    521511          if (pftmp->fieldType==70){ 
    522512            mplsFirstCache.mplsLabel1 = (*((unsigned long*)&buffer4))>>4; 
    523513          } 
    524           /* end CRI */ 
     514#endif /* CRIHAN */ 
    525515          break; 
    526516        case 4: 
     
    541531/*        } */ 
    542532          /* end aggregation */ 
    543           /* CRI */ 
     533#ifdef CRIHAN 
    544534          if (pftmp->fieldType==8){ 
    545535            ipFirstCache.v4AdS = *((unsigned long*)&buffer4); 
     
    562552            lastTime = *((unsigned long*)&buffer4); 
    563553          } 
    564           /* end CRI */ 
     554#endif /* CRIHAN */ 
    565555          break; 
    566556        case 16: 
     
    585575         * end of one flow (not the flowset)  
    586576         */ 
    587         /* CRI */ 
     577#ifdef CRIHAN 
    588578        if ( mplsFirstCache.mplsLabel1 == 0 ) { 
    589579          (ipCache+(*ipCounter))->ipProt = ipFirstCache.ipProt; 
     
    618608          (mplsCache+(*mplsCounter))->ipProt = mplsFirstCache.ipProt; 
    619609          mplsFirstCache.ipProt = 0; 
    620 /*        (mplsCache+(*mplsCounter))->topLabelType = mplsFirstCache.topLabelType; */ 
    621 /*        mplsFirstCache.topLabelType = 0; */ 
    622610          (mplsCache+(*mplsCounter))->v4AdS =  mplsFirstCache.v4AdS; 
    623611          mplsFirstCache.v4AdS = 0; 
    624612          (mplsCache+(*mplsCounter))->v4AdD =  mplsFirstCache.v4AdD;  
    625613          mplsFirstCache.v4AdD = 0; 
    626           (mplsCache+(*mplsCounter))->inSnmp =  mplsFirstCache.inSnmp; 
    627           mplsFirstCache.inSnmp = 0; 
    628           (mplsCache+(*mplsCounter))->outSnmp =  mplsFirstCache.outSnmp;  
    629           mplsFirstCache.outSnmp = 0; 
    630614          (mplsCache+(*mplsCounter))->routerAd =  mplsFirstCache.routerAd; 
    631615          (mplsCache+(*mplsCounter))->mplsLabel1 =  mplsFirstCache.mplsLabel1; 
     
    633617          (*mplsCounter)++; 
    634618        } 
    635         /* end CRI */ 
     619#endif /* CRIHAN */ 
    636620        /* put aggregation cache information to tables */ 
    637         if (bool == 1){ 
    638           prefixKey.beginning = agCache.v4AdS>>(32-agCache.maskS)<<(32-agCache.maskS); 
    639           res = bsearch(&prefixKey, V4PTab, nbPV4,  
    640                         sizeof(struct PrefixV4), prefCmp); 
    641         } 
     621/*      if (bool == 1){ */ 
     622/*        prefixKey.beginning = agCache.v4AdS>>(32-agCache.maskS)<<(32-agCache.maskS); */ 
     623/*        res = bsearch(&prefixKey, V4PTab, nbPV4,  */ 
     624/*                      sizeof(struct PrefixV4), prefCmp); */ 
     625/*      } */ 
    642626        bool = 0;     
    643627        /* end put */ 
  • trunk/src/dataFlowSet.h

    r19 r20  
    6262  unsigned long v4AdS; 
    6363  unsigned long v4AdD; 
    64   unsigned short inSnmp; 
    65   unsigned short outSnmp; 
    6664  uint32_t tabAdd6S[4]; 
    6765  uint32_t tabAdd6D[4];   
  • trunk/src/renetcol.c

    r19 r20  
    2626#include "renetcol.h" 
    2727 
    28 /* uptade for CRIHAN -> CRI */ 
     28#ifdef CRIHAN 
    2929struct IPFLowCache tabIP[MAX_IP_FLOW], *tabIPPtr = tabIP; 
    3030struct MPLSFlowCache tabMPLS[MAX_MPLS_FLOW], *tabMPLSPtr = tabMPLS; 
     
    3939FILE *fIP; 
    4040FILE *fMPLS; 
    41 /* end */ 
     41#endif /* CRIHAN */ 
    4242 
    4343char *rulesFileName; 
     
    410410    } 
    411411 
    412     /* CRI */ 
     412#ifdef CRIHAN 
    413413    now = time((time_t *)NULL); 
    414414    receptionTime = now; 
     
    475475        for ( iMPLS = 0; iMPLS < mplsNb; iMPLS++){ 
    476476          if ( tabMPLS[iMPLS].ipProt == 0 ) { 
    477             fprintf(fMPLS, "%lu.%lu.%lu.%lu;%hu;%lu.%lu.%lu.%lu;%lu.%lu.%lu.%lu;%hu;%hu;%d\n", 
     477            fprintf(fMPLS, "%lu.%lu.%lu.%lu;%hu;%lu.%lu.%lu.%lu;%lu.%lu.%lu.%lu\n", 
    478478                    tabMPLS[iMPLS].routerAd>>24,tabMPLS[iMPLS].routerAd<<8>>24, 
    479479                    tabMPLS[iMPLS].routerAd<<16>>24, 
    480480                    tabMPLS[iMPLS].routerAd<<24>>24, 
    481                     tabMPLS[iMPLS].mplsLabel1, 
    482                     tabMPLS[iMPLS].v4AdS>>24, 
     481                    tabMPLS[iMPLS].mplsLabel1,tabMPLS[iMPLS].v4AdS>>24, 
    483482                    tabMPLS[iMPLS].v4AdS<<8>>24,tabMPLS[iMPLS].v4AdS<<16>>24, 
    484483                    tabMPLS[iMPLS].v4AdS<<24>>24,tabMPLS[iMPLS].v4AdD>>24, 
    485484                    tabMPLS[iMPLS].v4AdD<<8>>24,tabMPLS[iMPLS].v4AdD<<16>>24, 
    486                     tabMPLS[iMPLS].v4AdD<<24>>24, 
    487                     tabMPLS[iMPLS].inSnmp,tabMPLS[iMPLS].outSnmp, 
    488                     receptionTime 
     485                    tabMPLS[iMPLS].v4AdD<<24>>24  
    489486                    ); 
    490487          } 
     
    495492      lastMPLSOutput = now; 
    496493    } 
    497     /* end CRI */ 
     494#endif /* CRIHAN */ 
    498495  } while (1); 
    499496} 
  • trunk/src/renetcol.h

    r19 r20  
    7474#define MAX_RULES_PER_FIELD 10 
    7575 
    76  /* CRI */ 
     76#ifdef CRIHAN 
    7777#define OUTPUT_IP "/tmp/ipflow" 
    7878#define EXTENSION ".txt"  
     
    8080#define MAX_IP_OUTPUT_FILES 3 
    8181#define MAX_MPLS_OUTPUT_FILES 3 
    82 #define MAX_IP_FLOW 1000 
     82#define MAX_IP_FLOW 10000 
    8383#define MAX_MPLS_FLOW 200 
    8484#define IP_TIME_THRESHOLD 60 /* in sec */ 
    8585#define MPLS_TIME_THRESHOLD 60 /* in sec */ 
    86 /* end CRI */ 
     86#endif /* CRIHAN */ 
    8787 
    8888void setCache(RulesPtr); 
  • trunk/src/renetcolSender.c

    r14 r20  
    7676    buffer[length] = '\0'; 
    7777    if (strncmp("DELETE", buffer, 6)==0){ 
     78      /* DELETE ALL RULES FROM A REMOTE CLIENT */ 
    7879      if (!(ruleFile = fopen(rulesFileName, "r"))) { 
    7980        syslog (LOG_ERR, "error during %s opening\n", rulesFileName); 
     
    8586            ruleToDelete = 0; 
    8687            if (sscanf(lineCopy, "%1s %s\n", 
    87                        strTok,         
     88                       strTok, 
    8889                       strName) != 0) { 
    89               if (strncmp(strName, host, strlen(host)) != 0){ 
    90                 strncpy(lines[cpt], lineCopy, strlen(lineCopy)); 
     90              if (strncmp(strName, host, strlen(host)) == 0){ 
     91                ruleToDelete = 1; 
    9192              } else { 
    92                 ruleToDelete = 1; 
     93                strncpy(lines[cpt], line, strlen(line)); 
    9394              } 
    9495            } else { 
    95               syslog (LOG_ERR, "error in file %s at line %d",  
    96                       rulesFileName, cpt); 
    9796              return 1; 
    9897            } 
     
    103102          } 
    104103          cpt++; 
    105         } 
     104        } /* while end */ 
    106105        fclose(ruleFile); 
    107106        if (!(tmpFile = fopen("rules.tmp", "w"))) { 
     
    124123      } 
    125124    } else { 
     125      /* NEW RULE */ 
    126126      if (sscanf(buffer, "%s %s %1s %s\n", 
    127127                 port,