- Timestamp:
- 03/16/06 17:45:26 (17 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r14 r15 2 2 * File: dataFlowSet.c 3 3 * 4 * Authors: ANDREU Fran çois-Xavier4 * Authors: ANDREU Francois-Xavier 5 5 * 6 6 * Copyright (C) 2005 GIP RENATER … … 132 132 buffer4[1]= *(buf+(*offV9)); (*offV9)++; 133 133 buffer4[0]= *(buf+(*offV9)); (*offV9)++; 134 /* here , add a check on the field type */134 /* FIXME : here , add a check on the field type */ 135 135 if ((((RuleDefPtr)(*(rulesCache+pos)))->value->stor.lvalue) 136 136 == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) ) … … 145 145 buffer4[1]= *(buf+(*offV9)); (*offV9)++; 146 146 buffer4[0]= *(buf+(*offV9)); (*offV9)++; 147 /* here check a new var : moreIsNecessary */148 147 if (1==moreIsNecessary){ 149 148 switch(i){ 150 149 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 /* ); */158 150 if (((RuleDefPtr)(*(rulesCache+pos)))->value->mask <= 32){ 159 151 if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) … … 182 174 break; 183 175 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)); */189 176 if (((RuleDefPtr)(*(rulesCache+pos)))->value->mask <= 64){ 190 177 if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) … … 274 261 } /* end of if moreIsNecessary */ 275 262 } 276 /* fprintf(stderr,"GOOD %d\n", */277 /* ((RuleDefPtr)(*(rulesCache+pos)))->check); */278 263 moreIsNecessary = 1; 279 264 break; … … 409 394 return (data_length+shift); 410 395 } 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 2 2 * File: dataFlowSet.h 3 3 * 4 * Authors: ANDREU Fran çois-Xavier4 * Authors: ANDREU Francois-Xavier 5 5 * 6 6 * Copyright (C) 2005 GIP RENATER -
trunk/src/renetcol.c
r13 r15 131 131 } 132 132 133 /* handler, SIGUSR1 from renetcolSender */ 133 134 myAction.sa_handler = sigusr1Mgmt; 134 135 myAction.sa_flags = SA_RESTART; … … 167 168 initStream(); 168 169 169 datagramNumber =0; 170 171 /* TIME */ 170 datagramNumber =0; /* FIXME : ???? */ 171 172 172 now = time((time_t *)NULL); 173 173 tmPtr = localtime(&now); 174 socketLoop(); 174 socketLoop(); /* all work on datagram is made here */ 175 175 closelog(); 176 176 fprintf(stderr, "END\n"); … … 332 332 getNetFlowHeader(pcktPtr, ptr_buffer, 333 333 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;345 334 case 9: 346 335 if ((currentRouterPtr=notExistRouter(routersListPtr, -
trunk/src/template.c
r2 r15 76 76 unsigned short tplMsgType = 1; 77 77 78 fprintf (stderr, "NORMAL\n"); 78 79 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 79 80 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 80 81 getFlowsetId = *((unsigned short*)&buffer2); 82 fprintf(stderr,"FlowsetID: %hu \n", getFlowsetId); 81 83 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 82 84 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 83 85 length = *((unsigned short*)&buffer2); 86 fprintf(stderr,"length: %hu \n", length); 84 87 do { 85 88 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; … … 88 91 existTplId(cr, v9Ptr->sourceId, 89 92 *((unsigned short*)&buffer2)))==NULL) { 93 fprintf (stderr, "NEW\n"); 90 94 cTFSPtr = newRouterTplList(); 91 95 cTFSPtr->next = cr->tplList; … … 93 97 cr->tplList = cTFSPtr; 94 98 cTFSPtr->templateFlowSetId = *((unsigned short*)&buffer2); 99 fprintf(stderr,"templateFlowSetId: %hu \n", cTFSPtr->templateFlowSetId); 95 100 cTFSPtr->sourceId = v9Ptr->sourceId; 96 101 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 97 102 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 98 103 cTFSPtr->fieldCount = *((unsigned short*)&buffer2); 104 fprintf(stderr,"fieldCount: %hu \n", cTFSPtr->fieldCount); 99 105 cpt_fields = 0; 100 106 for ( i=0; i<cTFSPtr->fieldCount; i++) { … … 130 136 } 131 137 } else { /*update*/ 138 fprintf (stderr, "UPDATE\n"); 132 139 ptpltmp = cTFSPtr; 133 140 if (ptpltmp->prev == NULL) { … … 244 251 TplOptionPtr ptplotmp; 245 252 253 fprintf (stderr, "\nOPTION\n"); 246 254 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 247 255 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 248 256 getFlowsetId = *((unsigned short*)&buffer2); 257 fprintf(stderr,"FlowsetID: %hu \n", getFlowsetId); 249 258 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 250 259 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 251 260 length = *((unsigned short*)&buffer2); 261 fprintf(stderr,"length: %hu \n", length); 252 262 do { 253 263 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; … … 256 266 existTplOptId(cr, v9Ptr->sourceId, 257 267 *((unsigned short*)&buffer2)))==NULL) { 268 fprintf (stderr, "NEW\n"); 258 269 cTOPtr = newRouterTplOptList(); 259 270 cTOPtr->next = cr->tplOptList; … … 261 272 cr->tplOptList = cTOPtr; 262 273 cTOPtr->templateOptionId = *((unsigned short*)&buffer2); 274 fprintf(stderr,"templateOptionId: %hu \n", cTOPtr->templateOptionId); 263 275 cTOPtr->sourceId = v9Ptr->sourceId; 264 276 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 265 277 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 266 278 cTOPtr->optionScopeLg = *((unsigned short*)&buffer2); 279 fprintf(stderr,"optionScopeLg: %hu \n", cTOPtr->optionScopeLg); 267 280 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 268 281 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 269 282 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++) { 271 285 FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); 272 286 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 273 287 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 274 288 tmp->fieldType = *((unsigned short*)&buffer2); 289 fprintf (stderr, " (%hu,", tmp->fieldType); 275 290 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 276 291 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 277 292 tmp->fieldLength = *((unsigned short*)&buffer2); 293 fprintf (stderr, "%hu)", tmp->fieldLength); 278 294 tmp->next = cTOPtr->fieldSet; 279 295 tmp->prev = NULL; … … 285 301 } 286 302 while ((*offV9)%4 != 0) { 303 fprintf (stderr, "padding\n"); 287 304 (*offV9)++; cpt++; 288 305 } /*padding case*/ 289 306 } else { /*update */ 307 fprintf (stderr, "UPDATE\n"); 290 308 ptplotmp = cTOPtr; 291 309 if (ptplotmp->prev == NULL) { … … 314 332 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 315 333 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++) { 317 335 FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); 318 336 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 319 337 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 320 338 tmp->fieldType = *((unsigned short*)&buffer2); 339 fprintf (stderr, " (%hu,", tmp->fieldType); 321 340 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 322 341 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 323 342 tmp->fieldLength = *((unsigned short*)&buffer2); 343 fprintf (stderr, "%hu) ", tmp->fieldLength); 324 344 tmp->next = cTOPtr->fieldSet; 325 345 tmp->prev = NULL; … … 331 351 } 332 352 while ((*offV9)%4 != 0) { 353 fprintf(stderr,"padding\n"); 333 354 (*offV9)++; cpt++; 334 355 } /*padding case*/ 335 356 } 336 357 (*cFNPtr)++; 337 } while ((cpt *2) < (length-3));358 } while ((cpt) < (length-2)); 338 359 /* show_all_tplFlSet(); */ 339 360 return length;