(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/msg_dlmap.c) |
| |
| 2216 | | | gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) |
| 2217 | | | { |
| 2218 | | | |
| 2219 | | | |
| 2220 | | | |
| 2221 | | | |
| 2222 | | | proto_item *ti = NULL; |
| 2223 | | | proto_tree *tree = NULL; |
| 2224 | | | |
| 2225 | | | gint nibble = offset; |
| 2226 | | | gint diuc; |
| 2227 | | | gint ext2_diuc; |
| 2228 | | | gint len; |
| 2229 | | | gint ext_diuc; |
| 2230 | | | |
| 2231 | | | gint alt_format = 0; |
| 2232 | | | guint data = 0; |
| 2233 | | | gint i; |
| 2234 | | | gint papr = 0; |
| 2235 | | | gint ie_len = 9; |
| 2236 | | | |
| 2237 | | | gint n_cid; |
| 2238 | | | |
| 2239 | | | |
| 2240 | | | diuc = NIB_NIBBLE(nibble, bufptr);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
52 | #define NIB_NIBBLE(n,b) \ |
53 | (((n) & 1) \ |
54 | ? (b)[(n)/2] & NIBBLE_MASK \ |
55 | : ((b)[(n)/2] >> 4) & NIBBLE_MASK) |
| |
|
| 2241 | | | if (diuc == 14) |
| 2242 | | | { |
| 2243 | | | |
| 2244 | | | ext2_diuc = NIB_NIBBLE(1+nibble, bufptr);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
52 | #define NIB_NIBBLE(n,b) \ |
53 | (((n) & 1) \ |
54 | ? (b)[(n)/2] & NIBBLE_MASK \ |
55 | : ((b)[(n)/2] >> 4) & NIBBLE_MASK) |
| |
|
| 2245 | | | len = NIB_BYTE(1+nibble+1, bufptr);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
58 | #define NIB_BYTE(n,b) \ |
59 | (n) & 1 \ |
60 | ? (pntohs( (b)+(n)/2 ) >> 4) & BYTE_MASK \ |
61 | : (b)[(n)/2] |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
37 | #define pntohs(p) ((guint16) \ |
38 | ((guint16)*((const guint8 *)(p)+0)<<8| \ |
39 | (guint16)*((const guint8 *)(p)+1)<<0)) |
| |
|
| 2246 | | | |
| 2247 | | | ti = proto_tree_add_uint(ie_tree, hf_dlmap_ie_diuc, tvb, NIBHI(nibble, 1+3+len*2), diuc); |
| 2248 | | | proto_item_append_text(ti, " (Extended-2)"); |
| 2249 | | | tree = proto_item_add_subtree(ti, ett_277b); |
| 2250 | | | nibble++; |
| 2251 | | | |
| 2252 | | | len = 3 + BYTE_TO_NIB(len); |
| 2253 | | | |
| 2254 | | | |
| 2255 | | | switch (ext2_diuc) |
| 2256 | | | { |
| 2257 | | | case 0x00: |
| 2258 | | | |
| 2259 | | | nibble = MBS_MAP_IE(tree, bufptr, nibble, len, tvb); |
| 2260 | | | break; |
| 2261 | | | case 0x01: |
| 2262 | | | |
| 2263 | | | nibble = HO_Anchor_Active_DL_MAP_IE(tree, bufptr, nibble, len, tvb); |
| 2264 | | | break; |
| 2265 | | | case 0x02: |
| 2266 | | | |
| 2267 | | | nibble = HO_Active_Anchor_DL_MAP_IE(tree, bufptr, nibble, len, tvb); |
| 2268 | | | break; |
| 2269 | | | case 0x03: |
| 2270 | | | |
| 2271 | | | nibble = HO_CID_Translation_MAP_IE(tree, bufptr, nibble, len, tvb); |
| 2272 | | | break; |
| 2273 | | | case 0x04: |
| 2274 | | | |
| 2275 | | | nibble = MIMO_in_another_BS_IE(tree, bufptr, nibble, len, tvb); |
| 2276 | | | break; |
| 2277 | | | case 0x05: |
| 2278 | | | |
| 2279 | | | nibble = Macro_MIMO_DL_Basic_IE(tree, bufptr, nibble, len, tvb); |
| 2280 | | | break; |
| 2281 | | | case 0x06: |
| 2282 | | | |
| 2283 | | | nibble = Skip_IE(tree, bufptr, nibble, len, tvb); |
| 2284 | | | break; |
| 2285 | | | case 0x07: |
| 2286 | | | |
| 2287 | | | nibble = HARQ_DL_MAP_IE(tree, bufptr, nibble, len, tvb); |
| 2288 | | | break; |
| 2289 | | | case 0x08: |
| 2290 | | | |
| 2291 | | | nibble = HARQ_ACK_IE(tree, bufptr, nibble, len, tvb); |
| 2292 | | | break; |
| 2293 | | | case 0x09: |
| 2294 | | | |
| 2295 | | | nibble = Enhanced_DL_MAP_IE(tree, bufptr, nibble, len, tvb); |
| 2296 | | | break; |
| 2297 | | | case 0x0a: |
| 2298 | | | |
| 2299 | | | nibble = Closed_loop_MIMO_DL_Enhanced_IE(tree, bufptr, nibble, len, tvb); |
| 2300 | | | break; |
| 2301 | | | case 0x0b: |
| 2302 | | | nibble = MIMO_DL_Basic_IE(tree, bufptr, nibble, len, tvb); |
| 2303 | | | break; |
| 2304 | | | case 0x0c: |
| 2305 | | | nibble = MIMO_DL_Enhanced_IE(tree, bufptr, nibble, len, tvb); |
| 2306 | | | break; |
| 2307 | | | |
| 2308 | | | case 0x0e: |
| 2309 | | | nibble = AAS_SDMA_DL_IE(tree, bufptr, nibble, len, tvb); |
| 2310 | | | break; |
| 2311 | | | |
| 2312 | | | default: |
| 2313 | | | proto_tree_add_text(tree, tvb, NIBHI(nibble,len), "(reserved Extended-2 DIUC: %d)", ext2_diuc); |
| 2314 | | | nibble += len; |
| 2315 | | | break; |
| 2316 | | | |
| 2317 | | | } |
| 2318 | | | } |
| 2319 | | | else if (diuc == 15) |
| 2320 | | | { |
| 2321 | | | |
| 2322 | | | ext_diuc = NIB_NIBBLE(1+nibble, bufptr);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
52 | #define NIB_NIBBLE(n,b) \ |
53 | (((n) & 1) \ |
54 | ? (b)[(n)/2] & NIBBLE_MASK \ |
55 | : ((b)[(n)/2] >> 4) & NIBBLE_MASK) |
| |
|
| 2323 | | | len = NIB_NIBBLE(1+nibble+1, bufptr);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
52 | #define NIB_NIBBLE(n,b) \ |
53 | (((n) & 1) \ |
54 | ? (b)[(n)/2] & NIBBLE_MASK \ |
55 | : ((b)[(n)/2] >> 4) & NIBBLE_MASK) |
| |
|
| 2324 | | | |
| 2325 | | | ti = proto_tree_add_uint(ie_tree, hf_dlmap_ie_diuc, tvb, NIBHI(nibble, 1+2+len*2), diuc); |
| 2326 | | | proto_item_append_text(ti, " (Extended)"); |
| 2327 | | | tree = proto_item_add_subtree(ti, ett_277); |
| 2328 | | | nibble++; |
| 2329 | | | |
| 2330 | | | len = 2 + BYTE_TO_NIB(len); |
| 2331 | | | |
| 2332 | | | |
| 2333 | | | |
| 2334 | | | |
| 2335 | | | switch (ext_diuc) |
| 2336 | | | { |
| 2337 | | | case 0x00: |
| 2338 | | | |
| 2339 | | | nibble = Channel_Measurement_IE(tree, bufptr, nibble, len, tvb); |
| 2340 | | | break; |
| 2341 | | | case 0x01: |
| 2342 | | | |
| 2343 | | | nibble = STC_Zone_IE(tree, bufptr, nibble, len, tvb); |
| 2344 | | | break; |
| 2345 | | | case 0x02: |
| 2346 | | | |
| 2347 | | | nibble = AAS_DL_IE(tree, bufptr, nibble, len, tvb); |
| 2348 | | | break; |
| 2349 | | | case 0x03: |
| 2350 | | | |
| 2351 | | | nibble = Data_location_in_another_BS_IE(tree, bufptr, nibble, len, tvb); |
| 2352 | | | break; |
| 2353 | | | case 0x04: |
| 2354 | | | |
| 2355 | | | nibble = CID_Switch_IE(tree, bufptr, nibble, len, tvb); |
| 2356 | | | break; |
| 2357 | | | case 0x07: |
| 2358 | | | |
| 2359 | | | nibble = HARQ_Map_Pointer_IE(tree, bufptr, nibble, len, tvb); |
| 2360 | | | break; |
| 2361 | | | case 0x08: |
| 2362 | | | |
| 2363 | | | nibble = PHYMOD_DL_IE(tree, bufptr, nibble, len, tvb); |
| 2364 | | | break; |
| 2365 | | | |
| 2366 | | | case 0x0b: |
| 2367 | | | |
| 2368 | | | nibble = DL_PUSC_Burst_Allocation_in_Other_Segment_IE(tree, bufptr, nibble, len, tvb); |
| 2369 | | | break; |
| 2370 | | | case 0x0c: |
| 2371 | | | nibble = PUSC_ASCA_Alloc_IE(tree, bufptr, nibble, len, tvb); |
| 2372 | | | break; |
| 2373 | | | |
| 2374 | | | case 0x0f: |
| 2375 | | | |
| 2376 | | | nibble = UL_interference_and_noise_level_IE(tree, bufptr, nibble, len, tvb); |
| 2377 | | | break; |
| 2378 | | | |
| 2379 | | | default: |
| 2380 | | | proto_tree_add_text(tree, tvb, NIBHI(nibble,len), "(reserved Extended DIUC: %d)", ext_diuc); |
| 2381 | | | nibble += len; |
| 2382 | | | break; |
| 2383 | | | } |
| 2384 | | | } |
| 2385 | | | else |
| 2386 | | | { |
| 2387 | | | |
| 2388 | | | alt_format = 0; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 2389 | | | data = 0; |
| 2390 | | | papr = 0; |
| 2391 | | | ie_len = 9; |
| 2392 | | | |
| 2393 | | | |
| 2394 | | | |
| 2395 | | | |
| 2396 | | | if (INC_CID && !sub_dl_ul_map) { |
| 2397 | | | ie_len += 2 + (NIB_BYTE(nibble+1, bufptr) * 4);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
58 | #define NIB_BYTE(n,b) \ |
59 | (n) & 1 \ |
60 | ? (pntohs( (b)+(n)/2 ) >> 4) & BYTE_MASK \ |
61 | : (b)[(n)/2] |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
37 | #define pntohs(p) ((guint16) \ |
38 | ((guint16)*((const guint8 *)(p)+0)<<8| \ |
39 | (guint16)*((const guint8 *)(p)+1)<<0)) |
| |
|
| 2398 | | | } |
| 2399 | | | |
| 2400 | | | |
| 2401 | | | ti = proto_tree_add_uint(ie_tree, hf_dlmap_ie_diuc, tvb, NIBHI(nibble, ie_len), diuc); |
| 2402 | | | tree = proto_item_add_subtree(ti, ett_275_1); |
| 2403 | | | nibble += 1; |
| 2404 | | | |
| 2405 | | | if (diuc == 13) { |
| 2406 | | | |
| 2407 | | | papr = 1; |
| 2408 | | | proto_item_append_text(ti, " (Gap/PAPR Reduction)"); |
| 2409 | | | } |
| 2410 | | | |
| 2411 | | | |
| 2412 | | | if (INC_CID) |
| 2413 | | | { |
| 2414 | | | n_cid = NIB_BYTE(nibble, bufptr);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
58 | #define NIB_BYTE(n,b) \ |
59 | (n) & 1 \ |
60 | ? (pntohs( (b)+(n)/2 ) >> 4) & BYTE_MASK \ |
61 | : (b)[(n)/2] |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
37 | #define pntohs(p) ((guint16) \ |
38 | ((guint16)*((const guint8 *)(p)+0)<<8| \ |
39 | (guint16)*((const guint8 *)(p)+1)<<0)) |
| |
|
| 2415 | | | proto_tree_add_uint(tree, hf_dlmap_ie_ncid, tvb, NIBHI(nibble, 2), n_cid); |
| 2416 | | | nibble += 2; |
| 2417 | | | |
| 2418 | | | for (i = 0; i < n_cid; i++) |
| 2419 | | | { |
| 2420 | | | if (sub_dl_ul_map) { |
| 2421 | | | |
| 2422 | | | |
| 2423 | | | nibble += RCID_IE(tree, bufptr, nibble*4, length, tvb, RCID_Type) / 4; |
| 2424 | | | } else { |
| 2425 | | | data = NIB_WORD(nibble, bufptr);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
71 | #define NIB_WORD(n,b) \ |
72 | (n) & 1 \ |
73 | ? (gint)((pntohl(((b) + (n)/2)) >> 12) & 0x0000FFFF) \ |
74 | : pntohs((b) + (n)/2) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
45 | #define pntohl(p) ((guint32)*((const guint8 *)(p)+0)<<24| \ |
46 | (guint32)*((const guint8 *)(p)+1)<<16| \ |
47 | (guint32)*((const guint8 *)(p)+2)<<8| \ |
48 | (guint32)*((const guint8 *)(p)+3)<<0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
37 | #define pntohs(p) ((guint16) \ |
38 | ((guint16)*((const guint8 *)(p)+0)<<8| \ |
39 | (guint16)*((const guint8 *)(p)+1)<<0)) |
| |
|
| 2426 | | | proto_tree_add_uint(tree, hf_dlmap_ie_cid, tvb, NIBHI(nibble, 4), data); |
| 2427 | | | nibble += 4; |
| 2428 | | | } |
| 2429 | | | } |
| 2430 | | | } |
| 2431 | | | |
| 2432 | | | data = NIB_LONG(nibble, bufptr);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/wimax_bits.h |
| |
81 | #define NIB_LONG(n,b) \ |
82 | (n) & 1 \ |
83 | ? (pntohl(((b) + (n)/2)) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \ |
84 | : pntohl((b) + (n)/2) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
45 | #define pntohl(p) ((guint32)*((const guint8 *)(p)+0)<<24| \ |
46 | (guint32)*((const guint8 *)(p)+1)<<16| \ |
47 | (guint32)*((const guint8 *)(p)+2)<<8| \ |
48 | (guint32)*((const guint8 *)(p)+3)<<0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/pint.h |
| |
45 | #define pntohl(p) ((guint32)*((const guint8 *)(p)+0)<<24| \ |
46 | (guint32)*((const guint8 *)(p)+1)<<16| \ |
47 | (guint32)*((const guint8 *)(p)+2)<<8| \ |
48 | (guint32)*((const guint8 *)(p)+3)<<0) |
| |
|
| 2433 | | | if (alt_format) { |
| 2434 | | | proto_tree_add_uint(tree, hf_dlmap_ie_offsym2, tvb, NIBHI(nibble, 8), data); |
| 2435 | | | proto_tree_add_uint(tree, hf_dlmap_ie_offsub2, tvb, NIBHI(nibble, 8), data); |
| 2436 | | | proto_tree_add_uint(tree, hf_dlmap_ie_boosting2, tvb, NIBHI(nibble, 8), data); |
| 2437 | | | proto_tree_add_uint(tree, hf_dlmap_ie_numsym2, tvb, NIBHI(nibble, 8), data); |
| 2438 | | | proto_tree_add_uint(tree, hf_dlmap_ie_numsub2, tvb, NIBHI(nibble, 8), data); |
| 2439 | | | proto_tree_add_uint(tree, hf_dlmap_ie_rep2, tvb, NIBHI(nibble, 8), data); |
| 2440 | | | } else { |
| 2441 | | | proto_tree_add_uint(tree, hf_dlmap_ie_offsym, tvb, NIBHI(nibble, 8), data); |
| 2442 | | | proto_tree_add_uint(tree, hf_dlmap_ie_offsub, tvb, NIBHI(nibble, 8), data); |
| 2443 | | | proto_tree_add_uint(tree, hf_dlmap_ie_boosting, tvb, NIBHI(nibble, 8), data); |
| 2444 | | | proto_tree_add_uint(tree, hf_dlmap_ie_numsym, tvb, NIBHI(nibble, 8), data); |
| 2445 | | | proto_tree_add_uint(tree, hf_dlmap_ie_numsub, tvb, NIBHI(nibble, 8), data); |
| 2446 | | | proto_tree_add_uint(tree, hf_dlmap_ie_rep, tvb, NIBHI(nibble, 8), data); |
| 2447 | | | } |
| 2448 | | | nibble += 8; |
| 2449 | | | } |
| 2450 | | | |
| 2451 | | | |
| 2452 | | | return (nibble - offset); |
| 2453 | | | } |
| |