diff options
Diffstat (limited to 'epan/dissectors/packet-knet.c')
-rw-r--r-- | epan/dissectors/packet-knet.c | 91 |
1 files changed, 36 insertions, 55 deletions
diff --git a/epan/dissectors/packet-knet.c b/epan/dissectors/packet-knet.c index 20ef578cf9..dbc49a12b0 100644 --- a/epan/dissectors/packet-knet.c +++ b/epan/dissectors/packet-knet.c @@ -50,7 +50,7 @@ void proto_reg_handoff_knet(void); * Protocol variables. */ /**@{*/ -static int proto_knet = -1; +static int proto_knet; /**@}*/ /** @@ -60,31 +60,31 @@ static int proto_knet = -1; /* *@{*/ /* Fields used by the TCP/SCTP dissector */ -static int hf_knet_message_tree = -1; /*!< Message tree */ -static int hf_knet_content_length_vle = -1; /*!< Content Length */ +static int hf_knet_message_tree; /*!< Message tree */ +static int hf_knet_content_length_vle; /*!< Content Length */ /* Fields used by the UDP dissector */ -static int hf_knet_content_length = -1; /*!< Content Length */ -static int hf_knet_datagram_tree = -1; /*!< Datagram subtree */ -static int hf_knet_flags = -1; /*!< UDP Flags subtree */ -static int hf_knet_inorder = -1; /*!< Inorder Flag */ -static int hf_knet_reliable = -1; /*!< Reliable Flag */ -static int hf_knet_packetid = -1; /*!< PacketID */ -static int hf_knet_rmib = -1; /*!< Reliable Message Index Base */ -static int hf_knet_msg_flags = -1; /*!< Message Block Flags subtree */ -static int hf_knet_msg_fs = -1; /*!< Fragment Start */ -static int hf_knet_msg_ff = -1; /*!< Fragment Flag */ -static int hf_knet_msg_inorder = -1; /*!< Inorder Flag */ -static int hf_knet_msg_reliable = -1; /*!< Reliable Flag */ -static int hf_knet_msg_reliable_message_number = -1; /*!< Reliable Message Number */ - -static int hf_knet_payload_tree = -1; /*!< Payload subtree */ -static int hf_knet_payload = -1; /*!< Payload subtree */ -static int hf_knet_messageid = -1; /*!< MessageID of the packet */ -static int hf_knet_pingid = -1; -static int hf_knet_flowctrlreq = -1; -static int hf_knet_packetack = -1; -static int hf_knet_seqnumber = -1; +static int hf_knet_content_length; /*!< Content Length */ +static int hf_knet_datagram_tree; /*!< Datagram subtree */ +static int hf_knet_flags; /*!< UDP Flags subtree */ +static int hf_knet_inorder; /*!< Inorder Flag */ +static int hf_knet_reliable; /*!< Reliable Flag */ +static int hf_knet_packetid; /*!< PacketID */ +static int hf_knet_rmib; /*!< Reliable Message Index Base */ +static int hf_knet_msg_flags; /*!< Message Block Flags subtree */ +static int hf_knet_msg_fs; /*!< Fragment Start */ +static int hf_knet_msg_ff; /*!< Fragment Flag */ +static int hf_knet_msg_inorder; /*!< Inorder Flag */ +static int hf_knet_msg_reliable; /*!< Reliable Flag */ +static int hf_knet_msg_reliable_message_number; /*!< Reliable Message Number */ + +static int hf_knet_payload_tree; /*!< Payload subtree */ +static int hf_knet_payload; /*!< Payload subtree */ +static int hf_knet_messageid; /*!< MessageID of the packet */ +static int hf_knet_pingid; +static int hf_knet_flowctrlreq; +static int hf_knet_packetack; +static int hf_knet_seqnumber; /**@}*/ /** @@ -93,21 +93,18 @@ static int hf_knet_seqnumber = -1; /* *@{*/ /*Knet Subtrees */ -static gint ett_knet_main = -1; /*!< Main kNet tree */ -static gint ett_knet_message = -1; /*!< Message tree */ -static gint ett_knet_payload = -1; /*!< Payload tree */ -static gint ett_knet_message_flags = -1; /*!< Message flags tree */ -static gint ett_knet_datagram = -1; -static gint ett_knet_flags = -1; +static gint ett_knet_main; /*!< Main kNet tree */ +static gint ett_knet_message; /*!< Message tree */ +static gint ett_knet_payload; /*!< Payload tree */ +static gint ett_knet_message_flags; /*!< Message flags tree */ +static gint ett_knet_datagram; +static gint ett_knet_flags; /**@}*/ static dissector_handle_t knet_handle_sctp; static dissector_handle_t knet_handle_tcp; static dissector_handle_t knet_handle_udp; -/* Ports used by the dissectors */ -static guint32 knet_sctp_port = PORT; /*!< Port used by kNet SCTP */ - static const value_string packettypenames[] = { /*!< Messageid List */ { PINGREQUEST, "Ping Request" }, { PINGREPLY, "Ping Reply" }, @@ -648,7 +645,7 @@ dissect_knet_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data void proto_register_knet(void) { - module_t *knet_module; + /* module_t *knet_module; */ static hf_register_info hf_knet[] = { @@ -746,11 +743,9 @@ proto_register_knet(void) knet_handle_tcp = register_dissector("knettcp", dissect_knet_tcp, proto_knet); knet_handle_udp = register_dissector("knetudp", dissect_knet_udp, proto_knet); - knet_module = prefs_register_protocol(proto_knet, proto_reg_handoff_knet); + /* Prefs module added by Decode As */ + /* knet_module = prefs_register_protocol(proto_knet, NULL); */ - prefs_register_uint_preference(knet_module, "sctp.port", "kNet SCTP Port", - "Set the SCTP port for kNet messages", - 10, &knet_sctp_port); } /** @@ -760,23 +755,9 @@ proto_register_knet(void) void proto_reg_handoff_knet(void) { - static gboolean initialized = FALSE; - - static guint current_sctp_port; - - if(!initialized) - { - dissector_add_uint_with_preference("tcp.port", PORT, knet_handle_tcp); - dissector_add_uint_with_preference("udp.port", PORT, knet_handle_udp); - initialized = TRUE; - } - else - { - dissector_delete_uint("sctp.port", current_sctp_port, knet_handle_sctp); - } - - current_sctp_port = knet_sctp_port; - dissector_add_uint("sctp.port", current_sctp_port, knet_handle_sctp); + dissector_add_uint_with_preference("tcp.port", PORT, knet_handle_tcp); + dissector_add_uint_with_preference("udp.port", PORT, knet_handle_udp); + dissector_add_uint_with_preference("sctp.port", PORT, knet_handle_sctp); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html |