Rename the routines that handle dissector tables with unsigned integer
[obnox/wireshark/wip.git] / epan / dissectors / packet-igmp.c
index 9c2a685b3fc5cd9eb6c54b603264284e82b91372..853154a8334d6d44ea2d496125b47f04a4b5d013 100644 (file)
 # include "config.h"
 #endif
 
-#include <stdio.h>
 #include <string.h>
 #include <glib.h>
 
@@ -314,16 +313,20 @@ static const value_string mtrace_fwd_code_vals[] = {
 };
 
 #define PRINT_IGMP_VERSION(version)                                    \
-       if (check_col(pinfo->cinfo, COL_INFO)) {                        \
-               col_add_fstr(pinfo->cinfo, COL_INFO,                    \
-                       "V%d %s",version,val_to_str(type, commands,     \
-                               "Unknown Type:0x%02x"));                \
-       }                                                               \
-       /* version of IGMP protocol */                                  \
-       proto_tree_add_uint(tree, hf_version, tvb, 0, 0, version);      \
-       /* type of command */                                           \
-       proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);       \
-       offset += 1;
+       do {                                                            \
+               proto_item *ti;                                         \
+               if (check_col(pinfo->cinfo, COL_INFO)) {                \
+                       col_add_fstr(pinfo->cinfo, COL_INFO,            \
+                               "V%d %s",version,val_to_str(type, commands,     \
+                                       "Unknown Type:0x%02x"));        \
+               }                                                       \
+               /* version of IGMP protocol */                          \
+               ti = proto_tree_add_uint(tree, hf_version, tvb, 0, 0, version); \
+               PROTO_ITEM_SET_GENERATED(ti);                           \
+               /* type of command */                                   \
+               proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);\
+               offset += 1;                                            \
+       } while (0);
 
 void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index,
     int hf_index_bad, packet_info *pinfo, guint len)
@@ -909,12 +912,8 @@ dissect_igmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
        tree = proto_item_add_subtree(item, ett_igmp);
 
 
-       if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
-               col_set_str(pinfo->cinfo, COL_PROTOCOL, "IGMP");
-       }
-       if (check_col(pinfo->cinfo, COL_INFO)) {
-               col_clear(pinfo->cinfo, COL_INFO);
-       }
+       col_set_str(pinfo->cinfo, COL_PROTOCOL, "IGMP");
+       col_clear(pinfo->cinfo, COL_INFO);
 
 
        type = tvb_get_guint8(tvb, offset);
@@ -1041,7 +1040,7 @@ proto_register_igmp(void)
 
                { &hf_version,
                        { "IGMP Version", "igmp.version", FT_UINT8, BASE_DEC,
-                         NULL, 0, "IGMP Version", HFILL }},
+                         NULL, 0, NULL, HFILL }},
 
                { &hf_group_type,
                        { "Type Of Group", "igmp.group_type", FT_UINT8, BASE_DEC,
@@ -1061,14 +1060,14 @@ proto_register_igmp(void)
 
                { &hf_checksum_bad,
                        { "Bad Checksum", "igmp.checksum_bad", FT_BOOLEAN, BASE_NONE,
-                         NULL, 0, "Bad IGMP Checksum", HFILL }},
+                         NULL, 0x0, "Bad IGMP Checksum", HFILL }},
 
                { &hf_identifier,
                        { "Identifier", "igmp.identifier", FT_UINT32, BASE_DEC,
                          NULL, 0, "IGMP V0 Identifier", HFILL }},
 
                { &hf_access_key,
-                       { "Access Key", "igmp.access_key", FT_BYTES, BASE_HEX,
+                       { "Access Key", "igmp.access_key", FT_BYTES, BASE_NONE,
                          NULL, 0, "IGMP V0 Access Key", HFILL }},
 
                { &hf_max_resp,
@@ -1093,7 +1092,7 @@ proto_register_igmp(void)
 
                { &hf_saddr,
                        { "Source Address", "igmp.saddr", FT_IPv4, BASE_NONE,
-                         NULL, 0, "Source Address", HFILL }},
+                         NULL, 0, NULL, HFILL }},
 
                { &hf_num_grp_recs,
                        { "Num Group Records", "igmp.num_grp_recs", FT_UINT16, BASE_DEC,
@@ -1101,7 +1100,7 @@ proto_register_igmp(void)
 
                { &hf_record_type,
                        { "Record Type", "igmp.record_type", FT_UINT8, BASE_DEC,
-                       VALS(vs_record_type), 0, "Record Type", HFILL }},
+                       VALS(vs_record_type), 0, NULL, HFILL }},
 
                { &hf_aux_data_len,
                        { "Aux Data Len", "igmp.aux_data_len", FT_UINT8, BASE_DEC,
@@ -1109,10 +1108,10 @@ proto_register_igmp(void)
 
                { &hf_maddr,
                        { "Multicast Address", "igmp.maddr", FT_IPv4, BASE_NONE,
-                         NULL, 0, "Multicast Address", HFILL }},
+                         NULL, 0, NULL, HFILL }},
 
                { &hf_aux_data,
-                       { "Aux Data", "igmp.aux_data", FT_BYTES, BASE_HEX,
+                       { "Aux Data", "igmp.aux_data", FT_BYTES, BASE_NONE,
                          NULL, 0, "IGMP V3 Auxiliary Data", HFILL }},
 
                { &hf_max_resp_exp,
@@ -1177,7 +1176,7 @@ proto_register_igmp(void)
 
                { &hf_mtrace_q_rtg_proto,
                        { "Rtg Protocol", "igmp.mtrace.q_rtg_proto", FT_UINT8, BASE_DEC,
-                       VALS(&mtrace_rtg_vals), 0, "Routing protocol between this and previous hop rtr", HFILL }},
+                       VALS(mtrace_rtg_vals), 0, "Routing protocol between this and previous hop rtr", HFILL }},
 
                { &hf_mtrace_q_fwd_ttl,
                        { "FwdTTL", "igmp.mtrace.q_fwd_ttl", FT_UINT8, BASE_DEC,
@@ -1197,7 +1196,7 @@ proto_register_igmp(void)
 
                { &hf_mtrace_q_fwd_code,
                        { "Forwarding Code", "igmp.mtrace.q_fwd_code", FT_UINT8, BASE_HEX,
-                       VALS(&mtrace_fwd_code_vals), 0, "Forwarding information/error code", HFILL }},
+                       VALS(mtrace_fwd_code_vals), 0, "Forwarding information/error code", HFILL }},
 
        };
        static gint *ett[] = {
@@ -1220,5 +1219,5 @@ proto_reg_handoff_igmp(void)
        dissector_handle_t igmp_handle;
 
        igmp_handle = create_dissector_handle(dissect_igmp, proto_igmp);
-       dissector_add("ip.proto", IP_PROTO_IGMP, igmp_handle);
+       dissector_add_uint("ip.proto", IP_PROTO_IGMP, igmp_handle);
 }