diff options
author | Evan Huus <eapache@gmail.com> | 2012-09-29 13:44:45 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2012-09-29 13:44:45 +0000 |
commit | d908cf11328ca61c7b8c31d48e5f72bb43870f71 (patch) | |
tree | 01016d74ae4729eb169cf5dd4095a14691fe2da9 /epan/dissectors/packet-sdh.c | |
parent | 99e7a5b4dc4f02bfd6517c39503c2d63e4247a53 (diff) |
From Andrew Kampjes via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7750
Pull SDH level out of ERF header if the user hasn't manually set the preference.
svn path=/trunk/; revision=45207
Diffstat (limited to 'epan/dissectors/packet-sdh.c')
-rw-r--r-- | epan/dissectors/packet-sdh.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/epan/dissectors/packet-sdh.c b/epan/dissectors/packet-sdh.c index 33ea6cebce..a0d8db688a 100644 --- a/epan/dissectors/packet-sdh.c +++ b/epan/dissectors/packet-sdh.c @@ -76,11 +76,22 @@ static enum_val_t data_rates[] = { {NULL, NULL, -1} }; -static int -get_sdh_level(tvbuff_t *tvb) +static int +get_sdh_level(tvbuff_t *tvb, packet_info *pinfo) { - /*data rate has been set in the SHD options*/ + /*data rate has been set in the SDH options*/ if(sdh_data_rate != -1) return sdh_data_rate; + /*ERF specifies data rate*/ + switch((pinfo->pseudo_header->erf.ehdr_list[0].ehdr & 0xff00) >> 8){ + case 1: /*OC-3*/ + return 1; + case 2: /*OC-12*/ + return 4; + case 3: /*OC-48*/ + return 16; + default: /*drop through and try the next method*/ + ; + } /*returns the multiplier for each data level*/ switch(tvb_reported_length(tvb)){ case 2430: /*OC-3*/ @@ -90,12 +101,13 @@ get_sdh_level(tvbuff_t *tvb) case 19440: /*OC-24*/ return 8; case 38880: /*OC-48*/ - return 16; + return 16; } return 1; } + static void dissect_sdh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -106,7 +118,7 @@ dissect_sdh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *sdh_tree; proto_item *sdh_item; - int level = get_sdh_level(tvb); + int level = get_sdh_level(tvb, pinfo); guint32 a1; guint32 a2; |