- Timestamp:
- 11/21/08 11:27:21 (14 years ago)
- Location:
- trunk/src
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r85 r86 299 299 } 300 300 } 301 if ((pftmp->fieldType==16)||(pftmp->fieldType==17)){ 302 if ((((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.svalue) 303 == ((unsigned short)*((unsigned long*)&buffer4))) 304 { 305 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 306 } 307 } 301 308 if (pftmp->fieldType==1){ 302 309 agCache.bytes = *((unsigned long*)&buffer4); … … 331 338 if (pftmp->fieldType==2){ 332 339 agCache.pkts = *((unsigned long*)&buffer4); 340 } 341 #endif 342 #ifdef ASACC 343 if (pftmp->fieldType==16){ 344 agCache.asS = (unsigned short)*((unsigned long*)&buffer4); 345 } 346 if (pftmp->fieldType==17){ 347 agCache.asD = (unsigned short)*((unsigned long*)&buffer4); 333 348 } 334 349 #endif … … 573 588 } 574 589 #endif 590 #ifdef ASACC 591 if (pftmp->fieldType==16){ 592 agCache.asS = (unsigned short)*((unsigned long*)&buffer4); 593 } 594 if (pftmp->fieldType==17){ 595 agCache.asD = (unsigned short)*((unsigned long*)&buffer4); 596 } 597 #endif 575 598 break; 576 599 case 16: … … 611 634 asres = bsearch(&asKey, myPtrs->currentASTab, myPtrs->asNb, sizeof(struct AS), asGlobalCmp); 612 635 if (asres != NULL) { 613 if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1 ) { 636 if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1 ) { 637 #if defined(MULTISAMPLING) 638 if (myPtrs->currentRouterPtr->sampled != asres->sampling ){ 639 /* OUT ("traffic from the AS") */ 640 asres->bytesNbOUT += agCache.bytes*myPtrs->currentRouterPtr->sampled/asres->sampling; 641 asres->pktsNbOUT += agCache.pkts*myPtrs->currentRouterPtr->sampled/asres->sampling; 642 }else{ 643 asres->bytesNbOUT += agCache.bytes; 644 asres->pktsNbOUT += agCache.pkts; 645 (asres->flowNbOUT)++; 646 } 647 #else 614 648 if (myPtrs->currentRouterPtr->sampled != 0 ){ 615 649 /* OUT ("traffic from the AS") */ … … 622 656 asres->sampling = myPtrs->currentRouterPtr->sampled; 623 657 } 658 #endif 624 659 asres = NULL; 625 660 asKey.as = agCache.asD; 626 661 asres = bsearch(&asKey, myPtrs->currentASTab, myPtrs->asNb, sizeof(struct AS), asGlobalCmp); 627 662 if (asres!=NULL){ 663 #if defined(MULTISAMPLING) 664 if (myPtrs->currentRouterPtr->sampled != asres->sampling ){ 665 /* IN ("traffic to the AS") */ 666 asres->bytesNbIN += agCache.bytes*myPtrs->currentRouterPtr->sampled/asres->sampling; 667 asres->pktsNbIN += agCache.pkts*myPtrs->currentRouterPtr->sampled/asres->sampling; 668 }else{ 669 asres->bytesNbIN += agCache.bytes; 670 asres->pktsNbIN += agCache.pkts; 671 (asres->flowNbIN)++; 672 } 673 #else 628 674 if (myPtrs->currentRouterPtr->sampled != 0 ){ 629 675 /* IN ("traffic to the AS") */ … … 636 682 asres->sampling = myPtrs->currentRouterPtr->sampled; 637 683 } 684 #endif 638 685 asres = NULL; 639 686 } … … 645 692 if (asres!=NULL){ 646 693 if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1 ) { 694 #if defined(MULTISAMPLING) 695 if (myPtrs->currentRouterPtr->sampled != asres->sampling ){ 696 /* IN ("traffic to the AS") */ 697 asres->bytesNbIN += agCache.bytes*myPtrs->currentRouterPtr->sampled/asres->sampling; 698 asres->pktsNbIN += agCache.pkts*myPtrs->currentRouterPtr->sampled/asres->sampling; 699 }else{ 700 asres->bytesNbIN += agCache.bytes; 701 asres->pktsNbIN += agCache.pkts; 702 (asres->flowNbIN)++; 703 } 704 #else 647 705 if (myPtrs->currentRouterPtr->sampled != 0 ){ 648 706 /* IN ("traffic to the AS") */ … … 655 713 asres->sampling = myPtrs->currentRouterPtr->sampled; 656 714 } 715 #endif 657 716 } 658 717 } -
trunk/src/get_conf.c
r84 r86 434 434 unsigned short counter = 0; 435 435 unsigned short n0; 436 #if defined(MULTISAMPLING) 437 unsigned short n1; 438 #endif 436 439 unsigned short buffer; 437 440 int i = 0; 438 char ASStrTab[MAX_AS][ 7];441 char ASStrTab[MAX_AS][256]; 439 442 440 443 if (!(asFile = fopen(filename, "r"))) { … … 446 449 ASTabPtr[i].sampling = 0; 447 450 } 448 while (fgets(line, 7, asFile) != 0)451 while (fgets(line, 256, asFile) != 0) 449 452 { 450 453 strcpy(ASStrTab[counter], line); … … 457 460 } 458 461 } 459 qsort(ASStrTab, counter, 7, compASStr);462 qsort(ASStrTab, counter, 256, compASStr); 460 463 for(i=0;i<counter;i++) 461 464 { 465 #if defined(MULTISAMPLING) 466 sscanf(ASStrTab[i],"%hu %hu\n", 467 &n0, 468 &n1); 469 buffer = (unsigned short)n0; 470 ASTabPtr[i].as = *((unsigned short*)&buffer); 471 buffer = (unsigned short)n1; 472 ASTabPtr[i].sampling = *((unsigned short*)&buffer); 473 #else 462 474 sscanf(ASStrTab[i],"%hu\n", 463 475 &n0); … … 465 477 ASTabPtr[i].as = *((unsigned short*)&buffer); 466 478 ASTabPtr[i].sampling = 0; 479 #endif 467 480 } 468 481 if( fclose(asFile) == 0) {