diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-08-12 00:15:40 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-08-12 00:15:40 +0000 |
commit | 2c6e256a872d1252546cefb59bfce7464fa2aa58 (patch) | |
tree | 63965b628fbb6957e1f74557f4024b153354440c | |
parent | eb587ac5f1bf0ef98505a9d2125ccaefdbf02f78 (diff) |
"p_get_proto_data()" should, if it finds an entry, return the pointer
supplied in the "p_add_proto_data()" call that created the entry, not
the pointer to the data structure that holds the protocol and data
arguments to "p_add_proto_data()" (the protocol is uninteresting, as
its value is the value supplied as the "proto" argument to
"p_get_proto_data()".
The "frame_proto_data" structure isn't needed outside the code that
handles it; remove its definition from "packet.h" and put it in
"packet.c".
svn path=/trunk/; revision=2260
-rw-r--r-- | packet.c | 16 | ||||
-rw-r--r-- | packet.h | 7 |
2 files changed, 14 insertions, 9 deletions
@@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.98 2000/08/11 13:34:33 deniel Exp $ + * $Id: packet.c,v 1.99 2000/08/12 00:15:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -107,6 +107,13 @@ static int proto_malformed = -1; static gint ett_frame = -1; +/* Protocol-specific data attched to a frame_data structure - protocol + index and opaque pointer. */ +typedef struct _frame_proto_data { + int proto; + void *proto_data; +} frame_proto_data; + GMemChunk *frame_proto_data_area = NULL; /* @@ -1279,7 +1286,7 @@ p_add_proto_data(frame_data *fd, int proto, void *proto_data) void * p_get_proto_data(frame_data *fd, int proto) { - frame_proto_data temp; + frame_proto_data temp, *p1; GSList *item; temp.proto = proto; @@ -1287,7 +1294,10 @@ p_get_proto_data(frame_data *fd, int proto) item = g_slist_find_custom(fd->pfd, (gpointer *)&temp, p_compare); - if (item) return (void *)item->data; + if (item) { + p1 = (frame_proto_data *)item->data; + return p1->proto_data; + } return NULL; @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.193 2000/08/11 13:34:38 deniel Exp $ + * $Id: packet.h,v 1.194 2000/08/12 00:15:40 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -136,11 +136,6 @@ typedef enum { CHAR_EBCDIC = 1 /* EBCDIC */ } char_enc; -typedef struct _frame_proto_data { - int proto; - void *proto_data; -} frame_proto_data; - /* XXX - some of this stuff is used only while a packet is being dissected; should we keep around a separate data structure for that, to save memory? */ |