Show
Ignore:
Timestamp:
06/17/09 14:44:04 (14 years ago)
Author:
andreu
Message:

ticket #41 Pcap file integration

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dataFlowSet.c

    r97 r111  
    8181  int paddingCounter = 0; 
    8282  int crazyCounter = 0; 
     83#ifdef DEBUG 
     84  int flowCpt = 0; 
     85#endif 
    8386 
    8487  buffer2[1] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); 
     
    9396  data_length = *((unsigned short*)&buffer2); 
    9497  if (data_length == 0) { 
    95     syslog(LOG_INFO, "data flowset length null; all next informations of this data flowset are not considered! flowset ID: %hu, from router: %lu.%lu.%lu.%lu", 
    96            (*myPtrs->currentFlowsetIdPtr), 
    97            (myPtrs->pcktPtr->ipH->srcAdd>>24), 
    98            (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 
    99            (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 
    100            (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); 
     98#ifdef DEBUG     
     99    fprintf (stderr, " dlg==0 <--| "); 
     100#endif 
     101/*     syslog(LOG_INFO, "data flowset length null; all next informations of this data flowset are not considered! flowset ID: %hu, from router: %lu.%lu.%lu.%lu", */ 
     102/*         (*myPtrs->currentFlowsetIdPtr), */ 
     103/*         (myPtrs->pcktPtr->ipH->srcAdd>>24), */ 
     104/*         (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), */ 
     105/*         (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), */ 
     106/*         (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); */ 
    101107    return (-1); 
    102108 
     
    112118            data_length); 
    113119    if ( (*myPtrs->currentFlowsetIdPtr) > TRESHOLD_TEMPLATE_ID ) { 
    114       /*        fprintf(stderr,"Bad TID from router: %lu.%lu.%lu.%lu\n", */ 
    115       /*                (*myPtrs->currentFlowsetIdPtr), */ 
    116       /*                (myPtrs->pcktPtr->ipH->srcAdd>>24), */ 
    117       /*                (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), */ 
    118       /*                (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), */ 
    119       /*                (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); */ 
    120       /*        fprintf(stderr," Bytes : \n"); */ 
    121       /*        while ( ( myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr) ) > (myPtrs->ptr_buffer+1416) ){ */ 
    122       /*          buffer1= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; */ 
    123       /*          tmp = *((unsigned char*)&buffer1); */ 
    124       /*          fprintf (stderr, " %s ", tmp); */ 
    125       /*        } */ 
    126       /*        exit(-1); */ 
     120        fprintf(stderr,"Bad TID from router: %lu.%lu.%lu.%lu\n", 
     121                (*myPtrs->currentFlowsetIdPtr), 
     122                (myPtrs->pcktPtr->ipH->srcAdd>>24), 
     123                (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 
     124                (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 
     125                (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); 
     126        fprintf(stderr," Bytes : \n"); 
     127        while ( ( myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr) ) > (myPtrs->ptr_buffer+1416) ){ 
     128          buffer1= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 
     129          tmp = *((unsigned char*)&buffer1); 
     130          fprintf (stderr, " %s ", tmp); 
     131        } 
     132        exit(-1); 
    127133      return (data_length+shift); 
    128134    } 
     
    134140    if ( data_length%flow_size >= 9 ) { 
    135141      (*myPtrs->currentFlowsetNumberPtr) = myPtrs->currentHeaderV9Ptr->count; 
    136       syslog(LOG_INFO, "data flowset length not match with length from template definition, wrong template definition suspected; all next informations of this data flowset are not considered! flowset ID: %hu, from router: %lu.%lu.%lu.%lu", 
     142      syslog(LOG_INFO, "data flowset length not match with length from template definition, wrong template definition suspected; all next informations of this data flowset are not considered! sourceID: %lu flowset ID: %hu, from router: %lu.%lu.%lu.%lu", 
     143             myPtrs->currentHeaderV9Ptr->sourceId, 
    137144             (*myPtrs->currentFlowsetIdPtr), 
    138145             (myPtrs->pcktPtr->ipH->srcAdd>>24), 
     
    140147             (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 
    141148             (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); 
     149#ifdef DEBUG     
     150    fprintf (stderr, " dlg%flsz >=9 skip data "); 
     151#endif 
    142152      return (data_length+shift); 
    143153    } 
     
    149159             (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 
    150160             (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); 
     161#ifdef DEBUG     
     162    fprintf (stderr, " dlg >= 1452 skip pckt "); 
     163#endif 
    151164      return (-1); 
    152165    } 
     
    641654         * end of one flow (not the flowset)  
    642655         */ 
    643  
     656#ifdef DEBUG 
     657        flowCpt++; 
     658        fprintf(stderr," F%d ", flowCpt); 
     659#endif  
    644660        /* put aggregation cache information to IPv4 Prefixes table */ 
    645661        /* Aggregation mode must be enable in ./configure options   */ 
     
    12121228        /* not the flow end, progress in field list */ 
    12131229        pftmp = pftmp->prev; 
    1214       } 
     1230      }     
    12151231    } /* end of the while on one flow record */ 
    1216        
     1232        
    12171233    while ( ((*myPtrs->offsetV9Ptr)-48-shift) < data_length ) { 
    12181234      (*myPtrs->offsetV9Ptr)++; /* if padding */ 
    12191235      paddingCounter++; 
     1236#ifdef DEBUG 
     1237      fprintf(stderr,", pC: %d ", paddingCounter); 
    12201238      if ( paddingCounter > 8 ) { 
    1221 #ifdef DEBUG 
    1222         fprintf(stderr," padding too high: %d ", paddingCounter); 
    1223 #endif 
    12241239        syslog(LOG_INFO,"padding too high: %d ", paddingCounter); 
     1240        fprintf(stderr,", pC: %d <--| ", paddingCounter); 
    12251241        return (-1); 
     1242#endif 
    12261243      } 
     1244      return (-1); 
    12271245    } 
    12281246    while ( (*myPtrs->offsetV9Ptr)-48-shift > data_length ) {  
     
    12321250#ifdef DEBUG 
    12331251    if (crazyCounter != 0){ fprintf(stderr," crazyCounter: %d ", crazyCounter); } 
    1234 #endif 
    12351252    if (crazyCounter!=0) { syslog(LOG_INFO,"crazyCounter: %d ", crazyCounter);} 
    1236        
    1237 #ifdef DEBUG 
    1238     fprintf(stderr,"}"); 
     1253    fprintf(stderr,"(%hu,%hu)}", data_length, data_length+shift); 
    12391254#endif 
    12401255       
     
    13261341    } else { 
    13271342      /*  
    1328        * template unknown, we skip this all the data  
     1343       * template unknown, we skip the data  
    13291344       */ 
    13301345      (*myPtrs->offsetV9Ptr)+=(data_length-4); 
    1331       (*myPtrs->currentFlowsetNumberPtr) = myPtrs->currentHeaderV9Ptr->count; 
     1346      (*myPtrs->currentFlowsetNumberPtr)+= 1 ; 
     1347      /*      (*myPtrs->currentFlowsetNumberPtr) = myPtrs->currentHeaderV9Ptr->count;*/ 
    13321348#ifdef DEBUG 
    1333       fprintf(stderr, " U, r: %lu.%lu.%lu.%lu, sourceId: %lu, TID: %hu", 
     1349      fprintf(stderr, " U, r: %lu.%lu.%lu.%lu, sourceId: %lu, TID: %hu ", 
    13341350              (myPtrs->pcktPtr->ipH->srcAdd>>24), 
    13351351              (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 
     
    13391355              (*myPtrs->currentFlowsetIdPtr) 
    13401356              ); 
     1357      fprintf(stderr,"(%hu,%hu) ", data_length, data_length+shift); 
    13411358#endif 
    13421359      return (data_length+shift);