X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=blobdiff_plain;f=plugins%2Fdocsis%2Fpacket-dcd.c;h=7dec7e067580b5b986f126650b49482b9b2cf6d6;hp=5269ee755c5d4b4fd23e103346cead287c33d019;hb=834485eeeaae5dbf64dbfffdfb855af8afa9891c;hpb=cef12c9d0935179c8d3a9b4fd084000c4a3129ca diff --git a/plugins/docsis/packet-dcd.c b/plugins/docsis/packet-dcd.c index 5269ee755c..7dec7e0675 100644 --- a/plugins/docsis/packet-dcd.c +++ b/plugins/docsis/packet-dcd.c @@ -4,8 +4,8 @@ * * $Id$ * - * Ethereal - Network traffic analyzer - * By Gerald Combs + * Wireshark - Network traffic analyzer + * By Gerald Combs * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or @@ -27,15 +27,6 @@ #include "config.h" #endif - -#include "moduleinfo.h" - -#include -#include -#include - -#include - #include #define DCD_DOWN_CLASSIFIER 23 @@ -111,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; @@ -156,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 { @@ -167,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 { @@ -178,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 { @@ -189,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 { @@ -200,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 { @@ -209,7 +201,7 @@ dissect_dcd_dsg_cfg (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) break; case DCD_CFG_VENDOR_SPEC: proto_tree_add_item (dcd_tree, hf_docsis_dcd_cfg_vendor_spec, tvb, - pos, length, FALSE); + pos, length, ENC_NA); break; } @@ -239,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 { @@ -250,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 { @@ -261,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 { @@ -272,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 { @@ -283,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 { @@ -294,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 { @@ -305,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 { @@ -316,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 { @@ -346,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 { @@ -361,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 { @@ -372,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 { @@ -406,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 { @@ -417,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 +428,7 @@ dissect_dcd_dsg_rule (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) break; case DCD_RULE_UCID_RNG: proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_ucid_list, tvb, - pos, length, FALSE); + pos, length, ENC_NA); break; case DCD_RULE_CLIENT_ID: dissect_dcd_clid (tvb , dcd_tree , pos , length ); @@ -435,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 { @@ -446,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 { @@ -455,7 +457,7 @@ dissect_dcd_dsg_rule (tvbuff_t * tvb, proto_tree * tree, int start, guint16 len) break; case DCD_RULE_VENDOR_SPEC: proto_tree_add_item (dcd_tree, hf_docsis_dcd_rule_vendor_spec, tvb, - pos, length, FALSE); + pos, length, ENC_NA); break; } @@ -485,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 { @@ -496,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,11 +524,7 @@ dissect_dcd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) len = tvb_length_remaining (tvb, 0); - if (check_col (pinfo->cinfo, COL_INFO)) - { - col_clear (pinfo->cinfo, COL_INFO); - col_add_fstr (pinfo->cinfo, COL_INFO,"DCD Message: "); - } + col_set_str(pinfo->cinfo, COL_INFO, "DCD Message: "); if (tree) { @@ -535,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) @@ -561,7 +559,7 @@ dissect_dcd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) } /* if (tree) */ } -/* Register the protocol with Ethereal */ +/* Register the protocol with Wireshark */ /* this format is require because a script is used to build the C function that calls all the protocol registration. @@ -576,80 +574,80 @@ proto_register_docsis_dcd (void) {&hf_docsis_dcd_config_ch_cnt, { "Configuration Change Count", - "docsis.dcd.config_ch_cnt", + "docsis_dcd.config_ch_cnt", FT_UINT8, BASE_DEC, NULL, 0x0, - "Configuration Change Count", + NULL, HFILL } }, {&hf_docsis_dcd_num_of_frag, { "Number of Fragments", - "docsis.dcd.num_of_frag", + "docsis_dcd.num_of_frag", FT_UINT8, BASE_DEC, NULL, 0x0, - "Number of Fragments", + NULL, HFILL } }, {&hf_docsis_dcd_frag_sequence_num, { "Fragment Sequence Number", - "docsis.dcd.frag_sequence_num", + "docsis_dcd.frag_sequence_num", FT_UINT8, BASE_DEC, NULL, 0x0, - "Fragment Sequence Number", + NULL, HFILL } }, {&hf_docsis_dcd_cfr_id, { "Downstream Classifier Id", - "docsis.dcd.cfr_id", + "docsis_dcd.cfr_id", FT_UINT16, BASE_DEC, NULL, 0x0, - "Downstream Classifier Id", + NULL, HFILL } }, {&hf_docsis_dcd_cfr_rule_pri, { "Downstream Classifier Rule Priority", - "docsis.dcd.cfr_rule_pri", + "docsis_dcd.cfr_rule_pri", FT_UINT8, BASE_DEC, NULL, 0x0, - "Downstream Classifier Rule Priority", + NULL, HFILL } }, {&hf_docsis_dcd_cfr_ip_source_addr, { "Downstream Classifier IP Source Address", - "docsis.dcd.cfr_ip_source_addr", - FT_IPv4, BASE_DEC, NULL, 0x0, - "Downstream Classifier IP Source Address", + "docsis_dcd.cfr_ip_source_addr", + FT_IPv4, BASE_NONE, NULL, 0x0, + NULL, HFILL } }, {&hf_docsis_dcd_cfr_ip_source_mask, { "Downstream Classifier IP Source Mask", - "docsis.dcd.cfr_ip_source_mask", - FT_IPv4, BASE_DEC, NULL, 0x0, - "Downstream Classifier IP Source Mask", + "docsis_dcd.cfr_ip_source_mask", + FT_IPv4, BASE_NONE, NULL, 0x0, + NULL, HFILL } }, {&hf_docsis_dcd_cfr_ip_dest_addr, { "Downstream Classifier IP Destination Address", - "docsis.dcd.cfr_ip_dest_addr", - FT_IPv4, BASE_DEC, NULL, 0x0, - "Downstream Classifier IP Destination Address", + "docsis_dcd.cfr_ip_dest_addr", + FT_IPv4, BASE_NONE, NULL, 0x0, + NULL, HFILL } }, {&hf_docsis_dcd_cfr_ip_dest_mask, { "Downstream Classifier IP Destination Mask", - "docsis.dcd.cfr_ip_dest_mask", - FT_IPv4, BASE_DEC, NULL, 0x0, + "docsis_dcd.cfr_ip_dest_mask", + FT_IPv4, BASE_NONE, NULL, 0x0, "Downstream Classifier IP Destination Address", HFILL } @@ -657,171 +655,180 @@ proto_register_docsis_dcd (void) {&hf_docsis_dcd_cfr_tcpudp_srcport_start, { "Downstream Classifier IP TCP/UDP Source Port Start", - "docsis.dcd.cfr_ip_tcpudp_srcport_start", + "docsis_dcd.cfr_ip_tcpudp_srcport_start", FT_UINT16, BASE_DEC, NULL, 0x0, - "Downstream Classifier IP TCP/UDP Source Port Start", + NULL, HFILL } }, {&hf_docsis_dcd_cfr_tcpudp_srcport_end, { "Downstream Classifier IP TCP/UDP Source Port End", - "docsis.dcd.cfr_ip_tcpudp_srcport_end", + "docsis_dcd.cfr_ip_tcpudp_srcport_end", FT_UINT16, BASE_DEC, NULL, 0x0, - "Downstream Classifier IP TCP/UDP Source Port End", + NULL, HFILL } }, {&hf_docsis_dcd_cfr_tcpudp_dstport_start, { "Downstream Classifier IP TCP/UDP Destination Port Start", - "docsis.dcd.cfr_ip_tcpudp_dstport_start", + "docsis_dcd.cfr_ip_tcpudp_dstport_start", FT_UINT16, BASE_DEC, NULL, 0x0, - "Downstream Classifier IP TCP/UDP Destination Port Start", + NULL, HFILL } }, {&hf_docsis_dcd_cfr_tcpudp_dstport_end, { "Downstream Classifier IP TCP/UDP Destination Port End", - "docsis.dcd.cfr_ip_tcpudp_dstport_end", + "docsis_dcd.cfr_ip_tcpudp_dstport_end", FT_UINT16, BASE_DEC, NULL, 0x0, - "Downstream Classifier IP TCP/UDP Destination Port End", + NULL, HFILL } }, {&hf_docsis_dcd_rule_id, { - "DSG Rule Id ", - "docsis.dcd.rule_id", + "DSG Rule Id", + "docsis_dcd.rule_id", FT_UINT8, BASE_DEC, NULL, 0x0, - "DSG Rule Id ", + NULL, HFILL } }, {&hf_docsis_dcd_rule_pri, { - "DSG Rule Priority ", - "docsis.dcd.rule_pri", + "DSG Rule Priority", + "docsis_dcd.rule_pri", FT_UINT8, BASE_DEC, NULL, 0x0, - "DSG Rule Priority ", + NULL, HFILL } }, {&hf_docsis_dcd_rule_ucid_list, { - "DSG Rule UCID Range ", - "docsis.dcd.rule_ucid_list", - FT_BYTES, BASE_HEX, NULL, 0x0, - "DSG Rule UCID Range ", + "DSG Rule UCID Range", + "docsis_dcd.rule_ucid_list", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, 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 ", - "docsis.dcd.clid_known_mac_addr", - FT_ETHER, BASE_DEC, NULL, 0x0, - "DSG Rule Client ID Known MAC Address ", + "DSG Rule Client ID Known MAC Address", + "docsis_dcd.clid_known_mac_addr", + FT_ETHER, BASE_NONE, NULL, 0x0, + NULL, HFILL } }, {&hf_docsis_dcd_clid_ca_sys_id, { - "DSG Rule Client ID CA System ID ", - "docsis.dcd.clid_ca_sys_id", + "DSG Rule Client ID CA System ID", + "docsis_dcd.clid_ca_sys_id", FT_UINT16, BASE_DEC, NULL, 0x0, - "DSG Rule Client ID CA System ID ", + NULL, HFILL } }, {&hf_docsis_dcd_clid_app_id, { - "DSG Rule Client ID Application ID ", - "docsis.dcd.clid_app_id", + "DSG Rule Client ID Application ID", + "docsis_dcd.clid_app_id", FT_UINT16, BASE_DEC, NULL, 0x0, - "DSG Rule Client ID Application ID ", + NULL, HFILL } }, {&hf_docsis_dcd_rule_tunl_addr, { - "DSG Rule Tunnel MAC Address ", - "docsis.dcd.rule_tunl_addr", - FT_ETHER, BASE_DEC, NULL, 0x0, - "DSG Rule Tunnel MAC Address ", + "DSG Rule Tunnel MAC Address", + "docsis_dcd.rule_tunl_addr", + FT_ETHER, BASE_NONE, NULL, 0x0, + NULL, HFILL } }, {&hf_docsis_dcd_rule_cfr_id, { "DSG Rule Classifier ID", - "docsis.dcd.rule_cfr_id", + "docsis_dcd.rule_cfr_id", FT_UINT16, BASE_DEC, NULL, 0x0, - "DSG Rule Classifier ID", + NULL, HFILL } }, {&hf_docsis_dcd_rule_vendor_spec, { "DSG Rule Vendor Specific Parameters", - "docsis.dcd.rule_vendor_spec", - FT_BYTES, BASE_HEX, NULL, 0x0, - "DSG Rule Vendor Specific Parameters", + "docsis_dcd.rule_vendor_spec", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } }, {&hf_docsis_dcd_cfg_chan, { "DSG Configuration Channel", - "docsis.dcd.cfg_chan", + "docsis_dcd.cfg_chan", FT_UINT32, BASE_DEC, NULL, 0x0, - "DSG Configuration Channel", + NULL, HFILL } }, {&hf_docsis_dcd_cfg_tdsg1, { - "DSG Initialization Timeout (Tdsg1) ", - "docsis.dcd.cfg_tdsg1", + "DSG Initialization Timeout (Tdsg1)", + "docsis_dcd.cfg_tdsg1", FT_UINT16, BASE_DEC, NULL, 0x0, - "DSG Initialization Timeout (Tdsg1) ", + NULL, HFILL } }, {&hf_docsis_dcd_cfg_tdsg2, { - "DSG Operational Timeout (Tdsg2) ", - "docsis.dcd.cfg_tdsg2", + "DSG Operational Timeout (Tdsg2)", + "docsis_dcd.cfg_tdsg2", FT_UINT16, BASE_DEC, NULL, 0x0, - "DSG Operational Timeout (Tdsg2) ", + NULL, HFILL } }, {&hf_docsis_dcd_cfg_tdsg3, { - "DSG Two-Way Retry Timer (Tdsg3) ", - "docsis.dcd.cfg_tdsg3", + "DSG Two-Way Retry Timer (Tdsg3)", + "docsis_dcd.cfg_tdsg3", FT_UINT16, BASE_DEC, NULL, 0x0, - "DSG Two-Way Retry Timer (Tdsg3) ", + NULL, HFILL } }, {&hf_docsis_dcd_cfg_tdsg4, { - "DSG One-Way Retry Timer (Tdsg4) ", - "docsis.dcd.cfg_tdsg4", + "DSG One-Way Retry Timer (Tdsg4)", + "docsis_dcd.cfg_tdsg4", FT_UINT16, BASE_DEC, NULL, 0x0, - "DSG One-Way Retry Timer (Tdsg4) ", + NULL, HFILL } }, {&hf_docsis_dcd_cfg_vendor_spec, { "DSG Configuration Vendor Specific Parameters", - "docsis.dcd.cfg_vendor_spec", - FT_BYTES, BASE_HEX, NULL, 0x0, - "DSG Configuration Vendor Specific Parameters", + "docsis_dcd.cfg_vendor_spec", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } }, @@ -840,7 +847,7 @@ proto_register_docsis_dcd (void) /* Register the protocol name and description */ proto_docsis_dcd = - proto_register_protocol ("DOCSIS Downstream Channel Descriptor ", + proto_register_protocol ("DOCSIS Downstream Channel Descriptor", "DOCSIS DCD", "docsis_dcd"); /* Required function calls to register the header fields and subtrees used */ @@ -861,6 +868,6 @@ proto_reg_handoff_docsis_dcd (void) dissector_handle_t docsis_dcd_handle; docsis_dcd_handle = find_dissector ("docsis_dcd"); - dissector_add ("docsis_mgmt", 0x20, docsis_dcd_handle); + dissector_add_uint ("docsis_mgmt", 0x20, docsis_dcd_handle); }