aboutsummaryrefslogtreecommitdiffstats
path: root/packet-pop.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>1999-11-20 23:03:09 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>1999-11-20 23:03:09 +0000
commit7457b4c1b70564a7b72d172151c919e91d268a26 (patch)
tree0d0102e1589037fabe28d7e7c60e4c57e3916146 /packet-pop.c
parentc8f23bce4a7e6fb076581015f7453ab575aa4fd1 (diff)
Patches from Heikki Vatiainen to:
handle replies that may be continued from an earlier TCP segment; not show the argument line in the tree display if the request or response didn't contain an argument. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1080 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-pop.c')
-rw-r--r--packet-pop.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/packet-pop.c b/packet-pop.c
index 59ee2d2e83..5dc5ad57fc 100644
--- a/packet-pop.c
+++ b/packet-pop.c
@@ -2,7 +2,7 @@
* Routines for pop packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
- * $Id: packet-pop.c,v 1.10 1999/11/16 11:42:46 guy Exp $
+ * $Id: packet-pop.c,v 1.11 1999/11/20 23:03:09 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -49,6 +49,8 @@ static int hf_pop_request = -1;
static gint ett_pop = -1;
+static gboolean is_continuation(const u_char *data);
+
void
dissect_pop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
@@ -80,11 +82,19 @@ dissect_pop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
}
if (check_col(fd, COL_PROTOCOL))
- col_add_str(fd, COL_PROTOCOL, "POP");
+ col_add_str(fd, COL_PROTOCOL, "POP");
if (check_col(fd, COL_INFO)) {
-
- col_add_fstr(fd, COL_INFO, "%s: %s %s", (pi.match_port == pi.destport)? "Request" : "Response", rr, rd);
+ /*
+ * Do it like HTTP does.
+ * Put the first line from the buffer into the summary,
+ * if it's an POP request or reply.
+ * Otherwise, just call it a continuation.
+ */
+ if (pi.match_port == pi.srcport && is_continuation(pd+offset))
+ col_add_str(fd, COL_INFO, "Continuation");
+ else
+ col_add_fstr(fd, COL_INFO, "%s: %s %s", (pi.match_port == pi.destport)? "Request" : "Response", rr, rd);
}
if (tree) {
@@ -96,14 +106,21 @@ dissect_pop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
proto_tree_add_item_hidden(pop_tree, hf_pop_request, offset, i1, TRUE);
proto_tree_add_text(pop_tree, offset, i1, "Request: %s", rr);
- proto_tree_add_text(pop_tree, offset + i1 + 1, END_OF_FRAME, "Request Arg: %s", rd);
+ if (strlen(rd) != 0)
+ proto_tree_add_text(pop_tree, offset + i1 + 1, END_OF_FRAME, "Request Arg: %s", rd);
}
else {
proto_tree_add_item_hidden(pop_tree, hf_pop_response, offset, i1, TRUE);
- proto_tree_add_text(pop_tree, offset, i1, "Response: %s", rr);
- proto_tree_add_text(pop_tree, offset + i1 + 1, END_OF_FRAME, "Response Arg: %s", rd);
+ if (is_continuation(pd+offset))
+ dissect_data(pd, offset, fd, pop_tree);
+ else {
+ proto_tree_add_text(pop_tree, offset, i1, "Response: %s", rr);
+
+ if (strlen(rd) != 0)
+ proto_tree_add_text(pop_tree, offset + i1 + 1, END_OF_FRAME, "Response Arg: %s", rd);
+ }
}
}
@@ -132,3 +149,14 @@ proto_register_pop(void)
proto_register_field_array(proto_pop, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
+
+static gboolean is_continuation(const u_char *data)
+{
+ if (strncmp(data, "+OK", strlen("+OK")) == 0)
+ return FALSE;
+
+ if (strncmp(data, "-ERR", strlen("-ERR")) == 0)
+ return FALSE;
+
+ return TRUE;
+}