From Yi Zhang:
[obnox/wireshark/wip.git] / plugins / docsis / packet-dcd.c
index b2aaa6f5747c4de96ee343e9d9077f4a3ece5f8d..7dec7e067580b5b986f126650b49482b9b2cf6d6 100644 (file)
@@ -102,6 +102,7 @@ static int hf_docsis_dcd_cfr_tcpudp_dstport_end = -1;
 static int hf_docsis_dcd_rule_id = -1;
 static int hf_docsis_dcd_rule_pri = -1;
 static int hf_docsis_dcd_rule_ucid_list = -1;
+static int hf_docsis_dcd_clid_bcast_id = -1;
 static int hf_docsis_dcd_clid_known_mac_addr = -1;
 static int hf_docsis_dcd_clid_ca_sys_id = -1;
 static int hf_docsis_dcd_clid_app_id = -1;
@@ -147,7 +148,7 @@ dissect_dcd_dsg_cfg (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 4)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_chan, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -158,7 +159,7 @@ dissect_dcd_dsg_cfg (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg1, tvb,
-                                  pos, length, FALSE);
+                                  pos, length, ENC_BIG_ENDIAN);
                }
               else 
                {
@@ -169,7 +170,7 @@ dissect_dcd_dsg_cfg (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg2, tvb,
-                                  pos, length, FALSE);
+                                  pos, length, ENC_BIG_ENDIAN);
                }
               else 
                {
@@ -180,7 +181,7 @@ dissect_dcd_dsg_cfg (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg3, tvb,
-                                  pos, length, FALSE);
+                                  pos, length, ENC_BIG_ENDIAN);
                }
               else 
                {
@@ -191,7 +192,7 @@ dissect_dcd_dsg_cfg (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_tdsg4, tvb,
-                                  pos, length, FALSE);
+                                  pos, length, ENC_BIG_ENDIAN);
                }
               else 
                {
@@ -230,7 +231,7 @@ dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, gu
              if (length == 4)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_source_addr, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -241,7 +242,7 @@ dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, gu
              if (length == 4)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_source_mask, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -252,7 +253,7 @@ dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, gu
              if (length == 4)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_dest_addr, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -263,7 +264,7 @@ dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, gu
              if (length == 4)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_ip_dest_mask, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -274,7 +275,7 @@ dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, gu
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_srcport_start, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -285,7 +286,7 @@ dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, gu
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_srcport_end, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -296,7 +297,7 @@ dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, gu
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_dstport_start, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -307,7 +308,7 @@ dissect_dcd_down_classifier_ip (tvbuff_t * tvb, proto_tree * tree, int start, gu
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_tcpudp_dstport_end, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -337,11 +338,21 @@ dissect_dcd_clid (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
        
        switch (type)
          {
+               case DCD_CLID_BCAST_ID:
+                       if (length == 2)
+                       {
+                               proto_tree_add_item(dcd_tree, hf_docsis_dcd_clid_bcast_id, tvb, pos, length, ENC_BIG_ENDIAN);
+                       }
+                       else
+                       {
+                               THROW (ReportedBoundsError);
+                       }
+                       break;
            case DCD_CLID_KNOWN_MAC_ADDR:
              if (length == 6)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_known_mac_addr, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_NA);
                }
              else
                {
@@ -352,7 +363,7 @@ dissect_dcd_clid (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_ca_sys_id, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -363,7 +374,7 @@ dissect_dcd_clid (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_clid_app_id, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -397,7 +408,7 @@ dissect_dcd_dsg_rule (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 1)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_id, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -408,7 +419,7 @@ dissect_dcd_dsg_rule (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 1)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_pri, tvb,
-                                  pos, length, FALSE);
+                                  pos, length, ENC_BIG_ENDIAN);
                }
               else 
                {
@@ -426,7 +437,7 @@ dissect_dcd_dsg_rule (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 6)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_tunl_addr, tvb,
-                                  pos, length, FALSE);
+                                  pos, length, ENC_NA);
                }
               else 
                {
@@ -437,7 +448,7 @@ dissect_dcd_dsg_rule (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len)
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_cfr_id, tvb,
-                                  pos, length, FALSE);
+                                  pos, length, ENC_BIG_ENDIAN);
                }
               else 
                {
@@ -476,7 +487,7 @@ dissect_dcd_down_classifier (tvbuff_t * tvb, proto_tree * tree, int start, guint
              if (length == 2)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_id, tvb,
-                                      pos, length, FALSE);
+                                      pos, length, ENC_BIG_ENDIAN);
                }
              else
                {
@@ -487,7 +498,7 @@ dissect_dcd_down_classifier (tvbuff_t * tvb, proto_tree * tree, int start, guint
              if (length == 1)
                {
                  proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfr_rule_pri, tvb,
-                                  pos, length, FALSE);
+                                  pos, length, ENC_BIG_ENDIAN);
                }
               else 
                {
@@ -522,9 +533,9 @@ dissect_dcd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
                                        tvb_length_remaining (tvb, 0),
                                        "DCD Message");
       dcd_tree = proto_item_add_subtree (dcd_item, ett_docsis_dcd);
-      proto_tree_add_item (dcd_tree, hf_docsis_dcd_config_ch_cnt, tvb, 0, 1, FALSE);
-      proto_tree_add_item (dcd_tree, hf_docsis_dcd_num_of_frag, tvb, 1, 1, FALSE);
-      proto_tree_add_item (dcd_tree, hf_docsis_dcd_frag_sequence_num, tvb, 2, 1, FALSE);
+      proto_tree_add_item (dcd_tree, hf_docsis_dcd_config_ch_cnt, tvb, 0, 1, ENC_BIG_ENDIAN);
+      proto_tree_add_item (dcd_tree, hf_docsis_dcd_num_of_frag, tvb, 1, 1, ENC_BIG_ENDIAN);
+      proto_tree_add_item (dcd_tree, hf_docsis_dcd_frag_sequence_num, tvb, 2, 1, ENC_BIG_ENDIAN);
 
       pos = 3;
       while (pos < len)
@@ -704,6 +715,15 @@ proto_register_docsis_dcd (void)
       HFILL
       }
     },
+       {&hf_docsis_dcd_clid_bcast_id,
+               {
+                       "DSG Rule Client ID Broadcast ID",
+                       "docsis_dcd.clid_bcast_id",
+                       FT_UINT16, BASE_DEC, NULL, 0x0,
+                       NULL,
+                       HFILL
+               }
+       },
     {&hf_docsis_dcd_clid_known_mac_addr,
       {
       "DSG Rule Client ID Known MAC Address",