Changeset 36 for trunk/src/dataFlowSet.c
- Timestamp:
- 05/19/07 11:57:44 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r34 r36 60 60 unsigned char buffer4[4]; 61 61 RulesPtr tmpRuleList = myPtrs->rulesListPtr; 62 RulesPtr tmpRL = myPtrs->rulesListPtr; 62 63 msgType myMsg; 63 64 char *msgTextIndex; 65 char *msgToSend; 64 66 unsigned short tplMsgType = 11; 65 struct PrefixV4 prefixKey, *res ; /* for bsearch */67 struct PrefixV4 prefixKey, *res, *res2; /* for bsearch */ 66 68 struct AggCache agCache; 67 69 int bool = 0; /* in IPV4 Agg mode enabled, we need to now if it's an IPv4 */ … … 674 676 /* Aggregation mode must be enable in ./configure options */ 675 677 /* first we must know if the address belong to our prefix */ 678 myPtrs->nbFluxTT++; 676 679 #ifdef IPV4AGG 677 680 if ( (bool == 1) && (isMplsFlow == 0) ){ … … 681 684 if (res!=NULL){ 682 685 if ( myPtrs->routersID[res->routerNb] == agCache.routerAd ) { 686 myPtrs->nbFluxSR4++; 683 687 /* OUT ("traffic from the prefix/subnet") */ 684 688 res->bytesNbOUT += agCache.bytes; 685 689 res->pktsNbOUT += agCache.pkts; 686 690 (res->flowNbOUT)++; 691 /* inter-pop matrix Accounting */ 692 prefixKey.beginning = agCache.v4AdD>>(32-agCache.maskD)<<(32-agCache.maskD); 693 res2 = bsearch(&prefixKey, V4PTab, nbPV4, 694 sizeof(struct PrefixV4), prefGlobalCmp); 695 if (res2!=NULL){ 696 myPtrs->nbFluxIR4++; 697 ((struct POP *)((myPtrs->matrixPOP) 698 +((res->routerNb)*ROUTER_INDEX_MAX) 699 +((res2->routerNb))))->pktsNb += agCache.pkts; 700 ((struct POP *)((myPtrs->matrixPOP) 701 +((res->routerNb)*ROUTER_INDEX_MAX) 702 +((res2->routerNb))))->bytesNb += agCache.bytes; 703 ((struct POP *)((myPtrs->matrixPOP) 704 +((res->routerNb)*ROUTER_INDEX_MAX) 705 +((res2->routerNb))))->flowNb++; 706 } else { 707 myPtrs->nbFluxSE++; 708 ( 709 ((struct POP *)(myPtrs->matrixPOP) 710 +((res->routerNb)*ROUTER_INDEX_MAX) 711 +((ROUTER_INDEX_MAX-1))))->pktsNb += agCache.pkts; 712 ( 713 ((struct POP *)(myPtrs->matrixPOP) 714 +((res->routerNb)*ROUTER_INDEX_MAX) 715 +((ROUTER_INDEX_MAX-1))))->bytesNb += agCache.bytes; 716 ( 717 ((struct POP *)(myPtrs->matrixPOP) 718 +((res->routerNb)*ROUTER_INDEX_MAX) 719 +((ROUTER_INDEX_MAX-1))))->flowNb++; 720 } 721 /* end interpop matrix accounting */ 687 722 } else { 688 723 /* doublon or bad reference in prefix list */ … … 725 760 /* - prefix not referenced but not allowed to be routed */ 726 761 /* - spoofing */ 762 myPtrs->nbFluxUK++; 727 763 #ifdef PRINTUNKNOWNSUBNET 728 764 fprintf(stderr, "%lu.%lu.%lu.%lu/%hu -> %lu.%lu.%lu.%lu/%hu (R:%lu.%lu.%lu.%lu) \n", … … 759 795 */ 760 796 tmpRuleList = myPtrs->rulesListPtr; 797 tmpRL = myPtrs->rulesListPtr; 761 798 while (tmpRuleList){ 762 /* RulesPtr tmpRuleList_for_to = myPtrs->rulesListPtr; */763 799 RuleDefPtr tmpRuleDefList = tmpRuleList->def; 764 800 unsigned short check = 1; 765 /* int s=0; */ 801 int s=0; 766 802 secondOffset = secondOldOffset; 767 803 while (tmpRuleDefList){ … … 773 809 /* msg building */ 774 810 secondPftmp = tmp->lastField; 775 msgTextIndex = mempcpy(mempcpy(mempcpy(myMsg.text,811 msgTextIndex = mempcpy(mempcpy(mempcpy(myMsg.text, 776 812 &tplMsgType, 777 813 sizeof(unsigned short) … … 795 831 myMsg.type = 1; 796 832 /* OLD transfert type */ 797 msgSend( myQueue, myMsg); 833 /* msgSend( myQueue, myMsg); */ 798 834 /* NEW transfert type */ 799 /* for ( ; tmpRuleList_for_to; tmpRuleList_for_to=tmpRuleList_for_to->next){ */ 800 /* fprintf(stderr, "?\n"); */ 801 /* if (tmpRuleList_for_to->id == tmpRuleList->id){ */ 802 /* fprintf(stderr, "y\n"); */ 803 /* s = sendMessage(tmpRuleList_for_to->host->sockId, &(myMsg.text), sizeof(myMsg.text), */ 804 /* tmpRuleList_for_to->host->hostAddressPtr); */ 805 /* fprintf(stderr, "o\n"); */ 806 /* } */ 807 /* } */ 835 for ( ; tmpRL; tmpRL=tmpRL->next){ 836 if (tmpRL->id == tmpRuleList->id){ 837 s = sendMessage(tmpRL->host->sockId, myMsg.text, sizeof(myMsg.text), 838 tmpRL->host->hostAddressPtr); 839 } 840 } 808 841 /* FIXME : perhaps check "s" */ 809 842 noEnd = 1;