diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-10-20 19:25:48 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-10-20 19:25:48 +0000 |
commit | c4afed7a8c76297863d62d039a5bde638159988d (patch) | |
tree | e9be8f5c2a910b845e35259f58b521d1bc338d74 /packet-laplink.c | |
parent | 2fa083371dc0bf02ae95f48a8704e2d44c35a711 (diff) |
From Brad Hards: support TCP desegmentation.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8738 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-laplink.c')
-rw-r--r-- | packet-laplink.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/packet-laplink.c b/packet-laplink.c index a2fc79e6a9..8ed355f58c 100644 --- a/packet-laplink.c +++ b/packet-laplink.c @@ -2,7 +2,7 @@ * Routines for laplink dissection * Copyright 2003, Brad Hards <bradh@frogmouth.net> * - * $Id: packet-laplink.c,v 1.2 2003/09/05 08:44:52 guy Exp $ + * $Id: packet-laplink.c,v 1.3 2003/10/20 19:25:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -38,6 +38,11 @@ #endif #include <epan/packet.h> +#include <epan/strutil.h> +#include <epan/conversation.h> + +#include "packet-tcp.h" +#include "prefs.h" #define TCP_PORT_LAPLINK 1547 #define UDP_PORT_LAPLINK 1547 @@ -60,7 +65,6 @@ static const value_string laplink_udp_magic[] = { }; static const value_string laplink_tcp_magic[] = { - { 0x00000000, "Null bytes" }, { 0xff08c000, "Unknown TCP query - connection?" }, { 0xff08c200, "Unknown TCP query - connection?" }, { 0xff0bc000, "Unknown TCP query - connection?" }, @@ -75,6 +79,8 @@ static const value_string laplink_tcp_magic[] = { { 0, NULL } }; +static gboolean laplink_desegment = TRUE; + /* Code to actually dissect the packets - UDP */ static gint dissect_laplink_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) @@ -116,7 +122,7 @@ dissect_laplink_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Code to actually dissect the packets - TCP aspects*/ static void -dissect_laplink_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_laplink_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; int length = 0; @@ -147,15 +153,32 @@ dissect_laplink_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(laplink_tree, hf_laplink_tcp_length, tvb, offset, 2, FALSE); offset += 2; - proto_tree_add_item(laplink_tree, hf_laplink_tcp_data, tvb, offset, -1, FALSE); + proto_tree_add_item(laplink_tree, hf_laplink_tcp_data, tvb, offset, length, FALSE); /* Continue adding tree items to process the packet here */ } +/* If this protocol has a sub-dissector call it here, see section 1.8 */ +} +static guint +get_laplink_pdu_len(tvbuff_t *tvb, int offset) +{ + guint plen; + /* + * The length doesn't include the length or ident fields; add those in. + */ + plen = (tvb_get_ntohs(tvb, offset+4) + 2 + 4); + return plen; +} -/* If this protocol has a sub-dissector call it here, see section 1.8 */ +static void +dissect_laplink_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + tcp_dissect_pdus(tvb, pinfo, tree, laplink_desegment, + 6, get_laplink_pdu_len, + dissect_laplink_tcp_pdu); } @@ -199,6 +222,7 @@ proto_register_laplink(void) &ett_laplink, }; + /* Register the protocol name and description */ proto_laplink = proto_register_protocol("Laplink", "Laplink", "laplink"); @@ -206,6 +230,14 @@ proto_register_laplink(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_laplink, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + module_t *laplink_module; + + laplink_module = prefs_register_protocol(proto_laplink, NULL); + prefs_register_bool_preference(laplink_module, "desegment_laplink_over_tcp", + "Desegment all Laplink-over-TCP messages", + "Whether the Laplink dissector should desegment all Laplink-over-TCP messages", + &laplink_desegment); } |