Changeset 16 for trunk/src

Show
Ignore:
Timestamp:
03/17/06 17:15:12 (17 years ago)
Author:
andreu
Message:

Friday save

Location:
trunk/src
Files:
1 added
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dataFlowSet.c

    r15 r16  
    3434                 unsigned short *offV9, unsigned char *buf, short *cFNPtr, 
    3535                 short *cFId, DatagramPtr pcktPtr, RuleDefPtr *rulesCache, 
    36                  RulesPtr rlPtr, int myQueue) 
     36                 RulesPtr rlPtr, int myQueue, struct PrefixV4 *V4PTab,  
     37                 size_t nbPV4) 
    3738{ 
    3839  TplFlowSetPtr tmp; 
     
    5051  int overflow = 0; 
    5152  int noEnd = 1; 
    52   int i=0; 
    53   int j=0; 
     53  int i = 0; 
     54  int j = 0; 
    5455  int pos = 0; 
    5556  unsigned char buffer1;   
     
    6061  char *msgTextIndex; 
    6162  unsigned short tplMsgType = 11; 
     63  struct PrefixV4 prefixKey, *res; /* for bsearch */ 
     64  struct AggCache agCache; 
    6265 
    6366  buffer2[1] = *(buf+(*offV9));(*offV9)++; 
     
    118121                  == *((unsigned char*)&buffer1)) { 
    119122                ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 
    120               }  
     123              } 
     124              /* aggregation */ 
     125 
     126              /* end aggregation */ 
    121127              break; 
    122128            case 2: 
     
    126132                  == *((unsigned short*)&buffer2)) 
    127133                ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 
     134              /* aggregation */ 
     135 
     136              /* end aggregation */ 
    128137              break; 
    129138            case 4: 
     
    133142              buffer4[0]= *(buf+(*offV9)); (*offV9)++; 
    134143              /* FIXME : here , add a check on the field type */ 
    135               if ((((RuleDefPtr)(*(rulesCache+pos)))->value->stor.lvalue)  
    136                   == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) ) 
    137                 { 
    138                   ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 
    139                 } 
     144              if ((pftmp->fieldType==8)||(pftmp->fieldType==12)){ 
     145                if ((((RuleDefPtr)(*(rulesCache+pos)))->value->stor.lvalue)  
     146                    == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) ) 
     147                  { 
     148                    ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 
     149                  } 
     150                prefixKey.beginning = *((unsigned long*)&buffer4); 
     151                res = bsearch(&prefixKey, V4PTab, nbPV4,  
     152                              sizeof(struct PrefixV4), prefCmp); 
     153                if (res == NULL) 
     154                  fprintf(stderr,"!"); 
     155                else 
     156                  fprintf(stderr,"."); 
     157              }        
     158              /* aggregation */ 
     159 
     160              /* end aggregation */ 
    140161              break; 
    141162            case 16: 
     
    262283              } 
    263284              moreIsNecessary = 1; 
     285              /* aggregation */ 
     286               
     287              /* end aggregation */ 
    264288              break; 
    265289            default: 
     
    286310        case 1: 
    287311          buffer1 = *(buf+(*offV9)); (*offV9)++; 
     312          /* aggregation */ 
     313           
     314          /* end aggregation */ 
    288315          break; 
    289316        case 2: 
    290317          buffer2[1]= *(buf+(*offV9)); (*offV9)++; 
    291318          buffer2[0]= *(buf+(*offV9)); (*offV9)++; 
     319          /* aggregation */ 
     320           
     321          /* end aggregation */ 
    292322          break; 
    293323        case 4: 
     
    296326          buffer4[1]= *(buf+(*offV9)); (*offV9)++; 
    297327          buffer4[0]= *(buf+(*offV9)); (*offV9)++; 
     328          /* aggregation */ 
     329           
     330          /* end aggregation */ 
    298331          break; 
    299332        case 16: 
     
    304337            buffer2[0]= *(buf+(*offV9)); (*offV9)++; 
    305338          } 
     339          /* aggregation */ 
     340           
     341          /* end aggregation */ 
    306342          break; 
    307343        default: 
     
    316352         * end of one flow (not the flowset)  
    317353         */ 
     354        /* put aggregation cache information to tables */ 
     355 
     356        /* end put */ 
    318357        /*  
    319358         * Redirection if needed  
  • trunk/src/dataFlowSet.h

    r15 r16  
    3434#include "rules_mgmt.h" 
    3535#include "msg_mgmt.h" 
     36#include "get_conf.h" 
     37#include "prefix_mgmt.h" 
     38 
     39struct AggCache { 
     40  unsigned short mode; 
     41  unsigned long v4Ad; 
     42  uint32_t tabAdd6[4]; 
     43  unsigned short mask; 
     44  unsigned short sens; /* In/out */ 
     45  unsigned long bytes; 
     46  unsigned long pkts; 
     47  unsigned short tProt; 
     48  unsigned short netProt; 
     49  unsigned long routerAd; 
     50  unsigned short idSnmp; 
     51  unsigned short dscp; 
     52  /*  unsigned short mplsLabel1; 
     53      unsigned long intAdd; */ 
     54}; 
    3655 
    3756unsigned short  
    3857checkDataFlowSet(unsigned short, RouterPtr, NetFlowV9HeaderPtr, 
    3958                 unsigned short *, unsigned char *, short *, 
    40                  short *, DatagramPtr, RuleDefPtr *, RulesPtr, int); 
     59                 short *, DatagramPtr, RuleDefPtr *, RulesPtr, int, 
     60                 struct PrefixV4 *, size_t); 
    4161 
    4262#endif /* DATAFLOWSET_H */ 
  • trunk/src/get_conf.c

    r2 r16  
    130130/*  
    131131 * getPrefixV4() 
     132 * 
     133 * read IPv4 prefix file and sort the list 
    132134 */ 
    133135short getPrefixV4(char *filename, struct PrefixV4 *pV4TabPtr) 
  • trunk/src/prefix_mgmt.c

    r15 r16  
    2626#include "prefix_mgmt.h" 
    2727 
     28/* 
     29 * prefCmp() 
     30 */ 
     31int 
     32prefCmp(const void *elem1, const void *elem2){ 
     33  struct PrefixV4 *el1 = (struct PrefixV4 *) elem1; 
     34  struct PrefixV4 *el2 = (struct PrefixV4 *) elem2; 
     35  return (  
     36          el1->beginning - el2->beginning 
     37          ); 
     38} 
  • trunk/src/renetcol.c

    r15 r16  
    364364                                   currentFlowsetIdPtr, pcktPtr, 
    365365                                   rulesAddressPtr, rulesListPtr, 
    366                                    myQueue); 
     366                                   myQueue, prefixV4Tab, 
     367                                   (size_t) PREFIX_V4_MAX); 
    367368        } 
    368369      } 
  • trunk/src/template.c

    r15 r16  
    7676  unsigned short tplMsgType = 1; 
    7777 
    78   fprintf (stderr, "NORMAL\n"); 
    7978  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    8079  buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    8180  getFlowsetId = *((unsigned short*)&buffer2); 
    82   fprintf(stderr,"FlowsetID: %hu \n", getFlowsetId); 
    8381  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    8482  buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    8583  length = *((unsigned short*)&buffer2); 
    86   fprintf(stderr,"length: %hu \n", length); 
    8784  do { 
    8885    buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     
    9188         existTplId(cr, v9Ptr->sourceId, 
    9289                    *((unsigned short*)&buffer2)))==NULL) { 
    93       fprintf (stderr, "NEW\n"); 
    9490      cTFSPtr = newRouterTplList(); 
    9591      cTFSPtr->next = cr->tplList; 
     
    9793      cr->tplList = cTFSPtr; 
    9894      cTFSPtr->templateFlowSetId = *((unsigned short*)&buffer2); 
    99       fprintf(stderr,"templateFlowSetId: %hu \n", cTFSPtr->templateFlowSetId); 
    10095      cTFSPtr->sourceId = v9Ptr->sourceId; 
    10196      buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    10297      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    10398      cTFSPtr->fieldCount = *((unsigned short*)&buffer2); 
    104       fprintf(stderr,"fieldCount: %hu \n", cTFSPtr->fieldCount); 
    10599      cpt_fields = 0; 
    106100      for ( i=0; i<cTFSPtr->fieldCount; i++) { 
     
    136130      } 
    137131    } else { /*update*/ 
    138       fprintf (stderr, "UPDATE\n"); 
    139132      ptpltmp = cTFSPtr; 
    140133      if (ptpltmp->prev == NULL) { 
     
    251244  TplOptionPtr ptplotmp; 
    252245 
    253   fprintf (stderr, "\nOPTION\n"); 
    254246  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    255247  buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    256248  getFlowsetId = *((unsigned short*)&buffer2); 
    257   fprintf(stderr,"FlowsetID: %hu \n", getFlowsetId); 
    258249  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    259250  buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    260251  length = *((unsigned short*)&buffer2); 
    261   fprintf(stderr,"length: %hu \n", length); 
    262252  do { 
    263253    buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     
    266256         existTplOptId(cr, v9Ptr->sourceId,  
    267257                       *((unsigned short*)&buffer2)))==NULL) { 
    268       fprintf (stderr, "NEW\n"); 
    269258      cTOPtr = newRouterTplOptList(); 
    270259      cTOPtr->next = cr->tplOptList; 
     
    272261      cr->tplOptList = cTOPtr; 
    273262      cTOPtr->templateOptionId = *((unsigned short*)&buffer2); 
    274       fprintf(stderr,"templateOptionId: %hu \n", cTOPtr->templateOptionId); 
    275263      cTOPtr->sourceId = v9Ptr->sourceId; 
    276264      buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    277265      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    278266      cTOPtr->optionScopeLg = *((unsigned short*)&buffer2); 
    279       fprintf(stderr,"optionScopeLg: %hu \n", cTOPtr->optionScopeLg); 
    280267      buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    281268      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    282269      cTOPtr->optionLg = *((unsigned short*)&buffer2); 
    283       fprintf(stderr,"optionLg: %hu \n", cTOPtr->optionLg); 
    284270      for ( i=0; i<(((cTOPtr->optionScopeLg)+(cTOPtr->optionLg))/4); i++) { 
    285271        FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); 
     
    287273        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    288274        tmp->fieldType = *((unsigned short*)&buffer2); 
    289         fprintf (stderr, " (%hu,", tmp->fieldType); 
    290275        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    291276        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    292277        tmp->fieldLength = *((unsigned short*)&buffer2); 
    293         fprintf (stderr, "%hu)", tmp->fieldLength); 
    294278        tmp->next = cTOPtr->fieldSet; 
    295279        tmp->prev = NULL; 
     
    301285      } 
    302286      while ((*offV9)%4 != 0) { 
    303         fprintf (stderr, "padding\n"); 
    304287        (*offV9)++; cpt++; 
    305288      } /*padding case*/ 
    306289    } else { /*update */ 
    307       fprintf (stderr, "UPDATE\n"); 
    308290      ptplotmp = cTOPtr; 
    309291      if (ptplotmp->prev == NULL) { 
     
    337319        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    338320        tmp->fieldType = *((unsigned short*)&buffer2); 
    339         fprintf (stderr, " (%hu,", tmp->fieldType); 
    340321        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    341322        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    342323        tmp->fieldLength = *((unsigned short*)&buffer2); 
    343         fprintf (stderr, "%hu) ", tmp->fieldLength); 
    344324        tmp->next = cTOPtr->fieldSet; 
    345325        tmp->prev = NULL; 
     
    351331      } 
    352332      while ((*offV9)%4 != 0) { 
    353         fprintf(stderr,"padding\n"); 
    354333        (*offV9)++; cpt++; 
    355334      } /*padding case*/