diff options
42 files changed, 201 insertions, 291 deletions
diff --git a/Makefile.am b/Makefile.am index aef364b222..028e1c7da7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.652 2003/11/16 23:11:17 sahlberg Exp $ +# $Id: Makefile.am,v 1.653 2003/11/16 23:17:14 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -709,7 +709,6 @@ noinst_HEADERS = \ packet-sll.h \ packet-smb-browse.h \ packet-smb-common.h \ - packet-smb-logon.h \ packet-smb-mailslot.h \ packet-smb-pipe.h \ packet-smb-sidsnooping.h \ diff --git a/disabled_protos.c b/disabled_protos.c index f2cb3ce9ec..bb3c68e840 100644 --- a/disabled_protos.c +++ b/disabled_protos.c @@ -1,7 +1,7 @@ /* disabled_protos.c * Code for reading and writing the disabled protocols file. * - * $Id: disabled_protos.c,v 1.2 2003/08/07 01:05:06 guy Exp $ + * $Id: disabled_protos.c,v 1.3 2003/11/16 23:17:15 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -272,6 +272,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return) gchar *ff_path, *ff_path_new, *ff_name; FILE *ff; gint i; + protocol_t *protocol; void *cookie; *pref_path_return = NULL; /* assume no error */ @@ -302,7 +303,8 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return) continue; } - if (proto_is_protocol_enabled(i)) { + protocol = find_protocol_by_id(i); + if (proto_is_protocol_enabled(protocol)) { continue; } diff --git a/epan/packet.c b/epan/packet.c index bc15ec865f..b99cbd5c5e 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.97 2003/09/09 18:09:42 guy Exp $ + * $Id: packet.c,v 1.98 2003/11/16 23:17:24 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -339,7 +339,7 @@ struct dissector_handle { dissector_t old; new_dissector_t new; } dissector; - int proto_index; + protocol_t *protocol; }; static int @@ -351,9 +351,9 @@ call_dissector_through_handle(dissector_handle_t handle, tvbuff_t *tvb, saved_proto = pinfo->current_proto; - if (handle->proto_index != -1) { + if (handle->protocol != NULL) { pinfo->current_proto = - proto_get_protocol_short_name(handle->proto_index); + proto_get_protocol_short_name(handle->protocol); } if (handle->is_new) @@ -399,8 +399,8 @@ call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb, volatile address save_src; volatile address save_dst; - if (handle->proto_index != -1 && - !proto_is_protocol_enabled(handle->proto_index)) { + if (handle->protocol != NULL && + !proto_is_protocol_enabled(handle->protocol)) { /* * The protocol isn't enabled. */ @@ -419,9 +419,9 @@ call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb, * offers this service can use it. */ pinfo->can_desegment = saved_can_desegment-(saved_can_desegment>0); - if (handle->proto_index != -1) { + if (handle->protocol != NULL) { pinfo->current_proto = - proto_get_protocol_short_name(handle->proto_index); + proto_get_protocol_short_name(handle->protocol); } if (pinfo->in_error_pkt) { @@ -1103,7 +1103,7 @@ dissector_table_foreach_func (gpointer key, gpointer value, gpointer user_data) dtbl_entry = value; if (dtbl_entry->current == NULL || - dtbl_entry->current->proto_index == -1) { + dtbl_entry->current->protocol == NULL) { /* * Either there is no dissector for this entry, or * the dissector doesn't have a protocol associated @@ -1362,7 +1362,7 @@ static GHashTable *heur_dissector_lists = NULL; typedef struct { heur_dissector_t dissector; - int proto_index; + protocol_t *protocol; } heur_dtbl_entry_t; /* Finds a heuristic dissector table by field name. */ @@ -1384,7 +1384,7 @@ heur_dissector_add(const char *name, heur_dissector_t dissector, int proto) dtbl_entry = g_malloc(sizeof (heur_dtbl_entry_t)); dtbl_entry->dissector = dissector; - dtbl_entry->proto_index = proto; + dtbl_entry->protocol = find_protocol_by_id(proto); /* do the table insertion */ *sub_dissectors = g_slist_append(*sub_dissectors, (gpointer)dtbl_entry); @@ -1413,17 +1413,17 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, for (entry = sub_dissectors; entry != NULL; entry = g_slist_next(entry)) { pinfo->can_desegment = saved_can_desegment-(saved_can_desegment>0); dtbl_entry = (heur_dtbl_entry_t *)entry->data; - if (dtbl_entry->proto_index != -1 && - !proto_is_protocol_enabled(dtbl_entry->proto_index)) { + if (dtbl_entry->protocol != NULL && + !proto_is_protocol_enabled(dtbl_entry->protocol)) { /* * No - don't try this dissector. */ continue; } - if (dtbl_entry->proto_index != -1) { + if (dtbl_entry->protocol != NULL) { pinfo->current_proto = - proto_get_protocol_short_name(dtbl_entry->proto_index); + proto_get_protocol_short_name(dtbl_entry->protocol); } if ((*dtbl_entry->dissector)(tvb, pinfo, tree)) { status = TRUE; @@ -1469,14 +1469,14 @@ static GHashTable *registered_dissectors = NULL; char * dissector_handle_get_short_name(dissector_handle_t handle) { - return proto_get_protocol_short_name(handle->proto_index); + return proto_get_protocol_short_name(handle->protocol); } /* Get the index of the protocol for a dissector handle. */ int dissector_handle_get_protocol_index(dissector_handle_t handle) { - return handle->proto_index; + return proto_get_id(handle->protocol); } /* Find a registered dissector by name. */ @@ -1497,7 +1497,7 @@ create_dissector_handle(dissector_t dissector, int proto) handle->name = NULL; handle->is_new = FALSE; handle->dissector.old = dissector; - handle->proto_index = proto; + handle->protocol = find_protocol_by_id(proto); return handle; } @@ -1511,7 +1511,7 @@ new_create_dissector_handle(new_dissector_t dissector, int proto) handle->name = NULL; handle->is_new = TRUE; handle->dissector.new = dissector; - handle->proto_index = proto; + handle->protocol = find_protocol_by_id(proto); return handle; } @@ -1535,7 +1535,7 @@ register_dissector(const char *name, dissector_t dissector, int proto) handle->name = name; handle->is_new = FALSE; handle->dissector.old = dissector; - handle->proto_index = proto; + handle->protocol = find_protocol_by_id(proto); g_hash_table_insert(registered_dissectors, (gpointer)name, (gpointer) handle); @@ -1559,7 +1559,7 @@ new_register_dissector(const char *name, new_dissector_t dissector, int proto) handle->name = name; handle->is_new = TRUE; handle->dissector.new = dissector; - handle->proto_index = proto; + handle->protocol = find_protocol_by_id(proto); g_hash_table_insert(registered_dissectors, (gpointer)name, (gpointer) handle); @@ -1579,7 +1579,7 @@ call_dissector(dissector_handle_t handle, tvbuff_t *tvb, * it. Just dissect this packet as data. */ g_assert(data_handle != NULL); - g_assert(data_handle->proto_index != -1); + g_assert(data_handle->protocol != NULL); call_dissector(data_handle, tvb, pinfo, tree); return tvb_length(tvb); } diff --git a/epan/proto.c b/epan/proto.c index 23d14ebd7b..8e1aa05e04 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -1,7 +1,7 @@ /* proto.c * Routines for protocol tree * - * $Id: proto.c,v 1.102 2003/11/13 23:38:33 guy Exp $ + * $Id: proto.c,v 1.103 2003/11/16 23:17:24 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -128,7 +128,7 @@ static int g_strcmp(gconstpointer a, gconstpointer b); int hf_text_only = -1; /* Structure for information about a protocol */ -typedef struct { +struct _protocol { char *name; /* long description */ char *short_name; /* short description */ char *filter_name; /* name of this protocol in filters */ @@ -137,9 +137,7 @@ typedef struct { GList *last_field; /* pointer to end of list of fields */ gboolean is_enabled; /* TRUE if protocol is enabled */ gboolean can_disable; /* TRUE if protocol can be disabled */ -} protocol_t; - -static protocol_t *find_protocol_by_id(int proto_id); +}; /* List of all protocols */ static GList *protocols; @@ -2199,7 +2197,7 @@ compare_proto_id(gconstpointer proto_arg, gconstpointer id_arg) return (protocol->proto_id == *id_ptr) ? 0 : 1; } -static protocol_t * +protocol_t * find_protocol_by_id(int proto_id) { GList *list_entry; @@ -2219,6 +2217,12 @@ static gint compare_filter_name(gconstpointer proto_arg, return (strcmp(protocol->filter_name, f_name)); } +int +proto_get_id(protocol_t *protocol) +{ + return protocol->proto_id; +} + int proto_get_id_by_filter_name(gchar* filter_name) { GList *list_entry; @@ -2242,13 +2246,10 @@ proto_get_protocol_name(int proto_id) } char * -proto_get_protocol_short_name(int proto_id) +proto_get_protocol_short_name(protocol_t *protocol) { - protocol_t *protocol; - - if (proto_id == -1) + if (protocol == NULL) return "(none)"; - protocol = find_protocol_by_id(proto_id); return protocol->short_name; } @@ -2262,11 +2263,8 @@ proto_get_protocol_filter_name(int proto_id) } gboolean -proto_is_protocol_enabled(int proto_id) +proto_is_protocol_enabled(protocol_t *protocol) { - protocol_t *protocol; - - protocol = find_protocol_by_id(proto_id); return protocol->is_enabled; } diff --git a/epan/proto.h b/epan/proto.h index 610b00e5be..d0a47ff5bb 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -1,7 +1,7 @@ /* proto.h * Definitions for protocol display * - * $Id: proto.h,v 1.42 2003/10/29 23:48:13 guy Exp $ + * $Id: proto.h,v 1.43 2003/11/16 23:17:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -49,12 +49,16 @@ struct _value_string; /* ... and similarly, */ #define TFS(x) (const struct true_false_string*)(x) +struct _protocol; + +typedef struct _protocol protocol_t; + /* check protocol activation */ #define CHECK_DISPLAY_AS_X(x_handle,index, tvb, pinfo, tree) { \ - if (!proto_is_protocol_enabled(index)) { \ - call_dissector(x_handle,tvb, pinfo, tree); \ - return; \ - } \ + if (!proto_is_protocol_enabled(find_protocol_by_id(index))) { \ + call_dissector(x_handle,tvb, pinfo, tree); \ + return; \ + } \ } enum { @@ -98,7 +102,6 @@ typedef struct hf_register_info { header_field_info hfinfo; } hf_register_info; - /* Contains the field information for the proto_item. */ typedef struct field_info { header_field_info *hfinfo; @@ -538,8 +541,8 @@ extern int proto_registrar_get_parent(int n); /* Is item #n a protocol? */ extern gboolean proto_registrar_is_protocol(int n); -/* Is item #n decoding enabled ? */ -extern gboolean proto_is_protocol_enabled(int proto_id); +/* Is protocol's decoding enabled ? */ +extern gboolean proto_is_protocol_enabled(protocol_t *protocol); /* Can item #n decoding be disabled? */ extern gboolean proto_can_disable_protocol(int proto_id); @@ -552,14 +555,20 @@ extern int proto_get_next_protocol(void **cookie); extern header_field_info *proto_get_first_protocol_field(int proto_id, void **cookle); extern header_field_info *proto_get_next_protocol_field(void **cookle); -/* Given a protocol's filter_name, return it's proto_id */ +/* Given a protocol's "protocol_t", return its proto_id */ +extern int proto_get_id(protocol_t *protocol); + +/* Given a protocol's filter_name, return its proto_id */ extern int proto_get_id_by_filter_name(gchar* filter_name); +/* Given a protocol's item number, find the "protocol_t" structure for it */ +extern protocol_t *find_protocol_by_id(int proto_id); + /* Given a protocol's item number, return its name. */ extern char *proto_get_protocol_name(int n); -/* Given a protocol's item number, return its short name. */ -extern char *proto_get_protocol_short_name(int proto_id); +/* Given a protocol's "protocol_t", return its short name. */ +extern char *proto_get_protocol_short_name(protocol_t *protocol); /* Given a protocol's item number, return its filter name. */ extern char *proto_get_protocol_filter_name(int proto_id); diff --git a/gtk/dfilter_expr_dlg.c b/gtk/dfilter_expr_dlg.c index 7318583fbb..8eb655b578 100644 --- a/gtk/dfilter_expr_dlg.c +++ b/gtk/dfilter_expr_dlg.c @@ -7,7 +7,7 @@ * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> and * Guy Harris <guy@alum.mit.edu> * - * $Id: dfilter_expr_dlg.c,v 1.42 2003/10/29 23:15:35 guy Exp $ + * $Id: dfilter_expr_dlg.c,v 1.43 2003/11/16 23:17:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1093,6 +1093,7 @@ dfilter_expr_dlg_new(GtkWidget *filter_te) GtkWidget *list_bb, *alignment, *accept_bt, *close_bt; header_field_info *hfinfo; int i; + protocol_t *protocol; #if GTK_MAJOR_VERSION < 2 int len; void *cookie; @@ -1306,7 +1307,8 @@ dfilter_expr_dlg_new(GtkWidget *filter_te) hfinfo = proto_registrar_get_nth(i); /* Create a node for the protocol, and remember it for later use. */ - name = proto_get_protocol_short_name(i); /* name, short_name or filter name ? */ + protocol = find_protocol_by_id(i); + name = proto_get_protocol_short_name(protocol); /* name, short_name or filter name ? */ protocol_node = gtk_ctree_insert_node(GTK_CTREE(tree), NULL, NULL, &name, 5, @@ -1381,7 +1383,8 @@ dfilter_expr_dlg_new(GtkWidget *filter_te) char *strp, str[TAG_STRING_LEN+1]; hfinfo = proto_registrar_get_nth(i); - name = proto_get_protocol_short_name(i); /* name, short_name or filter name ? */ + protocol = find_protocol_by_id(i); + name = proto_get_protocol_short_name(protocol); /* name, short_name or filter name ? */ gtk_tree_store_append(store, &iter, NULL); gtk_tree_store_set(store, &iter, 0, name, 1, hfinfo, -1); diff --git a/gtk/help_dlg.c b/gtk/help_dlg.c index b48a67040f..c139d74632 100644 --- a/gtk/help_dlg.c +++ b/gtk/help_dlg.c @@ -1,6 +1,6 @@ /* help_dlg.c * - * $Id: help_dlg.c,v 1.35 2003/08/25 21:42:33 guy Exp $ + * $Id: help_dlg.c,v 1.36 2003/11/16 23:17:26 guy Exp $ * * Laurent Deniel <laurent.deniel@free.fr> * @@ -420,6 +420,7 @@ static void set_help_text(GtkWidget *w, help_type_t type) #endif const char *type_name; void *cookie, *cookie2; + protocol_t *protocol; char *name, *short_name, *filter_name; int namel = 0, short_namel = 0, filter_namel = 0; int count, fcount; @@ -449,8 +450,9 @@ static void set_help_text(GtkWidget *w, help_type_t type) for (i = proto_get_first_protocol(&cookie); i != -1; i = proto_get_next_protocol(&cookie)) { count++; + protocol = find_protocol_by_id(i); name = proto_get_protocol_name(i); - short_name = proto_get_protocol_short_name(i); + short_name = proto_get_protocol_short_name(protocol); filter_name = proto_get_protocol_filter_name(i); if ((len = strlen(name)) > namel) namel = len; @@ -473,8 +475,9 @@ static void set_help_text(GtkWidget *w, help_type_t type) /* ok, display the correctly aligned strings */ for (i = proto_get_first_protocol(&cookie); i != -1; i = proto_get_next_protocol(&cookie)) { + protocol = find_protocol_by_id(i); name = proto_get_protocol_name(i); - short_name = proto_get_protocol_short_name(i); + short_name = proto_get_protocol_short_name(protocol); filter_name = proto_get_protocol_filter_name(i); /* the name used for sorting in the left column */ @@ -535,8 +538,9 @@ static void set_help_text(GtkWidget *w, help_type_t type) fcount = 0; for (i = proto_get_first_protocol(&cookie); i != -1; i = proto_get_next_protocol(&cookie)) { + protocol = find_protocol_by_id(i); name = proto_get_protocol_name(i); - short_name = proto_get_protocol_short_name(i); + short_name = proto_get_protocol_short_name(protocol); filter_name = proto_get_protocol_filter_name(i); count = 0; diff --git a/gtk/proto_dlg.c b/gtk/proto_dlg.c index 1477bb0c2e..7c54f08d94 100644 --- a/gtk/proto_dlg.c +++ b/gtk/proto_dlg.c @@ -1,6 +1,6 @@ /* proto_dlg.c * - * $Id: proto_dlg.c,v 1.26 2003/08/07 00:41:28 guy Exp $ + * $Id: proto_dlg.c,v 1.27 2003/11/16 23:17:26 guy Exp $ * * Laurent Deniel <laurent.deniel@free.fr> * @@ -501,8 +501,10 @@ set_proto_selection(GtkWidget *parent_w _U_) for (entry = protocol_list; entry != NULL; entry = g_slist_next(entry)) { protocol_data_t *p = entry->data; + protocol_t *protocol; - if (proto_is_protocol_enabled(p->hfinfo_index) != p->enabled) { + protocol = find_protocol_by_id(p->hfinfo_index); + if (proto_is_protocol_enabled(protocol) != p->enabled) { proto_set_decoding(p->hfinfo_index, p->enabled); need_redissect = TRUE; } @@ -523,8 +525,10 @@ revert_proto_selection(void) */ for (entry = protocol_list; entry != NULL; entry = g_slist_next(entry)) { protocol_data_t *p = entry->data; + protocol_t *protocol; - if (proto_is_protocol_enabled(p->hfinfo_index) != p->was_enabled) { + protocol = find_protocol_by_id(p->hfinfo_index); + if (proto_is_protocol_enabled(protocol) != p->was_enabled) { proto_set_decoding(p->hfinfo_index, p->was_enabled); need_redissect = TRUE; } @@ -553,6 +557,7 @@ show_proto_selection(GtkListStore *proto_store) GSList *entry; gint i; void *cookie; + protocol_t *protocol; protocol_data_t *p; #if GTK_MAJOR_VERSION < 2 gchar *proto_text[3]; @@ -564,10 +569,11 @@ show_proto_selection(GtkListStore *proto_store) i = proto_get_next_protocol(&cookie)) { if (proto_can_disable_protocol(i)) { p = g_malloc(sizeof(protocol_data_t)); + protocol = find_protocol_by_id(i); p->name = proto_get_protocol_name(i); - p->abbrev = proto_get_protocol_short_name(i); + p->abbrev = proto_get_protocol_short_name(protocol); p->hfinfo_index = i; - p->enabled = proto_is_protocol_enabled(i); + p->enabled = proto_is_protocol_enabled(protocol); p->was_enabled = p->enabled; protocol_list = g_slist_insert_sorted(protocol_list, p, protocol_data_compare); diff --git a/packet-alcap.c b/packet-alcap.c index ae90a787fd..cf40b82a3c 100644 --- a/packet-alcap.c +++ b/packet-alcap.c @@ -6,7 +6,7 @@ * Copyright 2003, Michael Lum <mlum [AT] telostech.com> * In association with Telos Technology Inc. * - * $Id: packet-alcap.c,v 1.3 2003/10/06 19:25:20 guy Exp $ + * $Id: packet-alcap.c,v 1.4 2003/11/16 23:17:15 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1666,12 +1666,6 @@ dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *alcap_item; proto_tree *alcap_tree = NULL; - if (!proto_is_protocol_enabled(proto_alcap)) - { - call_dissector(data_handle,tvb, pinfo, tree); - return; - } - g_pinfo = pinfo; /* diff --git a/packet-ansi_637.c b/packet-ansi_637.c index 88fbc3cddc..36f0ea4eb4 100644 --- a/packet-ansi_637.c +++ b/packet-ansi_637.c @@ -9,7 +9,7 @@ * Short Message Service * 3GPP2 C.S0015-0 TIA/EIA-637-A * - * $Id: packet-ansi_637.c,v 1.2 2003/10/22 20:59:01 guy Exp $ + * $Id: packet-ansi_637.c,v 1.3 2003/11/16 23:17:15 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1674,12 +1674,6 @@ dissect_ansi_637_tele(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *ansi_637_tree = NULL; gchar *str = NULL; - if (!proto_is_protocol_enabled(proto_ansi_637_tele)) - { - call_dissector(data_handle,tvb, pinfo, tree); - return; - } - if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, ansi_proto_name_short); @@ -1792,12 +1786,6 @@ dissect_ansi_637_trans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 oct; guint8 len; - if (!proto_is_protocol_enabled(proto_ansi_637_trans)) - { - call_dissector(data_handle,tvb, pinfo, tree); - return; - } - if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, ansi_proto_name_short); diff --git a/packet-ansi_683.c b/packet-ansi_683.c index 6b8e05aa00..b87ae2bb50 100644 --- a/packet-ansi_683.c +++ b/packet-ansi_683.c @@ -4,7 +4,7 @@ * Copyright 2003, Michael Lum <mlum [AT] telostech.com> * In association with Telos Technology Inc. * - * $Id: packet-ansi_683.c,v 1.2 2003/10/23 00:16:20 guy Exp $ + * $Id: packet-ansi_683.c,v 1.3 2003/11/16 23:17:16 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -2029,12 +2029,6 @@ dissect_ansi_683(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *ansi_683_item; proto_tree *ansi_683_tree = NULL; - if (!proto_is_protocol_enabled(proto_ansi_683)) - { - call_dissector(data_handle,tvb, pinfo, tree); - return; - } - g_pinfo = pinfo; if (check_col(pinfo->cinfo, COL_PROTOCOL)) diff --git a/packet-ansi_a.c b/packet-ansi_a.c index c85042918c..1f9643ac9f 100644 --- a/packet-ansi_a.c +++ b/packet-ansi_a.c @@ -10,7 +10,7 @@ * 2000 Access Network Interfaces * 3GPP2 A.S0001-1 TIA/EIA-2001 * - * $Id: packet-ansi_a.c,v 1.9 2003/11/11 05:51:09 guy Exp $ + * $Id: packet-ansi_a.c,v 1.10 2003/11/16 23:17:16 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -7979,13 +7979,6 @@ dissect_bsmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *bsmap_tree = NULL; gchar *str; - - if (!proto_is_protocol_enabled(proto_a_bsmap)) - { - call_dissector(data_handle, tvb, pinfo, tree); - return; - } - if (check_col(pinfo->cinfo, COL_INFO)) { col_append_str(pinfo->cinfo, COL_INFO, "(BSMAP) "); @@ -8081,13 +8074,6 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *oct_1_tree = NULL; gchar *str; - - if (!proto_is_protocol_enabled(proto_a_dtap)) - { - call_dissector(data_handle, tvb, pinfo, tree); - return; - } - len = tvb_length(tvb); if (len < 3) diff --git a/packet-ansi_map.c b/packet-ansi_map.c index 407539f4a9..0141aa1d1a 100644 --- a/packet-ansi_map.c +++ b/packet-ansi_map.c @@ -79,7 +79,7 @@ * UIM * 3GPP2 N.S0003 * - * $Id: packet-ansi_map.c,v 1.9 2003/11/11 05:54:06 guy Exp $ + * $Id: packet-ansi_map.c,v 1.10 2003/11/16 23:17:16 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -13171,12 +13171,6 @@ dissect_ansi_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ASN1_SCK asn1; int offset = 0; - if (!proto_is_protocol_enabled(proto_ansi_map)) - { - call_dissector(data_handle, tvb, pinfo, tree); - return; - } - g_pinfo = pinfo; /* diff --git a/packet-atalk.c b/packet-atalk.c index 05d9a317d4..6ede79e757 100644 --- a/packet-atalk.c +++ b/packet-atalk.c @@ -2,7 +2,7 @@ * Routines for AppleTalk packet disassembly: LLAP, DDP, NBP, ATP, ASP, * RTMP. * - * $Id: packet-atalk.c,v 1.90 2003/09/21 20:05:59 gerald Exp $ + * $Id: packet-atalk.c,v 1.91 2003/11/16 23:17:16 guy Exp $ * * Simon Wilkinson <sxw@dcs.ed.ac.uk> * @@ -73,6 +73,7 @@ static int hf_ddp_dst_socket = -1; static int hf_ddp_src_socket = -1; static int hf_ddp_type = -1; +static dissector_handle_t ddp_handle; /* -------------------------------------- * ATP protocol parameters @@ -1691,18 +1692,18 @@ dissect_llap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) new_tvb = tvb_new_subset(tvb, 3, -1, -1); - if (proto_is_protocol_enabled(proto_ddp)) { - pinfo->current_proto = "DDP"; - switch (type) { + switch (type) { - case 0x01: + case 0x01: + if (proto_is_protocol_enabled(find_protocol_by_id(proto_ddp))) { + pinfo->current_proto = "DDP"; dissect_ddp_short(new_tvb, pinfo, dnode, snode, tree); return; + } - case 0x02: - dissect_ddp(new_tvb, pinfo, tree); + case 0x02: + if (call_dissector(ddp_handle, new_tvb, pinfo, tree)) return; - } } call_dissector(data_handle,new_tvb, pinfo, tree); } @@ -2254,7 +2255,7 @@ proto_register_atalk(void) void proto_reg_handoff_atalk(void) { - dissector_handle_t ddp_handle, nbp_handle, rtmp_request_handle; + dissector_handle_t nbp_handle, rtmp_request_handle; dissector_handle_t atp_handle; dissector_handle_t zip_ddp_handle; dissector_handle_t rtmp_data_handle, llap_handle; diff --git a/packet-clnp.c b/packet-clnp.c index aa1311048f..14c5c726bc 100644 --- a/packet-clnp.c +++ b/packet-clnp.c @@ -1,7 +1,7 @@ /* packet-clnp.c * Routines for ISO/OSI network and transport protocol packet disassembly * - * $Id: packet-clnp.c,v 1.78 2003/10/06 20:46:50 guy Exp $ + * $Id: packet-clnp.c,v 1.79 2003/11/16 23:17:17 guy Exp $ * Laurent Deniel <laurent.deniel@free.fr> * Ralf Schneider <Ralf.Schneider@t-online.de> * @@ -1621,7 +1621,7 @@ static gboolean dissect_ositp_internal(tvbuff_t *tvb, packet_info *pinfo, gboolean is_cltp = FALSE; gboolean subdissector_found = FALSE; - if (!proto_is_protocol_enabled(proto_cotp)) + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_cotp))) return FALSE; /* COTP has been disabled */ /* XXX - what about CLTP? */ diff --git a/packet-dcerpc.c b/packet-dcerpc.c index 31030733e0..0963a06191 100644 --- a/packet-dcerpc.c +++ b/packet-dcerpc.c @@ -3,7 +3,7 @@ * Copyright 2001, Todd Sabin <tas@webspan.net> * Copyright 2003, Tim Potter <tpot@samba.org> * - * $Id: packet-dcerpc.c,v 1.154 2003/11/13 23:13:51 guy Exp $ + * $Id: packet-dcerpc.c,v 1.155 2003/11/16 23:17:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -603,9 +603,10 @@ dcerpc_init_uuid (int proto, int ett, e_uuid_t *uuid, guint16 ver, key->uuid = *uuid; key->ver = ver; - value->proto = proto; + value->proto = find_protocol_by_id(proto); + value->proto_id = proto; value->ett = ett; - value->name = proto_get_protocol_short_name (proto); + value->name = proto_get_protocol_short_name (value->proto); value->procs = procs; value->opnum_hf = opnum_hf; @@ -1809,7 +1810,7 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, if (tree) { proto_item *sub_item; - sub_item = proto_tree_add_item (tree, sub_proto->proto, tvb, 0, + sub_item = proto_tree_add_item (tree, sub_proto->proto_id, tvb, 0, -1, FALSE); if (sub_item) { diff --git a/packet-dcerpc.h b/packet-dcerpc.h index d21888b2a9..20568f76a0 100644 --- a/packet-dcerpc.h +++ b/packet-dcerpc.h @@ -2,7 +2,7 @@ * Copyright 2001, Todd Sabin <tas@webspan.net> * Copyright 2003, Tim Potter <tpot@samba.org> * - * $Id: packet-dcerpc.h,v 1.36 2003/10/10 11:11:37 sahlberg Exp $ + * $Id: packet-dcerpc.h,v 1.37 2003/11/16 23:17:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -280,7 +280,8 @@ typedef struct _dcerpc_uuid_key { } dcerpc_uuid_key; typedef struct _dcerpc_uuid_value { - int proto; + protocol_t *proto; + int proto_id; int ett; gchar *name; dcerpc_sub_dissector *procs; diff --git a/packet-dvmrp.c b/packet-dvmrp.c index 7158d4f7d4..dbbb89dfb7 100644 --- a/packet-dvmrp.c +++ b/packet-dvmrp.c @@ -1,7 +1,7 @@ /* packet-dvmrp.c 2001 Ronnie Sahlberg <See AUTHORS for email> * Routines for IGMP/DVMRP packet disassembly * - * $Id: packet-dvmrp.c,v 1.13 2002/08/28 21:00:12 jmayer Exp $ + * $Id: packet-dvmrp.c,v 1.14 2003/11/16 23:17:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -621,7 +621,7 @@ dissect_dvmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int of proto_tree *tree; proto_item *item; - if (!proto_is_protocol_enabled(proto_dvmrp)) { + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_dvmrp))) { /* we are not enabled, skip entire packet to be nice to the igmp layer. (so clicking on IGMP will display the data) */ diff --git a/packet-fcip.c b/packet-fcip.c index 5cc7bef5bf..9406096717 100644 --- a/packet-fcip.c +++ b/packet-fcip.c @@ -2,7 +2,7 @@ * Routines for FCIP dissection * Copyright 2001, Dinesh G Dutt (ddutt@cisco.com) * - * $Id: packet-fcip.c,v 1.8 2003/10/30 02:06:11 guy Exp $ + * $Id: packet-fcip.c,v 1.9 2003/11/16 23:17:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -388,9 +388,6 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *fcip_tree = NULL; tvbuff_t *next_tvb; - if (!proto_is_protocol_enabled(proto_fcip)) - return FALSE; /* iSCSI has been disabled */ - if (bytes_remaining < FCIP_ENCAP_HEADER_LEN) { return FALSE; } diff --git a/packet-giop.c b/packet-giop.c index 263968bed2..49de0bfdc4 100644 --- a/packet-giop.c +++ b/packet-giop.c @@ -9,7 +9,7 @@ * Frank Singleton <frank.singleton@ericsson.com> * Trevor Shepherd <eustrsd@am1.ericsson.se> * - * $Id: packet-giop.c,v 1.72 2003/03/05 15:33:12 gerald Exp $ + * $Id: packet-giop.c,v 1.73 2003/11/16 23:17:18 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1073,7 +1073,7 @@ void register_giop_user_module(giop_sub_dissector_t *sub, gchar *name, gchar *mo module_val->subh->sub_name = name; /* save dissector name */ module_val->subh->sub_fn = sub; /* save subdissector*/ - module_val->subh->sub_proto = sub_proto; /* save subdissector's proto_XXX value */ + module_val->subh->sub_proto = find_protocol_by_id(sub_proto); /* save protocol_t for subdissector's protocol */ g_hash_table_insert(giop_module_hash, new_module_key, module_val); @@ -1440,7 +1440,7 @@ void register_giop_user(giop_sub_dissector_t *sub, gchar *name, int sub_proto) { subh->sub_name = name; subh->sub_fn = sub; - subh->sub_proto = sub_proto; /* proto_XXX from sub dissectors's proto_register_protocol() */ + subh->sub_proto = find_protocol_by_id(sub_proto); /* protocol_t for sub dissectors's proto_register_protocol() */ giop_sub_list = g_slist_append (giop_sub_list, subh); diff --git a/packet-giop.h b/packet-giop.h index ad4d67eaee..96a63a5aff 100644 --- a/packet-giop.h +++ b/packet-giop.h @@ -4,7 +4,7 @@ * * Based on CORBAv2.4.2 Chapter 15 GIOP Description. * - * $Id: packet-giop.h,v 1.10 2002/08/28 21:00:13 jmayer Exp $ + * $Id: packet-giop.h,v 1.11 2003/11/16 23:17:18 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -106,7 +106,7 @@ typedef gboolean (giop_sub_dissector_t)(tvbuff_t *, packet_info *, proto_tree *, typedef struct giop_sub_handle { giop_sub_dissector_t *sub_fn; /* ptr to sub dissector function */ gchar *sub_name; /* subdissector string name */ - int sub_proto; /* proto_XXX value from proto_register_protocol() */ + protocol_t *sub_proto; /* protocol_t for subprotocol */ } giop_sub_handle_t; /* Main GIOP entry point */ diff --git a/packet-gsm_a.c b/packet-gsm_a.c index b5022c1319..da130b0660 100644 --- a/packet-gsm_a.c +++ b/packet-gsm_a.c @@ -38,7 +38,7 @@ * Formats and coding * (3GPP TS 24.080 version 4.3.0 Release 4) * - * $Id: packet-gsm_a.c,v 1.5 2003/11/09 22:41:55 guy Exp $ + * $Id: packet-gsm_a.c,v 1.6 2003/11/16 23:17:18 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -10169,12 +10169,6 @@ dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gchar *str; - if (!proto_is_protocol_enabled(proto_a_rp)) - { - call_dissector(data_handle, tvb, pinfo, tree); - return; - } - if (check_col(pinfo->cinfo, COL_INFO)) { col_append_str(pinfo->cinfo, COL_INFO, "(RP) "); @@ -10271,12 +10265,6 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gchar *str; - if (!proto_is_protocol_enabled(proto_a_bssmap)) - { - call_dissector(data_handle, tvb, pinfo, tree); - return; - } - if (check_col(pinfo->cinfo, COL_INFO)) { col_append_str(pinfo->cinfo, COL_INFO, "(BSSMAP) "); @@ -10380,12 +10368,6 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int hf_idx; - if (!proto_is_protocol_enabled(proto_a_dtap)) - { - call_dissector(data_handle, tvb, pinfo, tree); - return; - } - len = tvb_length(tvb); if (len < 2) diff --git a/packet-gsm_sms.c b/packet-gsm_sms.c index 29f8b5f959..f8b963074b 100644 --- a/packet-gsm_sms.c +++ b/packet-gsm_sms.c @@ -11,7 +11,7 @@ * Technical realization of Short Message Service (SMS) * (3GPP TS 23.040 version 5.4.0 Release 5) * - * $Id: packet-gsm_sms.c,v 1.3 2003/10/30 11:54:21 guy Exp $ + * $Id: packet-gsm_sms.c,v 1.4 2003/11/16 23:17:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -2554,12 +2554,6 @@ dissect_gsm_sms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint ett_msg_idx; - if (!proto_is_protocol_enabled(proto_gsm_sms)) - { - call_dissector(data_handle,tvb, pinfo, tree); - return; - } - g_pinfo = pinfo; if (check_col(pinfo->cinfo, COL_PROTOCOL)) diff --git a/packet-gssapi.c b/packet-gssapi.c index 3be922300b..643cbb1069 100644 --- a/packet-gssapi.c +++ b/packet-gssapi.c @@ -4,7 +4,7 @@ * Copyright 2002, Richard Sharpe <rsharpe@samba.org> Added a few * bits and pieces ... * - * $Id: packet-gssapi.c,v 1.27 2003/07/16 04:20:32 tpot Exp $ + * $Id: packet-gssapi.c,v 1.28 2003/11/16 23:17:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -84,7 +84,7 @@ gssapi_init_oid(char *oid, int proto, int ett, dissector_handle_t handle, char *key = g_strdup(oid); gssapi_oid_value *value = g_malloc(sizeof(*value)); - value->proto = proto; + value->proto = find_protocol_by_id(proto); value->ett = ett; value->handle = handle; value->wrap_handle = wrap_handle; diff --git a/packet-gssapi.h b/packet-gssapi.h index 105261e778..f55f20998f 100644 --- a/packet-gssapi.h +++ b/packet-gssapi.h @@ -2,7 +2,7 @@ * Dissector for GSS-API tokens as described in rfc2078, section 3.1 * Copyright 2002, Tim Potter <tpot@samba.org> * - * $Id: packet-gssapi.h,v 1.8 2002/11/28 06:48:41 guy Exp $ + * $Id: packet-gssapi.h,v 1.9 2003/11/16 23:17:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -29,7 +29,7 @@ /* Structures needed outside */ typedef struct _gssapi_oid_value { - int proto; + protocol_t *proto; int ett; dissector_handle_t handle; dissector_handle_t wrap_handle; diff --git a/packet-iscsi.c b/packet-iscsi.c index a4531f7465..bc3d083f89 100644 --- a/packet-iscsi.c +++ b/packet-iscsi.c @@ -2,7 +2,7 @@ * Routines for iSCSI dissection * Copyright 2001, Eurologic and Mark Burton <markb@ordern.com> * - * $Id: packet-iscsi.c,v 1.47 2003/09/09 09:54:13 sahlberg Exp $ + * $Id: packet-iscsi.c,v 1.48 2003/11/16 23:17:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1626,9 +1626,6 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec guint offset = 0; guint32 available_bytes = tvb_length_remaining(tvb, offset); - if (!proto_is_protocol_enabled(proto_iscsi)) - return FALSE; /* iSCSI has been disabled */ - /* quick check to see if the packet is long enough to contain the * minimum amount of information we need */ if (available_bytes < 48 && (!iscsi_desegment || available_bytes < 8)) { diff --git a/packet-mrdisc.c b/packet-mrdisc.c index 525fab1fa2..c0975730db 100644 --- a/packet-mrdisc.c +++ b/packet-mrdisc.c @@ -1,7 +1,7 @@ /* packet-mrdisc.c 2001 Ronnie Sahlberg <See AUTHORS for email> * Routines for IGMP/MRDISC packet disassembly * - * $Id: packet-mrdisc.c,v 1.9 2002/08/28 21:00:22 jmayer Exp $ + * $Id: packet-mrdisc.c,v 1.10 2003/11/16 23:17:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -188,7 +188,7 @@ dissect_mrdisc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int o proto_item *item; guint8 type; - if (!proto_is_protocol_enabled(proto_mrdisc)) { + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_mrdisc))) { /* we are not enabled, skip entire packet to be nice to the igmp layer. (so clicking on IGMP will display the data) */ diff --git a/packet-msnip.c b/packet-msnip.c index 7a1a93fa2f..40d0dcd222 100644 --- a/packet-msnip.c +++ b/packet-msnip.c @@ -1,7 +1,7 @@ /* packet-msnip.c 2001 Ronnie Sahlberg <See AUTHORS for email> * Routines for IGMP/MSNIP packet disassembly * - * $Id: packet-msnip.c,v 1.8 2002/08/28 21:00:22 jmayer Exp $ + * $Id: packet-msnip.c,v 1.9 2003/11/16 23:17:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -222,7 +222,7 @@ dissect_msnip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int of proto_item *item; guint8 type; - if (!proto_is_protocol_enabled(proto_msnip)) { + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_msnip))) { /* we are not enabled, skip entire packet to be nice to the igmp layer. (so clicking on IGMP will display the data) */ diff --git a/packet-pim.c b/packet-pim.c index e629f41f63..c86d4eadd1 100644 --- a/packet-pim.c +++ b/packet-pim.c @@ -2,7 +2,7 @@ * Routines for PIM disassembly * (c) Copyright Jun-ichiro itojun Hagino <itojun@itojun.org> * - * $Id: packet-pim.c,v 1.45 2003/10/17 21:27:34 guy Exp $ + * $Id: packet-pim.c,v 1.46 2003/11/16 23:17:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -113,7 +113,7 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *pimopt_tree = NULL; proto_item *tiopt; - if (!proto_is_protocol_enabled(proto_pim)) { + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_pim))) { /* * We are not enabled; skip entire packet to be nice to the * IGMP layer (so clicking on IGMP will display the data). diff --git a/packet-ppp.c b/packet-ppp.c index d77ef8a92b..75fcea0592 100644 --- a/packet-ppp.c +++ b/packet-ppp.c @@ -2,7 +2,7 @@ * Routines for ppp packet disassembly * RFC 1661, RFC 1662 * - * $Id: packet-ppp.c,v 1.116 2003/08/26 06:18:18 guy Exp $ + * $Id: packet-ppp.c,v 1.117 2003/11/16 23:17:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -2357,11 +2357,10 @@ dissect_cp( tvbuff_t *tvb, int proto_id, int proto_subtree_index, if(check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, - proto_get_protocol_short_name(proto_id)); + proto_get_protocol_short_name(find_protocol_by_id(proto_id))); if(check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", - proto_get_protocol_short_name(proto_id), + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(code, proto_vals, "Unknown")); if(tree) { @@ -2604,12 +2603,10 @@ dissect_bap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) length = tvb_get_ntohs(tvb, 2); if(check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, - proto_get_protocol_short_name(proto_bap)); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP BAP"); if(check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", - proto_get_protocol_short_name(proto_bap), + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, bap_vals, "Unknown")); if(tree) { @@ -2652,13 +2649,10 @@ dissect_comp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *comp_data_tree; if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, - proto_get_protocol_short_name(proto_comp_data)); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP Comp"); if(check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", - proto_get_protocol_short_name(proto_comp_data), - val_to_str(PPP_COMP, ppp_vals, "Unknown")); + col_set_str(pinfo->cinfo, COL_INFO, "Compressed data"); if (tree) { ti = proto_tree_add_item(tree, proto_comp_data, tvb, 0, -1, FALSE); @@ -2982,12 +2976,10 @@ dissect_pap( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) { length = tvb_get_ntohs(tvb, 2); if(check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, - proto_get_protocol_short_name(proto_pap)); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP PAP"); if(check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", - proto_get_protocol_short_name(proto_pap), + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(code, pap_vals, "Unknown")); if(tree) { @@ -3082,12 +3074,10 @@ dissect_chap( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) { length = tvb_get_ntohs(tvb, 2); if(check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, - proto_get_protocol_short_name(proto_chap)); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP CHAP"); if(check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", - proto_get_protocol_short_name(proto_chap), + col_add_str(pinfo->cinfo, COL_INFO, val_to_str(code, chap_vals, "Unknown")); if(tree) { diff --git a/packet-rpc.c b/packet-rpc.c index c2a44bc5d2..ea19cd0a04 100644 --- a/packet-rpc.c +++ b/packet-rpc.c @@ -2,7 +2,7 @@ * Routines for rpc dissection * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de> * - * $Id: packet-rpc.c,v 1.138 2003/09/05 10:26:42 sahlberg Exp $ + * $Id: packet-rpc.c,v 1.139 2003/11/16 23:17:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -387,9 +387,10 @@ rpc_init_prog(int proto, guint32 prog, int ett) key->prog = prog; value = (rpc_prog_info_value *) g_malloc(sizeof(rpc_prog_info_value)); - value->proto = proto; + value->proto = find_protocol_by_id(proto); + value->proto_id = proto; value->ett = ett; - value->progname = proto_get_protocol_short_name(proto); + value->progname = proto_get_protocol_short_name(value->proto); value->procedure_hfs = g_array_new(FALSE, TRUE, sizeof (int)); g_hash_table_insert(rpc_progs,key,value); @@ -1649,7 +1650,8 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, flavor_t flavor = FLAVOR_UNKNOWN; unsigned int gss_proc = 0; unsigned int gss_svc = 0; - int proto = 0; + protocol_t *proto = NULL; + int proto_id = 0; int ett = 0; int procedure_hf; @@ -1846,6 +1848,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* we know already the proto-entry, the ETT-const, and "rpc_prog" */ proto = rpc_prog->proto; + proto_id = rpc_prog->proto_id; ett = rpc_prog->ett; progname = rpc_prog->progname; @@ -2131,12 +2134,14 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rpc_prog_key.prog = prog; if ((rpc_prog = g_hash_table_lookup(rpc_progs,&rpc_prog_key)) == NULL) { - proto = 0; + proto = NULL; + proto_id = 0; ett = 0; progname = "Unknown"; } else { proto = rpc_prog->proto; + proto_id = rpc_prog->proto_id; ett = rpc_prog->ett; progname = rpc_prog->progname; @@ -2339,7 +2344,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* create here the program specific sub-tree */ if (tree && (flavor != FLAVOR_AUTHGSSAPI_MSG)) { - pitem = proto_tree_add_item(tree, proto, tvb, offset, -1, + pitem = proto_tree_add_item(tree, proto_id, tvb, offset, -1, FALSE); if (pitem) { ptree = proto_item_add_subtree(pitem, ett); diff --git a/packet-rpc.h b/packet-rpc.h index b01f2b469a..2a26246db7 100644 --- a/packet-rpc.h +++ b/packet-rpc.h @@ -1,6 +1,6 @@ /* packet-rpc.h * - * $Id: packet-rpc.h,v 1.43 2003/09/05 10:26:43 sahlberg Exp $ + * $Id: packet-rpc.h,v 1.44 2003/11/16 23:17:21 guy Exp $ * * (c) 1999 Uwe Girlich * @@ -163,7 +163,8 @@ typedef struct _rpc_prog_info_key { } rpc_prog_info_key; typedef struct _rpc_prog_info_value { - int proto; + protocol_t *proto; + int proto_id; int ett; char* progname; GArray *procedure_hfs; diff --git a/packet-smb-browse.c b/packet-smb-browse.c index 9f5f424f3c..2c864f0030 100644 --- a/packet-smb-browse.c +++ b/packet-smb-browse.c @@ -2,7 +2,7 @@ * Routines for SMB Browser packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-smb-browse.c,v 1.32 2003/09/03 20:58:09 guy Exp $ + * $Id: packet-smb-browse.c,v 1.33 2003/11/16 23:17:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -563,7 +563,7 @@ dissect_smb_server_type_flags(tvbuff_t *tvb, int offset, packet_info *pinfo, } -gboolean +static gboolean dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { int offset = 0; @@ -577,12 +577,6 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr int i; guint32 uptime; - if (!proto_is_protocol_enabled(proto_smb_browse)) { - return FALSE; - } - - pinfo->current_proto = "BROWSER"; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "BROWSER"); } @@ -820,7 +814,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr * * XXX - what other browser packets go out to that mailslot? */ -gboolean +static gboolean dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { int offset = 0; @@ -831,12 +825,6 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr const char *host_name; guint namelen; - if (!proto_is_protocol_enabled(proto_smb_browse)) { - return FALSE; - } - - pinfo->current_proto = "BROWSER"; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "BROWSER"); } @@ -1175,4 +1163,9 @@ proto_register_smb_browse(void) proto_register_field_array(proto_smb_browse, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + new_register_dissector("mailslot_browse", dissect_mailslot_browse, + proto_smb_browse); + new_register_dissector("mailslot_lanman", dissect_mailslot_lanman, + proto_smb_browse); } diff --git a/packet-smb-browse.h b/packet-smb-browse.h index 546af5a1b2..136668347e 100644 --- a/packet-smb-browse.h +++ b/packet-smb-browse.h @@ -2,7 +2,7 @@ * Declaration of routines for SMB Browser packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-smb-browse.h,v 1.6 2003/02/17 01:59:39 tpot Exp $ + * $Id: packet-smb-browse.h,v 1.7 2003/11/16 23:17:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -26,12 +26,6 @@ #ifndef _PACKET_SMB_BROWSE_H_ #define _PACKET_SMB_BROWSE_H_ -gboolean -dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree); - -gboolean -dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree); - int dissect_smb_server_type_flags(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, char *drep, diff --git a/packet-smb-logon.c b/packet-smb-logon.c index a927de74f7..b995af6eab 100644 --- a/packet-smb-logon.c +++ b/packet-smb-logon.c @@ -2,7 +2,7 @@ * Routines for SMB net logon packet dissection * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet-smb-logon.c,v 1.34 2003/06/12 08:33:30 guy Exp $ + * $Id: packet-smb-logon.c,v 1.35 2003/11/16 23:17:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -26,7 +26,6 @@ */ #include "packet-smb-common.h" -#include "packet-smb-logon.h" static int proto_smb_logon = -1; static int hf_command = -1; @@ -815,7 +814,7 @@ static int (*dissect_smb_logon_cmds[])(tvbuff_t *tvb, packet_info *pinfo, proto_ }; -gboolean +static gboolean dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; @@ -823,11 +822,6 @@ dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *smb_logon_tree = NULL; proto_item *item = NULL; - if (!proto_is_protocol_enabled(proto_smb_logon)) - return FALSE; - - pinfo->current_proto = "NETLOGON"; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "NETLOGON"); if (check_col(pinfo->cinfo, COL_INFO)) @@ -1035,4 +1029,6 @@ proto_register_smb_logon( void) proto_register_field_array(proto_smb_logon, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + new_register_dissector("netlogon", dissect_smb_logon, proto_smb_logon); } diff --git a/packet-smb-logon.h b/packet-smb-logon.h deleted file mode 100644 index 525cb6af98..0000000000 --- a/packet-smb-logon.h +++ /dev/null @@ -1,32 +0,0 @@ -/* packet-smb-logon.h - * Declaration of outines for SMB net logon packet dissection - * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> - * - * $Id: packet-smb-logon.h,v 1.3 2002/08/28 21:00:31 jmayer Exp $ - * - * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@ethereal.com> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef _PACKET_SMB_LOGON_H_ -#define _PACKET_SMB_LOGON_H_ - -gboolean -dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - -#endif diff --git a/packet-smb-mailslot.c b/packet-smb-mailslot.c index a99def1937..ce33a8d922 100644 --- a/packet-smb-mailslot.c +++ b/packet-smb-mailslot.c @@ -2,7 +2,7 @@ * Routines for SMB mailslot packet dissection * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet-smb-mailslot.c,v 1.33 2002/08/28 21:00:31 jmayer Exp $ + * $Id: packet-smb-mailslot.c,v 1.34 2003/11/16 23:17:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -29,7 +29,6 @@ #include "packet-smb-common.h" #include "packet-smb-mailslot.h" #include "packet-smb-browse.h" -#include "packet-smb-logon.h" #include "packet-smb-pipe.h" static int proto_smb_msp = -1; @@ -41,6 +40,9 @@ static int hf_name = -1; static int ett_smb_msp = -1; +static dissector_handle_t mailslot_browse_handle; +static dissector_handle_t mailslot_lanman_handle; +static dissector_handle_t netlogon_handle; static dissector_handle_t data_handle; #define MAILSLOT_UNKNOWN 0 @@ -85,7 +87,7 @@ dissect_mailslot_smb(tvbuff_t *mshdr_tvb, tvbuff_t *setup_tvb, int len; gboolean dissected; - if (!proto_is_protocol_enabled(proto_smb_msp)) { + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_smb_msp))) { return FALSE; } pinfo->current_proto = "SMB Mailslot"; @@ -185,15 +187,18 @@ dissect_mailslot_smb(tvbuff_t *mshdr_tvb, tvbuff_t *setup_tvb, dissected = FALSE; switch(trans_subcmd){ case MAILSLOT_BROWSE: - dissected = dissect_mailslot_browse(tvb, pinfo, parent_tree); + dissected = call_dissector(mailslot_browse_handle, tvb, pinfo, + parent_tree); break; case MAILSLOT_LANMAN: - dissected = dissect_mailslot_lanman(tvb, pinfo, parent_tree); + dissected = call_dissector(mailslot_lanman_handle, tvb, pinfo, + parent_tree); break; case MAILSLOT_NET: case MAILSLOT_TEMP_NETLOGON: case MAILSLOT_MSSP: - dissected = dissect_smb_logon(tvb, pinfo, parent_tree); + dissected = call_dissector(netlogon_handle, tvb, pinfo, + parent_tree); break; } if (!dissected) { @@ -247,5 +252,8 @@ proto_register_smb_mailslot(void) void proto_reg_handoff_smb_mailslot(void) { + mailslot_browse_handle = find_dissector("mailslot_browse"); + mailslot_lanman_handle = find_dissector("mailslot_lanman"); + netlogon_handle = find_dissector("netlogon"); data_handle = find_dissector("data"); } diff --git a/packet-smb-pipe.c b/packet-smb-pipe.c index a5946de45c..3062ce6db4 100644 --- a/packet-smb-pipe.c +++ b/packet-smb-pipe.c @@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets * significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and * Guy Harris 2001 * - * $Id: packet-smb-pipe.c,v 1.96 2003/09/03 20:58:09 guy Exp $ + * $Id: packet-smb-pipe.c,v 1.97 2003/11/16 23:17:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -2598,7 +2598,7 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, proto_item *data_item; proto_tree *data_tree; - if (!proto_is_protocol_enabled(proto_smb_lanman)) + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_smb_lanman))) return FALSE; if (smb_info->request && p_tvb == NULL) { /* @@ -3494,7 +3494,7 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb, int fid = -1; guint16 info_level; - if (!proto_is_protocol_enabled(proto_smb_pipe)) + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_smb_pipe))) return FALSE; pinfo->current_proto = "SMB Pipe"; diff --git a/packet-snmp.c b/packet-snmp.c index b8b9b4f08d..19026b8cdb 100644 --- a/packet-snmp.c +++ b/packet-snmp.c @@ -10,7 +10,7 @@ * * See RFCs 2570-2576 for SNMPv3 * - * $Id: packet-snmp.c,v 1.122 2003/11/02 23:12:31 gerald Exp $ + * $Id: packet-snmp.c,v 1.123 2003/11/16 23:17:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1653,7 +1653,7 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, - proto_get_protocol_short_name(proto)); + proto_get_protocol_short_name(find_protocol_by_id(proto))); } if (tree) { diff --git a/packet-tpkt.c b/packet-tpkt.c index 34396e32be..708191be80 100644 --- a/packet-tpkt.c +++ b/packet-tpkt.c @@ -7,7 +7,7 @@ * Routine to dissect RFC 1006 TPKT packet containing OSI TP PDU * Copyright 2001, Martin Thomas <Martin_A_Thomas@yahoo.com> * - * $Id: packet-tpkt.c,v 1.22 2002/08/28 21:00:36 jmayer Exp $ + * $Id: packet-tpkt.c,v 1.23 2003/11/16 23:17:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -77,7 +77,7 @@ is_tpkt(tvbuff_t *tvb, int min_len) * If TPKT is disabled, don't dissect it, just return -1, meaning * "this isn't TPKT". */ - if (!proto_is_protocol_enabled(proto_tpkt)) + if (!proto_is_protocol_enabled(find_protocol_by_id(proto_tpkt))) return -1; /* There should at least be 4 bytes left in the frame */ diff --git a/plugins/plugin_api_list.c b/plugins/plugin_api_list.c index 8a43c57868..6ee9e95338 100644 --- a/plugins/plugin_api_list.c +++ b/plugins/plugin_api_list.c @@ -1,7 +1,7 @@ /* plugin_api_list.c * Used to generate various included files for plugin API * - * $Id: plugin_api_list.c,v 1.14 2003/11/11 06:10:07 guy Exp $ + * $Id: plugin_api_list.c,v 1.15 2003/11/16 23:17:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -84,7 +84,7 @@ void tcp_dissect_pdus(tvbuff_t *, packet_info *, proto_tree *, gboolean, guint, guint (*)(tvbuff_t *, int), void (*)(tvbuff_t *, packet_info *, proto_tree *)); -gboolean proto_is_protocol_enabled(int); +gboolean proto_is_protocol_enabled(protocol_t *); int proto_item_get_len(proto_item*); void proto_item_set_len(proto_item*, gint); @@ -262,7 +262,7 @@ gchar* abs_time_to_str(nstime_t*); int proto_get_id_by_filter_name(gchar* filter_name); char *proto_get_protocol_name(int n); -char *proto_get_protocol_short_name(int proto_id); +char *proto_get_protocol_short_name(protocol_t *); char *proto_get_protocol_filter_name(int proto_id); void prefs_register_obsolete_preference(module_t *, const char *); @@ -1,7 +1,7 @@ /* prefs.c * Routines for handling preferences * - * $Id: prefs.c,v 1.112 2003/11/09 01:36:21 guy Exp $ + * $Id: prefs.c,v 1.113 2003/11/16 23:17:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -245,6 +245,8 @@ module_t *protocols_module; module_t * prefs_register_protocol(int id, void (*apply_cb)(void)) { + protocol_t *protocol; + /* * Have we yet created the "Protocols" subtree? */ @@ -254,9 +256,10 @@ prefs_register_protocol(int id, void (*apply_cb)(void)) */ protocols_module = prefs_register_subtree(NULL, "Protocols"); } + protocol = find_protocol_by_id(id); return prefs_register_module(protocols_module, proto_get_protocol_filter_name(id), - proto_get_protocol_short_name(id), apply_cb); + proto_get_protocol_short_name(protocol), apply_cb); } /* @@ -267,6 +270,7 @@ module_t * prefs_register_protocol_obsolete(int id) { module_t *module; + protocol_t *protocol; /* * Have we yet created the "Protocols" subtree? @@ -277,9 +281,10 @@ prefs_register_protocol_obsolete(int id) */ protocols_module = prefs_register_subtree(NULL, "Protocols"); } + protocol = find_protocol_by_id(id); module = prefs_register_module(protocols_module, proto_get_protocol_filter_name(id), - proto_get_protocol_short_name(id), NULL); + proto_get_protocol_short_name(protocol), NULL); module->obsolete = TRUE; return module; } |