diff options
author | Anders Broman <anders.broman@ericsson.com> | 2005-10-20 18:51:47 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2005-10-20 18:51:47 +0000 |
commit | 9dd9e3e80f7d031df1b14f76a84056f10192d1b0 (patch) | |
tree | 06f1278fb8f4e92c96d308f21fd38e125577909a /epan/dissectors | |
parent | 385fb3eea221f2274a0db75309f0edc4f61cbfb1 (diff) | |
download | wireshark-9dd9e3e80f7d031df1b14f76a84056f10192d1b0.tar.gz |
From Julian Onions
- some improvements to the NORM decoder, and the ability to
(optionally) heuristically detect NORM.
- some improvements to FEC block labelling.
- making the LCT header extension handler more generic and to decode more header extensions.
svn path=/trunk/; revision=16280
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-rmt-fec.c | 55 | ||||
-rw-r--r-- | epan/dissectors/packet-rmt-lct.c | 182 | ||||
-rw-r--r-- | epan/dissectors/packet-rmt-lct.h | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-rmt-norm.c | 97 | ||||
-rw-r--r-- | epan/dissectors/packet-rmt-norm.h | 3 |
5 files changed, 216 insertions, 128 deletions
diff --git a/epan/dissectors/packet-rmt-fec.c b/epan/dissectors/packet-rmt-fec.c index ac92d4a8c7..573dbd1387 100644 --- a/epan/dissectors/packet-rmt-fec.c +++ b/epan/dissectors/packet-rmt-fec.c @@ -27,12 +27,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -75,7 +75,7 @@ void fec_info_column(struct _fec *fec, packet_info *pinfo) { if (fec->sbn_present) col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "SBN: %u", fec->sbn); - + if (fec->esi_present) col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "ESI: 0x%X", fec->esi); } @@ -88,11 +88,11 @@ void fec_decode_ext_fti(struct _ext *e, tvbuff_t *tvb, proto_tree *tree, gint et { proto_item* ti = NULL; proto_tree *ext_tree; - + if (tree) ti = proto_tree_add_none_format(tree, f.hf->fti_header, tvb, e->offset, e->length, "EXT_FTI, FEC Object Transmission Information (%u)", e->het); - + if (f.fec->encoding_id_present) { ext_tree = proto_item_add_subtree(ti, ett); @@ -100,17 +100,17 @@ void fec_decode_ext_fti(struct _ext *e, tvbuff_t *tvb, proto_tree *tree, gint et /* Decode 48-bit length field */ f.fec->transfer_length = tvb_get_ntoh64(tvb, e->offset) & G_GINT64_CONSTANT(0xFFFFFFFFFFFFU); - + if (f.fec->encoding_id >= 128) { /* Decode FEC Instance ID */ f.fec->instance_id_present = TRUE; f.fec->instance_id = (guint8) tvb_get_ntohs(tvb, e->offset+8); } - + if (tree) proto_tree_add_uint64(ext_tree, f.hf->fti_transfer_length, tvb, e->offset+2, 6, f.fec->transfer_length); - + switch (f.fec->encoding_id) { case 0: @@ -119,19 +119,19 @@ void fec_decode_ext_fti(struct _ext *e, tvbuff_t *tvb, proto_tree *tree, gint et case 130: f.fec->encoding_symbol_length = tvb_get_ntohs(tvb, e->offset+10); f.fec->max_source_block_length = tvb_get_ntohl(tvb, e->offset+12); - + if (tree) { proto_tree_add_uint(ext_tree, f.hf->fti_encoding_symbol_length, tvb, e->offset+10, 2, f.fec->encoding_symbol_length); proto_tree_add_uint(ext_tree, f.hf->fti_max_source_block_length, tvb, e->offset+12, 4, f.fec->max_source_block_length); } break; - + case 129: f.fec->encoding_symbol_length = tvb_get_ntohs(tvb, e->offset+10); f.fec->max_source_block_length = tvb_get_ntohs(tvb, e->offset+12); f.fec->max_number_encoding_symbols = tvb_get_ntohs(tvb, e->offset+14); - + if (tree) { proto_tree_add_uint(ext_tree, f.hf->fti_encoding_symbol_length, tvb, e->offset+10, 2, f.fec->encoding_symbol_length); @@ -139,12 +139,12 @@ void fec_decode_ext_fti(struct _ext *e, tvbuff_t *tvb, proto_tree *tree, gint et proto_tree_add_uint(ext_tree, f.hf->fti_max_number_encoding_symbols, tvb, e->offset+14, 2, f.fec->max_number_encoding_symbols); } break; - + case 132: f.fec->encoding_symbol_length = tvb_get_ntohs(tvb, e->offset+10); f.fec->max_source_block_length = tvb_get_ntohl(tvb, e->offset+12); f.fec->max_number_encoding_symbols = tvb_get_ntohl(tvb, e->offset+16); - + if (tree) { proto_tree_add_uint(ext_tree, f.hf->fti_encoding_symbol_length, tvb, e->offset+10, 2, f.fec->encoding_symbol_length); @@ -153,7 +153,7 @@ void fec_decode_ext_fti(struct _ext *e, tvbuff_t *tvb, proto_tree *tree, gint et } break; } - + } else if (tree) rmt_ext_decode_default_subtree(e, tvb, ti, ett); @@ -173,7 +173,8 @@ void fec_dissector(struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *of { proto_item *ti; proto_tree *fec_tree; - + guint offset_save = *offset; + /* Create the FEC subtree */ if (tree) { @@ -181,65 +182,65 @@ void fec_dissector(struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *of fec_tree = proto_item_add_subtree(ti, f.ett->main); } else fec_tree = NULL; - + /* FEC Encoding ID and FEC Instance ID processing */ if (f.fec->encoding_id_present) { if (tree) { proto_tree_add_uint(fec_tree, f.hf->encoding_id, tvb, *offset, 0, f.fec->encoding_id); - + if (f.fec->encoding_id >= 128 && f.fec->instance_id_present) proto_tree_add_uint(fec_tree, f.hf->instance_id, tvb, *offset, 0, f.fec->instance_id); } - + switch (f.fec->encoding_id) { case 0: case 130: f.fec->sbn = tvb_get_ntohs(tvb, *offset); f.fec->esi = tvb_get_ntohs(tvb, *offset+2); - + if (tree) { proto_tree_add_uint(fec_tree, f.hf->sbn, tvb, *offset, 2, f.fec->sbn); proto_tree_add_uint(fec_tree, f.hf->esi, tvb, *offset+2, 2, f.fec->esi); } - + f.fec->sbn_present = TRUE; f.fec->esi_present = TRUE; *offset += 4; break; - + case 2: case 128: case 132: f.fec->sbn = tvb_get_ntohl(tvb, *offset); f.fec->esi = tvb_get_ntohl(tvb, *offset+4); - + if (tree) { proto_tree_add_uint(fec_tree, f.hf->sbn, tvb, *offset, 4, f.fec->sbn); proto_tree_add_uint(fec_tree, f.hf->esi, tvb, *offset+4, 4, f.fec->esi); } - + f.fec->sbn_present = TRUE; f.fec->esi_present = TRUE; *offset += 8; break; - + case 129: f.fec->sbn = tvb_get_ntohl(tvb, *offset); f.fec->sbl = tvb_get_ntohs(tvb, *offset+4); f.fec->esi = tvb_get_ntohs(tvb, *offset+6); - + if (tree) { proto_tree_add_uint(fec_tree, f.hf->sbn, tvb, *offset, 4, f.fec->sbn); proto_tree_add_uint(fec_tree, f.hf->sbl, tvb, *offset+4, 2, f.fec->sbl); proto_tree_add_uint(fec_tree, f.hf->esi, tvb, *offset+6, 2, f.fec->esi); } - + f.fec->sbn_present = TRUE; f.fec->sbl_present = TRUE; f.fec->esi_present = TRUE; @@ -247,6 +248,8 @@ void fec_dissector(struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *of break; } } + if (tree) + proto_item_set_len(ti, *offset - offset_save); } void fec_dissector_free(struct _fec *fec _U_) diff --git a/epan/dissectors/packet-rmt-lct.c b/epan/dissectors/packet-rmt-lct.c index f3159cccb3..a74b7ab514 100644 --- a/epan/dissectors/packet-rmt-lct.c +++ b/epan/dissectors/packet-rmt-lct.c @@ -27,12 +27,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -52,6 +52,8 @@ #include <epan/prefs.h> #include <epan/strutil.h> +#include <math.h> + #include "packet-rmt-lct.h" /* Enumerated data types for LCT preferences */ @@ -68,7 +70,7 @@ static const enum_val_t enum_lct_ext_193[] = { "flute", "Decode as FLUTE extension (EXT_CENC)", LCT_PREFS_EXT_193_FLUTE }, { NULL, NULL, 0 } }; - + /* LCT helper functions */ /* ==================== */ @@ -78,7 +80,7 @@ static void lct_timestamp_parse(guint32 t, nstime_t* s) s->nsecs = (t % 1000) * 1000000; } -static void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f) +void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f) { guint32 buffer32; proto_item *ti; @@ -86,34 +88,72 @@ static void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *t switch (e->het) { - + /* EXT_NOP */ case 0: if (tree) { ti = proto_tree_add_text(tree, tvb, e->offset, e->length, "EXT_NOP, No-Operation (0)"); - + rmt_ext_decode_default_subtree(e, tvb, ti, ett); } break; - + /* EXT_AUTH */ case 1: if (tree) { ti = proto_tree_add_text(tree, tvb, e->offset, e->length, "EXT_AUTH, Packet authentication (1)"); - + rmt_ext_decode_default_subtree(e, tvb, ti, ett); } break; - + + /* EXT_CC RATE */ + case 3: + if (tree) { + ti = proto_tree_add_text(tree, tvb, e->offset, e->length, + "EXT_CC, Congestion Control Feedback (%u)", e->het); + + ext_tree = proto_item_add_subtree(ti, ett); + rmt_ext_decode_default_header(e, tvb, ext_tree); + proto_tree_add_text(ext_tree, tvb, e->offset+2, 2, + "CC Sequence: %u", tvb_get_ntohs(tvb, e->offset+2)); + proto_tree_add_text(ext_tree, tvb, e->offset+4, 1, + "CC Flags: 0x%x", tvb_get_guint8(tvb, e->offset+4)); + proto_tree_add_text(ext_tree, tvb, e->offset+5, 1, + "CC RTT: %u", tvb_get_guint8(tvb, e->offset+5)); + proto_tree_add_text(ext_tree, tvb, e->offset+6, 2, + "CC Loss: %g", tvb_get_ntohs(tvb, e->offset+6)/65535.0); + proto_tree_add_text(ext_tree, tvb, e->offset+8, 2, + "CC Rate: %u", tvb_get_ntohs(tvb, e->offset+8)); + + } + break; /* EXT_FTI */ case 64: fec_decode_ext_fti(e, tvb, tree, ett, f); break; - + + /* EXT_RATE */ + case 128: + if (tree) { + guint16 send_rate; + double value; + ti = proto_tree_add_text(tree, tvb, e->offset, e->length, + "EXT_RATE, Send Rate (%u)", e->het); + + ext_tree = proto_item_add_subtree(ti, ett); + rmt_ext_decode_default_header(e, tvb, ext_tree); + send_rate = tvb_get_ntohs(tvb, e->offset+2); + value = (send_rate >> 4) * 10.0 / 4096.0 * pow(10.0, (send_rate & 0xf)); + proto_tree_add_text(ext_tree, tvb, e->offset+2, 2, + "Send Rate: %g", value); + } + break; + /* EXT_FDT */ case 192: switch (prefs->ext_192) @@ -121,28 +161,28 @@ static void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *t case LCT_PREFS_EXT_192_NONE: rmt_ext_decode_default(e, tvb, tree, ett); break; - + case LCT_PREFS_EXT_192_FLUTE: if (tree) { ti = proto_tree_add_text(tree, tvb, e->offset, e->length, "EXT_FDT, FDT Instance Header (192)"); - + ext_tree = proto_item_add_subtree(ti, ett); buffer32 = tvb_get_ntohl(tvb, e->offset); - + rmt_ext_decode_default_header(e, tvb, ext_tree); - + proto_tree_add_text(ext_tree, tvb, e->offset+1, 1, "FLUTE version (V): %u", (buffer32 & 0x00F00000) >> 20); - + proto_tree_add_text(ext_tree, tvb, e->offset+1, 3, "FDT Instance ID: %u", buffer32 & 0x000FFFFF); - } + } break; } break; - + /* EXT_CENC */ case 193: switch (prefs->ext_193) @@ -150,25 +190,25 @@ static void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *t case LCT_PREFS_EXT_193_NONE: rmt_ext_decode_default(e, tvb, tree, ett); break; - + case LCT_PREFS_EXT_193_FLUTE: if (tree) { ti = proto_tree_add_text(tree, tvb, e->offset, e->length, "EXT_CENC, FDT Instance Content Encoding (193)"); - + ext_tree = proto_item_add_subtree(ti, ett); buffer32 = tvb_get_ntohl(tvb, e->offset); - + rmt_ext_decode_default_header(e, tvb, ext_tree); - + proto_tree_add_text(ext_tree, tvb, e->offset+1, 1, "Content Encoding Algorithm (CENC): %u", (buffer32 & 0x00FF0000) >> 16); - } + } break; } break; - + default: rmt_ext_decode_default(e, tvb, tree, ett); } @@ -184,7 +224,7 @@ void lct_info_column(struct _lct *lct, packet_info *pinfo) { if (lct->tsi_present) col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "TSI: %" PRIu64, lct->tsi); - + if (lct->toi_present) { if (lct->toi_size <= 8) @@ -192,10 +232,10 @@ void lct_info_column(struct _lct *lct, packet_info *pinfo) else col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "TOI: 0x%s", bytes_to_str(lct->toi_extended, lct->toi_size)); } - + if (lct->close_session) col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "Close session"); - + if (lct->close_object) col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "Close object"); } @@ -217,7 +257,7 @@ void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tr guint offset_old; guint offset_start; guint16 buffer16; - + /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; proto_tree *lct_tree; @@ -227,24 +267,24 @@ void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tr /* LCT fixed-size fields dissection */ /* -------------------------------- */ - + offset_start = *offset; - + buffer16 = tvb_get_ntohs(tvb, *offset); - + l.lct->version = ((buffer16 & 0xF000) >> 12); - + l.lct->cci_size = ((buffer16 & 0x0C00) >> 10) * 4 + 4; l.lct->tsi_size = ((buffer16 & 0x0080) >> 7) * 4 + ((buffer16 & 0x0010) >> 4) * 2; l.lct->toi_size = ((buffer16 & 0x0060) >> 5) * 4 + ((buffer16 & 0x0010) >> 4) * 2; - + l.lct->tsi_present = (l.lct->tsi_size > 0); l.lct->toi_present = (l.lct->toi_size > 0); l.lct->sct_present = (buffer16 & 0x0008) != 0; l.lct->ert_present = (buffer16 & 0x0004) != 0; l.lct->close_session = (buffer16 & 0x0002) != 0; l.lct->close_object = (buffer16 & 0x0001) != 0; - + l.lct->hlen = tvb_get_guint8(tvb, *offset+2) * 4; l.lct->codepoint = tvb_get_guint8(tvb, *offset+3); @@ -253,47 +293,47 @@ void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tr f.fec->encoding_id_present = TRUE; f.fec->encoding_id = l.lct->codepoint; } - + if (tree) { /* Create the LCT subtree */ ti = proto_tree_add_item(tree, l.hf->header, tvb, *offset, l.lct->hlen, FALSE); lct_tree = proto_item_add_subtree(ti, l.ett->main); - + /* Fill the LCT subtree */ proto_tree_add_uint(lct_tree, l.hf->version, tvb, *offset, 1, l.lct->version); - + ti = proto_tree_add_item(lct_tree, l.hf->fsize_header, tvb, *offset, 2, FALSE); lct_fsize_tree = proto_item_add_subtree(ti, l.ett->fsize); - + ti = proto_tree_add_item(lct_tree, l.hf->flags_header, tvb, *offset, 2, FALSE); lct_flags_tree = proto_item_add_subtree(ti, l.ett->flags); - + proto_tree_add_uint(lct_tree, l.hf->hlen, tvb, *offset+2, 1, l.lct->hlen); proto_tree_add_uint(lct_tree, l.hf->codepoint, tvb, *offset+3, 1, l.lct->codepoint); - + /* Fill the LCT fsize subtree */ proto_tree_add_uint(lct_fsize_tree, l.hf->fsize_cci, tvb, *offset, 1, l.lct->cci_size); proto_tree_add_uint(lct_fsize_tree, l.hf->fsize_tsi, tvb, *offset+1, 1, l.lct->tsi_size); proto_tree_add_uint(lct_fsize_tree, l.hf->fsize_toi, tvb, *offset+1, 1, l.lct->toi_size); - + /* Fill the LCT flags subtree */ proto_tree_add_boolean(lct_flags_tree, l.hf->flags_sct_present, tvb, *offset+1, 1, l.lct->sct_present); proto_tree_add_boolean(lct_flags_tree, l.hf->flags_ert_present, tvb, *offset+1, 1, l.lct->ert_present); proto_tree_add_boolean(lct_flags_tree, l.hf->flags_close_session, tvb, *offset+1, 1, l.lct->close_session); proto_tree_add_boolean(lct_flags_tree, l.hf->flags_close_object, tvb, *offset+1, 1, l.lct->close_object); - + } else { lct_tree = NULL; lct_fsize_tree = NULL; lct_flags_tree = NULL; } - + *offset += 4; - + /* LCT variable-size and optional fields dissection */ /* ------------------------------------------------ */ - + /* Congestion Control Information (CCI) */ if (l.lct->cci_size > 0) { l.lct->cci = (guint8*) tvb_get_ptr(tvb, *offset, l.lct->cci_size); @@ -301,87 +341,87 @@ void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tr proto_tree_add_bytes(lct_tree, l.hf->cci, tvb, *offset, l.lct->cci_size, l.lct->cci); *offset += l.lct->cci_size; } - + /* Transmission Session Identifier (TSI) */ if (l.lct->tsi_present) { - + switch (l.lct->tsi_size) { case 0: l.lct->tsi = 0; break; - + case 2: l.lct->tsi = tvb_get_ntohs(tvb, *offset); break; - + case 4: l.lct->tsi = tvb_get_ntohl(tvb, *offset); break; - + case 6: l.lct->tsi = tvb_get_ntoh64(tvb, *offset-2) & G_GINT64_CONSTANT(0x0000FFFFFFFFFFFFU); break; } - + if (tree) proto_tree_add_uint64(lct_tree, l.hf->tsi, tvb, *offset, l.lct->tsi_size, l.lct->tsi); *offset += l.lct->tsi_size; } - + /* Transmission Object Identifier (TOI) */ if (l.lct->toi_present) { - + switch (l.lct->toi_size) { case 0: l.lct->toi = 0; break; - + case 2: l.lct->toi = tvb_get_ntohs(tvb, *offset); break; - + case 4: l.lct->toi = tvb_get_ntohl(tvb, *offset); break; - + case 6: l.lct->toi = tvb_get_ntoh64(tvb, *offset-2) & G_GINT64_CONSTANT(0x0000FFFFFFFFFFFFU); break; - + case 8: l.lct->toi = tvb_get_ntoh64(tvb, *offset); break; - + case 10: l.lct->toi = tvb_get_ntoh64(tvb, *offset+2); break; - + case 12: l.lct->toi = tvb_get_ntoh64(tvb, *offset+4); break; - + case 14: l.lct->toi = tvb_get_ntoh64(tvb, *offset)+6; break; } - + l.lct->toi_extended = (guint8*) tvb_get_ptr(tvb, *offset, l.lct->toi_size); - + if (tree) { if (l.lct->toi_size > 8) proto_tree_add_uint64(lct_tree, l.hf->toi, tvb, *offset+(l.lct->toi_size-8), 8, l.lct->toi); else proto_tree_add_uint64(lct_tree, l.hf->toi, tvb, *offset, l.lct->toi_size, l.lct->toi); - + proto_tree_add_bytes(lct_tree, l.hf->toi_extended, tvb, *offset, l.lct->toi_size, l.lct->toi_extended); } - + *offset += l.lct->toi_size; } - + /* Sender Current Time (SCT) */ if (l.lct->sct_present) { lct_timestamp_parse(tvb_get_ntohl(tvb, *offset), &l.lct->sct); @@ -397,19 +437,19 @@ void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tr proto_tree_add_time(lct_tree, l.hf->ert, tvb, *offset, 4, &l.lct->ert); *offset += 4; } - + /* LCT header extensions, if applicable */ /* ------------------------------------ */ - + /* Allocate an array of _ext elements */ l.lct->ext = g_array_new(FALSE, TRUE, sizeof(struct _ext)); - + offset_old = *offset; rmt_ext_parse(l.lct->ext, tvb, offset, offset_start + l.lct->hlen); - + /* Resync the offset with the end of LCT header */ *offset = offset_start + l.lct->hlen; - + if (l.lct->ext->len > 0) { if (tree) @@ -419,7 +459,7 @@ void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tr lct_ext_tree = proto_item_add_subtree(ti, l.ett->ext); } else lct_ext_tree = NULL; - + /* Add the extensions to the subtree */ for (i = 0; i < l.lct->ext->len; i++) lct_ext_decode(&g_array_index(l.lct->ext, struct _ext, i), l.prefs, tvb, lct_ext_tree, l.ett->ext_ext, f); @@ -450,7 +490,7 @@ void lct_prefs_register(struct _lct_prefs *prefs, module_t *module) "LCT Codepoint as FEC Encoding ID", "Whether the LCT header Codepoint field should be considered the FEC Encoding ID of carried object", &prefs->codepoint_as_fec_encoding); - + prefs_register_enum_preference(module, "lct.ext.192", "LCT header extention 192", diff --git a/epan/dissectors/packet-rmt-lct.h b/epan/dissectors/packet-rmt-lct.h index 9cf79448c3..64f623f578 100644 --- a/epan/dissectors/packet-rmt-lct.h +++ b/epan/dissectors/packet-rmt-lct.h @@ -13,12 +13,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -89,7 +89,7 @@ struct _lct_hf struct _lct_ett { gint main; - + gint fsize; gint flags; gint ext; @@ -181,5 +181,6 @@ void lct_dissector_free(struct _lct *lct); void lct_prefs_set_default(struct _lct_prefs *prefs); void lct_prefs_register(struct _lct_prefs *prefs, module_t *module); +void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f); #endif diff --git a/epan/dissectors/packet-rmt-norm.c b/epan/dissectors/packet-rmt-norm.c index 33554c8ee6..2372d2c8e7 100644 --- a/epan/dissectors/packet-rmt-norm.c +++ b/epan/dissectors/packet-rmt-norm.c @@ -101,6 +101,7 @@ static const value_string string_norm_nack_form[] = /* ============================================= */ static int proto = -1; +static gboolean global_norm_heur = FALSE; static struct _norm_hf hf; static struct _norm_ett ett; @@ -211,6 +212,8 @@ static guint dissect_norm_hdrext(struct _norm *norm, struct _fec_ptr *f, proto_t if (ext->len > 0) { + struct _lct_prefs lctp; + memset(&lctp, 0, sizeof(lctp)); if (tree) { /* Add the extensions subtree */ @@ -222,14 +225,47 @@ static guint dissect_norm_hdrext(struct _norm *norm, struct _fec_ptr *f, proto_t ext_tree = NULL; /* Add the extensions to the subtree */ - for (i = 0; i < ext->len; i++) - fec_decode_ext_fti(&g_array_index(ext, struct _ext, i), - tvb, ext_tree, ett.hdrext, *f); + for (i = 0; i < ext->len; i++) { + struct _ext *e = &g_array_index(ext, struct _ext, i); + + lct_ext_decode(e, &lctp, tvb, ext_tree, ett.hdrext, *f); +// fec_decode_ext_fti(e, tvb, ext_tree, ett.hdrext, *f); + } } g_array_free(ext, TRUE); return offset; } +static guint dissect_nack_data(struct _norm *norm, proto_tree *tree, + tvbuff_t *tvb, guint offset, packet_info *pinfo) +{ + proto_item *ti, *tif; + proto_tree *nack_tree, *flag_tree; + guint orig_offset = offset; + guint16 len; + ti = proto_tree_add_text(tree, tvb, offset, 8, "NACK Data"); + nack_tree = proto_item_add_subtree(ti, ett.nackdata); + proto_tree_add_item(nack_tree, hf.nack_form, tvb, offset, 1, FALSE); offset += 1; + + tif = proto_tree_add_item(nack_tree, hf.nack_flags, tvb, offset, 1, FALSE); + flag_tree = proto_item_add_subtree(tif, ett.flags); + proto_tree_add_item(flag_tree, hf.nack_flags_segment, tvb, offset, 1, FALSE); + proto_tree_add_item(flag_tree, hf.nack_flags_block, tvb, offset, 1, FALSE); + proto_tree_add_item(flag_tree, hf.nack_flags_info, tvb, offset, 1, FALSE); + proto_tree_add_item(flag_tree, hf.nack_flags_object, tvb, offset, 1, FALSE); + offset += 1; + len = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(nack_tree, hf.nack_length, tvb, offset, 2, FALSE); offset += 2; + proto_item_set_len(ti, 4+len); + if (len > 4) { + struct _fec_ptr f; + dissect_feccode(norm, &f, nack_tree, tvb, offset, pinfo, 1); + } + offset += len; + return offset; +} + + /* code to dissect NORM data packets */ static void dissect_norm_data(struct _norm *norm, proto_tree *tree, tvbuff_t *tvb, guint offset, packet_info *pinfo) @@ -294,6 +330,8 @@ static void dissect_norm_info(struct _norm *norm, proto_tree *tree, proto_tree_add_item(flag_tree, hf.flag.msgstart, tvb, offset, 1, FALSE); offset++; + norm->fec.encoding_id = tvb_get_guint8(tvb, offset); + norm->fec.encoding_id_present = 1; proto_tree_add_item(tree, hf.fec.encoding_id, tvb, offset, 1, FALSE); offset++; proto_tree_add_item(tree, hf.object_transport_id, tvb, offset, 2, FALSE); offset+=2; @@ -338,6 +376,9 @@ static guint dissect_norm_cmd_repairadv(struct _norm *norm, proto_tree *tree, f.prefs = &preferences.fec; offset = dissect_norm_hdrext(norm, &f, tree, tvb, offset, pinfo); } + while (offset < tvb_length(tvb)) { + offset = dissect_nack_data(norm, tree, tvb, offset, pinfo); + } return offset; } @@ -469,6 +510,8 @@ static void dissect_norm_ack(struct _norm *norm, proto_tree *tree, } + + /* code to dissect NORM nack packets */ static void dissect_norm_nack(struct _norm *norm, proto_tree *tree, tvbuff_t *tvb, guint offset, packet_info *pinfo) @@ -489,29 +532,7 @@ static void dissect_norm_nack(struct _norm *norm, proto_tree *tree, } while (offset < tvb_length(tvb)) { - proto_item *ti, *tif; - proto_tree *nack_tree, *flag_tree; - guint orig_offset = offset; - guint16 len; - ti = proto_tree_add_text(tree, tvb, offset, 8, "NACK Data"); - nack_tree = proto_item_add_subtree(ti, ett.nackdata); - proto_tree_add_item(nack_tree, hf.nack_form, tvb, offset, 1, FALSE); offset += 1; - - tif = proto_tree_add_item(nack_tree, hf.nack_flags, tvb, offset, 1, FALSE); - flag_tree = proto_item_add_subtree(tif, ett.flags); - proto_tree_add_item(flag_tree, hf.nack_flags_segment, tvb, offset, 1, FALSE); - proto_tree_add_item(flag_tree, hf.nack_flags_block, tvb, offset, 1, FALSE); - proto_tree_add_item(flag_tree, hf.nack_flags_info, tvb, offset, 1, FALSE); - proto_tree_add_item(flag_tree, hf.nack_flags_object, tvb, offset, 1, FALSE); - offset += 1; - len = tvb_get_ntohs(tvb, offset); - proto_tree_add_item(nack_tree, hf.nack_length, tvb, offset, 2, FALSE); offset += 2; - proto_item_set_len(ti, 4+len); - if (len > 4) { - struct _fec_ptr f; - dissect_feccode(norm, &f, nack_tree, tvb, offset, pinfo, 1); - } - offset += len; + offset = dissect_nack_data(norm, tree, tvb, offset, pinfo); } if (tvb_length(tvb) > offset) proto_tree_add_none_format(tree, hf.payload, tvb, offset, -1, "Payload (%u bytes)", tvb_length(tvb) - offset); @@ -627,6 +648,23 @@ static void dissect_norm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } +static gboolean +dissect_norm_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + guint8 byte1; + if (!global_norm_heur) + return FALSE; + byte1 = tvb_get_guint8(tvb, 0); + + if (hi_nibble(byte1) != 1) return FALSE; + if (lo_nibble(byte1) < 1 || lo_nibble(byte1) > 6) return FALSE; + if (tvb_get_guint8(tvb, 1) > 20) return FALSE; + if (tvb_length_remaining(tvb, 0) < 12) + return FALSE; + dissect_norm(tvb, pinfo, tree); + return TRUE; /* could be a NORM packet */ +} + void proto_reg_handoff_norm(void) { static dissector_handle_t handle; @@ -636,7 +674,7 @@ void proto_reg_handoff_norm(void) preferences_initialized = TRUE; handle = create_dissector_handle(dissect_norm, proto); dissector_add_handle("udp.port", handle); - //dissector_add("udp.port", 6003, handle); + heur_dissector_add("udp", dissect_norm_heur, proto); } norm_prefs_save(&preferences, &preferences_old); @@ -791,4 +829,9 @@ void proto_register_norm(void) /* Register preferences */ module = prefs_register_protocol(proto, proto_reg_handoff_norm); norm_prefs_register(&preferences, module); + prefs_register_bool_preference(module, "heuristic_norm", + "Try to decode UDP packets as NORM packets", + "Check this to decode NORM traffic between clients", + &global_norm_heur); + } diff --git a/epan/dissectors/packet-rmt-norm.h b/epan/dissectors/packet-rmt-norm.h index 7144cafd4f..b3b00f153c 100644 --- a/epan/dissectors/packet-rmt-norm.h +++ b/epan/dissectors/packet-rmt-norm.h @@ -31,6 +31,7 @@ #include "packet-rmt-common.h" #include "packet-rmt-fec.h" +#include "packet-rmt-lct.h" /* Type definitions */ /* ================ */ @@ -90,7 +91,7 @@ enum { NORM_FLAG_CC_RTT = 0x04, NORM_FLAG_CC_START = 0x08, NORM_FLAG_CC_LEAVE = 0x10, - + }; |