diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-11-19 04:14:26 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-11-19 04:14:26 +0000 |
commit | 649b025e7a3b91e6727ecffca541aa4823673406 (patch) | |
tree | f44685308b5be91bcd13506de4393ac0a124822b /packet-x25.c | |
parent | 8e27b1863e9a2ec683d22b13dd1f37c6a7f02c7c (diff) |
Register the OSI transport dissector by name, and make it static.
"packet-clnp.h" no longer exports anything, so remove it.
Have the X.25 dissector call subdissectors through dissector handles
(now that all the dissectors it uses are registered by name).
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2668 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-x25.c')
-rw-r--r-- | packet-x25.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/packet-x25.c b/packet-x25.c index 694a830393..d362c69425 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.37 2000/11/18 10:38:26 guy Exp $ + * $Id: packet-x25.c,v 1.38 2000/11/19 04:14:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -41,7 +41,6 @@ #include "packet-x25.h" #include "packet-ip.h" #include "packet-osi.h" -#include "packet-clnp.h" #include "nlpid.h" #define FROM_DCE 0x80 @@ -160,6 +159,9 @@ static const value_string vals_x25_type[] = { { 0, NULL} }; +static dissector_handle_t ip_handle; +static dissector_handle_t ositp_handle; + /* * each vc_info node contains : * the time of the first frame using this dissector (secs and usecs) @@ -173,7 +175,7 @@ static const value_string vals_x25_type[] = { typedef struct _vc_info { guint32 first_frame_secs, first_frame_usecs; guint32 last_frame_secs, last_frame_usecs; - dissector_t dissect; + dissector_handle_t dissect; struct _vc_info *next; } vc_info; @@ -227,7 +229,7 @@ reinit_x25_hashtable(void) static void x25_hash_add_proto_start(guint16 vc, guint32 frame_secs, guint32 frame_usecs, - dissector_t dissect) + dissector_handle_t dissect) { int idx = vc % 64; global_vc_info *hash_ent; @@ -323,7 +325,7 @@ x25_hash_add_proto_end(guint16 vc, guint32 frame_secs, guint32 frame_usecs) vci->last_frame_usecs = frame_usecs; } -static dissector_t +static dissector_handle_t x25_hash_get_dissect(guint32 frame_secs, guint32 frame_usecs, guint16 vc) { global_vc_info *hash_ent = hash_table[vc%64]; @@ -1394,7 +1396,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int x25_pkt_len; int modulo; guint16 vc; - dissector_t dissect; + dissector_handle_t dissect; gboolean toa; /* TOA/NPI address format */ guint16 bytes0_1; guint8 pkt_type; @@ -1486,7 +1488,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case NLPID_IP: x25_hash_add_proto_start(vc, pinfo->fd->abs_secs, - pinfo->fd->abs_usecs, dissect_ip); + pinfo->fd->abs_usecs, ip_handle); if (x25_tree) proto_tree_add_text(x25_tree, tvb, localoffset, 1, "X.224 secondary protocol ID: IP"); @@ -1546,7 +1548,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case PRT_ID_ISO_8073: /* ISO 8073 COTP */ x25_hash_add_proto_start(vc, pinfo->fd->abs_secs, - pinfo->fd->abs_usecs, dissect_ositp); + pinfo->fd->abs_usecs, ositp_handle); break; default: @@ -1921,13 +1923,13 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset(tvb, localoffset, -1, -1); /* search the dissector in the hash table */ if ((dissect = x25_hash_get_dissect(pinfo->fd->abs_secs, pinfo->fd->abs_usecs, vc))) - (*dissect)(next_tvb, pinfo, tree); + call_dissector(dissect, next_tvb, pinfo, tree); else { /* If the Call Req. has not been captured, 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, dissect_ip); - dissect_ip(next_tvb, pinfo, tree); + pinfo->fd->abs_usecs, ip_handle); + call_dissector(ip_handle, next_tvb, pinfo, tree); } else { dissect_data(next_tvb, 0, pinfo, tree); @@ -2023,3 +2025,13 @@ proto_register_x25(void) proto_register_subtree_array(ett, array_length(ett)); register_init_routine(&reinit_x25_hashtable); } + +void +proto_reg_handoff_x25(void) +{ + /* + * Get handles for the IP and OSI TP (COTP/CLTP) dissector. + */ + ip_handle = find_dissector("ip"); + ositp_handle = find_dissector("ositp"); +} |