diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-08-26 05:52:53 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-08-26 05:52:53 +0000 |
commit | f7e30628672367a757016ef3b2bfd604bbc93c1b (patch) | |
tree | 733504afac6821618f370545b556d2541c2176b9 /packet-chdlc.c | |
parent | 42fdef2ff460e460016b841b640f47bee0bb8f21 (diff) | |
download | wireshark-f7e30628672367a757016ef3b2bfd604bbc93c1b.tar.gz wireshark-f7e30628672367a757016ef3b2bfd604bbc93c1b.tar.bz2 wireshark-f7e30628672367a757016ef3b2bfd604bbc93c1b.zip |
From Jesper Peterson:
Extract the FCS decoding section of the PPP_HDLC dissector to
allow the CHDLC dissector to use the same routine.
The ppp_options used for preferences has been renamed to
fcs_options and exported via packet-ppp.h so CHDLC gets a
separate (but identical) FCS preference.
This means prefs.h has to be included before packet-ppp.h so a
couple of ppp related files (packet-{gtp,null,raw,vj}.c) had
their includes slightly re-arranged.
From me: make the PPP/CHDLC FCS code use "crc32()" to check the 32-bit
FCS.
svn path=/trunk/; revision=8266
Diffstat (limited to 'packet-chdlc.c')
-rw-r--r-- | packet-chdlc.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/packet-chdlc.c b/packet-chdlc.c index 7b27352da4..582eb41805 100644 --- a/packet-chdlc.c +++ b/packet-chdlc.c @@ -1,7 +1,7 @@ /* packet-chdlc.c * Routines for Cisco HDLC packet disassembly * - * $Id: packet-chdlc.c,v 1.19 2003/01/27 19:28:52 guy Exp $ + * $Id: packet-chdlc.c,v 1.20 2003/08/26 05:52:43 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -29,9 +29,11 @@ #include <glib.h> #include <epan/packet.h> #include "etypes.h" +#include "prefs.h" #include "chdlctypes.h" #include <epan/resolv.h> #include "packet-chdlc.h" +#include "packet-ppp.h" #include "packet-ip.h" /* @@ -104,7 +106,7 @@ const value_string chdlc_vals[] = { void capture_chdlc( const guchar *pd, int offset, int len, packet_counts *ld ) { - if (!BYTES_ARE_IN_FRAME(offset, len, 2)) { + if (!BYTES_ARE_IN_FRAME(offset, len, 4)) { ld->other++; return; } @@ -140,6 +142,8 @@ chdlctype(guint16 chdlctype, tvbuff_t *tvb, int offset_after_chdlctype, } } +static gint chdlc_fcs_decode = 0; /* 0 = No FCS, 1 = 16 bit FCS, 2 = 32 bit FCS */ + static void dissect_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -187,6 +191,8 @@ dissect_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(fh_tree, hf_chdlc_addr, tvb, 0, 1, addr); } + decode_fcs(tvb, fh_tree, chdlc_fcs_decode, 2); + chdlctype(proto, tvb, 4, pinfo, tree, fh_tree, hf_chdlc_proto); } @@ -205,6 +211,8 @@ proto_register_chdlc(void) &ett_chdlc, }; + module_t *chdlc_module; + proto_chdlc = proto_register_protocol("Cisco HDLC", "CHDLC", "chdlc"); proto_register_field_array(proto_chdlc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -214,6 +222,17 @@ proto_register_chdlc(void) "Cisco HDLC frame type", FT_UINT16, BASE_HEX); register_dissector("chdlc", dissect_chdlc, proto_chdlc); + + /* Register the preferences for the chdlc protocol */ + chdlc_module = prefs_register_protocol(proto_chdlc, NULL); + + prefs_register_enum_preference(chdlc_module, + "fcs_type", + "CHDLC Frame Checksum Type", + "The type of CHDLC frame checksum (none, 16-bit, 32-bit)", + &chdlc_fcs_decode, + fcs_options, FALSE); + } void |