dissectors and that's no longer needed.
svn path=/trunk/; revision=4112
/* conversation.c
* Routines for building lists of packets that are part of a "conversation"
*
- * $Id: conversation.c,v 1.13 2001/09/03 10:33:12 guy Exp $
+ * $Id: conversation.c,v 1.14 2001/10/31 05:59:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
conversation->data_list = NULL;
/* clear dissector pointer */
- conversation->dissector.new_d = NULL;
+ conversation->dissector = NULL;
/* set the options and key pointer */
conversation->options = options;
conv->data_list = g_slist_remove(conv->data_list, item);
}
-/*
- * Set the dissector for a conversation.
- */
-void
-old_conversation_set_dissector(conversation_t *conversation,
- old_dissector_t dissector)
-{
- conversation->is_old_dissector = TRUE;
- conversation->dissector.old_d = dissector;
-}
-
void
conversation_set_dissector(conversation_t *conversation,
dissector_t dissector)
{
- conversation->is_old_dissector = FALSE;
- conversation->dissector.new_d = dissector;
+ conversation->dissector = dissector;
}
/*
port_b, 0);
if (conversation != NULL) {
- if (conversation->is_old_dissector) {
- if (conversation->dissector.old_d == NULL)
- return FALSE;
-
- /*
- * New dissector calling old dissector; use
- * "tvb_compat()" to remap.
- *
- * "is_old_dissector" won't be set unless
- * "dissector.old_d" is set.
- */
- tvb_compat(tvb, &pd, &offset);
- (*conversation->dissector.old_d)(pd, offset, pinfo->fd,
- tree);
- } else {
- if (conversation->dissector.new_d == NULL)
- return FALSE;
- (*conversation->dissector.new_d)(tvb, pinfo, tree);
- }
+ if (conversation->dissector == NULL)
+ return FALSE;
+ (*conversation->dissector)(tvb, pinfo, tree);
return TRUE;
}
return FALSE;
/* conversation.h
* Routines for building lists of packets that are part of a "conversation"
*
- * $Id: conversation.h,v 1.6 2001/09/03 10:33:12 guy Exp $
+ * $Id: conversation.h,v 1.7 2001/10/31 05:59:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
typedef struct conversation {
struct conversation *next; /* pointer to next conversation on hash chain */
- guint32 index; /* unique ID for conversation */
- GSList *data_list; /* list of data associated with conversation */
- gboolean is_old_dissector; /* XXX - nuke when everybody tvbuffified */
- union {
- old_dissector_t old_d;
- dissector_t new_d;
- } dissector; /* protocol dissector client can associate with conversation */
+ guint32 index; /* unique ID for conversation */
+ GSList *data_list; /* list of data associated with conversation */
+ dissector_t dissector; /* protocol dissector client can associate with conversation */
guint options; /* wildcard flags */
conversation_key *key_ptr; /* pointer to the key for this conversation */
} conversation_t;
void *conversation_get_proto_data(conversation_t *conv, int proto);
void conversation_delete_proto_data(conversation_t *conv, int proto);
-void old_conversation_set_dissector(conversation_t *conversation,
- old_dissector_t dissector);
void conversation_set_dissector(conversation_t *conversation,
dissector_t dissector);
gboolean
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.36 2001/06/29 09:46:54 guy Exp $
+ * $Id: packet.c,v 1.37 2001/10/31 05:59:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
static GHashTable *dissector_tables = NULL;
-/*
- * XXX - for now, we support having both "old" dissectors, with packet
- * data pointer, packet offset, frame_data pointer, and protocol tree
- * pointer arguments, and "new" dissectors, with tvbuff pointer,
- * packet_info pointer, and protocol tree pointer arguments.
- *
- * Nuke this and go back to storing a pointer to the dissector when
- * the last old-style dissector is gone.
- */
typedef struct {
- gboolean is_old_dissector;
- union {
- old_dissector_t old;
- dissector_t new;
- } dissector;
- int proto_index;
+ dissector_t dissector;
+ int proto_index;
} dissector_entry_t;
struct dtbl_entry {
return g_hash_table_lookup( dissector_tables, name );
}
-/* add an entry, lookup the dissector table for the specified field name, */
-/* if a valid table found, add the subdissector */
-void
-old_dissector_add(const char *name, guint32 pattern, old_dissector_t dissector,
- int proto)
-{
- dissector_table_t sub_dissectors = find_dissector_table( name);
- dtbl_entry_t *dtbl_entry;
-
-/* sanity check */
- g_assert( sub_dissectors);
-
- dtbl_entry = g_malloc(sizeof (dtbl_entry_t));
- dtbl_entry->current.is_old_dissector = TRUE;
- dtbl_entry->current.dissector.old = dissector;
- dtbl_entry->current.proto_index = proto;
- dtbl_entry->initial = dtbl_entry->current;
- proto_set_protocol_dissector(proto, dissector);
-
-/* do the table insertion */
- g_hash_table_insert( sub_dissectors, GUINT_TO_POINTER( pattern),
- (gpointer)dtbl_entry);
-}
-
void
dissector_add(const char *name, guint32 pattern, dissector_t dissector,
int proto)
g_assert( sub_dissectors);
dtbl_entry = g_malloc(sizeof (dtbl_entry_t));
- dtbl_entry->current.is_old_dissector = FALSE;
- dtbl_entry->current.dissector.new = dissector;
+ dtbl_entry->current.dissector = dissector;
dtbl_entry->current.proto_index = proto;
dtbl_entry->initial = dtbl_entry->current;
proto_set_protocol_dissector(proto, dissector);
void
dissector_change(const char *name, guint32 pattern, dissector_t dissector,
- gboolean old, int proto)
+ int proto)
{
dissector_table_t sub_dissectors = find_dissector_table( name);
dtbl_entry_t *dtbl_entry;
dtbl_entry = g_hash_table_lookup(sub_dissectors,
GUINT_TO_POINTER(pattern));
if (dtbl_entry != NULL) {
- dtbl_entry->current.is_old_dissector = old;
- dtbl_entry->current.dissector.new = dissector ? dissector : dissect_null;
+ dtbl_entry->current.dissector = dissector ? dissector : dissect_null;
dtbl_entry->current.proto_index = proto;
return;
}
return;
dtbl_entry = g_malloc(sizeof (dtbl_entry_t));
- dtbl_entry->initial.is_old_dissector = FALSE;
- dtbl_entry->initial.dissector.old = NULL;
dtbl_entry->initial.proto_index = -1;
- dtbl_entry->current.is_old_dissector = old;
- dtbl_entry->current.dissector.new = dissector;
+ dtbl_entry->current.dissector = dissector;
dtbl_entry->current.proto_index = proto;
/* do the table insertion */
(gpointer)dtbl_entry);
}
+/* Reset a dissector in a sub-dissector table to its initial value. */
void
dissector_reset(const char *name, guint32 pattern)
{
/*
* Found - is there an initial value?
*/
- if (dtbl_entry->initial.dissector.new != NULL) {
+ if (dtbl_entry->initial.dissector != NULL) {
dtbl_entry->current = dtbl_entry->initial;
} else {
g_hash_table_remove(sub_dissectors, GUINT_TO_POINTER(pattern));
saved_proto = pinfo->current_proto;
saved_match_port = pinfo->match_port;
pinfo->match_port = port;
- if (dtbl_entry->current.is_old_dissector) {
- /*
- * New dissector calling old dissector; use
- * "tvb_compat()" to remap.
- */
- tvb_compat(tvb, &pd, &offset);
- (*dtbl_entry->current.dissector.old)(pd, offset, pinfo->fd,
- tree);
- } else {
- if (dtbl_entry->current.proto_index != -1) {
- pinfo->current_proto =
- proto_get_protocol_short_name(dtbl_entry->current.proto_index);
- }
- (*dtbl_entry->current.dissector.new)(tvb, pinfo, tree);
+ if (dtbl_entry->current.proto_index != -1) {
+ pinfo->current_proto =
+ proto_get_protocol_short_name(dtbl_entry->current.proto_index);
}
+ (*dtbl_entry->current.dissector)(tvb, pinfo, tree);
pinfo->current_proto = saved_proto;
pinfo->match_port = saved_match_port;
return TRUE;
return FALSE;
}
-gboolean
-dissector_get_old_flag (dtbl_entry_t *dtbl_entry)
-{
- g_assert(dtbl_entry);
- return(dtbl_entry->current.is_old_dissector);
-}
-
gint
dissector_get_proto (dtbl_entry_t *dtbl_entry)
{
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.35 2001/06/29 09:46:54 guy Exp $
+ * $Id: packet.h,v 1.36 2001/10/31 05:59:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
#ifndef __PACKET_H__
#define __PACKET_H__
/* Useful when highlighting regions inside a dissect_*() function. With this
* macro, you can highlight from an arbitrary offset to the end of the
* packet (which may come before the end of the frame).
- * See old_dissect_data() for an example.
+ * See the SMB dissector for an example.
+ * XXX - this goes when the SMB dissector is fully tvbuffified.
*/
#define END_OF_FRAME (pi.captured_len - offset)
/* Opaque structure - provides type checking but no access to components */
typedef struct dtbl_entry dtbl_entry_t;
-gboolean dissector_get_old_flag (dtbl_entry_t *entry);
gint dissector_get_proto (dtbl_entry_t * entry);
gint dissector_get_initial_proto (dtbl_entry_t * entry);
void dissector_table_foreach_changed (char *name, DATFunc func, gpointer user_data);
/* Add a sub-dissector to a dissector table. Called by the protocol routine */
/* that wants to register a sub-dissector. */
-void old_dissector_add(const char *abbrev, guint32 pattern,
- old_dissector_t dissector, int proto);
void dissector_add(const char *abbrev, guint32 pattern,
dissector_t dissector, int proto);
/* that wants to de-register a sub-dissector. */
void dissector_delete(const char *name, guint32 pattern, dissector_t dissector);
-/* Reset a dissector in a sub-dissector table to its initial value. */
void dissector_change(const char *abbrev, guint32 pattern,
- dissector_t dissector, gboolean old, int proto);
+ dissector_t dissector, int proto);
+
+/* Reset a dissector in a sub-dissector table to its initial value. */
void dissector_reset(const char *name, guint32 pattern);
/* Look for a given port in a given dissector table and, if found, call
*/
void dissect_packet(tvbuff_t **p_tvb, union wtap_pseudo_header *pseudo_header,
const u_char *pd, frame_data *fd, proto_tree *tree);
-void old_dissect_data(const u_char *, int, frame_data *, proto_tree *);
void dissect_data(tvbuff_t *tvb, int, packet_info *pinfo, proto_tree *tree);
/* proto.h
* Definitions for protocol display
*
- * $Id: proto.h,v 1.17 2001/09/14 07:10:10 guy Exp $
+ * $Id: proto.h,v 1.18 2001/10/31 05:59:19 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#define TFS(x) (struct true_false_string*)(x)
/* check protocol activation */
-#define OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree) {\
- if (!proto_is_protocol_enabled(index)) { \
- old_dissect_data(pd, offset, fd, tree); \
- return; \
- } \
- }
-
#define CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree) { \
if (!proto_is_protocol_enabled(index)) { \
dissect_data(tvb, 0, pinfo, tree); \
/* decode_as_dlg.c
*
- * $Id: decode_as_dlg.c,v 1.10 2001/08/21 07:03:50 guy Exp $
+ * $Id: decode_as_dlg.c,v 1.11 2001/10/31 05:59:20 guy Exp $
*
* Routines to modify dissector tables on the fly.
*
* 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.
- *
*/
#ifdef HAVE_CONFIG_H
*/
#define E_CLIST_S_PROTO_NAME 0
#define E_CLIST_S_TABLE 1
-#define E_CLIST_S_ISOLD 2
/* The following is for debugging in decode_add_to_clist */
-#define E_CLIST_S_ISCONV 3
+#define E_CLIST_S_ISCONV 2
#define E_CLIST_S_MAX E_CLIST_S_ISCONV
#define E_CLIST_S_COLUMNS (E_CLIST_S_MAX + 1)
decode_change_one_dissector (gchar *table_name, gint selector, GtkCList *clist)
{
dissector_t dissector;
- gboolean old;
- gchar *abbrev, *oldstring;
+ gchar *abbrev;
gint row, proto_num;
if (!clist->selection) {
proto_num = -1;
abbrev = "(NULL)";
- old = FALSE;
dissector = NULL;
} else {
row = GPOINTER_TO_INT(clist->selection->data);
proto_num = GPOINTER_TO_INT(gtk_clist_get_row_data(clist, row));
gtk_clist_get_text(clist, row, E_CLIST_S_PROTO_NAME, &abbrev);
- gtk_clist_get_text(clist, row, E_CLIST_S_ISOLD, &oldstring);
- old = (strcmp(oldstring, "TRUE") == 0);
dissector = proto_get_protocol_dissector(proto_num);
if ((proto_num != -1) && (dissector == NULL)) {
simple_dialog(ESD_TYPE_CRIT, NULL,
if (strcmp(abbrev, "(default)") == 0) {
dissector_reset(table_name, selector);
} else {
- dissector_change(table_name, selector, dissector, old, proto_num);
+ dissector_change(table_name, selector, dissector, proto_num);
}
}
row = GPOINTER_TO_INT(clist->selection->data);
gtk_clist_get_text(clist, row, E_CLIST_S_PROTO_NAME, &text[E_CLIST_S_PROTO_NAME]);
gtk_clist_get_text(clist, row, E_CLIST_S_TABLE, &text[E_CLIST_S_TABLE]);
- gtk_clist_get_text(clist, row, E_CLIST_S_ISOLD, &text[E_CLIST_S_ISOLD]);
proto_num = GPOINTER_TO_INT(gtk_clist_get_row_data(clist, row));
- sprintf(string, "%s clist row %d: proto %d, name %s, table %s, old %s",
+ sprintf(string, "%s clist row %d: proto %d, name %s, table %s",
leadin, row, proto_num, text[E_CLIST_S_PROTO_NAME],
- text[E_CLIST_S_TABLE], text[E_CLIST_S_ISOLD]);
+ text[E_CLIST_S_TABLE]);
} else {
sprintf(string, "%s clist row (none), aka do not decode", leadin);
}
gpointer value, gpointer user_data)
{
GtkCList *clist;
- gchar *proto_name, *isold, *isconv;
+ gchar *proto_name, *isconv;
gchar *text[E_CLIST_S_COLUMNS];
gint proto, row;
decode_build_clist_info_t *info;
clist = info->clist;
if (info->conv) {
proto = conv_dissector_get_proto(value);
- isold = "FALSE";
isconv = "TRUE";
} else {
proto = dissector_get_proto(value);
- isold = dissector_get_old_flag(value) ? "TRUE" : "FALSE";
isconv = "FALSE";
}
proto_name = proto_get_protocol_short_name(proto);
text[E_CLIST_S_PROTO_NAME] = proto_name;
text[E_CLIST_S_TABLE] = table_name;
- text[E_CLIST_S_ISOLD] = isold;
text[E_CLIST_S_ISCONV] = isconv;
row = gtk_clist_prepend(clist, text);
gtk_clist_set_row_data(clist, row, GINT_TO_POINTER(proto));
GtkWidget **scrolled_win_p)
{
gchar *titles[E_CLIST_S_COLUMNS] = {"Short Name", "Table Name",
- "Is Old", "Is Conversation"};
+ "Is Conversation"};
GtkCList *clist;
GtkWidget *window;
gint column;
text[E_CLIST_S_PROTO_NAME] = "(default)";
text[E_CLIST_S_TABLE] = "(none)";
- text[E_CLIST_S_ISOLD] = "(who cares)";
text[E_CLIST_S_ISCONV] = "(who cares)";
row = gtk_clist_prepend(clist, text);
gtk_clist_set_row_data(clist, row, GINT_TO_POINTER(-1));
* Routines for raw data (default case)
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-data.c,v 1.21 2001/01/03 06:55:27 guy Exp $
+ * $Id: packet-data.c,v 1.22 2001/10/31 05:59:18 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * 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
*/
int proto_data = -1;
-/* Remove this once all dissectors are converted to use tvbuffs */
-void
-old_dissect_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
-{
- if (IS_DATA_IN_FRAME(offset) && tree) {
- proto_tree_add_protocol_format(tree, proto_data, NullTVB, offset,
- END_OF_FRAME, "Data (%d byte%s)", END_OF_FRAME,
- plurality(END_OF_FRAME, "", "s"));
- }
-}
-
void
dissect_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
* Routines for socks versions 4 &5 packet dissection
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
- * $Id: packet-socks.c,v 1.26 2001/10/30 10:40:38 guy Exp $
+ * $Id: packet-socks.c,v 1.27 2001/10/31 05:59:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
col_append_str(pinfo->fd, COL_INFO, ", Results");
if ( tree){
- proto_tree_add_text(tree, tvb, offset, END_OF_FRAME,
+ proto_tree_add_text(tree, tvb, offset,
+ tvb_length_remaining(tvb, offset),
(hash_info->command == PING_COMMAND) ?
"Ping Results:" :
"Traceroute Results");