Changeset 15 for trunk/src

Show
Ignore:
Timestamp:
03/16/06 17:45:26 (17 years ago)
Author:
andreu
Message:

?

Location:
trunk/src
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dataFlowSet.c

    r14 r15  
    22 * File: dataFlowSet.c 
    33 *  
    4  * Authors: ANDREU François-Xavier  
     4 * Authors: ANDREU Francois-Xavier  
    55 * 
    66 * Copyright (C) 2005 GIP RENATER  
     
    132132              buffer4[1]= *(buf+(*offV9)); (*offV9)++; 
    133133              buffer4[0]= *(buf+(*offV9)); (*offV9)++; 
    134               /* here , add a check on the field type */ 
     134              /* FIXME : here , add a check on the field type */ 
    135135              if ((((RuleDefPtr)(*(rulesCache+pos)))->value->stor.lvalue)  
    136136                  == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) ) 
     
    145145                buffer4[1]= *(buf+(*offV9)); (*offV9)++; 
    146146                buffer4[0]= *(buf+(*offV9)); (*offV9)++; 
    147                 /* here check a new var : moreIsNecessary */ 
    148147                if (1==moreIsNecessary){ 
    149148                  switch(i){ 
    150149                  case 0: 
    151 /*                  fprintf(stderr, "i:%d case0, N:%lu V:%lu TC:%lu, %hu\n", */ 
    152 /*                          i, */ 
    153 /*                          ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]), */ 
    154 /*                          (*((unsigned long*)&buffer4)), */ 
    155 /*                          (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask), */ 
    156 /*                          ((RuleDefPtr)(*(rulesCache+pos)))->value->mask */ 
    157 /*                          ); */ 
    158150                    if (((RuleDefPtr)(*(rulesCache+pos)))->value->mask <= 32){ 
    159151                      if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i])  
     
    182174                    break; 
    183175                  case 1: 
    184 /*                  fprintf(stderr, "i:%d case1, N:%lu V:%lu TC:%lu\n", */ 
    185 /*                          i, */ 
    186 /*                          ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]), */ 
    187 /*                          (*((unsigned long*)&buffer4)), */ 
    188 /*                          (*((unsigned long*)&buffer4))>>(64-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(64-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)); */ 
    189176                    if (((RuleDefPtr)(*(rulesCache+pos)))->value->mask <= 64){ 
    190177                      if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i])  
     
    274261                } /* end of if moreIsNecessary */ 
    275262              } 
    276 /*            fprintf(stderr,"GOOD %d\n", */ 
    277 /*                    ((RuleDefPtr)(*(rulesCache+pos)))->check); */ 
    278263              moreIsNecessary = 1; 
    279264              break; 
     
    409394  return (data_length+shift); 
    410395} 
    411  
    412 /*     for (i=0; i<(90); i++){ */ 
    413 /*       int k=0; */ 
    414 /*       pos = i*10+k; */ 
    415 /*       if (((RuleDefPtr)(*(rulesCache+pos))) != NULL){ */ 
    416 /*      fprintf(stderr," type: %d ",i); */ 
    417 /*      while ( ((RuleDefPtr)(*(rulesCache+pos))) != NULL){ */ 
    418 /*        fprintf(stderr, "\n op:%hu, pos: %d",  */ 
    419 /*                ((RuleDefPtr)(*(rulesCache+pos)))->operator, */ 
    420 /*                pos); */ 
    421 /*        k++; */ 
    422 /*        pos = i*10+k; */ 
    423 /*      } */ 
    424 /*      fprintf(stderr,"\n"); */ 
    425 /*       } */ 
    426 /*     }  */ 
  • trunk/src/dataFlowSet.h

    r2 r15  
    22 * File: dataFlowSet.h 
    33 *  
    4  * Authors: ANDREU François-Xavier  
     4 * Authors: ANDREU Francois-Xavier  
    55 * 
    66 * Copyright (C) 2005 GIP RENATER  
  • trunk/src/renetcol.c

    r13 r15  
    131131  } 
    132132 
     133  /* handler, SIGUSR1 from renetcolSender */ 
    133134  myAction.sa_handler = sigusr1Mgmt; 
    134135  myAction.sa_flags = SA_RESTART; 
     
    167168  initStream(); 
    168169 
    169   datagramNumber =0; 
    170  
    171   /* TIME */ 
     170  datagramNumber =0; /* FIXME : ???? */ 
     171 
    172172  now = time((time_t *)NULL); 
    173173  tmPtr = localtime(&now); 
    174   socketLoop(); 
     174  socketLoop(); /* all work on datagram is made here */ 
    175175  closelog(); 
    176176  fprintf(stderr, "END\n"); 
     
    332332            getNetFlowHeader(pcktPtr, ptr_buffer,  
    333333                             currentHeaderV9Ptr, offsetV9Ptr)){ 
    334     case 1: 
    335       checkNetFlowHeader(pcktPtr); 
    336       break; 
    337     case 5: 
    338 /*       syslog(LOG_INFO,  */ 
    339 /*           "NetFlow export version 5 from router: %lu.%lu.%lu.%lu", */ 
    340 /*           (pcktPtr->ipH->srcAdd>>24), */ 
    341 /*           (pcktPtr->ipH->srcAdd<<8>>24), */ 
    342 /*           (pcktPtr->ipH->srcAdd<<16>>24), */ 
    343 /*           (pcktPtr->ipH->srcAdd<<24>>24)); */ 
    344       break; 
    345334    case 9: 
    346335      if ((currentRouterPtr=notExistRouter(routersListPtr,  
  • trunk/src/template.c

    r2 r15  
    7676  unsigned short tplMsgType = 1; 
    7777 
     78  fprintf (stderr, "NORMAL\n"); 
    7879  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    7980  buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    8081  getFlowsetId = *((unsigned short*)&buffer2); 
     82  fprintf(stderr,"FlowsetID: %hu \n", getFlowsetId); 
    8183  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    8284  buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    8385  length = *((unsigned short*)&buffer2); 
     86  fprintf(stderr,"length: %hu \n", length); 
    8487  do { 
    8588    buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     
    8891         existTplId(cr, v9Ptr->sourceId, 
    8992                    *((unsigned short*)&buffer2)))==NULL) { 
     93      fprintf (stderr, "NEW\n"); 
    9094      cTFSPtr = newRouterTplList(); 
    9195      cTFSPtr->next = cr->tplList; 
     
    9397      cr->tplList = cTFSPtr; 
    9498      cTFSPtr->templateFlowSetId = *((unsigned short*)&buffer2); 
     99      fprintf(stderr,"templateFlowSetId: %hu \n", cTFSPtr->templateFlowSetId); 
    95100      cTFSPtr->sourceId = v9Ptr->sourceId; 
    96101      buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    97102      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    98103      cTFSPtr->fieldCount = *((unsigned short*)&buffer2); 
     104      fprintf(stderr,"fieldCount: %hu \n", cTFSPtr->fieldCount); 
    99105      cpt_fields = 0; 
    100106      for ( i=0; i<cTFSPtr->fieldCount; i++) { 
     
    130136      } 
    131137    } else { /*update*/ 
     138      fprintf (stderr, "UPDATE\n"); 
    132139      ptpltmp = cTFSPtr; 
    133140      if (ptpltmp->prev == NULL) { 
     
    244251  TplOptionPtr ptplotmp; 
    245252 
     253  fprintf (stderr, "\nOPTION\n"); 
    246254  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    247255  buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    248256  getFlowsetId = *((unsigned short*)&buffer2); 
     257  fprintf(stderr,"FlowsetID: %hu \n", getFlowsetId); 
    249258  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    250259  buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    251260  length = *((unsigned short*)&buffer2); 
     261  fprintf(stderr,"length: %hu \n", length); 
    252262  do { 
    253263    buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     
    256266         existTplOptId(cr, v9Ptr->sourceId,  
    257267                       *((unsigned short*)&buffer2)))==NULL) { 
     268      fprintf (stderr, "NEW\n"); 
    258269      cTOPtr = newRouterTplOptList(); 
    259270      cTOPtr->next = cr->tplOptList; 
     
    261272      cr->tplOptList = cTOPtr; 
    262273      cTOPtr->templateOptionId = *((unsigned short*)&buffer2); 
     274      fprintf(stderr,"templateOptionId: %hu \n", cTOPtr->templateOptionId); 
    263275      cTOPtr->sourceId = v9Ptr->sourceId; 
    264276      buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    265277      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    266278      cTOPtr->optionScopeLg = *((unsigned short*)&buffer2); 
     279      fprintf(stderr,"optionScopeLg: %hu \n", cTOPtr->optionScopeLg); 
    267280      buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    268281      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    269282      cTOPtr->optionLg = *((unsigned short*)&buffer2); 
    270       for ( i=0; i<((cTOPtr->optionScopeLg)+(cTOPtr->optionLg)); i++) { 
     283      fprintf(stderr,"optionLg: %hu \n", cTOPtr->optionLg); 
     284      for ( i=0; i<(((cTOPtr->optionScopeLg)+(cTOPtr->optionLg))/4); i++) { 
    271285        FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); 
    272286        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    273287        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    274288        tmp->fieldType = *((unsigned short*)&buffer2); 
     289        fprintf (stderr, " (%hu,", tmp->fieldType); 
    275290        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    276291        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    277292        tmp->fieldLength = *((unsigned short*)&buffer2); 
     293        fprintf (stderr, "%hu)", tmp->fieldLength); 
    278294        tmp->next = cTOPtr->fieldSet; 
    279295        tmp->prev = NULL; 
     
    285301      } 
    286302      while ((*offV9)%4 != 0) { 
     303        fprintf (stderr, "padding\n"); 
    287304        (*offV9)++; cpt++; 
    288305      } /*padding case*/ 
    289306    } else { /*update */ 
     307      fprintf (stderr, "UPDATE\n"); 
    290308      ptplotmp = cTOPtr; 
    291309      if (ptplotmp->prev == NULL) { 
     
    314332      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    315333      cTOPtr->optionLg = *((unsigned short*)&buffer2); 
    316       for ( i=0; i<((cTOPtr->optionScopeLg)+(cTOPtr->optionLg)); i++) { 
     334      for ( i=0; i<(((cTOPtr->optionScopeLg)+(cTOPtr->optionLg))/4); i++) { 
    317335        FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); 
    318336        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    319337        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    320338        tmp->fieldType = *((unsigned short*)&buffer2); 
     339        fprintf (stderr, " (%hu,", tmp->fieldType); 
    321340        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    322341        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    323342        tmp->fieldLength = *((unsigned short*)&buffer2); 
     343        fprintf (stderr, "%hu) ", tmp->fieldLength); 
    324344        tmp->next = cTOPtr->fieldSet; 
    325345        tmp->prev = NULL; 
     
    331351      } 
    332352      while ((*offV9)%4 != 0) { 
     353        fprintf(stderr,"padding\n"); 
    333354        (*offV9)++; cpt++; 
    334355      } /*padding case*/ 
    335356    } 
    336357    (*cFNPtr)++; 
    337   } while ((cpt*2) < (length-3)); 
     358  } while ((cpt) < (length-2)); 
    338359/*   show_all_tplFlSet(); */ 
    339360  return length;