(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-epl.c) |
| |
| 236 | | | dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 237 | | | { |
| 238 | | | guint8 epl_mtyp, epl_src, epl_dest; |
| 239 | | | const gchar *src_str, *dest_str; |
| 240 | | | gboolean udpencap = FALSE; |
| 241 | | | |
| 242 | | | |
| 243 | | | proto_item *ti; |
| 244 | | | proto_tree *epl_tree = NULL, *epl_src_item, *epl_dest_item; |
| 245 | | | gint offset = 0; |
| 246 | | | |
| 247 | | | if (tvb_length(tvb) < 3) |
| 248 | | | { |
| 249 | | | |
| 250 | | | return FALSE; |
| 251 | | | } |
| 252 | | | |
| 253 | | | |
| 254 | | | if (pinfo->ethertype == ETHERTYPE_EPL_V2) |
| 255 | | | { |
| 256 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 257 | | | { |
| 258 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "EPL"); |
| 259 | | | } |
| 260 | | | udpencap = FALSE; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 261 | | | } |
| 262 | | | else |
| 263 | | | { |
| 264 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 265 | | | { |
| 266 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "EPL/UDP"); |
| 267 | | | } |
| 268 | | | udpencap = TRUE; |
| 269 | | | } |
| 270 | | | |
| 271 | | | |
| 272 | | | epl_mtyp = tvb_get_guint8(tvb, EPL_MTYP_OFFSET) & 0x7F; |
| 273 | | | |
| 274 | | | |
| 275 | | | |
| 276 | | | |
| 277 | | | |
| 278 | | | |
| 279 | | | |
| 280 | | | epl_dest = tvb_get_guint8(tvb, EPL_DEST_OFFSET); |
| 281 | | | dest_str = decode_epl_address(epl_dest); |
| 282 | | | |
| 283 | | | |
| 284 | | | epl_src = tvb_get_guint8(tvb, EPL_SRC_OFFSET); |
| 285 | | | src_str = decode_epl_address(epl_src); |
| 286 | | | |
| 287 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 288 | | | { |
| 289 | | | col_clear(pinfo->cinfo, COL_INFO); |
| 290 | | | |
| 291 | | | |
| 292 | | | switch (epl_mtyp) |
| 293 | | | { |
| 294 | | | case EPL_SOC: |
| 295 | | | |
| 296 | | | col_set_str(pinfo->cinfo, COL_INFO, "SoC "); |
| 297 | | | break; |
| 298 | | | |
| 299 | | | case EPL_PREQ: |
| 300 | | | |
| 301 | | | col_add_fstr(pinfo->cinfo, COL_INFO, "PReq dst = %3d ", epl_dest); |
| 302 | | | break; |
| 303 | | | |
| 304 | | | case EPL_PRES: |
| 305 | | | |
| 306 | | | col_add_fstr(pinfo->cinfo, COL_INFO, "PRes src = %3d ", epl_src); |
| 307 | | | break; |
| 308 | | | |
| 309 | | | case EPL_SOA: |
| 310 | | | |
| 311 | | | col_set_str(pinfo->cinfo, COL_INFO, "SoA "); |
| 312 | | | break; |
| 313 | | | |
| 314 | | | case EPL_ASND: |
| 315 | | | if (udpencap) |
| 316 | | | { |
| 317 | | | col_set_str(pinfo->cinfo, COL_INFO, "ASnd "); |
| 318 | | | } |
| 319 | | | else |
| 320 | | | { |
| 321 | | | col_add_fstr(pinfo->cinfo, COL_INFO, "ASnd src = %3d dst = %3d ", epl_src, epl_dest); |
| 322 | | | } |
| 323 | | | break; |
| 324 | | | |
| 325 | | | default: |
| 326 | | | return FALSE; |
| 327 | | | |
| 328 | | | } |
| 329 | | | |
| 330 | | | } |
| 331 | | | |
| 332 | | | if (tree) |
| 333 | | | { |
| 334 | | | |
| 335 | | | ti = proto_tree_add_item(tree, proto_epl, tvb, 0, -1, TRUE); |
| 336 | | | epl_tree = proto_item_add_subtree(ti, ett_epl); |
| 337 | | | |
| 338 | | | proto_tree_add_item(epl_tree, |
| 339 | | | hf_epl_mtyp, tvb, offset, 1, TRUE); |
| 340 | | | } |
| 341 | | | offset += 1; |
| 342 | | | |
| 343 | | | if (tree && !udpencap) |
| 344 | | | { |
| 345 | | | epl_dest_item = proto_tree_add_item(epl_tree, hf_epl_dest, tvb, offset, 1, TRUE); |
| 346 | | | proto_item_append_text (epl_dest_item, "%s", dest_str); |
| 347 | | | offset += 1; |
| 348 | | | |
| 349 | | | epl_src_item = proto_tree_add_item(epl_tree, hf_epl_src, tvb, offset, 1, TRUE); |
| 350 | | | proto_item_append_text (epl_src_item, "%s", src_str); |
| 351 | | | offset += 1; |
| 352 | | | } |
| 353 | | | else |
| 354 | | | { |
| 355 | | | offset += 2; |
| 356 | | | } |
| 357 | | | |
| 358 | | | |
| 359 | | | switch (epl_mtyp) |
| 360 | | | { |
| 361 | | | case EPL_SOC: |
| 362 | | | offset = dissect_epl_soc(epl_tree, tvb, pinfo, offset); |
| 363 | | | break; |
| 364 | | | |
| 365 | | | case EPL_PREQ: |
| 366 | | | offset = dissect_epl_preq(epl_tree, tvb, pinfo, offset); |
| 367 | | | break; |
| 368 | | | |
| 369 | | | case EPL_PRES: |
| 370 | | | offset = dissect_epl_pres(epl_tree, tvb, pinfo, epl_src, offset); |
| 371 | | | break; |
| 372 | | | |
| 373 | | | case EPL_SOA: |
| 374 | | | offset = dissect_epl_soa(epl_tree, tvb, pinfo, epl_src, offset); |
| 375 | | | break; |
| 376 | | | |
| 377 | | | case EPL_ASND: |
| 378 | | | offset = dissect_epl_asnd(epl_tree, tvb, pinfo, epl_src, offset); |
| 379 | | | break; |
| 380 | | | |
| 381 | | | default: |
| 382 | | | return FALSE; |
| 383 | | | } |
| 384 | | | |
| 385 | | | return TRUE; |
| 386 | | | } |
| |