[docsis->ucd] Dissect TYPE and LENGTH values for burst TLVs also.

* Fixed filter for TLV Length Wrong.

Change-Id: Ic2fa2a6e1faa7bad604468fbcbc431fd38a5a113
Reviewed-on: https://code.wireshark.org/review/11922
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
AdrianSimionov 2015-11-17 20:32:55 +01:00 committed by Anders Broman
parent 01cdabb63b
commit fefc14b121
1 changed files with 108 additions and 60 deletions

View File

@ -83,6 +83,8 @@ static int hf_docsis_ucd_mini_slot_size = -1;
static int hf_docsis_ucd_down_chid = -1;
static int hf_docsis_ucd_type = -1;
static int hf_docsis_ucd_length = -1;
static int hf_docsis_ucd_burst_type = -1;
static int hf_docsis_ucd_burst_length = -1;
static int hf_docsis_ucd_symbol_rate = -1;
static int hf_docsis_ucd_frequency = -1;
static int hf_docsis_ucd_preamble_pat = -1;
@ -123,14 +125,15 @@ static expert_field ei_docsis_ucd_tlvlen_bad = EI_INIT;
/* Initialize the subtree pointers */
static gint ett_docsis_ucd = -1;
static gint ett_tlv = -1;
static gint ett_docsis_tlv = -1;
static gint ett_docsis_burst_tlv = -1;
static const value_string channel_tlv_vals[] = {
{UCD_SYMBOL_RATE, "Symbol Rate"},
{UCD_FREQUENCY, "Frequency"},
{UCD_PREAMBLE, "Preamble Pattern"},
{UCD_BURST_DESCR, "Burst Descriptor"},
{UCD_BURST_DESCR5, "Burst Descriptor DOCSIS 2.0"},
{UCD_BURST_DESCR, "Burst Descriptor Type 4"},
{UCD_BURST_DESCR5, "Burst Descriptor Type 5"},
{UCD_EXT_PREAMBLE, "Extended Preamble Pattern"},
{UCD_SCDMA_MODE_ENABLED, "S-CDMA Mode Enabled"},
{UCD_MAINTAIN_POWER_SPECTRAL_DENSITY, "Maintain Power Spectral Density"},
@ -140,6 +143,24 @@ static const value_string channel_tlv_vals[] = {
{0, NULL}
};
static const value_string burst_tlv_vals[] = {
{UCD_MODULATION, "Modulation Type"},
{UCD_DIFF_ENCODING, "Differential Encoding"},
{UCD_PREAMBLE_LEN, "Preamble Length"},
{UCD_PREAMBLE_VAL_OFF, "Preamble Value Offset"},
{UCD_FEC, "FEC Error Correction (T)"},
{UCD_FEC_CODEWORD, "FEC Codeword Information Bytes (k)"},
{UCD_SCRAMBLER_SEED, "Scrambler Seed"},
{UCD_MAX_BURST, "Maximum Burst Size"},
{UCD_GUARD_TIME, "Guard Time Size"},
{UCD_LAST_CW_LEN, "Last Codeword Length"},
{UCD_SCRAMBLER_ONOFF, "Scrambler on/off"},
{UCD_RS_INT_DEPTH, "R-S Interleaver Depth (Ir)"},
{UCD_RS_INT_BLOCK, "R-S Interleaver Block Size (Br)"},
{UCD_PREAMBLE_TYPE, "Preamble Type"},
{0, NULL}
};
static const value_string on_off_vals[] = {
{1, "On"},
{2, "Off"},
@ -213,6 +234,8 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
proto_item *ucd_item;
proto_tree *tlv_tree;
proto_item *tlv_item;
proto_tree *burst_tree;
proto_item *burst_item;
gint len;
guint8 upchid, symrate;
@ -249,7 +272,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
{
type = tvb_get_guint8 (tvb, pos);
tlv_tree = proto_tree_add_subtree(ucd_tree, tvb, pos, -1,
ett_tlv, &tlv_item,
ett_docsis_tlv, &tlv_item,
val_to_str(type, channel_tlv_vals,
"Unknown TLV (%u)"));
proto_tree_add_uint (tlv_tree, hf_docsis_ucd_type,
@ -383,14 +406,21 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
endtlvpos = pos + length - 1;
while (pos < endtlvpos)
{
tlvtype = tvb_get_guint8 (tvb, pos++);
tlvlen = tvb_get_guint8 (tvb, pos++);
burst_tree = proto_tree_add_subtree (tlv_tree, tvb, pos, -1,
ett_docsis_burst_tlv, &burst_item,
val_to_str(type, burst_tlv_vals,
"Unknown TLV (%u)"));
tlvtype = tvb_get_guint8 (tvb, pos);
proto_tree_add_uint (burst_tree, hf_docsis_ucd_burst_type, tvb, pos++, 1, tlvtype);
tlvlen = tvb_get_guint8 (tvb, pos);
proto_tree_add_uint (burst_tree, hf_docsis_ucd_burst_length, tvb, pos++, 1, tlvlen);
proto_item_set_len(burst_item, tlvlen + 2);
switch (tlvtype)
{
case UCD_MODULATION:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_mod_type, tvb,
pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -402,7 +432,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_DIFF_ENCODING:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_diff_encoding,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -414,7 +444,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_PREAMBLE_LEN:
if (tlvlen == 2)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_preamble_len,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -426,7 +456,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_PREAMBLE_VAL_OFF:
if (tlvlen == 2)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_preamble_val_off,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -438,7 +468,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_FEC:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_fec, tvb, pos,
tlvlen, ENC_BIG_ENDIAN);
}
@ -450,7 +480,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_FEC_CODEWORD:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_fec_codeword,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -462,7 +492,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_SCRAMBLER_SEED:
if (tlvlen == 2)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_scrambler_seed,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -474,7 +504,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_MAX_BURST:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_max_burst, tvb,
pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -486,7 +516,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_GUARD_TIME:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_guard_time,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -498,7 +528,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_LAST_CW_LEN:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_last_cw_len,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -510,7 +540,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_SCRAMBLER_ONOFF:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_scrambler_onoff,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -530,14 +560,21 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
endtlvpos = pos + length - 1;
while (pos < endtlvpos)
{
tlvtype = tvb_get_guint8 (tvb, pos++);
tlvlen = tvb_get_guint8 (tvb, pos++);
burst_tree = proto_tree_add_subtree (tlv_tree, tvb, pos, -1,
ett_docsis_burst_tlv, &burst_item,
val_to_str(type, burst_tlv_vals,
"Unknown TLV (%u)"));
tlvtype = tvb_get_guint8 (tvb, pos);
proto_tree_add_uint (burst_tree, hf_docsis_ucd_burst_type, tvb, pos++, 1, tlvtype);
tlvlen = tvb_get_guint8 (tvb, pos);
proto_tree_add_uint (burst_tree, hf_docsis_ucd_burst_length, tvb, pos++, 1, tlvlen);
proto_item_set_len(burst_item, tlvlen + 2);
switch (tlvtype)
{
case UCD_MODULATION:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_mod_type, tvb,
pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -549,7 +586,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_DIFF_ENCODING:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_diff_encoding,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -561,7 +598,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_PREAMBLE_LEN:
if (tlvlen == 2)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_preamble_len,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -573,7 +610,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_PREAMBLE_VAL_OFF:
if (tlvlen == 2)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_preamble_val_off,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -585,7 +622,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_FEC:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_fec, tvb, pos,
tlvlen, ENC_BIG_ENDIAN);
}
@ -597,7 +634,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_FEC_CODEWORD:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_fec_codeword,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -609,7 +646,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_SCRAMBLER_SEED:
if (tlvlen == 2)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_scrambler_seed,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -621,7 +658,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_MAX_BURST:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_max_burst, tvb,
pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -633,7 +670,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_GUARD_TIME:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_guard_time,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -645,7 +682,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_LAST_CW_LEN:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_last_cw_len,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -657,7 +694,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_SCRAMBLER_ONOFF:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_burst_scrambler_onoff,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -669,7 +706,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_RS_INT_DEPTH:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_rs_int_depth,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -681,7 +718,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_RS_INT_BLOCK:
if (tlvlen == 2)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_rs_int_block,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -693,7 +730,7 @@ dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
case UCD_PREAMBLE_TYPE:
if (tlvlen == 1)
{
proto_tree_add_item (tlv_tree,
proto_tree_add_item (burst_tree,
hf_docsis_preamble_type,
tvb, pos, tlvlen, ENC_BIG_ENDIAN);
}
@ -739,15 +776,25 @@ proto_register_docsis_ucd (void)
"Management Message", HFILL}
},
{&hf_docsis_ucd_type,
{"TLV Type", "docsis_ucd.type",
{"Type", "docsis_ucd.type",
FT_UINT8, BASE_DEC, VALS(channel_tlv_vals), 0x0,
"Channel TLV type", HFILL}
},
{&hf_docsis_ucd_length,
{"TLV Length", "docsis_ucd.length",
{"Length", "docsis_ucd.length",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Channel TLV length", HFILL}
},
{&hf_docsis_ucd_burst_type,
{"Type", "docsis_ucd.burst.tlvtype",
FT_UINT8, BASE_DEC, VALS(channel_tlv_vals), 0x0,
"Burst TLV type", HFILL}
},
{&hf_docsis_ucd_burst_length,
{"Length", "docsis_ucd.burst.tlvlen",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Burst TLV length", HFILL}
},
{&hf_docsis_ucd_symbol_rate,
{"Symbol Rate (ksym/sec)", "docsis_ucd.symrate",
FT_UINT8, BASE_DEC, NULL, 0x0,
@ -859,84 +906,85 @@ proto_register_docsis_ucd (void)
NULL, HFILL}
},
{&hf_docsis_burst_mod_type,
{"1 Modulation Type", "docsis_ucd.burst.modtype",
{"Modulation Type", "docsis_ucd.burst.modtype",
FT_UINT8, BASE_DEC, VALS (mod_vals), 0x0,
"Modulation Type", HFILL}
NULL, HFILL}
},
{&hf_docsis_burst_diff_encoding,
{"2 Differential Encoding", "docsis_ucd.burst.diffenc",
{"Differential Encoding", "docsis_ucd.burst.diffenc",
FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
"Differential Encoding", HFILL}
NULL, HFILL}
},
{&hf_docsis_burst_preamble_len,
{"3 Preamble Length (Bits)", "docsis_ucd.burst.preamble_len",
{"Preamble Length (Bits)", "docsis_ucd.burst.preamble_len",
FT_UINT16, BASE_DEC, NULL, 0x0,
"Preamble Length (Bits)", HFILL}
NULL, HFILL}
},
{&hf_docsis_burst_preamble_val_off,
{"4 Preamble Offset (Bits)", "docsis_ucd.burst.preamble_off",
{"Preamble Offset (Bits)", "docsis_ucd.burst.preamble_off",
FT_UINT16, BASE_DEC, NULL, 0x0,
"Preamble Offset (Bits)", HFILL}
NULL, HFILL}
},
{&hf_docsis_burst_fec,
{"5 FEC (T)", "docsis_ucd.burst.fec",
{"FEC (T)", "docsis_ucd.burst.fec",
FT_UINT8, BASE_DEC, NULL, 0x0,
"FEC (T) Codeword Parity Bits = 2^T", HFILL}
},
{&hf_docsis_burst_fec_codeword,
{"6 FEC Codeword Info bytes (k)", "docsis_ucd.burst.fec_codeword",
{"FEC Codeword Info bytes (k)", "docsis_ucd.burst.fec_codeword",
FT_UINT8, BASE_DEC, NULL, 0x0,
"FEC Codeword Info Bytes (k)", HFILL}
NULL, HFILL}
},
{&hf_docsis_burst_scrambler_seed,
{"7 Scrambler Seed", "docsis_ucd.burst.scrambler_seed",
{"Scrambler Seed", "docsis_ucd.burst.scrambler_seed",
FT_UINT16, BASE_HEX, NULL, 0x0,
"Burst Descriptor", HFILL}
},
{&hf_docsis_burst_max_burst,
{"8 Max Burst Size (Minislots)", "docsis_ucd.burst.maxburst",
{"Max Burst Size (Minislots)", "docsis_ucd.burst.maxburst",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Max Burst Size (Minislots)", HFILL}
NULL, HFILL}
},
{&hf_docsis_burst_guard_time,
{"9 Guard Time Size (Symbol Times)", "docsis_ucd.burst.guardtime",
{"Guard Time Size (Symbol Times)", "docsis_ucd.burst.guardtime",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Guard Time Size", HFILL}
},
{&hf_docsis_burst_last_cw_len,
{"10 Last Codeword Length", "docsis_ucd.burst.last_cw_len",
{"Last Codeword Length", "docsis_ucd.burst.last_cw_len",
FT_UINT8, BASE_DEC, VALS (last_cw_len_vals), 0x0,
"Last Codeword Length", HFILL}
NULL, HFILL}
},
{&hf_docsis_burst_scrambler_onoff,
{"11 Scrambler On/Off", "docsis_ucd.burst.scrambleronoff",
{"Scrambler On/Off", "docsis_ucd.burst.scrambleronoff",
FT_UINT8, BASE_DEC, VALS (on_off_vals), 0x0,
"Scrambler On/Off", HFILL}
NULL, HFILL}
},
{&hf_docsis_rs_int_depth,
{"12 RS Interleaver Depth", "docsis_ucd.burst.rsintdepth",
{"RS Interleaver Depth", "docsis_ucd.burst.rsintdepth",
FT_UINT8, BASE_DEC, NULL, 0x0,
"R-S Interleaver Depth", HFILL}
},
{&hf_docsis_rs_int_block,
{"13 RS Interleaver Block Size", "docsis_ucd.burst.rsintblock",
{"RS Interleaver Block Size", "docsis_ucd.burst.rsintblock",
FT_UINT8, BASE_DEC, NULL, 0x0,
"R-S Interleaver Block", HFILL}
},
{&hf_docsis_preamble_type,
{"14 Preamble Type", "docsis_ucd.burst.preambletype",
{"Preamble Type", "docsis_ucd.burst.preambletype",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Preamble Type", HFILL}
NULL, HFILL}
},
};
static ei_register_info ei[] = {
{&ei_docsis_ucd_tlvlen_bad, {"docsis_ucd.tlvlen.bad", PI_MALFORMED, PI_ERROR, "Bad TLV length", EXPFILL}},
{&ei_docsis_ucd_tlvlen_bad, {"docsis_ucd.tlvlenbad", PI_MALFORMED, PI_ERROR, "Bad TLV length", EXPFILL}},
};
static gint *ett[] = {
&ett_docsis_ucd,
&ett_tlv,
&ett_docsis_tlv,
&ett_docsis_burst_tlv,
};
expert_module_t* expert_docsis_ucd;