aboutsummaryrefslogtreecommitdiffstats
path: root/packet-pptp.c
diff options
context:
space:
mode:
authorLaurent Deniel <laurent.deniel@free.fr>2000-08-25 12:30:30 +0000
committerLaurent Deniel <laurent.deniel@free.fr>2000-08-25 12:30:30 +0000
commitf5a09a3f3157bb3e59bbeb19674dbb7114632d8a (patch)
tree728ec703bc95409d6dbbb5d1554459e037a7d86a /packet-pptp.c
parent9cc45a4a10fe6317b5e2a679239313e032e5aca1 (diff)
Add protocol registration (pptp).
Add OLD_CHECK_DISPLAY_AS_DATA(). Add display filters. Check the magic cookie to see if the decoding or frame is correct (in most cases, we probably need TCP reassembly). svn path=/trunk/; revision=2371
Diffstat (limited to 'packet-pptp.c')
-rw-r--r--packet-pptp.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/packet-pptp.c b/packet-pptp.c
index 1dbeba5152..de7a2aaa87 100644
--- a/packet-pptp.c
+++ b/packet-pptp.c
@@ -2,7 +2,7 @@
* Routines for the Point-to-Point Tunnelling Protocol (PPTP) (RFC 2637)
* Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
*
- * $Id: packet-pptp.c,v 1.11 2000/08/07 03:21:01 guy Exp $
+ * $Id: packet-pptp.c,v 1.12 2000/08/25 12:30:30 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -41,10 +41,15 @@
#include <glib.h>
#include "packet.h"
+static int proto_pptp = -1;
+static int hf_pptp_message_type = -1;
+
static gint ett_pptp = -1;
#define TCP_PORT_PPTP 1723
+#define MAGIC_COOKIE 0x1A2B3C4D
+
#define NUM_MSG_TYPES 3
#define msgtype2str(t) \
((t < NUM_MSG_TYPES) ? msgtypestr[t] : "UNKNOWN-MESSAGES-TYPE")
@@ -384,7 +389,9 @@ dissect_pptp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
struct pptp_hdr * hdr = (struct pptp_hdr *)(pd + offset);
guint16 len;
guint16 cntrl_type;
-
+
+ OLD_CHECK_DISPLAY_AS_DATA(proto_pptp, pd, offset, fd, tree);
+
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "PPTP");
@@ -396,10 +403,11 @@ dissect_pptp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
if (IS_DATA_IN_FRAME(offset) && tree) {
guint16 msg_type;
+ guint32 cookie;
proto_item * ti;
proto_tree * pptp_tree;
- ti = proto_tree_add_text(tree, NullTVB, offset, len, "PPTP Control Channel");
+ ti = proto_tree_add_item(tree, proto_pptp, NullTVB, offset, len, FALSE);
pptp_tree = proto_item_add_subtree(ti, ett_pptp);
proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->len),
@@ -407,12 +415,22 @@ dissect_pptp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
offset += sizeof(hdr->len);
msg_type = pntohs(&hdr->type);
- proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->type),
- "Message type: %s (%u)", msgtype2str(msg_type), msg_type);
+ proto_tree_add_uint_format(pptp_tree, hf_pptp_message_type, NullTVB,
+ offset, sizeof(hdr->type),
+ msg_type,
+ "Message type: %s (%u)",
+ msgtype2str(msg_type), msg_type);
+
offset += sizeof(hdr->type);
- proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->cookie),
- "Cookie: %#08x", pntohl(&hdr->cookie));
+ cookie = pntohl(&hdr->cookie);
+
+ if (cookie == MAGIC_COOKIE)
+ proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->cookie),
+ "Cookie: %#08x (correct)", cookie);
+ else
+ proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->cookie),
+ "Cookie: %#08x (incorrect)", cookie);
offset += sizeof(hdr->cookie);
proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->cntrl_type),
@@ -897,6 +915,16 @@ proto_register_pptp(void)
&ett_pptp,
};
+ static hf_register_info hf[] = {
+ { &hf_pptp_message_type,
+ { "Message Type", "pptp.type",
+ FT_UINT16, BASE_HEX, NULL, 0x0,
+ "PPTP message type" }}
+ };
+
+ proto_pptp = proto_register_protocol("Point-to-Point Tunnelling Protocol",
+ "pptp");
+ proto_register_field_array(proto_pptp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}