[2] | 1 | |
---|
| 2 | |
---|
| 3 | |
---|
[15] | 4 | |
---|
[2] | 5 | |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | #include "dataFlowSet.h" |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | unsigned short |
---|
| 33 | checkDataFlowSet(unsigned short shift, RouterPtr cr, NetFlowV9HeaderPtr v9Ptr, |
---|
| 34 | unsigned short *offV9, unsigned char *buf, short *cFNPtr, |
---|
| 35 | short *cFId, DatagramPtr pcktPtr, RuleDefPtr *rulesCache, |
---|
[16] | 36 | RulesPtr rlPtr, int myQueue, struct PrefixV4 *V4PTab, |
---|
| 37 | size_t nbPV4) |
---|
[2] | 38 | { |
---|
| 39 | TplFlowSetPtr tmp; |
---|
| 40 | FieldPtr pftmp; |
---|
| 41 | FieldPtr secondPftmp; |
---|
| 42 | unsigned short data_length = 0; |
---|
| 43 | unsigned short flow_size = 0; |
---|
| 44 | unsigned short oldOffset = *offV9; |
---|
| 45 | unsigned short secondOffset = 0; |
---|
| 46 | unsigned short secondOldOffset = 0; |
---|
[14] | 47 | int moreIsNecessary = 1; |
---|
[2] | 48 | int field_size = 0; |
---|
| 49 | int cpt = 0; |
---|
| 50 | int secondCpt = 0; |
---|
| 51 | int overflow = 0; |
---|
| 52 | int noEnd = 1; |
---|
[16] | 53 | int i = 0; |
---|
| 54 | int j = 0; |
---|
[2] | 55 | int pos = 0; |
---|
| 56 | unsigned char buffer1; |
---|
| 57 | unsigned char buffer2[2]; |
---|
| 58 | unsigned char buffer4[4]; |
---|
| 59 | RulesPtr tmpRuleList = rlPtr; |
---|
| 60 | msgType myMsg; |
---|
| 61 | char *msgTextIndex; |
---|
| 62 | unsigned short tplMsgType = 11; |
---|
[16] | 63 | struct PrefixV4 prefixKey, *res; |
---|
| 64 | struct AggCache agCache; |
---|
[17] | 65 | int bool = 0; |
---|
[2] | 66 | |
---|
| 67 | buffer2[1] = *(buf+(*offV9));(*offV9)++; |
---|
| 68 | buffer2[0] = *(buf+(*offV9));(*offV9)++; |
---|
| 69 | (*cFId) = *((unsigned short*)&buffer2); |
---|
| 70 | buffer2[1] = *(buf+(*offV9));(*offV9)++; |
---|
| 71 | buffer2[0] = *(buf+(*offV9));(*offV9)++; |
---|
| 72 | data_length = *((unsigned short*)&buffer2); |
---|
| 73 | if ((tmp=existTplId(cr, v9Ptr->sourceId, |
---|
| 74 | (*cFId)))!=NULL) { |
---|
| 75 | pftmp = tmp->lastField; |
---|
| 76 | for (; pftmp; pftmp = pftmp->prev) { |
---|
| 77 | flow_size += pftmp->fieldLength; |
---|
| 78 | } |
---|
| 79 | if ( data_length%flow_size >= 9 ) { |
---|
| 80 | (*cFNPtr) = v9Ptr->count; |
---|
| 81 | 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", |
---|
| 82 | (*cFId), |
---|
| 83 | (pcktPtr->ipH->srcAdd>>24), |
---|
| 84 | (pcktPtr->ipH->srcAdd<<8>>24), |
---|
| 85 | (pcktPtr->ipH->srcAdd<<16>>24), |
---|
| 86 | (pcktPtr->ipH->srcAdd<<24>>24)); |
---|
| 87 | return (data_length+shift); |
---|
| 88 | } |
---|
[17] | 89 | |
---|
| 90 | agCache.routerAd = pcktPtr->ipH->srcAdd; |
---|
| 91 | |
---|
[2] | 92 | pftmp = tmp->lastField; |
---|
| 93 | secondPftmp = tmp->lastField; |
---|
| 94 | secondOffset = *offV9; |
---|
| 95 | secondOldOffset = secondOffset; |
---|
| 96 | while ( (((*offV9)-48-shift) <= data_length) && (overflow!=1) ) { |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | cpt++; |
---|
| 104 | j=0; |
---|
| 105 | pos = (pftmp->fieldType)*10+j; |
---|
| 106 | field_size = (int) pftmp->fieldLength; |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | |
---|
| 111 | if (((RuleDefPtr)(*(rulesCache+pos))) != NULL) { |
---|
| 112 | oldOffset = *offV9; |
---|
| 113 | while (((RuleDefPtr)(*(rulesCache+pos))) != NULL){ |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | *offV9 = oldOffset; |
---|
| 118 | switch ((int) |
---|
| 119 | (((RuleDefPtr)(*(rulesCache+pos)))->operator)){ |
---|
| 120 | case 2: |
---|
| 121 | switch (field_size) { |
---|
| 122 | case 1: |
---|
| 123 | buffer1 = *(buf+(*offV9)); (*offV9)++; |
---|
[17] | 124 | |
---|
[2] | 125 | if (((RuleDefPtr)(*(rulesCache+pos)))->value->stor.cvalue |
---|
| 126 | == *((unsigned char*)&buffer1)) { |
---|
| 127 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; |
---|
[16] | 128 | } |
---|
[17] | 129 | |
---|
[16] | 130 | |
---|
[17] | 131 | if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ |
---|
| 132 | agCache.maskS = *((unsigned char*)&buffer1); |
---|
| 133 | } |
---|
| 134 | if ((pftmp->fieldType==13)||(pftmp->fieldType==30)){ |
---|
| 135 | agCache.maskD = *((unsigned char*)&buffer1); |
---|
| 136 | } |
---|
| 137 | if (pftmp->fieldType==60){ |
---|
| 138 | agCache.ipProt = *((unsigned char*)&buffer1); |
---|
| 139 | } |
---|
| 140 | if (pftmp->fieldType==4){ |
---|
| 141 | agCache.tProt = *((unsigned char*)&buffer1); |
---|
| 142 | } |
---|
| 143 | if (pftmp->fieldType==61){ |
---|
| 144 | agCache.sens = *((unsigned char*)&buffer1); |
---|
| 145 | } |
---|
| 146 | if (pftmp->fieldType==5){ |
---|
| 147 | agCache.dscp = *((unsigned char*)&buffer1); |
---|
| 148 | } |
---|
[16] | 149 | |
---|
[2] | 150 | break; |
---|
| 151 | case 2: |
---|
| 152 | buffer2[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 153 | buffer2[0]= *(buf+(*offV9)); (*offV9)++; |
---|
| 154 | if (((RuleDefPtr)(*(rulesCache+pos)))->value->stor.svalue |
---|
| 155 | == *((unsigned short*)&buffer2)) |
---|
| 156 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; |
---|
[16] | 157 | |
---|
[17] | 158 | if (pftmp->fieldType==10){ |
---|
| 159 | agCache.idSnmp = *((unsigned short*)&buffer2); |
---|
| 160 | } |
---|
[16] | 161 | |
---|
[2] | 162 | break; |
---|
[17] | 163 | case 3: |
---|
| 164 | buffer4[3]= 0; |
---|
| 165 | buffer4[2]= *(buf+(*offV9)); (*offV9)++; |
---|
| 166 | buffer4[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 167 | buffer4[0]= *(buf+(*offV9)); (*offV9)++; |
---|
| 168 | if (((RuleDefPtr)(*(rulesCache+pos)))->value->stor.lvalue |
---|
| 169 | == *((unsigned long*)&buffer4)) |
---|
| 170 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | break; |
---|
[2] | 174 | case 4: |
---|
| 175 | buffer4[3]= *(buf+(*offV9)); (*offV9)++; |
---|
| 176 | buffer4[2]= *(buf+(*offV9)); (*offV9)++; |
---|
| 177 | buffer4[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 178 | buffer4[0]= *(buf+(*offV9)); (*offV9)++; |
---|
[15] | 179 | |
---|
[16] | 180 | if ((pftmp->fieldType==8)||(pftmp->fieldType==12)){ |
---|
| 181 | if ((((RuleDefPtr)(*(rulesCache+pos)))->value->stor.lvalue) |
---|
| 182 | == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) ) |
---|
| 183 | { |
---|
| 184 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; |
---|
| 185 | } |
---|
| 186 | } |
---|
| 187 | |
---|
[17] | 188 | if ((pftmp->fieldType==8)){ |
---|
| 189 | agCache.v4AdS = *((unsigned long*)&buffer4); |
---|
| 190 | } |
---|
| 191 | if ((pftmp->fieldType==12)){ |
---|
| 192 | agCache.v4AdD = *((unsigned long*)&buffer4); |
---|
| 193 | } |
---|
| 194 | if (pftmp->fieldType==1){ |
---|
| 195 | agCache.bytes = *((unsigned long*)&buffer4); |
---|
| 196 | } |
---|
| 197 | if (pftmp->fieldType==2){ |
---|
| 198 | agCache.pkts = *((unsigned long*)&buffer4); |
---|
| 199 | } |
---|
[16] | 200 | |
---|
[2] | 201 | break; |
---|
| 202 | case 16: |
---|
| 203 | for (i=0; i<4; i++) { |
---|
| 204 | buffer4[3]= *(buf+(*offV9)); (*offV9)++; |
---|
| 205 | buffer4[2]= *(buf+(*offV9)); (*offV9)++; |
---|
| 206 | buffer4[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 207 | buffer4[0]= *(buf+(*offV9)); (*offV9)++; |
---|
[14] | 208 | if (1==moreIsNecessary){ |
---|
| 209 | switch(i){ |
---|
| 210 | case 0: |
---|
| 211 | if (((RuleDefPtr)(*(rulesCache+pos)))->value->mask <= 32){ |
---|
| 212 | if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) |
---|
| 213 | == |
---|
| 214 | (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) |
---|
| 215 | ) |
---|
| 216 | { |
---|
| 217 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; |
---|
| 218 | moreIsNecessary = 0; |
---|
| 219 | } else { |
---|
| 220 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 0; |
---|
| 221 | moreIsNecessary = 0; |
---|
| 222 | } |
---|
[2] | 223 | } else { |
---|
[14] | 224 | if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) |
---|
| 225 | == |
---|
| 226 | (*((unsigned long*)&buffer4)) |
---|
| 227 | ) |
---|
| 228 | { |
---|
| 229 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; |
---|
| 230 | } else { |
---|
| 231 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 0; |
---|
| 232 | moreIsNecessary = 0; |
---|
| 233 | } |
---|
[2] | 234 | } |
---|
[14] | 235 | break; |
---|
| 236 | case 1: |
---|
| 237 | if (((RuleDefPtr)(*(rulesCache+pos)))->value->mask <= 64){ |
---|
| 238 | if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) |
---|
| 239 | == |
---|
| 240 | (*((unsigned long*)&buffer4))>>(64-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(64-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) |
---|
| 241 | ) |
---|
| 242 | { |
---|
| 243 | ((RuleDefPtr)(*(rulesCache+pos)))->check = |
---|
| 244 | ((RuleDefPtr)(*(rulesCache+pos)))->check && 1; |
---|
| 245 | moreIsNecessary = 0; |
---|
| 246 | } else { |
---|
| 247 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 0; |
---|
| 248 | moreIsNecessary = 0; |
---|
| 249 | } |
---|
| 250 | } else { |
---|
| 251 | if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) |
---|
| 252 | == |
---|
| 253 | (*((unsigned long*)&buffer4)) |
---|
| 254 | ) |
---|
| 255 | { |
---|
| 256 | ((RuleDefPtr)(*(rulesCache+pos)))->check = |
---|
| 257 | ((RuleDefPtr)(*(rulesCache+pos)))->check && 1; |
---|
| 258 | } else { |
---|
| 259 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 0; |
---|
| 260 | moreIsNecessary = 0; |
---|
| 261 | } |
---|
| 262 | } |
---|
| 263 | break; |
---|
| 264 | case 2: |
---|
| 265 | if (((RuleDefPtr)(*(rulesCache+pos)))->value->mask <= 96){ |
---|
| 266 | if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) |
---|
| 267 | == |
---|
| 268 | (*((unsigned long*)&buffer4))>>(96-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(96-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) |
---|
| 269 | ) |
---|
| 270 | { |
---|
| 271 | ((RuleDefPtr)(*(rulesCache+pos)))->check = |
---|
| 272 | ((RuleDefPtr)(*(rulesCache+pos)))->check && 1; |
---|
| 273 | moreIsNecessary = 0; |
---|
| 274 | } else { |
---|
| 275 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 0; |
---|
| 276 | moreIsNecessary = 0; |
---|
| 277 | } |
---|
| 278 | } else { |
---|
| 279 | if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) |
---|
| 280 | == |
---|
| 281 | (*((unsigned long*)&buffer4)) |
---|
| 282 | ) |
---|
| 283 | { |
---|
| 284 | ((RuleDefPtr)(*(rulesCache+pos)))->check = |
---|
| 285 | ((RuleDefPtr)(*(rulesCache+pos)))->check && 1; |
---|
| 286 | } else { |
---|
| 287 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 0; |
---|
| 288 | moreIsNecessary = 0; |
---|
| 289 | } |
---|
| 290 | } |
---|
| 291 | break; |
---|
| 292 | case 3: |
---|
| 293 | if (((RuleDefPtr)(*(rulesCache+pos)))->value->mask <= 128){ |
---|
| 294 | if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) |
---|
| 295 | == |
---|
| 296 | (*((unsigned long*)&buffer4))>>(128-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)<<(128-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) |
---|
| 297 | ) |
---|
| 298 | { |
---|
| 299 | ((RuleDefPtr)(*(rulesCache+pos)))->check = |
---|
| 300 | ((RuleDefPtr)(*(rulesCache+pos)))->check && 1; |
---|
| 301 | } else { |
---|
| 302 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 0; |
---|
| 303 | moreIsNecessary = 0; |
---|
| 304 | } |
---|
| 305 | } else { |
---|
| 306 | if (ntohl(((RuleDefPtr)(*(rulesCache+pos)))->value->stor.tabAdd6[i]) |
---|
| 307 | == |
---|
| 308 | (*((unsigned long*)&buffer4)) |
---|
| 309 | ) |
---|
| 310 | { |
---|
| 311 | ((RuleDefPtr)(*(rulesCache+pos)))->check = |
---|
| 312 | ((RuleDefPtr)(*(rulesCache+pos)))->check && 1; |
---|
| 313 | } else { |
---|
| 314 | ((RuleDefPtr)(*(rulesCache+pos)))->check = 0; |
---|
| 315 | moreIsNecessary = 0; |
---|
| 316 | } |
---|
| 317 | } |
---|
| 318 | break; |
---|
| 319 | default: |
---|
| 320 | break; |
---|
| 321 | } |
---|
| 322 | } |
---|
[2] | 323 | } |
---|
[14] | 324 | moreIsNecessary = 1; |
---|
[16] | 325 | |
---|
| 326 | |
---|
| 327 | |
---|
[2] | 328 | break; |
---|
| 329 | default: |
---|
| 330 | syslog(LOG_INFO, "Field size not known: %d\n", field_size); |
---|
| 331 | for (i=0; i<field_size; i++){ |
---|
| 332 | (*offV9)++; |
---|
| 333 | } |
---|
| 334 | break; |
---|
| 335 | } |
---|
| 336 | break; |
---|
| 337 | default: |
---|
| 338 | syslog(LOG_INFO, "Operator not known: %d\n", |
---|
| 339 | (int)(((RuleDefPtr)(*(rulesCache+pos)))->operator)); |
---|
| 340 | break; |
---|
| 341 | } |
---|
| 342 | j++; |
---|
| 343 | pos = (pftmp->fieldType)*10+j; |
---|
| 344 | } |
---|
| 345 | } else { |
---|
| 346 | |
---|
| 347 | |
---|
| 348 | |
---|
| 349 | switch (field_size) { |
---|
| 350 | case 1: |
---|
| 351 | buffer1 = *(buf+(*offV9)); (*offV9)++; |
---|
[16] | 352 | |
---|
[17] | 353 | if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ |
---|
| 354 | agCache.maskS = *((unsigned char*)&buffer1); |
---|
| 355 | } |
---|
| 356 | if ((pftmp->fieldType==13)||(pftmp->fieldType==30)){ |
---|
| 357 | agCache.maskD = *((unsigned char*)&buffer1); |
---|
| 358 | } |
---|
| 359 | if (pftmp->fieldType==60){ |
---|
| 360 | agCache.ipProt = *((unsigned char*)&buffer1); |
---|
| 361 | } |
---|
| 362 | if (pftmp->fieldType==4){ |
---|
| 363 | agCache.tProt = *((unsigned char*)&buffer1); |
---|
| 364 | } |
---|
| 365 | if (pftmp->fieldType==61){ |
---|
| 366 | agCache.sens = *((unsigned char*)&buffer1); |
---|
| 367 | } |
---|
| 368 | if (pftmp->fieldType==5){ |
---|
| 369 | agCache.dscp = *((unsigned char*)&buffer1); |
---|
| 370 | } |
---|
[16] | 371 | |
---|
[2] | 372 | break; |
---|
| 373 | case 2: |
---|
| 374 | buffer2[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 375 | buffer2[0]= *(buf+(*offV9)); (*offV9)++; |
---|
[16] | 376 | |
---|
[17] | 377 | if (pftmp->fieldType==10){ |
---|
| 378 | agCache.idSnmp = *((unsigned short*)&buffer2); |
---|
| 379 | } |
---|
[16] | 380 | |
---|
[2] | 381 | break; |
---|
[17] | 382 | case 3: |
---|
| 383 | buffer4[3]= 0; |
---|
| 384 | buffer4[2]= *(buf+(*offV9)); (*offV9)++; |
---|
| 385 | buffer4[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 386 | buffer4[0]= *(buf+(*offV9)); (*offV9)++; |
---|
| 387 | |
---|
| 388 | |
---|
| 389 | |
---|
| 390 | |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | break; |
---|
[2] | 394 | case 4: |
---|
| 395 | buffer4[3]= *(buf+(*offV9)); (*offV9)++; |
---|
| 396 | buffer4[2]= *(buf+(*offV9)); (*offV9)++; |
---|
| 397 | buffer4[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 398 | buffer4[0]= *(buf+(*offV9)); (*offV9)++; |
---|
[16] | 399 | |
---|
[17] | 400 | if ((pftmp->fieldType==8)){ |
---|
| 401 | bool = 1; |
---|
| 402 | agCache.v4AdS = *((unsigned long*)&buffer4); |
---|
| 403 | } else if ((pftmp->fieldType==12)){ |
---|
| 404 | agCache.v4AdD = *((unsigned long*)&buffer4); |
---|
| 405 | } else if (pftmp->fieldType==1){ |
---|
| 406 | agCache.bytes = *((unsigned long*)&buffer4); |
---|
| 407 | } else if (pftmp->fieldType==2){ |
---|
| 408 | agCache.pkts = *((unsigned long*)&buffer4); |
---|
| 409 | } |
---|
[16] | 410 | |
---|
[2] | 411 | break; |
---|
| 412 | case 16: |
---|
| 413 | for (i=0; i<4; i++) { |
---|
| 414 | buffer2[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 415 | buffer2[0]= *(buf+(*offV9)); (*offV9)++; |
---|
| 416 | buffer2[1]= *(buf+(*offV9)); (*offV9)++; |
---|
| 417 | buffer2[0]= *(buf+(*offV9)); (*offV9)++; |
---|
| 418 | } |
---|
[16] | 419 | |
---|
| 420 | |
---|
| 421 | |
---|
[2] | 422 | break; |
---|
| 423 | default: |
---|
| 424 | syslog(LOG_INFO,"UNKNOWN FIELDS LENGTH: %d ", field_size); |
---|
| 425 | for (i=0; i<field_size; i++){ |
---|
| 426 | (*offV9)++; |
---|
| 427 | } |
---|
| 428 | } |
---|
| 429 | } |
---|
| 430 | if (cpt==tmp->fieldCount) { |
---|
| 431 | |
---|
| 432 | |
---|
| 433 | |
---|
[16] | 434 | |
---|
[17] | 435 | if (bool == 1){ |
---|
| 436 | prefixKey.beginning = agCache.v4AdS>>(32-agCache.maskS)<<(32-agCache.maskS); |
---|
| 437 | res = bsearch(&prefixKey, V4PTab, nbPV4, |
---|
| 438 | sizeof(struct PrefixV4), prefCmp); |
---|
| 439 | } |
---|
| 440 | bool = 0; |
---|
[16] | 441 | |
---|
[2] | 442 | |
---|
| 443 | |
---|
| 444 | |
---|
| 445 | |
---|
| 446 | |
---|
| 447 | tmpRuleList = rlPtr; |
---|
| 448 | while (tmpRuleList){ |
---|
| 449 | unsigned short check = 1; |
---|
| 450 | RuleDefPtr tmpRuleDefList = tmpRuleList->def; |
---|
| 451 | secondOffset = secondOldOffset; |
---|
| 452 | while (tmpRuleDefList){ |
---|
| 453 | check = check && tmpRuleDefList->check; |
---|
| 454 | tmpRuleDefList->check = 0; |
---|
| 455 | tmpRuleDefList = tmpRuleDefList->next; |
---|
| 456 | } |
---|
| 457 | if ( (tmpRuleList->def != NULL) && (check == 1)) { |
---|
| 458 | |
---|
| 459 | secondPftmp = tmp->lastField; |
---|
| 460 | |
---|
| 461 | msgTextIndex = mempcpy(mempcpy(mempcpy(myMsg.text, |
---|
| 462 | &tplMsgType, |
---|
| 463 | sizeof(unsigned short) |
---|
| 464 | ), |
---|
| 465 | &tmpRuleList->id, |
---|
| 466 | sizeof(tmpRuleList->id) |
---|
| 467 | ), |
---|
| 468 | &cr->IpAddress, |
---|
| 469 | sizeof(unsigned long) |
---|
| 470 | ); |
---|
| 471 | msgTextIndex = mempcpy(mempcpy(mempcpy(msgTextIndex, |
---|
| 472 | &tmp->sourceId, |
---|
| 473 | sizeof(unsigned long) |
---|
| 474 | ), |
---|
| 475 | &tmp->templateFlowSetId, |
---|
| 476 | sizeof(tmp->templateFlowSetId) |
---|
| 477 | ), |
---|
| 478 | buf+secondOffset, |
---|
| 479 | flow_size |
---|
| 480 | ); |
---|
| 481 | myMsg.type = 1; |
---|
| 482 | msgSend( myQueue, myMsg); |
---|
| 483 | noEnd = 1; |
---|
| 484 | secondCpt=0; |
---|
| 485 | } |
---|
| 486 | tmpRuleList = tmpRuleList->next; |
---|
| 487 | secondPftmp = tmp->lastField; |
---|
| 488 | } |
---|
| 489 | |
---|
| 490 | |
---|
| 491 | |
---|
| 492 | secondOffset = *offV9; |
---|
| 493 | secondOldOffset = secondOffset; |
---|
| 494 | pftmp = tmp->lastField; |
---|
| 495 | cpt=0; |
---|
| 496 | (*cFNPtr)++; |
---|
| 497 | if (((*offV9)-48-shift+flow_size) > data_length){ |
---|
| 498 | overflow = 1; |
---|
| 499 | } |
---|
| 500 | } else { |
---|
| 501 | |
---|
| 502 | pftmp = pftmp->prev; |
---|
| 503 | } |
---|
| 504 | } |
---|
| 505 | }else{ |
---|
| 506 | |
---|
| 507 | |
---|
| 508 | |
---|
| 509 | (*offV9)+=(data_length-4); |
---|
| 510 | (*cFNPtr) = v9Ptr->count; |
---|
| 511 | } |
---|
| 512 | while ( ((*offV9)-48-shift) < data_length ) { |
---|
| 513 | (*offV9)++; |
---|
| 514 | } |
---|
| 515 | while ( (*offV9)-48-shift > data_length ) { |
---|
| 516 | (*offV9)--; |
---|
| 517 | } |
---|
| 518 | return (data_length+shift); |
---|
| 519 | } |
---|