diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-10-24 07:27:20 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-10-24 07:27:20 +0000 |
commit | 1d72c68bc61aeffd53dfb73b4f89e510495e5653 (patch) | |
tree | f964a7c43be302b36e2f04cd329ba0d062b31e64 /packet-afs.c | |
parent | da1fdf005fd91fe48fca5857a64d1087dd67ff86 (diff) | |
download | wireshark-1d72c68bc61aeffd53dfb73b4f89e510495e5653.tar.gz wireshark-1d72c68bc61aeffd53dfb73b4f89e510495e5653.tar.bz2 wireshark-1d72c68bc61aeffd53dfb73b4f89e510495e5653.zip |
Export the data structure used to represent a conversation.
Replace "add_to_conversation()" with:
"conversation_new()", which creates a new conversation, given
source and destination addresses and ports, and returns a
pointer to the structure for the conversation;
"find_conversation()", which tries to find a conversation for
given source and destination addresses and ports, and returns a
pointer to the structure for the conversation if found, and a
null pointer if not found.
Add a private data pointer field to the conversation structure, and have
"conversation_new()" take an argument that specifies what to set that
pointer to; that lets clients of the conversation code hang arbitrary
data off the conversation (e.g., a hash table of protocol requests and
replies, in case the protocol is a request/reply protocol wherein the
reply doesn't say what type of request it's a reply to, and you need
that information to dissect the reply).
svn path=/trunk/; revision=920
Diffstat (limited to 'packet-afs.c')
-rw-r--r-- | packet-afs.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/packet-afs.c b/packet-afs.c index 3d0301dc3f..f15b941878 100644 --- a/packet-afs.c +++ b/packet-afs.c @@ -6,7 +6,7 @@ * Portions based on information retrieved from the RX definitions * in Arla, the free AFS client at http://www.stacken.kth.se/project/arla/ * - * $Id: packet-afs.c,v 1.2 1999/10/22 07:17:30 guy Exp $ + * $Id: packet-afs.c,v 1.3 1999/10/24 07:27:18 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -636,6 +636,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) value_string const *vals; int reply = 0; int doffset = 0; + conversation_t *conversation; struct afs_request_key request_key, *new_request_key; struct afs_request_val *request_val; void (*dissector)(const u_char *pd, int offset, @@ -656,8 +657,7 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) port = ((reply == 0) ? pi.destport : pi.srcport ); /* - * Find out what conversation this packet is part of, or add it to a - * new conversation if it's not already part of one. + * Find out what conversation this packet is part of. * XXX - this should really be done by the transport-layer protocol, * although for connectionless transports, we may not want to do that * unless we know some higher-level protocol will want it - or we @@ -669,8 +669,15 @@ dissect_afs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) * packets from A:X to B:Y as being part of the same conversation as * packets from B:Y to A:X. */ - request_key.conversation = add_to_conversation(&pi.src, &pi.dst, - pi.ptype, pi.srcport, pi.destport); + conversation = find_conversation(&pi.src, &pi.dst, pi.ptype, + pi.srcport, pi.destport); + if (conversation == NULL) { + /* It's not part of any conversation - create a new one. */ + conversation = conversation_new(&pi.src, &pi.dst, pi.ptype, + pi.srcport, pi.destport, NULL); + } + + request_key.conversation = conversation->index; request_key.service = ntohs(rxh->serviceId); request_key.callnumber = ntohl(rxh->callNumber); |