aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-osi.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2006-09-08 06:58:40 +0000
committerAnders Broman <anders.broman@ericsson.com>2006-09-08 06:58:40 +0000
commitd0ee14432c8e172dfa419a3015ed7b7eedc35d4b (patch)
tree99166a5c728a8057a04ffcee2556dfdc04385b59 /epan/dissectors/packet-osi.c
parentbb8ff68e21fa3156ce467b8d8a38ba33bbecc562 (diff)
Move the code to handle ISO protocols over TCP/TPKT to packet-osi.c where it belongs.
svn path=/trunk/; revision=19180
Diffstat (limited to 'epan/dissectors/packet-osi.c')
-rw-r--r--epan/dissectors/packet-osi.c84
1 files changed, 63 insertions, 21 deletions
diff --git a/epan/dissectors/packet-osi.c b/epan/dissectors/packet-osi.c
index 9bde514dcc..3b9fa3919a 100644
--- a/epan/dissectors/packet-osi.c
+++ b/epan/dissectors/packet-osi.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <ctype.h>
#include <glib.h>
+#include <epan/prefs.h>
#include <epan/packet.h>
#include <epan/llcsaps.h>
#include <epan/aftypes.h>
@@ -42,7 +43,16 @@
#include "packet-osi.h"
#include "packet-isis.h"
#include "packet-esis.h"
+#include "packet-tpkt.h"
+static int proto_osi = -1;
+static dissector_handle_t osi_handle;
+static dissector_handle_t osi_tpkt_handle;
+
+/* Preferences for OSI over TPKT over TCP */
+static gboolean tpkt_desegment = FALSE;
+int global_tcp_port_osi_over_tpkt = 8473;
+int tcp_port_osi_over_tpkt = 8473;
cksum_status_t
calc_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum) {
@@ -227,6 +237,13 @@ static dissector_table_t osinl_subdissector_table;
static dissector_table_t osinl_excl_subdissector_table;
static dissector_handle_t data_handle, ppp_handle;
+/* Dissect OSI over TCP over TPKT */
+static void
+dissect_osi_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ dissect_tpkt_encap(tvb, pinfo, tree, tpkt_desegment, osi_handle);
+}
+
static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint8 nlpid;
@@ -239,7 +256,6 @@ static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* try lookup with the subdissector tables that includes the nlpid */
if (dissector_try_port(osinl_subdissector_table, nlpid, tvb, pinfo, tree))
return;
-
/* try lookup with the subdissector tables that excludes the nlpid */
new_tvb = tvb_new_subset(tvb, 1, -1, -1);
if (dissector_try_port(osinl_excl_subdissector_table, nlpid, new_tvb, pinfo, tree))
@@ -274,13 +290,43 @@ static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} /* dissect_osi */
void
+proto_reg_handoff_osi(void)
+{
+ static int osi_prefs_initialized = FALSE;
+ if (!osi_prefs_initialized) {
+ osi_handle = create_dissector_handle(dissect_osi, proto_osi);
+ dissector_add("llc.dsap", SAP_OSINL1, osi_handle);
+ dissector_add("llc.dsap", SAP_OSINL2, osi_handle);
+ dissector_add("llc.dsap", SAP_OSINL3, osi_handle);
+ dissector_add("llc.dsap", SAP_OSINL4, osi_handle);
+ dissector_add("llc.dsap", SAP_OSINL5, osi_handle);
+ dissector_add("ppp.protocol", PPP_OSI, osi_handle);
+ dissector_add("chdlctype", CHDLCTYPE_OSI, osi_handle);
+ dissector_add("null.type", BSD_AF_ISO, osi_handle);
+ dissector_add("gre.proto", SAP_OSINL5, osi_handle);
+ data_handle = find_dissector("data");
+ ppp_handle = find_dissector("ppp");
+ osi_tpkt_handle = create_dissector_handle(dissect_osi_tpkt, proto_osi);
+ osi_prefs_initialized = TRUE;
+ }else{
+ dissector_delete("tcp.port", tcp_port_osi_over_tpkt, osi_tpkt_handle);
+ }
+
+ tcp_port_osi_over_tpkt = global_tcp_port_osi_over_tpkt;
+ dissector_add("tcp.port", global_tcp_port_osi_over_tpkt, osi_tpkt_handle);
+}
+
+void
proto_register_osi(void)
{
+ module_t *osi_module;
+
/* There's no "OSI" protocol *per se*, but we do register a
dissector table so various protocols running at the
network layer can register themselves.
- all protocols that require inclusion of the NLPID
- should register here */
+ all protocols that require inclusion of the NLPID
+ should register here
+ */
osinl_subdissector_table = register_dissector_table("osinl",
"OSI incl NLPID", FT_UINT8, BASE_HEX);
@@ -289,23 +335,19 @@ proto_register_osi(void)
* (typically non OSI protocols like IP,IPv6,PPP */
osinl_excl_subdissector_table = register_dissector_table("osinl.excl",
"OSI excl NLPID", FT_UINT8, BASE_HEX);
-}
+
+ proto_osi = proto_register_protocol("OSI", "OSI", "osi");
+ /* Preferences how OSI protocols should be dissected */
+ osi_module = prefs_register_protocol(proto_osi, proto_reg_handoff_osi);
+
+ prefs_register_uint_preference(osi_module, "tpkt_port",
+ "TCP port for OSI over TPKT",
+ "TCP port for OSI over TPKT",
+ 10, &global_tcp_port_osi_over_tpkt);
+ prefs_register_bool_preference(osi_module, "tpkt_reassemble",
+ "Reassemble segmented TPKT datagrams",
+ "Whether segmented TPKT datagrams should be reassembled",
+ &tpkt_desegment);
-void
-proto_reg_handoff_osi(void)
-{
- dissector_handle_t osi_handle;
-
- osi_handle = create_dissector_handle(dissect_osi, -1);
- dissector_add("llc.dsap", SAP_OSINL1, osi_handle);
- dissector_add("llc.dsap", SAP_OSINL2, osi_handle);
- dissector_add("llc.dsap", SAP_OSINL3, osi_handle);
- dissector_add("llc.dsap", SAP_OSINL4, osi_handle);
- dissector_add("llc.dsap", SAP_OSINL5, osi_handle);
- dissector_add("ppp.protocol", PPP_OSI, osi_handle);
- dissector_add("chdlctype", CHDLCTYPE_OSI, osi_handle);
- dissector_add("null.type", BSD_AF_ISO, osi_handle);
- dissector_add("gre.proto", SAP_OSINL5, osi_handle);
- data_handle = find_dissector("data");
- ppp_handle = find_dissector("ppp");
}
+