From 43d499ca45b6a32d64ec201fb6e9eefa6efd9c08 Mon Sep 17 00:00:00 2001 From: David Perry Date: Tue, 9 Aug 2022 18:50:08 +0000 Subject: Use `register_dissector()` for more protocols --- epan/dissectors/packet-ar_drone.c | 8 +-- epan/dissectors/packet-extreme.c | 6 +- epan/dissectors/packet-fip.c | 6 +- epan/dissectors/packet-gfp.c | 10 +-- epan/dissectors/packet-igrp.c | 6 +- epan/dissectors/packet-lldp.c | 6 +- epan/dissectors/packet-ncsi.c | 4 +- epan/dissectors/packet-packetbb.c | 6 +- epan/dissectors/packet-pgsql.c | 3 +- epan/dissectors/packet-ppp.c | 137 +++++++++++++++----------------------- epan/dissectors/packet-realtek.c | 6 +- epan/dissectors/packet-sll.c | 4 +- epan/dissectors/packet-vlan.c | 2 +- epan/dissectors/packet-who.c | 6 +- epan/dissectors/packet-x29.c | 6 +- 15 files changed, 94 insertions(+), 122 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-ar_drone.c b/epan/dissectors/packet-ar_drone.c index 53aa7bd781..15682fe73a 100644 --- a/epan/dissectors/packet-ar_drone.c +++ b/epan/dissectors/packet-ar_drone.c @@ -27,6 +27,9 @@ void proto_reg_handoff_ar_drone(void); /* ar_drone Protocol */ static int proto_ar_drone = -1; +/* ar_drone Dissector handle */ +static dissector_handle_t ar_drone_handle; + /* Headers */ static int hf_command = -1; static int hf_PCMD_id = -1; @@ -751,6 +754,7 @@ proto_register_ar_drone(void) /* Setup protocol info */ proto_ar_drone = proto_register_protocol("AR Drone Packet", "AR Drone", "ar_drone"); + ar_drone_handle = register_dissector("ar_drone", dissect_ar_drone, proto_ar_drone); proto_register_field_array(proto_ar_drone, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -762,10 +766,6 @@ proto_register_ar_drone(void) void proto_reg_handoff_ar_drone(void) { - dissector_handle_t ar_drone_handle; - - ar_drone_handle = create_dissector_handle(dissect_ar_drone, proto_ar_drone); - heur_dissector_add("udp", dissect_ar_drone, "AR Drone over UDP", "ar_drone_udp", proto_ar_drone, HEURISTIC_ENABLE); dissector_add_for_decode_as_with_preference("udp.port", ar_drone_handle); } diff --git a/epan/dissectors/packet-extreme.c b/epan/dissectors/packet-extreme.c index e4c7a565a2..dd2f99c69e 100644 --- a/epan/dissectors/packet-extreme.c +++ b/epan/dissectors/packet-extreme.c @@ -141,6 +141,8 @@ void proto_reg_handoff_edp(void); static int hf_llc_extreme_pid = -1; +static dissector_handle_t edp_handle; + static int proto_edp = -1; /* EDP header */ static int hf_edp_version = -1; @@ -1538,6 +1540,7 @@ proto_register_edp(void) expert_module_t* expert_edp; proto_edp = proto_register_protocol(PROTO_LONG_NAME, PROTO_SHORT_NAME, "edp"); + edp_handle = register_dissector("edp", dissect_edp, proto_edp); proto_register_field_array(proto_edp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_edp = expert_register_protocol(proto_edp); @@ -1550,9 +1553,6 @@ proto_register_edp(void) void proto_reg_handoff_edp(void) { - dissector_handle_t edp_handle; - - edp_handle = create_dissector_handle(dissect_edp, proto_edp); dissector_add_uint("llc.extreme_pid", 0x00bb, edp_handle); } diff --git a/epan/dissectors/packet-fip.c b/epan/dissectors/packet-fip.c index 1a7d9c8def..2db4768c9d 100644 --- a/epan/dissectors/packet-fip.c +++ b/epan/dissectors/packet-fip.c @@ -30,6 +30,8 @@ void proto_register_fip(void); void proto_reg_handoff_fip(void); +static dissector_handle_t fip_handle; + /* * FIP protocol information. */ @@ -794,6 +796,7 @@ proto_register_fip(void) /* Register the protocol name and description */ proto_fip = proto_register_protocol("FCoE Initialization Protocol", "FIP", "fip"); + fip_handle = register_dissector("fip", dissect_fip, proto_fip); /* Required function calls to register the header fields and * subtrees used */ @@ -810,9 +813,6 @@ proto_register_fip(void) void proto_reg_handoff_fip(void) { - dissector_handle_t fip_handle; - - fip_handle = create_dissector_handle(dissect_fip, proto_fip); dissector_add_uint("ethertype", ETHERTYPE_FIP, fip_handle); fc_handle = find_dissector_add_dependency("fc", proto_fip); } diff --git a/epan/dissectors/packet-gfp.c b/epan/dissectors/packet-gfp.c index 00f7c69cff..ec6a0f5c77 100644 --- a/epan/dissectors/packet-gfp.c +++ b/epan/dissectors/packet-gfp.c @@ -37,6 +37,9 @@ void proto_reg_handoff_gfp(void); void proto_register_gfp(void); +/* Dissector handle */ +static dissector_handle_t gfp_handle; + /* Initialize the protocol and registered fields */ static int proto_gfp = -1; static int hf_gfp_pli = -1; @@ -555,6 +558,8 @@ proto_register_gfp(void) /* Register the protocol name and description */ proto_gfp = proto_register_protocol("Generic Framing Procedure", "GFP", "gfp"); + gfp_handle = register_dissector("gfp", dissect_gfp, + proto_gfp); /* Required function calls to register the header fields and subtrees */ proto_register_field_array(proto_gfp, hf, array_length(hf)); @@ -579,11 +584,6 @@ proto_register_gfp(void) void proto_reg_handoff_gfp(void) { - static dissector_handle_t gfp_handle; - - gfp_handle = create_dissector_handle(dissect_gfp, - proto_gfp); - dissector_add_uint("wtap_encap", WTAP_ENCAP_GFP_T, gfp_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_GFP_F, gfp_handle); diff --git a/epan/dissectors/packet-igrp.c b/epan/dissectors/packet-igrp.c index 74da053a3f..ebd7e9f192 100644 --- a/epan/dissectors/packet-igrp.c +++ b/epan/dissectors/packet-igrp.c @@ -28,6 +28,8 @@ void proto_reg_handoff_igrp(void); #define IGRP_HEADER_LENGTH 12 #define IGRP_ENTRY_LENGTH 14 +static dissector_handle_t igrp_handle; + static gint proto_igrp = -1; static gint hf_igrp_update = -1; static gint hf_igrp_as = -1; @@ -231,6 +233,7 @@ void proto_register_igrp(void) /* Register the protocol name and description */ proto_igrp = proto_register_protocol("Cisco Interior Gateway Routing Protocol", "IGRP", "igrp"); + igrp_handle = register_dissector("igrp", dissect_igrp, proto_igrp); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_igrp, hf, array_length(hf)); @@ -242,9 +245,6 @@ void proto_register_igrp(void) void proto_reg_handoff_igrp(void) { - dissector_handle_t igrp_handle; - - igrp_handle = create_dissector_handle(dissect_igrp, proto_igrp); dissector_add_uint("ip.proto", IP_PROTO_IGRP, igrp_handle); } diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index 3b91d62544..ab79404881 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -56,6 +56,8 @@ typedef struct _profinet_lldp_column_info { static gint column_info_selection = DEFAULT_COLUMN_INFO; +static dissector_handle_t lldp_handle; + void proto_register_lldp(void); void proto_reg_handoff_lldp(void); @@ -6485,6 +6487,7 @@ proto_register_lldp(void) /* Register the protocol name and description */ proto_lldp = proto_register_protocol("Link Layer Discovery Protocol", "LLDP", "lldp"); + lldp_handle = register_dissector("lldp", dissect_lldp, proto_lldp); /* Register preferences */ lldp_module = prefs_register_protocol(proto_lldp, NULL); @@ -6509,9 +6512,6 @@ proto_register_lldp(void) void proto_reg_handoff_lldp(void) { - dissector_handle_t lldp_handle; - - lldp_handle = create_dissector_handle(dissect_lldp,proto_lldp); dissector_add_uint("ethertype", ETHERTYPE_LLDP, lldp_handle); dissector_add_uint("ethertype", ETHERTYPE_ONOS, lldp_handle); } diff --git a/epan/dissectors/packet-ncsi.c b/epan/dissectors/packet-ncsi.c index 1e2ed376b0..61b69252b2 100644 --- a/epan/dissectors/packet-ncsi.c +++ b/epan/dissectors/packet-ncsi.c @@ -31,6 +31,7 @@ void proto_reg_handoff_ncsi(void); void proto_register_ncsi(void); static int proto_ncsi = -1; +static dissector_handle_t ncsi_handle; /* Common header fields */ static int hf_ncsi_mc_id = -1; @@ -1658,6 +1659,7 @@ proto_register_ncsi(void) /* Register the protocol name and description */ proto_ncsi = proto_register_protocol("NCSI", "NCSI", "ncsi"); + ncsi_handle = register_dissector("ncsi", dissect_ncsi, proto_ncsi); /* Required function calls to register the header fields and subtrees */ proto_register_field_array(proto_ncsi, hf, array_length(hf)); @@ -1667,8 +1669,6 @@ proto_register_ncsi(void) void proto_reg_handoff_ncsi(void) { - dissector_handle_t ncsi_handle; - ncsi_handle = create_dissector_handle(dissect_ncsi, proto_ncsi); dissector_add_uint("ethertype", ETHERTYPE_NCSI, ncsi_handle); } diff --git a/epan/dissectors/packet-packetbb.c b/epan/dissectors/packet-packetbb.c index 8ca0894d41..4e7abdd553 100644 --- a/epan/dissectors/packet-packetbb.c +++ b/epan/dissectors/packet-packetbb.c @@ -22,6 +22,8 @@ void proto_reg_handoff_packetbb(void); void proto_register_packetbb(void); +static dissector_handle_t packetbb_handle; + #define PACKET_HEADER_HASSEQNR 0x08 #define PACKET_HEADER_HASTLV 0x04 @@ -960,9 +962,6 @@ static int dissect_packetbb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } void proto_reg_handoff_packetbb(void) { - dissector_handle_t packetbb_handle; - - packetbb_handle = create_dissector_handle(dissect_packetbb, proto_packetbb); dissector_add_uint_with_preference("udp.port", PACKETBB_PORT, packetbb_handle); } @@ -1394,6 +1393,7 @@ void proto_register_packetbb(void) { /* name, short name, abbrev */ proto_packetbb = proto_register_protocol("PacketBB Protocol", "PacketBB", "packetbb"); + packetbb_handle = register_dissector("packetbb", dissect_packetbb, proto_packetbb); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_packetbb, hf, array_length(hf)); diff --git a/epan/dissectors/packet-pgsql.c b/epan/dissectors/packet-pgsql.c index c935eec1f8..1e9d42b2b7 100644 --- a/epan/dissectors/packet-pgsql.c +++ b/epan/dissectors/packet-pgsql.c @@ -1030,6 +1030,7 @@ proto_register_pgsql(void) }; proto_pgsql = proto_register_protocol("PostgreSQL", "PGSQL", "pgsql"); + pgsql_handle = register_dissector("pgsql", dissect_pgsql, proto_pgsql); proto_register_field_array(proto_pgsql, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -1037,8 +1038,6 @@ proto_register_pgsql(void) void proto_reg_handoff_pgsql(void) { - pgsql_handle = create_dissector_handle(dissect_pgsql, proto_pgsql); - dissector_add_uint_with_preference("tcp.port", PGSQL_PORT, pgsql_handle); tls_handle = find_dissector_add_dependency("tls", proto_pgsql); diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index 53ec5c2a13..6e10bf007e 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -85,7 +85,6 @@ void proto_reg_handoff_ipv6cp(void); void proto_register_iphc_crtp(void); void proto_reg_handoff_iphc_crtp(void); - static int proto_ppp = -1; static int hf_ppp_direction = -1; static int hf_ppp_address = -1; @@ -465,6 +464,33 @@ static expert_field ei_bap_sub_option_length = EI_INIT; static dissector_table_t bap_option_table; static dissector_handle_t ppp_hdlc_handle, ppp_handle; +static dissector_handle_t ppp_raw_hdlc_handle; +static dissector_handle_t mp_handle; +static dissector_handle_t lcp_handle; +static dissector_handle_t vsncp_handle; +static dissector_handle_t vsnp_handle; +static dissector_handle_t ipcp_handle; +static dissector_handle_t bcp_bpdu_handle; +static dissector_handle_t bcp_ncp_handle; +static dissector_handle_t osinlcp_handle; +static dissector_handle_t ccp_handle; +static dissector_handle_t cbcp_handle; +static dissector_handle_t bacp_handle; +static dissector_handle_t bap_handle; +static dissector_handle_t comp_data_handle; +static dissector_handle_t pap_handle; +static dissector_handle_t chap_handle; +static dissector_handle_t muxcp_handle; +static dissector_handle_t pppmux_handle; +static dissector_handle_t mplscp_handle; +static dissector_handle_t cdpcp_handle; +static dissector_handle_t ipv6cp_handle; +static dissector_handle_t fh_handle; +static dissector_handle_t cudp16_handle; +static dissector_handle_t cudp8_handle; +static dissector_handle_t cs_handle; +static dissector_handle_t cntcp_handle; + static int proto_comp_data = -1; @@ -6107,6 +6133,7 @@ proto_register_ppp_raw_hdlc(void) proto_ppp_hdlc = proto_register_protocol("PPP In HDLC-Like Framing", "PPP-HDLC", "ppp_hdlc"); + ppp_raw_hdlc_handle = register_dissector("ppp_raw_hdlc", dissect_ppp_raw_hdlc, proto_ppp_hdlc); proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_ppp_hdlc, hf, array_length(hf)); @@ -6117,11 +6144,8 @@ proto_register_ppp_raw_hdlc(void) void proto_reg_handoff_ppp_raw_hdlc(void) { - dissector_handle_t ppp_raw_hdlc_handle; capture_dissector_handle_t ppp_hdlc_cap_handle; - ppp_raw_hdlc_handle = create_dissector_handle(dissect_ppp_raw_hdlc, proto_ppp); - dissector_add_uint("gre.proto", ETHERTYPE_CDMA2000_A10_UBS, ppp_raw_hdlc_handle); dissector_add_uint("gre.proto", ETHERTYPE_3GPP2, ppp_raw_hdlc_handle); @@ -6589,6 +6613,7 @@ proto_register_mp(void) module_t *mp_module; proto_mp = proto_register_protocol("PPP Multilink Protocol", "PPP MP", "mp"); + mp_handle = register_dissector("mp", dissect_mp, proto_mp); proto_register_field_array(proto_mp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); reassembly_table_register(&mp_reassembly_table, @@ -6614,9 +6639,6 @@ proto_register_mp(void) void proto_reg_handoff_mp(void) { - dissector_handle_t mp_handle; - - mp_handle = create_dissector_handle(dissect_mp, proto_mp); dissector_add_uint("ppp.protocol", PPP_MP, mp_handle); } @@ -6900,6 +6922,7 @@ proto_register_lcp(void) }; proto_lcp = proto_register_protocol("PPP Link Control Protocol", "PPP LCP", "lcp"); + lcp_handle = register_dissector("lcp", dissect_lcp, proto_lcp); proto_register_field_array(proto_lcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -6941,12 +6964,8 @@ proto_register_lcp(void) void proto_reg_handoff_lcp(void) { - dissector_handle_t lcp_handle; - - lcp_handle = create_dissector_handle(dissect_lcp, proto_lcp); dissector_add_uint("ppp.protocol", PPP_LCP, lcp_handle); - /* * NDISWAN on Windows translates Ethernet frames from higher-level * protocols into PPP frames to hand to the PPP driver, and translates @@ -7046,6 +7065,7 @@ proto_register_vsncp(void) }; proto_vsncp = proto_register_protocol("Vendor Specific Control Protocol", "VSNCP", "vsncp"); + vsncp_handle = register_dissector("vsncp", dissect_vsncp, proto_vsncp); proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_vsncp, hf, array_length(hf)); @@ -7068,9 +7088,6 @@ proto_register_vsncp(void) void proto_reg_handoff_vsncp(void) { - dissector_handle_t vsncp_handle; - - vsncp_handle = create_dissector_handle(dissect_vsncp, proto_vsncp); dissector_add_uint("ppp.protocol", PPP_VSNCP, vsncp_handle); dissector_add_uint("vsncp.option", CI_PDN_IDENTIFIER, create_dissector_handle( dissect_vsncp_pdnid_opt, proto_vsncp_option_pdnid )); @@ -7101,6 +7118,7 @@ proto_register_vsnp(void) proto_vsnp = proto_register_protocol("Vendor Specific Network Protocol", "PPP VSNP", "vsnp"); + vsnp_handle = register_dissector("vsnp", dissect_vsnp, proto_vsnp); proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_vsnp, hf, array_length(hf)); } @@ -7108,9 +7126,6 @@ proto_register_vsnp(void) void proto_reg_handoff_vsnp(void) { - dissector_handle_t vsnp_handle; - - vsnp_handle = create_dissector_handle(dissect_vsnp, proto_vsnp); dissector_add_uint("ppp.protocol", PPP_VSNP, vsnp_handle); } @@ -7221,6 +7236,7 @@ proto_register_ipcp(void) }; proto_ipcp = proto_register_protocol("PPP IP Control Protocol", "PPP IPCP", "ipcp"); + ipcp_handle = register_dissector("ipcp", dissect_ipcp, proto_ipcp); proto_register_field_array(proto_ipcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -7248,9 +7264,6 @@ proto_register_ipcp(void) void proto_reg_handoff_ipcp(void) { - dissector_handle_t ipcp_handle; - - ipcp_handle = create_dissector_handle(dissect_ipcp, proto_ipcp); dissector_add_uint("ppp.protocol", PPP_IPCP, ipcp_handle); /* @@ -7314,6 +7327,7 @@ proto_register_bcp_bpdu(void) proto_bcp_bpdu = proto_register_protocol("PPP Bridging Control Protocol Bridged PDU", "PPP BCP BPDU", "bcp_bpdu"); + bcp_bpdu_handle = register_dissector("bcp_bpdu", dissect_bcp_bpdu, proto_bcp_bpdu); proto_register_field_array(proto_bcp_bpdu, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -7321,13 +7335,9 @@ proto_register_bcp_bpdu(void) void proto_reg_handoff_bcp_bpdu(void) { - dissector_handle_t bcp_bpdu_handle; - eth_withfcs_handle = find_dissector_add_dependency("eth_withfcs", proto_bcp_bpdu); eth_withoutfcs_handle = find_dissector_add_dependency("eth_withoutfcs", proto_bcp_bpdu); - bcp_bpdu_handle = create_dissector_handle(dissect_bcp_bpdu, proto_bcp_bpdu); - dissector_add_uint("ppp.protocol", PPP_BCP_BPDU, bcp_bpdu_handle); } @@ -7384,6 +7394,7 @@ proto_register_bcp_ncp(void) }; proto_bcp_ncp = proto_register_protocol("PPP Bridging Control Protocol Network Control Protocol", "PPP BCP NCP", "bcp_ncp"); + bcp_ncp_handle = register_dissector("bcp_ncp", dissect_bcp_ncp, proto_bcp_ncp); proto_register_field_array(proto_bcp_ncp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -7405,10 +7416,6 @@ proto_register_bcp_ncp(void) void proto_reg_handoff_bcp_ncp(void) { - dissector_handle_t bcp_ncp_handle; - - bcp_ncp_handle = create_dissector_handle(dissect_bcp_ncp, proto_bcp_ncp); - dissector_add_uint("ppp.protocol", PPP_BCP_NCP, bcp_ncp_handle); dissector_add_uint("bcp_ncp.option", CI_BCPNCP_BRIDGE_ID, create_dissector_handle( dissect_bcp_ncp_bridge_id, proto_bcp_ncp_option_bridge_id )); @@ -7445,6 +7452,7 @@ proto_register_osinlcp(void) }; proto_osinlcp = proto_register_protocol("PPP OSI Network Layer Control Protocol", "PPP OSINLCP", "osinlcp"); + osinlcp_handle = register_dissector("osinlcp", dissect_osinlcp, proto_osinlcp); proto_register_field_array(proto_osinlcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -7458,9 +7466,6 @@ proto_register_osinlcp(void) void proto_reg_handoff_osinlcp(void) { - dissector_handle_t osinlcp_handle; - - osinlcp_handle = create_dissector_handle(dissect_osinlcp, proto_osinlcp); dissector_add_uint("ppp.protocol", PPP_OSINLCP, osinlcp_handle); /* @@ -7608,6 +7613,7 @@ proto_register_ccp(void) }; proto_ccp = proto_register_protocol("PPP Compression Control Protocol", "PPP CCP", "ccp"); + ccp_handle = register_dissector("ccp", dissect_ccp, proto_ccp); proto_register_field_array(proto_ccp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -7635,9 +7641,6 @@ proto_register_ccp(void) void proto_reg_handoff_ccp(void) { - dissector_handle_t ccp_handle; - - ccp_handle = create_dissector_handle(dissect_ccp, proto_ccp); dissector_add_uint("ppp.protocol", PPP_CCP, ccp_handle); /* @@ -7694,6 +7697,7 @@ proto_register_cbcp(void) expert_module_t* expert_cbcp; proto_cbcp = proto_register_protocol("PPP Callback Control Protocol", "PPP CBCP", "cbcp"); + cbcp_handle = register_dissector("cbcp", dissect_cbcp, proto_cbcp); proto_register_field_array(proto_cbcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_cbcp = expert_register_protocol(proto_cbcp); @@ -7711,9 +7715,6 @@ proto_register_cbcp(void) void proto_reg_handoff_cbcp(void) { - dissector_handle_t cbcp_handle; - - cbcp_handle = create_dissector_handle(dissect_cbcp, proto_cbcp); dissector_add_uint("ppp.protocol", PPP_CBCP, cbcp_handle); /* @@ -7747,6 +7748,7 @@ proto_register_bacp(void) }; proto_bacp = proto_register_protocol("PPP Bandwidth Allocation Control Protocol", "PPP BACP", "bacp"); + bacp_handle = register_dissector("bacp", dissect_bacp, proto_bacp); proto_register_field_array(proto_bacp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -7759,9 +7761,6 @@ proto_register_bacp(void) void proto_reg_handoff_bacp(void) { - dissector_handle_t bacp_handle; - - bacp_handle = create_dissector_handle(dissect_bacp, proto_bacp); dissector_add_uint("ppp.protocol", PPP_BACP, bacp_handle); /* @@ -7815,6 +7814,7 @@ proto_register_bap(void) expert_module_t* expert_bap; proto_bap = proto_register_protocol("PPP Bandwidth Allocation Protocol", "PPP BAP", "bap"); + bap_handle = register_dissector("bap", dissect_bap, proto_bap); proto_register_field_array(proto_bap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_bap = expert_register_protocol(proto_bap); @@ -7834,9 +7834,6 @@ proto_register_bap(void) void proto_reg_handoff_bap(void) { - dissector_handle_t bap_handle; - - bap_handle = create_dissector_handle(dissect_bap, proto_bap); dissector_add_uint("ppp.protocol", PPP_BAP, bap_handle); /* @@ -7864,6 +7861,8 @@ proto_register_comp_data(void) proto_comp_data = proto_register_protocol("PPP Compressed Datagram", "PPP Comp", "comp_data"); + comp_data_handle = register_dissector("ppp_comp", dissect_comp_data, + proto_comp_data); #if 0 proto_register_subtree_array(ett, array_length(ett)); #endif @@ -7872,10 +7871,6 @@ proto_register_comp_data(void) void proto_reg_handoff_comp_data(void) { - dissector_handle_t comp_data_handle; - - comp_data_handle = create_dissector_handle(dissect_comp_data, - proto_comp_data); dissector_add_uint("ppp.protocol", PPP_COMP, comp_data_handle); /* @@ -7944,6 +7939,7 @@ proto_register_pap(void) proto_pap = proto_register_protocol("PPP Password Authentication Protocol", "PPP PAP", "pap"); + pap_handle = register_dissector("pap", dissect_pap, proto_pap); proto_register_field_array(proto_pap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -7951,9 +7947,6 @@ proto_register_pap(void) void proto_reg_handoff_pap(void) { - dissector_handle_t pap_handle; - - pap_handle = create_dissector_handle(dissect_pap, proto_pap); dissector_add_uint("ppp.protocol", PPP_PAP, pap_handle); /* @@ -8008,6 +8001,8 @@ proto_register_chap(void) proto_chap = proto_register_protocol( "PPP Challenge Handshake Authentication Protocol", "PPP CHAP", "chap"); + chap_handle = register_dissector("chap", dissect_chap, + proto_chap); proto_register_field_array(proto_chap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -8015,8 +8010,6 @@ proto_register_chap(void) void proto_reg_handoff_chap(void) { - dissector_handle_t chap_handle = create_dissector_handle(dissect_chap, - proto_chap); dissector_add_uint("ppp.protocol", PPP_CHAP, chap_handle); /* @@ -8061,6 +8054,7 @@ proto_register_pppmuxcp(void) }; proto_pppmuxcp = proto_register_protocol("PPPMux Control Protocol", "PPP PPPMuxCP", "pppmuxcp"); + muxcp_handle = register_dissector("pppmuxcp", dissect_pppmuxcp, proto_pppmuxcp); proto_register_field_array(proto_pppmuxcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -8074,9 +8068,6 @@ proto_register_pppmuxcp(void) void proto_reg_handoff_pppmuxcp(void) { - dissector_handle_t muxcp_handle; - - muxcp_handle = create_dissector_handle(dissect_pppmuxcp, proto_pppmuxcp); dissector_add_uint("ppp.protocol", PPP_MUXCP, muxcp_handle); /* @@ -8109,6 +8100,7 @@ proto_register_pppmux(void) proto_pppmux = proto_register_protocol("PPP Multiplexing", "PPP PPPMux", "pppmux"); + pppmux_handle = register_dissector("pppmux", dissect_pppmux, proto_pppmux); proto_register_field_array(proto_pppmux, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -8116,9 +8108,6 @@ proto_register_pppmux(void) void proto_reg_handoff_pppmux(void) { - dissector_handle_t pppmux_handle; - - pppmux_handle = create_dissector_handle(dissect_pppmux, proto_pppmux); dissector_add_uint("ppp.protocol", PPP_MUX, pppmux_handle); /* @@ -8138,15 +8127,13 @@ proto_register_mplscp(void) proto_mplscp = proto_register_protocol("PPP MPLS Control Protocol", "PPP MPLSCP", "mplscp"); + mplscp_handle = register_dissector("mplscp", dissect_mplscp, proto_mplscp); proto_register_subtree_array(ett, array_length(ett)); } void proto_reg_handoff_mplscp(void) { - dissector_handle_t mplscp_handle; - - mplscp_handle = create_dissector_handle(dissect_mplscp, proto_mplscp); dissector_add_uint("ppp.protocol", PPP_MPLSCP, mplscp_handle); /* @@ -8166,15 +8153,13 @@ proto_register_cdpcp(void) proto_cdpcp = proto_register_protocol("PPP CDP Control Protocol", "PPP CDPCP", "cdpcp"); + cdpcp_handle = register_dissector("cdpcp", dissect_cdpcp, proto_cdpcp); proto_register_subtree_array(ett, array_length(ett)); } void proto_reg_handoff_cdpcp(void) { - dissector_handle_t cdpcp_handle; - - cdpcp_handle = create_dissector_handle(dissect_cdpcp, proto_cdpcp); dissector_add_uint("ppp.protocol", PPP_CDPCP, cdpcp_handle); /* @@ -8201,6 +8186,7 @@ proto_register_ipv6cp(void) }; proto_ipv6cp = proto_register_protocol("PPP IPv6 Control Protocol", "PPP IPV6CP", "ipv6cp"); + ipv6cp_handle = register_dissector("ipv6cp", dissect_ipv6cp, proto_ipv6cp); proto_register_field_array(proto_ipv6cp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -8214,9 +8200,6 @@ proto_register_ipv6cp(void) void proto_reg_handoff_ipv6cp(void) { - dissector_handle_t ipv6cp_handle; - - ipv6cp_handle = create_dissector_handle(dissect_ipv6cp, proto_ipv6cp); dissector_add_uint("ppp.protocol", PPP_IPV6CP, ipv6cp_handle); /* @@ -8294,11 +8277,16 @@ proto_register_iphc_crtp(void) expert_module_t* expert_iphc_crtp; proto_iphc_crtp = proto_register_protocol("CRTP", "CRTP", "crtp"); + fh_handle = register_dissector("crtp", dissect_iphc_crtp_fh, proto_iphc_crtp); /* Created to remove Decode As confusion */ proto_iphc_crtp_cudp16 = proto_register_protocol_in_name_only("CRTP (CUDP 16)", "CRTP (CUDP 16)", "crtp_cudp16", proto_iphc_crtp, FT_PROTOCOL); + cudp16_handle = register_dissector("crtp_cudp16", dissect_iphc_crtp_cudp16, proto_iphc_crtp_cudp16); proto_iphc_crtp_cudp8 = proto_register_protocol_in_name_only("CRTP (CUDP 8)", "CRTP (CUDP 8)", "crtp_cudp8", proto_iphc_crtp, FT_PROTOCOL); + cudp8_handle = register_dissector("crtp_cudp8", dissect_iphc_crtp_cudp8, proto_iphc_crtp_cudp8); proto_iphc_crtp_cs = proto_register_protocol_in_name_only("CRTP (CS)", "CRTP (CS)", "crtp_cs", proto_iphc_crtp, FT_PROTOCOL); + cs_handle = register_dissector("crtp_cs", dissect_iphc_crtp_cs, proto_iphc_crtp_cs); proto_iphc_crtp_cntcp = proto_register_protocol_in_name_only("CRTP (CNTCP)", "CRTP (CNTCP)", "crtp_cntcp", proto_iphc_crtp, FT_PROTOCOL); + cntcp_handle = register_dissector("crtp_cntcp", dissect_iphc_crtp_cntcp, proto_iphc_crtp_cntcp); proto_register_field_array(proto_iphc_crtp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -8309,25 +8297,10 @@ proto_register_iphc_crtp(void) void proto_reg_handoff_iphc_crtp(void) { - dissector_handle_t fh_handle; - dissector_handle_t cudp16_handle; - dissector_handle_t cudp8_handle; - dissector_handle_t cs_handle; - dissector_handle_t cntcp_handle; - - fh_handle = create_dissector_handle(dissect_iphc_crtp_fh, proto_iphc_crtp); dissector_add_uint("ppp.protocol", PPP_RTP_FH, fh_handle); - - cudp16_handle = create_dissector_handle(dissect_iphc_crtp_cudp16, proto_iphc_crtp_cudp16); dissector_add_uint("ppp.protocol", PPP_RTP_CUDP16, cudp16_handle); - - cudp8_handle = create_dissector_handle(dissect_iphc_crtp_cudp8, proto_iphc_crtp_cudp8); dissector_add_uint("ppp.protocol", PPP_RTP_CUDP8, cudp8_handle); - - cs_handle = create_dissector_handle(dissect_iphc_crtp_cs, proto_iphc_crtp_cs); dissector_add_uint("ppp.protocol", PPP_RTP_CS, cs_handle); - - cntcp_handle = create_dissector_handle(dissect_iphc_crtp_cntcp, proto_iphc_crtp_cntcp); dissector_add_uint("ppp.protocol", PPP_RTP_CNTCP, cntcp_handle); /* diff --git a/epan/dissectors/packet-realtek.c b/epan/dissectors/packet-realtek.c index 885b9c8226..f834d3dac2 100644 --- a/epan/dissectors/packet-realtek.c +++ b/epan/dissectors/packet-realtek.c @@ -75,6 +75,8 @@ static const value_string rrcp_opcode_names[] = { {0, NULL} }; +static dissector_handle_t realtek_handle; + static int proto_realtek = -1; static int hf_realtek_packet = -1; @@ -415,6 +417,7 @@ proto_register_realtek(void) proto_realtek = proto_register_protocol("Realtek Layer 2 Protocols", "Realtek", "realtek"); + realtek_handle = register_dissector("realtek", dissect_realtek, proto_realtek); proto_register_field_array(proto_realtek, hf_realtek, array_length(hf_realtek)); realtek_heur_subdissector_list = register_heur_dissector_list("realtek", proto_realtek); @@ -438,9 +441,6 @@ proto_register_realtek(void) void proto_reg_handoff_realtek(void) { - dissector_handle_t realtek_handle; - - realtek_handle = create_dissector_handle(dissect_realtek, proto_realtek); dissector_add_uint("ethertype", ETHERTYPE_REALTEK, realtek_handle); heur_dissector_add("realtek", dissect_rrcp, "Realtek Remote Control Protocol", diff --git a/epan/dissectors/packet-sll.c b/epan/dissectors/packet-sll.c index 9e4697d441..602c8eb7f5 100644 --- a/epan/dissectors/packet-sll.c +++ b/epan/dissectors/packet-sll.c @@ -585,8 +585,8 @@ proto_register_sll(void) proto_register_field_array(proto_sll, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - sll_handle = create_dissector_handle(dissect_sll_v1, proto_sll); - sll2_handle = create_dissector_handle(dissect_sll_v2, proto_sll); + sll_handle = register_dissector("sll_v1", dissect_sll_v1, proto_sll); + sll2_handle = register_dissector("sll_v2", dissect_sll_v2, proto_sll); sll_tap = register_tap("sll"); /* diff --git a/epan/dissectors/packet-vlan.c b/epan/dissectors/packet-vlan.c index 8cc5936328..3872429828 100644 --- a/epan/dissectors/packet-vlan.c +++ b/epan/dissectors/packet-vlan.c @@ -436,7 +436,7 @@ proto_register_vlan(void) "Priorities and drop eligibility", "Number of priorities supported, and number of those drop eligible (not used for 802.1Q-1998)", &vlan_priority_drop, priority_drop_vals, FALSE); - vlan_handle = create_dissector_handle(dissect_vlan, proto_vlan); + vlan_handle = register_dissector("vlan", dissect_vlan, proto_vlan); } void diff --git a/epan/dissectors/packet-who.c b/epan/dissectors/packet-who.c index d7b1b35d2e..70636d8124 100644 --- a/epan/dissectors/packet-who.c +++ b/epan/dissectors/packet-who.c @@ -48,6 +48,8 @@ RWHOD(8) UNIX System Manager's Manual RWHOD(8) void proto_register_who(void); void proto_reg_handoff_who(void); +static dissector_handle_t who_handle; + static int proto_who = -1; static int hf_who_vers = -1; static int hf_who_type = -1; @@ -255,6 +257,7 @@ proto_register_who(void) }; proto_who = proto_register_protocol("Who", "WHO", "who"); + who_handle = register_dissector("who", dissect_who, proto_who); proto_register_field_array(proto_who, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -262,9 +265,6 @@ proto_register_who(void) void proto_reg_handoff_who(void) { - dissector_handle_t who_handle; - - who_handle = create_dissector_handle(dissect_who, proto_who); dissector_add_uint_with_preference("udp.port", UDP_PORT_WHO, who_handle); } diff --git a/epan/dissectors/packet-x29.c b/epan/dissectors/packet-x29.c index db15d8d807..819c9ecf4b 100644 --- a/epan/dissectors/packet-x29.c +++ b/epan/dissectors/packet-x29.c @@ -16,6 +16,8 @@ void proto_register_x29(void); void proto_reg_handoff_x29(void); +static dissector_handle_t x29_handle; + static int proto_x29 = -1; static int hf_msg_code = -1; static int hf_error_type = -1; @@ -257,6 +259,7 @@ proto_register_x29(void) }; proto_x29 = proto_register_protocol("X.29", "X.29", "x29"); + x29_handle = register_dissector("x29", dissect_x29, proto_x29); proto_register_field_array(proto_x29, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } @@ -264,9 +267,6 @@ proto_register_x29(void) void proto_reg_handoff_x29(void) { - dissector_handle_t x29_handle; - - x29_handle = create_dissector_handle(dissect_x29, proto_x29); dissector_add_uint("x.25.spi", NLPID_SPI_X_29, x29_handle); } -- cgit v1.2.3