diff options
Diffstat (limited to 'epan/dissectors/packet-tpncp.c')
-rw-r--r-- | epan/dissectors/packet-tpncp.c | 103 |
1 files changed, 58 insertions, 45 deletions
diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c index 0b158cdfdd..f75cbf6a50 100644 --- a/epan/dissectors/packet-tpncp.c +++ b/epan/dissectors/packet-tpncp.c @@ -790,16 +790,16 @@ void proto_reg_handoff_tpncp(void) { dissector_delete_uint("udp.port", host_udp_port, tpncp_handle); } - if(global_tpncp_load_db){ - trunkpack_tcp_port = global_tpncp_trunkpack_tcp_port; - trunkpack_udp_port = global_tpncp_trunkpack_udp_port; + if(global_tpncp_load_db){ + trunkpack_tcp_port = global_tpncp_trunkpack_tcp_port; + trunkpack_udp_port = global_tpncp_trunkpack_udp_port; - host_tcp_port = global_tpncp_host_tcp_port; - host_udp_port = global_tpncp_host_udp_port; + host_tcp_port = global_tpncp_host_tcp_port; + host_udp_port = global_tpncp_host_udp_port; - dissector_add_uint("tcp.port", global_tpncp_trunkpack_tcp_port, tpncp_tcp_handle); - dissector_add_uint("udp.port", global_tpncp_trunkpack_udp_port, tpncp_handle); - } + dissector_add_uint("tcp.port", global_tpncp_trunkpack_tcp_port, tpncp_tcp_handle); + dissector_add_uint("udp.port", global_tpncp_trunkpack_udp_port, tpncp_handle); + } } /*-------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -814,48 +814,48 @@ void proto_register_tpncp(void) { proto_tpncp = proto_register_protocol("AudioCodes TPNCP (TrunkPack Network Control Protocol)", "TPNCP", "tpncp"); - if(global_tpncp_load_db){ - if (init_tpncp_db() == -1) { - g_warning("Could not load tpncp.dat file, tpncp dissector will not work"); - return; - } - - - /* Rather than duplicating large quantities of code from - * proto_register_field_array() and friends to sanitize the tpncp.dat file - * when we read it, just catch any exceptions we get while registering and - * take them as a hint that the file is corrupt. Then move on, so that at - * least the rest of the protocol dissectors will still work. - */ - TRY { - /* The function proto_register_field_array does not work with dynamic - * arrays, so pass dynamic array elements one-by-one in the loop. - */ - for(idx = 0; idx < hf_size; idx++) { - proto_register_field_array(proto_tpncp, &hf[idx], 1); - } - } - - CATCH_ALL { - g_warning("Corrupt tpncp.dat file, tpncp dissector will not work."); - } - - ENDTRY; - - proto_register_subtree_array(ett, array_length(ett)); - } + if(global_tpncp_load_db){ + if (init_tpncp_db() == -1) { + g_warning("Could not load tpncp.dat file, tpncp dissector will not work"); + return; + } + + + /* Rather than duplicating large quantities of code from + * proto_register_field_array() and friends to sanitize the tpncp.dat file + * when we read it, just catch any exceptions we get while registering and + * take them as a hint that the file is corrupt. Then move on, so that at + * least the rest of the protocol dissectors will still work. + */ + TRY { + /* The function proto_register_field_array does not work with dynamic + * arrays, so pass dynamic array elements one-by-one in the loop. + */ + for(idx = 0; idx < hf_size; idx++) { + proto_register_field_array(proto_tpncp, &hf[idx], 1); + } + } + + CATCH_ALL { + g_warning("Corrupt tpncp.dat file, tpncp dissector will not work."); + } + + ENDTRY; + + proto_register_subtree_array(ett, array_length(ett)); + } tpncp_handle = new_register_dissector("tpncp", dissect_tpncp, proto_tpncp); tpncp_module = prefs_register_protocol(proto_tpncp, proto_reg_handoff_tpncp); - /* See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9569 for some discussion on this as well */ - prefs_register_bool_preference(tpncp_module, "load_db", - "Whether to load DB or not, if DB not loaded dissector is passive", - "Whether to load the Data base or not, not loading the DB " - "dissaables the protocol, Wireshar has to be restarted for the" - "setting to take effect ", - &global_tpncp_load_db); + /* See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9569 for some discussion on this as well */ + prefs_register_bool_preference(tpncp_module, "load_db", + "Whether to load DB or not, if DB not loaded dissector is passive", + "Whether to load the Data base or not, not loading the DB " + "dissaables the protocol, Wireshar has to be restarted for the" + "setting to take effect ", + &global_tpncp_load_db); prefs_register_uint_preference(tpncp_module, "tcp.trunkpack_port", "TPNCP \"well-known\" TrunkPack TCP Port", @@ -865,3 +865,16 @@ void proto_register_tpncp(void) { "TPNCP \"well-known\" TrunkPack UDP Port", "", 10, &global_tpncp_trunkpack_udp_port); } + +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ |