Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at packet-epl.c:260

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dissect_epl

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-epl.c)expand/collapse
Show more  
 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      /* static epl_info_t mi; */
 242      /* Set up structures needed to add the protocol subtree and manage it */
 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          /* Not enough data for an EPL header; don't try to interpret it */
 250          return FALSE;
 251      }
 252   
 253      /* Make entries in Protocol column and Info column on summary display */
 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;
 261      }
 262      else 
 263      {   /* guess that this is an EPL frame encapsulated into an UDP datagram */
 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      /* Get message type */
 272      epl_mtyp = tvb_get_guint8(tvb, EPL_MTYP_OFFSET) & 0x7F;
 273   
 274      /* tap */
 275      /*  mi.epl_mtyp = epl_mtyp;
 276      tap_queue_packet(epl_tap, pinfo, &mi);
 277      */
 278   
 279      /* Get Destination */
 280      epl_dest = tvb_get_guint8(tvb, EPL_DEST_OFFSET);
 281      dest_str = decode_epl_address(epl_dest);
 282   
 283      /* Get Source */
 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          /* Choose the right string for "Info" column (message type) */
 292          switch (epl_mtyp)
 293          {
 294              case EPL_SOC:
 295                  /* source and destination NodeID are fixed according to the spec */
 296                  col_set_str(pinfo->cinfo, COL_INFO, "SoC    ");
 297                  break;
 298   
 299              case EPL_PREQ:
 300                  /* show only destination NodeID, because source is always 240 (MN) */
 301                  col_add_fstr(pinfo->cinfo, COL_INFO, "PReq   dst = %3d   ", epl_dest);
 302                  break;
 303   
 304              case EPL_PRES:
 305                  /* show only source NodeID, because destination is always 255 (broadcast) */
 306                  col_add_fstr(pinfo->cinfo, COL_INFO, "PRes   src = %3d   ", epl_src);
 307                  break;
 308   
 309              case EPL_SOA:
 310                  /* source and destination NodeID are fixed according to the spec */
 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:    /* no valid EPL packet */
 326                  return FALSE;
 327   
 328          }
 329   
 330      }
 331   
 332      if (tree)
 333      {
 334          /* create display subtree for the protocol */
 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      /* The rest of the EPL dissector depends on the message type  */
 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:    /* no valid EPL packet */
 382              return FALSE;
 383      }
 384   
 385      return TRUE;
 386  }
Show more  




Change Warning 2343.34860 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: