aboutsummaryrefslogtreecommitdiffstats
path: root/packet-x25.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-12-05 08:43:26 +0000
committerGuy Harris <guy@alum.mit.edu>2001-12-05 08:43:26 +0000
commit15816babc10e8080908bf90d64bb37306e2fbd60 (patch)
treeca0afc3d28df49b1b855761cab4cecb737594643 /packet-x25.c
parent6b253331f087fbecb5de5e4548fbbe644d19b7af (diff)
Add a heuristic dissector for protocols running atop X.25.
svn path=/trunk/; revision=4336
Diffstat (limited to 'packet-x25.c')
-rw-r--r--packet-x25.c50
1 files changed, 31 insertions, 19 deletions
diff --git a/packet-x25.c b/packet-x25.c
index 0a800e76a8..7d7c0c1792 100644
--- a/packet-x25.c
+++ b/packet-x25.c
@@ -2,7 +2,7 @@
* Routines for x25 packet disassembly
* Olivier Abad <oabad@cybercable.fr>
*
- * $Id: packet-x25.c,v 1.59 2001/12/03 05:07:16 guy Exp $
+ * $Id: packet-x25.c,v 1.60 2001/12/05 08:43:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -165,6 +165,7 @@ static dissector_handle_t data_handle;
static gboolean non_q_bit_is_sna = FALSE;
static dissector_table_t x25_subdissector_table;
+static heur_dissector_list_t x25_heur_subdissector_list;
/*
* each vc_info node contains :
@@ -2142,27 +2143,37 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* search the dissector in the hash table */
if ((dissect = x25_hash_get_dissect(pinfo->fd->abs_secs, pinfo->fd->abs_usecs, vc))) {
+ /* Found it in the hash table; use it. */
call_dissector(dissect, next_tvb, pinfo, tree);
+ return;
}
- else {
- /* Did the user suggest SNA-over-X.25? */
- if (non_q_bit_is_sna) {
- x25_hash_add_proto_start(vc, pinfo->fd->abs_secs,
- pinfo->fd->abs_usecs, sna_handle);
- call_dissector(sna_handle, next_tvb, pinfo, tree);
- }
- /* If the Call Req. has not been captured, and the payload begins
- with what appears to be an IP header, assume these packets carry
- IP */
- else if (tvb_get_guint8(tvb, localoffset) == 0x45) {
- x25_hash_add_proto_start(vc, pinfo->fd->abs_secs,
- pinfo->fd->abs_usecs, ip_handle);
- call_dissector(ip_handle, next_tvb, pinfo, tree);
- }
- else {
- call_dissector(data_handle,next_tvb, pinfo, tree);
- }
+
+ /* Did the user suggest SNA-over-X.25? */
+ if (non_q_bit_is_sna) {
+ /* Yes - dissect it as SNA. */
+ x25_hash_add_proto_start(vc, pinfo->fd->abs_secs,
+ pinfo->fd->abs_usecs, sna_handle);
+ call_dissector(sna_handle, next_tvb, pinfo, tree);
+ return;
}
+
+ /* If the Call Req. has not been captured, and the payload begins
+ with what appears to be an IP header, assume these packets carry
+ IP */
+ if (tvb_get_guint8(tvb, localoffset) == 0x45) {
+ x25_hash_add_proto_start(vc, pinfo->fd->abs_secs,
+ pinfo->fd->abs_usecs, ip_handle);
+ call_dissector(ip_handle, next_tvb, pinfo, tree);
+ return;
+ }
+
+ /* Try the heuristic dissectors. */
+ if (dissector_try_heuristic(x25_heur_subdissector_list, next_tvb, pinfo,
+ tree))
+ return;
+
+ /* All else failed; dissect it as raw data */
+ call_dissector(data_handle, next_tvb, pinfo, tree);
}
void
@@ -2243,6 +2254,7 @@ proto_register_x25(void)
register_init_routine(&reinit_x25_hashtable);
x25_subdissector_table = register_dissector_table("x.25.spi");
+ register_heur_dissector_list("x.25", &x25_heur_subdissector_list);
register_dissector("x.25", dissect_x25, proto_x25);