Added default for every switch statement
authorBruno Verstuyft <bruno.verstuyft@excentis.com>
Tue, 17 Oct 2017 08:18:00 +0000 (10:18 +0200)
committerMichael Mann <mmann78@netscape.net>
Tue, 17 Oct 2017 23:14:50 +0000 (23:14 +0000)
Change-Id: Ie74dec4d854f65835a4e7e68dac609290a84d791
Reviewed-on: https://code.wireshark.org/review/23957
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
plugins/docsis/packet-tlv.c

index 524a4c17b006cc3ecd16d3732e5cb8debb090fc0..a7ab3e7567c833fde92c089249c7a909a6e6148f 100644 (file)
@@ -792,6 +792,9 @@ dissect_phs_err (tvbuff_t * tvb, packet_info *pinfo, proto_tree * tree, int star
             proto_tree_add_item (err_tree, hf_docsis_tlv_phs_err_msg, tvb, pos,
                                  length, ENC_ASCII|ENC_NA);
             break;
+          default:
+            proto_tree_add_item (err_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -919,6 +922,9 @@ dissect_phs (tvbuff_t * tvb, packet_info *pinfo, proto_tree * tree, int start, g
             proto_tree_add_item (phs_tree, hf_docsis_tlv_phs_vendorspec, tvb,
                                  pos, length, ENC_NA);
             break;
+          default:
+            proto_tree_add_item (phs_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -992,6 +998,9 @@ dissect_sflow_err (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int st
             proto_tree_add_item (err_tree, hf_docsis_tlv_sflow_err_msg, tvb,
                                  pos, length, ENC_ASCII|ENC_NA);
             break;
+          default:
+            proto_tree_add_item (err_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -1023,6 +1032,9 @@ dissect_downstream_sflow (tvbuff_t * tvb, packet_info* pinfo, proto_tree * sflow
               expert_add_info_format(pinfo, sflow_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
             }
           break;
+        default:
+          proto_tree_add_item (sflow_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+          break;
         }                       /* switch */
       pos = pos + length;
 
@@ -1163,7 +1175,9 @@ dissect_upstream_sflow (tvbuff_t * tvb, packet_info* pinfo, proto_tree * sflow_t
                 expert_add_info_format(pinfo, sflow_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
-
+          default:
+            proto_tree_add_item (sflow_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -1429,6 +1443,9 @@ dissect_dot1q_clsfr (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int
                                  hf_docsis_tlv_dot1qclsfr_vendorspec, tvb, pos,
                                  length, ENC_NA);
             break;
+          default:
+            proto_tree_add_item (dot1qclsfr_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -1488,6 +1505,9 @@ dissect_eth_clsfr (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int st
                 expert_add_info_format(pinfo, ethclsfr_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (ethclsfr_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -1544,6 +1564,9 @@ dissect_clsfr_err (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int st
             proto_tree_add_item (err_tree, hf_docsis_tlv_clsfr_err_msg, tvb,
                                  pos, length, ENC_ASCII|ENC_NA);
             break;
+          default:
+            proto_tree_add_item (err_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -1687,6 +1710,9 @@ dissect_ip_classifier (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, in
                 expert_add_info_format(pinfo, ipclsfr_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (ipclsfr_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -1811,7 +1837,9 @@ dissect_ip6_classifier (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, i
                 expert_add_info_format(pinfo, ip6clsfr_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
-          default: proto_tree_add_item (ip6clsfr_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+          default:
+            proto_tree_add_item (ip6clsfr_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
        }                       /* switch */
        pos = pos + length;
     }                           /* while */
@@ -1941,7 +1969,9 @@ dissect_classifiers (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int
             proto_tree_add_item (clsfr_tree, hf_docsis_tlv_clsfr_vendor_spc,
                                  tvb, pos, length, ENC_NA);
             break;
-          default: proto_tree_add_item (clsfr_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+          default:
+            proto_tree_add_item (clsfr_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -1989,6 +2019,9 @@ dissect_doc10cos (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int sta
                 expert_add_info_format(pinfo, doc10cos_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (doc10cos_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
 
@@ -2454,6 +2487,9 @@ dissect_modemcap (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int sta
                 expert_add_info_format(pinfo, mcap_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (mcap_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch (type) */
       pos = pos + length;
     }                           /* while (pos < pos+len) */
@@ -2554,6 +2590,9 @@ dissect_cos (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree, int start, g
                 expert_add_info_format(pinfo, cos_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (cos_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch (type) */
       pos = pos + length;
     }                           /* while (pos < pos+len) */
@@ -2608,6 +2647,9 @@ dissect_snmpv3_kickstart(tvbuff_t * tvb, proto_tree *tree, int start, guint16 le
                                  hf_docsis_tlv_snmpv3_kick_publicnum, tvb,
                                  pos, length, ENC_NA);
             break;
+          default:
+            proto_tree_add_item (snmpv3_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }  /* switch */
       pos += length;
     }   /* while */
@@ -2654,6 +2696,9 @@ dissect_ds_ch_list_single (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree
                 expert_add_info_format(pinfo, single_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (single_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }  /* switch */
       pos = pos + length;
     }                           /* while */
@@ -2722,6 +2767,9 @@ dissect_ds_ch_list_range (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree,
                 expert_add_info_format(pinfo, range_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (range_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                           /* switch */
       pos = pos + length;
     }                             /* while */
@@ -2761,6 +2809,9 @@ dissect_dut_filter (tvbuff_t * tvb, packet_info* pinfo, proto_tree * tree,
             proto_tree_add_item (dut_tree, hf_docsis_tlv_dut_filter_cmim, tvb,
                                  pos, length, ENC_NA);
             break;
+          default:
+            proto_tree_add_item (dut_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -2802,6 +2853,9 @@ dissect_ds_ch_list(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int sta
                 expert_add_info_format(pinfo, dschlst_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (dschlst_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -2847,6 +2901,9 @@ dissect_tcc_err(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int start,
                                  hf_docsis_tcc_err_msg, tvb,
                                  pos, length, ENC_ASCII|ENC_NA);
             break;
+          default:
+            proto_tree_add_item (tccerr_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -2930,6 +2987,9 @@ dissect_tcc_rng_parms(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int
                 expert_add_info_format(pinfo, rngparm_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (rngparm_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3001,6 +3061,9 @@ dissect_sid_cl_so_crit(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int
                 expert_add_info_format(pinfo, crit_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (crit_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3060,6 +3123,9 @@ dissect_sid_cl_enc_map(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int
                 expert_add_info_format(pinfo, map_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (map_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3101,6 +3167,9 @@ dissect_sid_cl_enc(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int sta
             else
               expert_add_info_format(pinfo, enc_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
             break;
+          default:
+            proto_tree_add_item (enc_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3142,6 +3211,9 @@ dissect_sid_cl(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int start,
           case SID_CL_SO_CRIT:
             dissect_sid_cl_so_crit(tvb, pinfo, sid_tree, pos, length);
             break;
+          default:
+            proto_tree_add_item (sid_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3261,6 +3333,9 @@ dissect_tcc(tvbuff_t * tvb, packet_info * pinfo,
           case TLV_TCC_ERR:
             dissect_tcc_err(tvb, pinfo, tcc_tree, pos, length);
             break;
+          default:
+            proto_tree_add_item (tcc_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3308,6 +3383,9 @@ dissect_ch_bl_rng(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int star
                 expert_add_info_format(pinfo, chblrng_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (chblrng_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3373,6 +3451,9 @@ dissect_rcp_rcv_mod(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int st
                                  hf_docsis_rcv_mod_enc_phy_layr_parms, tvb, pos,
                                  length, ENC_NA);
             break;
+          default:
+            proto_tree_add_item (rcvmod_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3437,6 +3518,9 @@ dissect_rcp_rcv_ch(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int sta
                 expert_add_info_format(pinfo, rcvch_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (rcvch_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3509,6 +3593,9 @@ dissect_rcp(tvbuff_t * tvb, packet_info * pinfo,
             vsif_tvb = tvb_new_subset_length (tvb, pos, length);
             call_dissector (docsis_vsif_handle, vsif_tvb, pinfo, rcp_tree);
             break;
+          default:
+            proto_tree_add_item (rcp_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3561,6 +3648,9 @@ dissect_rcc_rcv_mod(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int st
                                  hf_docsis_rcc_rcv_mod_enc_conn, tvb, pos,
                                  length, ENC_NA);
             break;
+          default:
+            proto_tree_add_item (rcvmod_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3625,6 +3715,9 @@ dissect_rcc_rcv_ch(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int sta
                 expert_add_info_format(pinfo, rcvch_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (rcvch_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3701,6 +3794,9 @@ dissect_rcc_err(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int start,
                                  hf_docsis_tlv_rcc_err_msg, tvb, pos,
                                  length, ENC_NA);
             break;
+          default:
+            proto_tree_add_item (err_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3751,6 +3847,9 @@ dissect_rcc(tvbuff_t * tvb, packet_info * pinfo,
           case TLV_RCC_ERR:
             dissect_rcc_err(tvb, pinfo, rcc_tree, pos, length);
             break;
+          default:
+            proto_tree_add_item (rcc_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3827,6 +3926,9 @@ dissect_dsid_ds_reseq(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int
                 expert_add_info_format(pinfo, dsid_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (dsid_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3874,6 +3976,9 @@ dissect_dsid_mc_addr(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int s
                 expert_add_info_format(pinfo, dsid_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+         default:
+           proto_tree_add_item (dsid_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+           break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3912,6 +4017,9 @@ dissect_dsid_mc(tvbuff_t * tvb, packet_info *pinfo, proto_tree *tree, int start,
           case TLV_DSID_MC_PHS:
             dissect_phs(tvb, pinfo, dsid_tree, pos, length);
             break;
+          default:
+            proto_tree_add_item (dsid_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -3965,6 +4073,9 @@ dissect_dsid(tvbuff_t * tvb, packet_info *pinfo, proto_tree *tree, int start, gu
           case TLV_DSID_MC:
             dissect_dsid_mc(tvb, pinfo, dsid_tree, pos, length);
             break;
+          default:
+            proto_tree_add_item (dsid_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -4012,6 +4123,9 @@ dissect_sec_assoc(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int star
                 expert_add_info_format(pinfo, sec_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (sec_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -4059,6 +4173,9 @@ dissect_ch_asgn(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, int start,
                 expert_add_info_format(pinfo, asgn_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (asgn_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -4106,6 +4223,9 @@ dissect_cmts_mc_sess_enc(tvbuff_t * tvb, packet_info* pinfo, proto_tree *tree, i
                 expert_add_info_format(pinfo, mc_item, &ei_docsis_tlv_tlvlen_bad, "Wrong TLV length: %u", length);
               }
             break;
+          default:
+            proto_tree_add_item (mc_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+            break;
         }                       /* switch */
       pos = pos + length;
     }                           /* while */
@@ -4545,6 +4665,9 @@ dissect_tlv (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
               break;
             case TLV_END:
               break;
+            default:
+              proto_tree_add_item (tlv_tree, hf_docsis_tlv_unknown, tvb, pos, length, ENC_NA);
+              break;
           }                     /* switch(type) */
 
         pos = pos + length;