diff options
Diffstat (limited to 'epan/dissectors/packet-pgsql.c')
-rw-r--r-- | epan/dissectors/packet-pgsql.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/epan/dissectors/packet-pgsql.c b/epan/dissectors/packet-pgsql.c index d20618d5fe..74e51dabe0 100644 --- a/epan/dissectors/packet-pgsql.c +++ b/epan/dissectors/packet-pgsql.c @@ -25,7 +25,6 @@ #include "config.h" #include <epan/packet.h> -#include <epan/prefs.h> #include "packet-ssl-utils.h" #include "packet-tcp.h" @@ -88,7 +87,7 @@ static int hf_routine = -1; static gint ett_pgsql = -1; static gint ett_values = -1; -static guint pgsql_port = 5432; +#define PGSQL_PORT 5432 static gboolean pgsql_desegment = TRUE; static gboolean first_message = TRUE; @@ -884,36 +883,19 @@ proto_register_pgsql(void) &ett_values }; - module_t *mod_pgsql; - proto_pgsql = proto_register_protocol("PostgreSQL", "PGSQL", "pgsql"); proto_register_field_array(proto_pgsql, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - - mod_pgsql = prefs_register_protocol(proto_pgsql, proto_reg_handoff_pgsql); - prefs_register_uint_preference( - mod_pgsql, "tcp.port", "PGSQL TCP port", "Set the port for PGSQL " - "messages (if different from the default of 5432)", 10, &pgsql_port - ); } void proto_reg_handoff_pgsql(void) { - static gboolean initialized = FALSE; - static guint saved_pgsql_port; - - if (!initialized) { - pgsql_handle = create_dissector_handle(dissect_pgsql, proto_pgsql); - initialized = TRUE; - } else { - dissector_delete_uint("tcp.port", saved_pgsql_port, pgsql_handle); - } + pgsql_handle = create_dissector_handle(dissect_pgsql, proto_pgsql); - dissector_add_uint("tcp.port", pgsql_port, pgsql_handle); - saved_pgsql_port = pgsql_port; + dissector_add_uint_with_preference("tcp.port", PGSQL_PORT, pgsql_handle); - ssl_handle = find_dissector("ssl"); + ssl_handle = find_dissector_add_dependency("ssl", proto_pgsql); } /* |