- Timestamp:
- 03/17/06 17:15:12 (17 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r15 r16 34 34 unsigned short *offV9, unsigned char *buf, short *cFNPtr, 35 35 short *cFId, DatagramPtr pcktPtr, RuleDefPtr *rulesCache, 36 RulesPtr rlPtr, int myQueue) 36 RulesPtr rlPtr, int myQueue, struct PrefixV4 *V4PTab, 37 size_t nbPV4) 37 38 { 38 39 TplFlowSetPtr tmp; … … 50 51 int overflow = 0; 51 52 int noEnd = 1; 52 int i =0;53 int j =0;53 int i = 0; 54 int j = 0; 54 55 int pos = 0; 55 56 unsigned char buffer1; … … 60 61 char *msgTextIndex; 61 62 unsigned short tplMsgType = 11; 63 struct PrefixV4 prefixKey, *res; /* for bsearch */ 64 struct AggCache agCache; 62 65 63 66 buffer2[1] = *(buf+(*offV9));(*offV9)++; … … 118 121 == *((unsigned char*)&buffer1)) { 119 122 ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 120 } 123 } 124 /* aggregation */ 125 126 /* end aggregation */ 121 127 break; 122 128 case 2: … … 126 132 == *((unsigned short*)&buffer2)) 127 133 ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 134 /* aggregation */ 135 136 /* end aggregation */ 128 137 break; 129 138 case 4: … … 133 142 buffer4[0]= *(buf+(*offV9)); (*offV9)++; 134 143 /* FIXME : here , add a check on the field type */ 135 if ((((RuleDefPtr)(*(rulesCache+pos)))->value->stor.lvalue) 136 == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) ) 137 { 138 ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 139 } 144 if ((pftmp->fieldType==8)||(pftmp->fieldType==12)){ 145 if ((((RuleDefPtr)(*(rulesCache+pos)))->value->stor.lvalue) 146 == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) ) 147 { 148 ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 149 } 150 prefixKey.beginning = *((unsigned long*)&buffer4); 151 res = bsearch(&prefixKey, V4PTab, nbPV4, 152 sizeof(struct PrefixV4), prefCmp); 153 if (res == NULL) 154 fprintf(stderr,"!"); 155 else 156 fprintf(stderr,"."); 157 } 158 /* aggregation */ 159 160 /* end aggregation */ 140 161 break; 141 162 case 16: … … 262 283 } 263 284 moreIsNecessary = 1; 285 /* aggregation */ 286 287 /* end aggregation */ 264 288 break; 265 289 default: … … 286 310 case 1: 287 311 buffer1 = *(buf+(*offV9)); (*offV9)++; 312 /* aggregation */ 313 314 /* end aggregation */ 288 315 break; 289 316 case 2: 290 317 buffer2[1]= *(buf+(*offV9)); (*offV9)++; 291 318 buffer2[0]= *(buf+(*offV9)); (*offV9)++; 319 /* aggregation */ 320 321 /* end aggregation */ 292 322 break; 293 323 case 4: … … 296 326 buffer4[1]= *(buf+(*offV9)); (*offV9)++; 297 327 buffer4[0]= *(buf+(*offV9)); (*offV9)++; 328 /* aggregation */ 329 330 /* end aggregation */ 298 331 break; 299 332 case 16: … … 304 337 buffer2[0]= *(buf+(*offV9)); (*offV9)++; 305 338 } 339 /* aggregation */ 340 341 /* end aggregation */ 306 342 break; 307 343 default: … … 316 352 * end of one flow (not the flowset) 317 353 */ 354 /* put aggregation cache information to tables */ 355 356 /* end put */ 318 357 /* 319 358 * Redirection if needed -
trunk/src/dataFlowSet.h
r15 r16 34 34 #include "rules_mgmt.h" 35 35 #include "msg_mgmt.h" 36 #include "get_conf.h" 37 #include "prefix_mgmt.h" 38 39 struct AggCache { 40 unsigned short mode; 41 unsigned long v4Ad; 42 uint32_t tabAdd6[4]; 43 unsigned short mask; 44 unsigned short sens; /* In/out */ 45 unsigned long bytes; 46 unsigned long pkts; 47 unsigned short tProt; 48 unsigned short netProt; 49 unsigned long routerAd; 50 unsigned short idSnmp; 51 unsigned short dscp; 52 /* unsigned short mplsLabel1; 53 unsigned long intAdd; */ 54 }; 36 55 37 56 unsigned short 38 57 checkDataFlowSet(unsigned short, RouterPtr, NetFlowV9HeaderPtr, 39 58 unsigned short *, unsigned char *, short *, 40 short *, DatagramPtr, RuleDefPtr *, RulesPtr, int); 59 short *, DatagramPtr, RuleDefPtr *, RulesPtr, int, 60 struct PrefixV4 *, size_t); 41 61 42 62 #endif /* DATAFLOWSET_H */ -
trunk/src/get_conf.c
r2 r16 130 130 /* 131 131 * getPrefixV4() 132 * 133 * read IPv4 prefix file and sort the list 132 134 */ 133 135 short getPrefixV4(char *filename, struct PrefixV4 *pV4TabPtr) -
trunk/src/prefix_mgmt.c
r15 r16 26 26 #include "prefix_mgmt.h" 27 27 28 /* 29 * prefCmp() 30 */ 31 int 32 prefCmp(const void *elem1, const void *elem2){ 33 struct PrefixV4 *el1 = (struct PrefixV4 *) elem1; 34 struct PrefixV4 *el2 = (struct PrefixV4 *) elem2; 35 return ( 36 el1->beginning - el2->beginning 37 ); 38 } -
trunk/src/renetcol.c
r15 r16 364 364 currentFlowsetIdPtr, pcktPtr, 365 365 rulesAddressPtr, rulesListPtr, 366 myQueue); 366 myQueue, prefixV4Tab, 367 (size_t) PREFIX_V4_MAX); 367 368 } 368 369 } -
trunk/src/template.c
r15 r16 76 76 unsigned short tplMsgType = 1; 77 77 78 fprintf (stderr, "NORMAL\n");79 78 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 80 79 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 81 80 getFlowsetId = *((unsigned short*)&buffer2); 82 fprintf(stderr,"FlowsetID: %hu \n", getFlowsetId);83 81 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 84 82 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 85 83 length = *((unsigned short*)&buffer2); 86 fprintf(stderr,"length: %hu \n", length);87 84 do { 88 85 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; … … 91 88 existTplId(cr, v9Ptr->sourceId, 92 89 *((unsigned short*)&buffer2)))==NULL) { 93 fprintf (stderr, "NEW\n");94 90 cTFSPtr = newRouterTplList(); 95 91 cTFSPtr->next = cr->tplList; … … 97 93 cr->tplList = cTFSPtr; 98 94 cTFSPtr->templateFlowSetId = *((unsigned short*)&buffer2); 99 fprintf(stderr,"templateFlowSetId: %hu \n", cTFSPtr->templateFlowSetId);100 95 cTFSPtr->sourceId = v9Ptr->sourceId; 101 96 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 102 97 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 103 98 cTFSPtr->fieldCount = *((unsigned short*)&buffer2); 104 fprintf(stderr,"fieldCount: %hu \n", cTFSPtr->fieldCount);105 99 cpt_fields = 0; 106 100 for ( i=0; i<cTFSPtr->fieldCount; i++) { … … 136 130 } 137 131 } else { /*update*/ 138 fprintf (stderr, "UPDATE\n");139 132 ptpltmp = cTFSPtr; 140 133 if (ptpltmp->prev == NULL) { … … 251 244 TplOptionPtr ptplotmp; 252 245 253 fprintf (stderr, "\nOPTION\n");254 246 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 255 247 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 256 248 getFlowsetId = *((unsigned short*)&buffer2); 257 fprintf(stderr,"FlowsetID: %hu \n", getFlowsetId);258 249 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 259 250 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 260 251 length = *((unsigned short*)&buffer2); 261 fprintf(stderr,"length: %hu \n", length);262 252 do { 263 253 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; … … 266 256 existTplOptId(cr, v9Ptr->sourceId, 267 257 *((unsigned short*)&buffer2)))==NULL) { 268 fprintf (stderr, "NEW\n");269 258 cTOPtr = newRouterTplOptList(); 270 259 cTOPtr->next = cr->tplOptList; … … 272 261 cr->tplOptList = cTOPtr; 273 262 cTOPtr->templateOptionId = *((unsigned short*)&buffer2); 274 fprintf(stderr,"templateOptionId: %hu \n", cTOPtr->templateOptionId);275 263 cTOPtr->sourceId = v9Ptr->sourceId; 276 264 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 277 265 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 278 266 cTOPtr->optionScopeLg = *((unsigned short*)&buffer2); 279 fprintf(stderr,"optionScopeLg: %hu \n", cTOPtr->optionScopeLg);280 267 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 281 268 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 282 269 cTOPtr->optionLg = *((unsigned short*)&buffer2); 283 fprintf(stderr,"optionLg: %hu \n", cTOPtr->optionLg);284 270 for ( i=0; i<(((cTOPtr->optionScopeLg)+(cTOPtr->optionLg))/4); i++) { 285 271 FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); … … 287 273 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 288 274 tmp->fieldType = *((unsigned short*)&buffer2); 289 fprintf (stderr, " (%hu,", tmp->fieldType);290 275 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 291 276 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 292 277 tmp->fieldLength = *((unsigned short*)&buffer2); 293 fprintf (stderr, "%hu)", tmp->fieldLength);294 278 tmp->next = cTOPtr->fieldSet; 295 279 tmp->prev = NULL; … … 301 285 } 302 286 while ((*offV9)%4 != 0) { 303 fprintf (stderr, "padding\n");304 287 (*offV9)++; cpt++; 305 288 } /*padding case*/ 306 289 } else { /*update */ 307 fprintf (stderr, "UPDATE\n");308 290 ptplotmp = cTOPtr; 309 291 if (ptplotmp->prev == NULL) { … … 337 319 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 338 320 tmp->fieldType = *((unsigned short*)&buffer2); 339 fprintf (stderr, " (%hu,", tmp->fieldType);340 321 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 341 322 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 342 323 tmp->fieldLength = *((unsigned short*)&buffer2); 343 fprintf (stderr, "%hu) ", tmp->fieldLength);344 324 tmp->next = cTOPtr->fieldSet; 345 325 tmp->prev = NULL; … … 351 331 } 352 332 while ((*offV9)%4 != 0) { 353 fprintf(stderr,"padding\n");354 333 (*offV9)++; cpt++; 355 334 } /*padding case*/