#if 0 code related to unused "docsis" dissector table;

Use consistent indentation & other whitespace cleanup.

svn path=/trunk/; revision=35869
This commit is contained in:
Bill Meier 2011-02-08 00:24:10 +00:00
parent 68b0cd7030
commit 7eb1530061
6 changed files with 3298 additions and 3360 deletions

View File

@ -158,201 +158,201 @@ dissect_attrs (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
length = tvb_get_ntohs (tvb, pos);
pos += 2;
switch (type)
{
case BPKM_RESERVED:
break;
case BPKM_SERIAL_NUM:
proto_tree_add_item (tree, hf_docsis_bpkmattr_serial_num, tvb, pos,
length, FALSE);
break;
case BPKM_MANUFACTURER_ID:
if (length == 3)
proto_tree_add_item (tree, hf_docsis_bpkmattr_manf_id, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_MAC_ADDR:
if (length == 6)
proto_tree_add_item (tree, hf_docsis_bpkmattr_mac_addr, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_RSA_PUB_KEY:
proto_tree_add_item (tree, hf_docsis_bpkmattr_rsa_pub_key, tvb, pos,
length, FALSE);
break;
case BPKM_CM_ID:
cmid_it =
proto_tree_add_text (tree, tvb, pos, length,
"5 CM Identification");
cmid_tree =
proto_item_add_subtree (cmid_it, ett_docsis_bpkmattr_cmid);
cmid_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (cmid_tvb, pinfo, cmid_tree);
break;
case BPKM_DISPLAY_STR:
proto_tree_add_item (tree, hf_docsis_bpkmattr_display_str, tvb, pos,
length, FALSE);
break;
case BPKM_AUTH_KEY:
if ((length == 96) || (length == 128))
proto_tree_add_item (tree, hf_docsis_bpkmattr_auth_key, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_TEK:
if (length == 8)
proto_tree_add_item (tree, hf_docsis_bpkmattr_tek, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_KEY_LIFETIME:
if (length == 4)
proto_tree_add_item (tree, hf_docsis_bpkmattr_key_life, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_KEY_SEQ_NUM:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_key_seq, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_HMAC_DIGEST:
if (length == 20)
proto_tree_add_item (tree, hf_docsis_bpkmattr_hmac_digest, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_SAID:
if (length == 2)
proto_tree_add_item (tree, hf_docsis_bpkmattr_said, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_TEK_PARAM:
tekp_it =
proto_tree_add_text (tree, tvb, pos, length, "13 TEK Parameters");
tekp_tree =
proto_item_add_subtree (tekp_it, ett_docsis_bpkmattr_tekp);
tekp_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (tekp_tvb, pinfo, tekp_tree);
break;
case BPKM_OBSOLETED:
break;
case BPKM_CBC_IV:
if (length == 8)
proto_tree_add_item (tree, hf_docsis_bpkmattr_cbc_iv, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_ERROR_CODE:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_error_code, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_CA_CERT:
proto_tree_add_item (tree, hf_docsis_bpkmattr_ca_cert, tvb, pos,
length, FALSE);
break;
case BPKM_CM_CERT:
proto_tree_add_item (tree, hf_docsis_bpkmattr_cm_cert, tvb, pos,
length, FALSE);
break;
case BPKM_SEC_CAPABILITIES:
scap_it =
proto_tree_add_text (tree, tvb, pos, length,
"19 Security Capabilities");
scap_tree =
proto_item_add_subtree (scap_it, ett_docsis_bpkmattr_scap);
scap_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (scap_tvb, pinfo, scap_tree);
break;
case BPKM_CRYPTO_SUITE:
if (length == 2)
proto_tree_add_item (tree, hf_docsis_bpkmattr_crypto_suite, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_CRYPTO_SUITE_LIST:
proto_tree_add_item (tree, hf_docsis_bpkmattr_crypto_suite_list,
tvb, pos, length, FALSE);
break;
case BPKM_BPI_VERSION:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_bpi_version, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_SA_DESCRIPTOR:
sadsc_it =
proto_tree_add_text (tree, tvb, pos, length, "23 SA Descriptor");
sadsc_tree =
proto_item_add_subtree (sadsc_it, ett_docsis_bpkmattr_sadsc);
sadsc_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (sadsc_tvb, pinfo, sadsc_tree);
break;
case BPKM_SA_TYPE:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_sa_type, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_SA_QUERY:
saqry_it =
proto_tree_add_text (tree, tvb, pos, length, "25 SA Query");
saqry_tree =
proto_item_add_subtree (saqry_it, ett_docsis_bpkmattr_saqry);
saqry_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (saqry_tvb, pinfo, saqry_tree);
break;
case BPKM_SA_QUERY_TYPE:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_sa_query_type, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_IP_ADDRESS:
if (length == 4)
proto_tree_add_item (tree, hf_docsis_bpkmattr_ip_address, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_VENDOR_DEFINED:
proto_tree_add_item (tree, hf_docsis_bpkmattr_vendor_def, tvb, pos,
length, FALSE);
case BPKM_DNLD_PARAMS:
dnld_it =
proto_tree_add_text (tree, tvb, pos, length,
"28 Download Parameters");
dnld_tree =
proto_item_add_subtree (dnld_it, ett_docsis_bpkmattr_dnld);
dnld_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (dnld_tvb, pinfo, dnld_tree);
break;
default:
proto_tree_add_item (tree, hf_docsis_bpkmattr_vendor_def, tvb, pos,
length, FALSE);
break;
}
pos += length; /* switch */
} /* while */
{
case BPKM_RESERVED:
break;
case BPKM_SERIAL_NUM:
proto_tree_add_item (tree, hf_docsis_bpkmattr_serial_num, tvb, pos,
length, FALSE);
break;
case BPKM_MANUFACTURER_ID:
if (length == 3)
proto_tree_add_item (tree, hf_docsis_bpkmattr_manf_id, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_MAC_ADDR:
if (length == 6)
proto_tree_add_item (tree, hf_docsis_bpkmattr_mac_addr, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_RSA_PUB_KEY:
proto_tree_add_item (tree, hf_docsis_bpkmattr_rsa_pub_key, tvb, pos,
length, FALSE);
break;
case BPKM_CM_ID:
cmid_it =
proto_tree_add_text (tree, tvb, pos, length,
"5 CM Identification");
cmid_tree =
proto_item_add_subtree (cmid_it, ett_docsis_bpkmattr_cmid);
cmid_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (cmid_tvb, pinfo, cmid_tree);
break;
case BPKM_DISPLAY_STR:
proto_tree_add_item (tree, hf_docsis_bpkmattr_display_str, tvb, pos,
length, FALSE);
break;
case BPKM_AUTH_KEY:
if ((length == 96) || (length == 128))
proto_tree_add_item (tree, hf_docsis_bpkmattr_auth_key, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_TEK:
if (length == 8)
proto_tree_add_item (tree, hf_docsis_bpkmattr_tek, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_KEY_LIFETIME:
if (length == 4)
proto_tree_add_item (tree, hf_docsis_bpkmattr_key_life, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_KEY_SEQ_NUM:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_key_seq, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_HMAC_DIGEST:
if (length == 20)
proto_tree_add_item (tree, hf_docsis_bpkmattr_hmac_digest, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_SAID:
if (length == 2)
proto_tree_add_item (tree, hf_docsis_bpkmattr_said, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_TEK_PARAM:
tekp_it =
proto_tree_add_text (tree, tvb, pos, length, "13 TEK Parameters");
tekp_tree =
proto_item_add_subtree (tekp_it, ett_docsis_bpkmattr_tekp);
tekp_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (tekp_tvb, pinfo, tekp_tree);
break;
case BPKM_OBSOLETED:
break;
case BPKM_CBC_IV:
if (length == 8)
proto_tree_add_item (tree, hf_docsis_bpkmattr_cbc_iv, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_ERROR_CODE:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_error_code, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_CA_CERT:
proto_tree_add_item (tree, hf_docsis_bpkmattr_ca_cert, tvb, pos,
length, FALSE);
break;
case BPKM_CM_CERT:
proto_tree_add_item (tree, hf_docsis_bpkmattr_cm_cert, tvb, pos,
length, FALSE);
break;
case BPKM_SEC_CAPABILITIES:
scap_it =
proto_tree_add_text (tree, tvb, pos, length,
"19 Security Capabilities");
scap_tree =
proto_item_add_subtree (scap_it, ett_docsis_bpkmattr_scap);
scap_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (scap_tvb, pinfo, scap_tree);
break;
case BPKM_CRYPTO_SUITE:
if (length == 2)
proto_tree_add_item (tree, hf_docsis_bpkmattr_crypto_suite, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_CRYPTO_SUITE_LIST:
proto_tree_add_item (tree, hf_docsis_bpkmattr_crypto_suite_list,
tvb, pos, length, FALSE);
break;
case BPKM_BPI_VERSION:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_bpi_version, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_SA_DESCRIPTOR:
sadsc_it =
proto_tree_add_text (tree, tvb, pos, length, "23 SA Descriptor");
sadsc_tree =
proto_item_add_subtree (sadsc_it, ett_docsis_bpkmattr_sadsc);
sadsc_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (sadsc_tvb, pinfo, sadsc_tree);
break;
case BPKM_SA_TYPE:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_sa_type, tvb, pos,
length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_SA_QUERY:
saqry_it =
proto_tree_add_text (tree, tvb, pos, length, "25 SA Query");
saqry_tree =
proto_item_add_subtree (saqry_it, ett_docsis_bpkmattr_saqry);
saqry_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (saqry_tvb, pinfo, saqry_tree);
break;
case BPKM_SA_QUERY_TYPE:
if (length == 1)
proto_tree_add_item (tree, hf_docsis_bpkmattr_sa_query_type, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_IP_ADDRESS:
if (length == 4)
proto_tree_add_item (tree, hf_docsis_bpkmattr_ip_address, tvb,
pos, length, FALSE);
else
THROW (ReportedBoundsError);
break;
case BPKM_VENDOR_DEFINED:
proto_tree_add_item (tree, hf_docsis_bpkmattr_vendor_def, tvb, pos,
length, FALSE);
case BPKM_DNLD_PARAMS:
dnld_it =
proto_tree_add_text (tree, tvb, pos, length,
"28 Download Parameters");
dnld_tree =
proto_item_add_subtree (dnld_it, ett_docsis_bpkmattr_dnld);
dnld_tvb = tvb_new_subset (tvb, pos, length, length);
dissect_attrs (dnld_tvb, pinfo, dnld_tree);
break;
default:
proto_tree_add_item (tree, hf_docsis_bpkmattr_vendor_def, tvb, pos,
length, FALSE);
break;
}
pos += length; /* switch */
} /* while */
}
static void
@ -365,8 +365,8 @@ dissect_bpkmattr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
if (tree)
{
it =
proto_tree_add_protocol_format (tree, proto_docsis_bpkmattr, tvb, 0, -1,
"BPKM Attributes");
proto_tree_add_protocol_format (tree, proto_docsis_bpkmattr, tvb, 0, -1,
"BPKM Attributes");
bpkmattr_tree = proto_item_add_subtree (it, ett_docsis_bpkmattr);
dissect_attrs (tvb, pinfo, bpkmattr_tree);
}
@ -552,7 +552,7 @@ proto_register_docsis_bpkmattr (void)
proto_register_subtree_array (ett, array_length (ett));
register_dissector ("docsis_bpkmattr", dissect_bpkmattr,
proto_docsis_bpkmattr);
proto_docsis_bpkmattr);
}
@ -563,9 +563,11 @@ proto_register_docsis_bpkmattr (void)
void
proto_reg_handoff_docsis_bpkmattr (void)
{
#if 0
dissector_handle_t docsis_bpkmattr_handle;
docsis_bpkmattr_handle = find_dissector ("docsis_bpkmattr");
dissector_add_uint ("docsis", 0xFE, docsis_bpkmattr_handle);
#endif
}

View File

@ -107,7 +107,9 @@ static dissector_handle_t docsis_handle;
static dissector_handle_t eth_withoutfcs_handle;
static dissector_handle_t data_handle;
static dissector_handle_t docsis_mgmt_handle;
#if 0
static dissector_table_t docsis_dissector_table;
#endif
/* Initialize the subtree pointers */
static gint ett_docsis = -1;
@ -195,105 +197,105 @@ dissect_ehdr (tvbuff_t * tvb, proto_tree * tree, gboolean isfrag)
{
type = (tvb_get_guint8 (tvb, pos) & 0xF0);
len = (tvb_get_guint8 (tvb, pos) & 0x0F);
if ((((type >> 4) & 0x0F)== 6) && (len == 2))
if ((((type >> 4) & 0x0F)== 6) && (len == 2))
{
item = proto_tree_add_item(ehdr_tree, hf_docsis_eh_type, tvb, pos, 1, FALSE);
PROTO_ITEM_SET_HIDDEN(item);
proto_tree_add_text(ehdr_tree, tvb, pos, 1, "0110 .... = Unsolicited Grant Sync EHDR Sub-Element" );
PROTO_ITEM_SET_HIDDEN(item);
proto_tree_add_text(ehdr_tree, tvb, pos, 1, "0110 .... = Unsolicited Grant Sync EHDR Sub-Element" );
}
else
proto_tree_add_item (ehdr_tree, hf_docsis_eh_type, tvb, pos, 1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_eh_len, tvb, pos, 1, FALSE);
switch ((type >> 4) & 0x0F)
{
case EH_REQUEST:
if (len == 3)
{
mini_slots = tvb_get_guint8 (tvb, pos + 1);
sid = tvb_get_ntohs (tvb, pos + 2);
proto_tree_add_uint (ehdr_tree, hf_docsis_mini_slots, tvb,
pos + 1, 1, mini_slots);
proto_tree_add_uint (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2,
sid);
}
else
{
THROW (ReportedBoundsError);
}
break;
case EH_ACK_REQ:
if (len == 2)
{
sid = tvb_get_ntohs (tvb, pos + 1);
proto_tree_add_uint (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2,
sid);
}
else
{
THROW (ReportedBoundsError);
}
case EH_BP_UP:
proto_tree_add_item (ehdr_tree, hf_docsis_key_seq, tvb, pos + 1, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_ver, tvb, pos + 1, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_bpi_en, tvb, pos + 2, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_toggle_bit, tvb, pos + 2,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_mini_slots, tvb, pos + 4,
1, FALSE);
if (isfrag)
{
proto_tree_add_item (ehdr_tree, hf_docsis_frag_rsvd, tvb, pos+5,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_frag_first, tvb, pos+5,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_frag_last, tvb, pos+5,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_frag_seq, tvb, pos+5,
1, FALSE);
}
break;
case EH_BP_DOWN:
proto_tree_add_item (ehdr_tree, hf_docsis_key_seq, tvb, pos + 1, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_ver, tvb, pos + 1, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_bpi_en, tvb, pos + 2, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_toggle_bit, tvb, pos + 2,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_said, tvb, pos + 2, 2,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_reserved, tvb, pos + 4, 1,
FALSE);
break;
case EH_SFLOW_HDR_DOWN:
case EH_SFLOW_HDR_UP:
val = tvb_get_guint8 (tvb, pos+1);
if (val == 0)
{
item = proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, FALSE);
PROTO_ITEM_SET_HIDDEN(item);
proto_tree_add_text (ehdr_tree, tvb, pos+1, 1, "0000 0000 = No PHS on current packet" );
}
else
proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, FALSE);
{
case EH_REQUEST:
if (len == 3)
{
mini_slots = tvb_get_guint8 (tvb, pos + 1);
sid = tvb_get_ntohs (tvb, pos + 2);
proto_tree_add_uint (ehdr_tree, hf_docsis_mini_slots, tvb,
pos + 1, 1, mini_slots);
proto_tree_add_uint (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2,
sid);
}
else
{
THROW (ReportedBoundsError);
}
break;
case EH_ACK_REQ:
if (len == 2)
{
sid = tvb_get_ntohs (tvb, pos + 1);
proto_tree_add_uint (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2,
sid);
}
else
{
THROW (ReportedBoundsError);
}
case EH_BP_UP:
proto_tree_add_item (ehdr_tree, hf_docsis_key_seq, tvb, pos + 1, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_ver, tvb, pos + 1, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_bpi_en, tvb, pos + 2, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_toggle_bit, tvb, pos + 2,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_sid, tvb, pos + 2, 2,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_mini_slots, tvb, pos + 4,
1, FALSE);
if (isfrag)
{
proto_tree_add_item (ehdr_tree, hf_docsis_frag_rsvd, tvb, pos+5,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_frag_first, tvb, pos+5,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_frag_last, tvb, pos+5,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_frag_seq, tvb, pos+5,
1, FALSE);
}
break;
case EH_BP_DOWN:
proto_tree_add_item (ehdr_tree, hf_docsis_key_seq, tvb, pos + 1, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_ver, tvb, pos + 1, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_bpi_en, tvb, pos + 2, 1,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_toggle_bit, tvb, pos + 2,
1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_said, tvb, pos + 2, 2,
FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_reserved, tvb, pos + 4, 1,
FALSE);
break;
case EH_SFLOW_HDR_DOWN:
case EH_SFLOW_HDR_UP:
val = tvb_get_guint8 (tvb, pos+1);
if (val == 0)
{
item = proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, FALSE);
PROTO_ITEM_SET_HIDDEN(item);
proto_tree_add_text (ehdr_tree, tvb, pos+1, 1, "0000 0000 = No PHS on current packet" );
}
else
proto_tree_add_item(ehdr_tree, hf_docsis_ehdr_phsi, tvb, pos+1, 1, FALSE);
if (len == 2)
{
proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_qind, tvb, pos+2, 1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_grants, tvb, pos+2, 1, FALSE);
}
break;
default:
if (len > 0)
proto_tree_add_item (ehdr_tree, hf_docsis_eh_val, tvb, pos + 1,
len, FALSE);
}
if (len == 2)
{
proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_qind, tvb, pos+2, 1, FALSE);
proto_tree_add_item (ehdr_tree, hf_docsis_ehdr_grants, tvb, pos+2, 1, FALSE);
}
break;
default:
if (len > 0)
proto_tree_add_item (ehdr_tree, hf_docsis_eh_val, tvb, pos + 1,
len, FALSE);
}
pos += len + 1;
}
@ -327,13 +329,13 @@ dissect_docsis (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
static gint concatpos;
/* Extract important fields */
fc = tvb_get_guint8 (tvb, 0); /* Frame Control Byte */
fctype = (fc >> 6) & 0x03; /* Frame Control Type: 2 MSB Bits */
fcparm = (fc >> 1) & 0x1F; /* Frame Control Parameter: Next 5 Bits */
ehdron = (fc & 0x01); /* Extended Header Bit: LSB */
fc = tvb_get_guint8 (tvb, 0); /* Frame Control Byte */
fctype = (fc >> 6) & 0x03; /* Frame Control Type: 2 MSB Bits */
fcparm = (fc >> 1) & 0x1F; /* Frame Control Parameter: Next 5 Bits */
ehdron = (fc & 0x01); /* Extended Header Bit: LSB */
mac_parm = tvb_get_guint8 (tvb, 1); /* Mac Parm */
len_sid = tvb_get_ntohs (tvb, 2); /* Length Or SID */
mac_parm = tvb_get_guint8 (tvb, 1); /* Mac Parm */
len_sid = tvb_get_ntohs (tvb, 2); /* Length Or SID */
/* set Header length based on presence of Extended header */
if (ehdron == 0x00)
@ -367,122 +369,122 @@ dissect_docsis (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
/* Make entries in Protocol column and Info column on summary display */
col_set_str (pinfo->cinfo, COL_PROTOCOL, "DOCSIS");
col_clear (pinfo->cinfo, COL_INFO);
switch (fctype)
{
case FCTYPE_PACKET:
col_set_str (pinfo->cinfo, COL_INFO, "Packet PDU");
break;
case FCTYPE_ATMPDU:
col_set_str (pinfo->cinfo, COL_INFO, "ATM PDU");
break;
case FCTYPE_RESRVD:
col_set_str (pinfo->cinfo, COL_INFO, "Reserved PDU");
break;
case FCTYPE_MACSPC:
if (fcparm == 0x02)
col_add_fstr (pinfo->cinfo, COL_INFO,
"Request Frame SID = %u Mini Slots = %u", len_sid,
mac_parm);
else if (fcparm == 0x03)
col_set_str (pinfo->cinfo, COL_INFO, "Fragmented Frame");
else
col_set_str (pinfo->cinfo, COL_INFO, "Mac Specific");
break;
} /* switch */
col_clear (pinfo->cinfo, COL_INFO);
switch (fctype)
{
case FCTYPE_PACKET:
col_set_str (pinfo->cinfo, COL_INFO, "Packet PDU");
break;
case FCTYPE_ATMPDU:
col_set_str (pinfo->cinfo, COL_INFO, "ATM PDU");
break;
case FCTYPE_RESRVD:
col_set_str (pinfo->cinfo, COL_INFO, "Reserved PDU");
break;
case FCTYPE_MACSPC:
if (fcparm == 0x02)
col_add_fstr (pinfo->cinfo, COL_INFO,
"Request Frame SID = %u Mini Slots = %u", len_sid,
mac_parm);
else if (fcparm == 0x03)
col_set_str (pinfo->cinfo, COL_INFO, "Fragmented Frame");
else
col_set_str (pinfo->cinfo, COL_INFO, "Mac Specific");
break;
} /* switch */
/* In the interest of speed, if "tree" is NULL, don't do any work not
necessary to generate protocol tree items. */
if (tree)
{
ti = proto_tree_add_protocol_format (tree, proto_docsis, tvb, 0,
hdrlen, "DOCSIS");
hdrlen, "DOCSIS");
docsis_tree = proto_item_add_subtree (ti, ett_docsis);
/* add an item to the subtree, see section 1.6 for more information */
proto_tree_add_item (docsis_tree, hf_docsis_fctype, tvb, 0, 1, FALSE);
switch (fctype)
{
case FCTYPE_PACKET:
case FCTYPE_ATMPDU:
case FCTYPE_RESRVD:
proto_tree_add_item (docsis_tree, hf_docsis_fcparm, tvb, 0, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_ehdron, tvb, 0, 1,
FALSE);
if (ehdron == 0x01)
{
proto_tree_add_item (docsis_tree, hf_docsis_ehdrlen, tvb, 1, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
dissect_ehdr (tvb, docsis_tree, isfrag);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb,
4 + mac_parm, 2, FALSE);
}
else
{
proto_tree_add_item (docsis_tree, hf_docsis_macparm, tvb, 1, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2,
FALSE);
}
break;
case FCTYPE_MACSPC:
proto_tree_add_item (docsis_tree, hf_docsis_machdr_fcparm, tvb, 0,
1, FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_ehdron, tvb, 0, 1,
FALSE);
/* Decode for a Request Frame. No extended header */
if (fcparm == 0x02)
{
proto_tree_add_uint (docsis_tree, hf_docsis_mini_slots, tvb, 1,
1, mac_parm);
proto_tree_add_uint (docsis_tree, hf_docsis_sid, tvb, 2, 2,
len_sid);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2,
FALSE);
break;
}
/* Check if this is a fragmentation header */
if (fcparm == 0x03)
{
isfrag = TRUE;
}
/* Decode for a Concatenated Header. No Extended Header */
if (fcparm == 0x1c)
{
proto_item_append_text (ti, " (Concatenated Header)");
proto_tree_add_item (docsis_tree, hf_docsis_concat_cnt, tvb, 1,
1, FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2,
FALSE);
break;
}
/* If Extended header is present then decode it */
if (ehdron == 0x01)
{
proto_tree_add_item (docsis_tree, hf_docsis_ehdrlen, tvb, 1, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
dissect_ehdr (tvb, docsis_tree, isfrag);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb,
4 + mac_parm, 2, FALSE);
break;
}
/* default case for all other Mac Frame Types */
proto_tree_add_item (docsis_tree, hf_docsis_macparm, tvb, 1, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2, FALSE);
break;
}
{
case FCTYPE_PACKET:
case FCTYPE_ATMPDU:
case FCTYPE_RESRVD:
proto_tree_add_item (docsis_tree, hf_docsis_fcparm, tvb, 0, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_ehdron, tvb, 0, 1,
FALSE);
if (ehdron == 0x01)
{
proto_tree_add_item (docsis_tree, hf_docsis_ehdrlen, tvb, 1, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
dissect_ehdr (tvb, docsis_tree, isfrag);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb,
4 + mac_parm, 2, FALSE);
}
else
{
proto_tree_add_item (docsis_tree, hf_docsis_macparm, tvb, 1, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2,
FALSE);
}
break;
case FCTYPE_MACSPC:
proto_tree_add_item (docsis_tree, hf_docsis_machdr_fcparm, tvb, 0,
1, FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_ehdron, tvb, 0, 1,
FALSE);
/* Decode for a Request Frame. No extended header */
if (fcparm == 0x02)
{
proto_tree_add_uint (docsis_tree, hf_docsis_mini_slots, tvb, 1,
1, mac_parm);
proto_tree_add_uint (docsis_tree, hf_docsis_sid, tvb, 2, 2,
len_sid);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2,
FALSE);
break;
}
/* Check if this is a fragmentation header */
if (fcparm == 0x03)
{
isfrag = TRUE;
}
/* Decode for a Concatenated Header. No Extended Header */
if (fcparm == 0x1c)
{
proto_item_append_text (ti, " (Concatenated Header)");
proto_tree_add_item (docsis_tree, hf_docsis_concat_cnt, tvb, 1,
1, FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2,
FALSE);
break;
}
/* If Extended header is present then decode it */
if (ehdron == 0x01)
{
proto_tree_add_item (docsis_tree, hf_docsis_ehdrlen, tvb, 1, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
dissect_ehdr (tvb, docsis_tree, isfrag);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb,
4 + mac_parm, 2, FALSE);
break;
}
/* default case for all other Mac Frame Types */
proto_tree_add_item (docsis_tree, hf_docsis_macparm, tvb, 1, 1,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_lensid, tvb, 2, 2,
FALSE);
proto_tree_add_item (docsis_tree, hf_docsis_hcs, tvb, 4, 2, FALSE);
break;
}
}
/* If this protocol has a sub-dissector call it here, see section 1.8 */
@ -490,73 +492,73 @@ dissect_docsis (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
case FCTYPE_PACKET:
if (pdulen >= 0)
{
if (pdulen > 0)
{
next_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen);
call_dissector (eth_withoutfcs_handle, next_tvb, pinfo, tree);
}
if (concatlen > 0)
{
concatlen = concatlen - framelen;
concatpos += framelen;
}
}
{
if (pdulen > 0)
{
next_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen);
call_dissector (eth_withoutfcs_handle, next_tvb, pinfo, tree);
}
if (concatlen > 0)
{
concatlen = concatlen - framelen;
concatpos += framelen;
}
}
break;
case FCTYPE_MACSPC:
switch (fcparm)
{
case 0x00:
case 0x01:
if (pdulen > 0)
{
mgt_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen);
call_dissector (docsis_mgmt_handle, mgt_tvb, pinfo, tree);
}
if (concatlen > 0)
{
concatlen = concatlen - framelen;
concatpos += framelen;
}
break;
case 0x02:
/* Don't do anything for a Request Frame */
break;
case 0x03:
/* For Fragmentation Frames simply dissect using the data
* dissector as we don't handle them yet
*/
if (pdulen > 0)
{
mgt_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen);
call_dissector (data_handle, mgt_tvb, pinfo, tree);
}
if (concatlen > 0)
{
concatlen = concatlen - framelen;
concatpos += framelen;
}
break;
case 0x1c:
/* call the docsis dissector on the same frame
* to dissect DOCSIS frames within the concatenated
* frame. concatpos and concatlen are declared
* static and are decremented and incremented
* respectively when the inner
* docsis frames are dissected. */
while (concatlen > 0)
{
oldconcatlen = concatlen;
next_tvb = tvb_new_subset (tvb, concatpos, -1, concatlen);
call_dissector (docsis_handle, next_tvb, pinfo, tree);
if (oldconcatlen <= concatlen)
THROW(ReportedBoundsError);
}
concatlen = 0;
concatpos = 0;
col_set_str(pinfo->cinfo, COL_INFO, "Concatenated Frame");
break;
}
{
case 0x00:
case 0x01:
if (pdulen > 0)
{
mgt_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen);
call_dissector (docsis_mgmt_handle, mgt_tvb, pinfo, tree);
}
if (concatlen > 0)
{
concatlen = concatlen - framelen;
concatpos += framelen;
}
break;
case 0x02:
/* Don't do anything for a Request Frame */
break;
case 0x03:
/* For Fragmentation Frames simply dissect using the data
* dissector as we don't handle them yet
*/
if (pdulen > 0)
{
mgt_tvb = tvb_new_subset (tvb, hdrlen, captured_length, pdulen);
call_dissector (data_handle, mgt_tvb, pinfo, tree);
}
if (concatlen > 0)
{
concatlen = concatlen - framelen;
concatpos += framelen;
}
break;
case 0x1c:
/* call the docsis dissector on the same frame
* to dissect DOCSIS frames within the concatenated
* frame. concatpos and concatlen are declared
* static and are decremented and incremented
* respectively when the inner
* docsis frames are dissected. */
while (concatlen > 0)
{
oldconcatlen = concatlen;
next_tvb = tvb_new_subset (tvb, concatpos, -1, concatlen);
call_dissector (docsis_handle, next_tvb, pinfo, tree);
if (oldconcatlen <= concatlen)
THROW(ReportedBoundsError);
}
concatlen = 0;
concatpos = 0;
col_set_str(pinfo->cinfo, COL_INFO, "Concatenated Frame");
break;
}
break;
}
}
@ -719,9 +721,11 @@ proto_register_docsis (void)
&ett_ehdr,
};
#if 0
docsis_dissector_table = register_dissector_table ("docsis",
"DOCSIS Encapsulation Type",
FT_UINT8, BASE_DEC);
"DOCSIS Encapsulation Type",
FT_UINT8, BASE_DEC);
#endif
/* Register the protocol name and description */
proto_docsis = proto_register_protocol ("DOCSIS 1.1", "DOCSIS", "docsis");
@ -742,7 +746,6 @@ void
proto_reg_handoff_docsis (void)
{
docsis_handle = find_dissector ("docsis");
data_handle = find_dissector ("data");
dissector_add_uint ("wtap_encap", WTAP_ENCAP_DOCSIS, docsis_handle);

View File

@ -171,27 +171,27 @@ dissect_macmgmt (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
if (tree)
{
mgt_hdr_it =
proto_tree_add_protocol_format (tree, proto_docsis_mgmt, tvb, 0, 20,
"Mac Management");
proto_tree_add_protocol_format (tree, proto_docsis_mgmt, tvb, 0, 20,
"Mac Management");
mgt_hdr_tree = proto_item_add_subtree (mgt_hdr_it, ett_docsis_mgmt);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_dst_addr, tvb, 0, 6,
FALSE);
FALSE);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_src_addr, tvb, 6, 6,
FALSE);
FALSE);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_msg_len, tvb, 12, 2,
FALSE);
FALSE);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_dsap, tvb, 14, 1,
FALSE);
FALSE);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_ssap, tvb, 15, 1,
FALSE);
FALSE);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_control, tvb, 16, 1,
FALSE);
FALSE);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_version, tvb, 17, 1,
FALSE);
FALSE);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_type, tvb, 18, 1,
FALSE);
FALSE);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_rsvd, tvb, 19, 1,
FALSE);
FALSE);
}
/* Code to Call subdissector */
@ -276,14 +276,14 @@ proto_register_docsis_mgmt (void)
};
docsis_mgmt_dissector_table = register_dissector_table ("docsis_mgmt",
"DOCSIS Mac Management",
FT_UINT8, BASE_DEC);
"DOCSIS Mac Management",
FT_UINT8, BASE_DEC);
/* Register the protocol name and description */
proto_docsis_mgmt = proto_register_protocol ("DOCSIS Mac Management",
"DOCSIS MAC MGMT",
"docsis_mgmt");
"DOCSIS MAC MGMT",
"docsis_mgmt");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array (proto_docsis_mgmt, hf, array_length (hf));
@ -300,10 +300,12 @@ proto_register_docsis_mgmt (void)
void
proto_reg_handoff_docsis_mgmt (void)
{
#if 0
dissector_handle_t docsis_mgmt_handle;
docsis_mgmt_handle = find_dissector ("docsis_mgmt");
data_handle = find_dissector ("data");
dissector_add_uint ("docsis", 0x03, docsis_mgmt_handle);
#endif
data_handle = find_dissector ("data");
}

View File

@ -64,7 +64,7 @@ static gint ett_cmctrl_tlv_us_event = -1;
static void
dissect_ds_event(tvbuff_t * tvb, proto_tree *tree, int start, guint16 len)
dissect_ds_event(tvbuff_t * tvb, proto_tree *tree, int start, guint16 len)
{
guint8 type, length;
proto_item *it;
@ -72,7 +72,7 @@ dissect_ds_event(tvbuff_t * tvb, proto_tree *tree, int start, guint16 len)
int pos = start;
it =
proto_tree_add_text (tree, tvb, start, len,
"Override Downstream Status Event Event Mask (Length = %u)", len);
"Override Downstream Status Event Event Mask (Length = %u)", len);
event_tree = proto_item_add_subtree (it, ett_cmctrl_tlv_ds_event);
while (pos < (start + len))
@ -80,36 +80,36 @@ dissect_ds_event(tvbuff_t * tvb, proto_tree *tree, int start, guint16 len)
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case DS_EVENT_CH_ID:
{
case DS_EVENT_CH_ID:
if (length == 1)
{
proto_tree_add_item (event_tree, hf_ds_event_ch_id,
tvb, pos, length, FALSE);
}
{
proto_tree_add_item (event_tree, hf_ds_event_ch_id,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case DS_EVENT_MASK:
{
THROW (ReportedBoundsError);
}
break;
case DS_EVENT_MASK:
if (length == 2)
{
proto_tree_add_item (event_tree, hf_ds_event_mask,
tvb, pos, length, FALSE);
}
{
proto_tree_add_item (event_tree, hf_ds_event_mask,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
} /* switch */
{
THROW (ReportedBoundsError);
}
break;
} /* switch */
pos = pos + length;
} /* while */
} /* while */
}
static void
dissect_us_event(tvbuff_t * tvb, proto_tree *tree, int start, guint16 len)
dissect_us_event(tvbuff_t * tvb, proto_tree *tree, int start, guint16 len)
{
guint8 type, length;
proto_item *it;
@ -117,7 +117,7 @@ dissect_us_event(tvbuff_t * tvb, proto_tree *tree, int start, guint16 len)
int pos = start;
it =
proto_tree_add_text (tree, tvb, start, len,
"Override Upstream Status Enable Event Mask (Length = %u)", len);
"Override Upstream Status Enable Event Mask (Length = %u)", len);
event_tree = proto_item_add_subtree (it, ett_cmctrl_tlv_us_event);
while (pos < (start + len))
@ -125,32 +125,32 @@ dissect_us_event(tvbuff_t * tvb, proto_tree *tree, int start, guint16 len)
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case US_EVENT_CH_ID:
{
case US_EVENT_CH_ID:
if (length == 1)
{
proto_tree_add_item (event_tree, hf_us_event_ch_id,
tvb, pos, length, FALSE);
}
{
proto_tree_add_item (event_tree, hf_us_event_ch_id,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case US_EVENT_MASK:
{
THROW (ReportedBoundsError);
}
break;
case US_EVENT_MASK:
if (length == 2)
{
proto_tree_add_item (event_tree, hf_us_event_mask,
tvb, pos, length, FALSE);
}
{
proto_tree_add_item (event_tree, hf_us_event_mask,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
} /* switch */
{
THROW (ReportedBoundsError);
}
break;
} /* switch */
pos = pos + length;
} /* while */
} /* while */
}
static void
@ -166,89 +166,89 @@ dissect_cmctrl_tlv (tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree)
total_len = tvb_reported_length_remaining (tvb, 0);
it =
proto_tree_add_protocol_format (tree, proto_cmctrl_tlv, tvb, 0,
total_len, "TLV Data");
tlv_tree = proto_item_add_subtree (it, ett_cmctrl_tlv);
proto_tree_add_protocol_format (tree, proto_cmctrl_tlv, tvb, 0,
total_len, "TLV Data");
tlv_tree = proto_item_add_subtree (it, ett_cmctrl_tlv);
while (pos < total_len)
{
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case CM_CTRL_MUTE:
if (length == 1)
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_mute,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case CM_CTRL_MUTE_TIMEOUT:
if (length == 4 || length == 1) /* response TLV always with len 1 */
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_mute_timeout,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case CM_CTRL_REINIT:
if (length == 1)
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_reinit,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case CM_CTRL_DISABLE_FWD:
if (length == 1)
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_disable_fwd,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case CM_CTRL_DS_EVENT:
if (length == 1)
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_ds_event,
tvb, pos, length, FALSE);
else
dissect_ds_event(tvb, tlv_tree, pos, length);
break;
case CM_CTRL_US_EVENT:
if (length == 1)
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_ds_event,
tvb, pos, length, FALSE);
else
dissect_us_event(tvb, tlv_tree, pos, length);
break;
case CM_CTRL_EVENT:
if (length == 2 || length == 1) /* response TLV always with len 1 */
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_event,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
while (pos < total_len)
{
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case CM_CTRL_MUTE:
if (length == 1)
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_mute,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case CM_CTRL_MUTE_TIMEOUT:
if (length == 4 || length == 1) /* response TLV always with len 1 */
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_mute_timeout,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case CM_CTRL_REINIT:
if (length == 1)
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_reinit,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case CM_CTRL_DISABLE_FWD:
if (length == 1)
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_disable_fwd,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
case CM_CTRL_DS_EVENT:
if (length == 1)
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_ds_event,
tvb, pos, length, FALSE);
else
dissect_ds_event(tvb, tlv_tree, pos, length);
break;
case CM_CTRL_US_EVENT:
if (length == 1)
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_ds_event,
tvb, pos, length, FALSE);
else
dissect_us_event(tvb, tlv_tree, pos, length);
break;
case CM_CTRL_EVENT:
if (length == 2 || length == 1) /* response TLV always with len 1 */
{
proto_tree_add_item (tlv_tree, hf_cmctrl_tlv_event,
tvb, pos, length, FALSE);
}
else
{
THROW (ReportedBoundsError);
}
break;
} /* switch */
pos = pos + length;
} /* while */
} /* switch */
pos = pos + length;
} /* while */
}
/* Register the protocol with Wireshark */
@ -330,7 +330,7 @@ proto_register_cmctrl_tlv (void)
/* Register the protocol name and description */
proto_cmctrl_tlv = proto_register_protocol ("DOCSIS CM-CTRL TLV's",
"DOCSIS CM-CTRL TLVs", "cmctrl_tlv");
"DOCSIS CM-CTRL TLVs", "cmctrl_tlv");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array (proto_cmctrl_tlv, hf, array_length (hf));
@ -346,10 +346,11 @@ proto_register_cmctrl_tlv (void)
void
proto_reg_handoff_cmctrl_tlv (void)
{
#if 0
dissector_handle_t cmctrl_tlv_handle;
cmctrl_tlv_handle = find_dissector ("cmctrl_tlv");
dissector_add_uint ("docsis", 0xFE, cmctrl_tlv_handle);
#endif
}

File diff suppressed because it is too large Load Diff

View File

@ -27,13 +27,13 @@
/* Notes to Adding dissectors for Vendor specific TLV's:
* 1. Create a dissect_<vendorname> function with the following prototype:
* dissect_foovendor(tvbuff_t *tvb, proto_tree *tree, gint vsif_len)
* 2. vsif_len will be the *entire* length of the vsif TLV (including the
* 2. vsif_len will be the *entire* length of the vsif TLV (including the
* Vendor Id TLV, which is 5 bytes long).
* 3. Create a new 'case' statement in dissect_vsif, for your specific Vendor
* id.
* id.
* 4. In that 'case' statement you will make the following calls:
* (assume for this example that your vendor id is 0x000054)
* #define VENDOR_FOOVENDOR 0x00054
* #define VENDOR_FOOVENDOR 0x00054
* case VENDOR_FOOVENDOR:
* proto_item_append_text (it, " (foo vendor)");
* dissect_foovendor (tvb, vsif_tree, vsif_len);
@ -73,15 +73,15 @@ static gint ett_docsis_vsif = -1;
static gint ett_docsis_vsif_ipprec = -1;
static const value_string vendorid_vals[] = {
{VENDOR_CISCO, "Cisco Systems, Inc."},
{0, NULL},
{VENDOR_CISCO, "Cisco Systems, Inc."},
{0, NULL},
};
/* Forward Declarations for vendor specific dissectors */
static void dissect_cisco (tvbuff_t * tvb, proto_tree * tree,
gint vsif_len);
gint vsif_len);
/* Code to actually dissect the packets */
static void
@ -117,26 +117,26 @@ dissect_vsif (tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree)
if (tree)
{
it =
proto_tree_add_protocol_format (tree, proto_docsis_vsif, tvb, 0, -1,
"VSIF Encodings");
proto_tree_add_protocol_format (tree, proto_docsis_vsif, tvb, 0, -1,
"VSIF Encodings");
vsif_tree = proto_item_add_subtree (it, ett_docsis_vsif);
proto_tree_add_item (vsif_tree, hf_docsis_vsif_vendorid, tvb, 2, 3, FALSE);
/* switch on the Vendor ID */
switch (value)
{
case VENDOR_CISCO:
proto_item_append_text (it, " (Cisco)");
dissect_cisco (tvb, vsif_tree, vsif_len);
break;
default:
proto_item_append_text (it, " (Unknown)");
proto_tree_add_item (vsif_tree, hf_docsis_vsif_vendor_unknown, tvb,
0, -1, FALSE);
break;
}
{
case VENDOR_CISCO:
proto_item_append_text (it, " (Cisco)");
dissect_cisco (tvb, vsif_tree, vsif_len);
break;
default:
proto_item_append_text (it, " (Unknown)");
proto_tree_add_item (vsif_tree, hf_docsis_vsif_vendor_unknown, tvb,
0, -1, FALSE);
break;
}
} /* if(tree) */
} /* if(tree) */
}
@ -166,48 +166,48 @@ dissect_cisco (tvbuff_t * tvb, proto_tree * tree, gint vsif_len)
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case NUM_PHONES:
proto_tree_add_item (tree, hf_docsis_vsif_cisco_numphones, tvb,
pos, length, FALSE);
break;
case IP_PREC:
ipprec_it =
proto_tree_add_text (tree, tvb, pos, length, "IP Precedence");
ipprec_tree =
proto_item_add_subtree (ipprec_it, ett_docsis_vsif_ipprec);
/* Handle Sub-TLVs in IP Precedence */
templen = pos + length;
while (pos < templen)
{
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case IP_PREC_VAL:
if (length != 1)
THROW (ReportedBoundsError);
proto_tree_add_item (ipprec_tree,
hf_docsis_vsif_cisco_ipprec_val, tvb,
pos, length, FALSE);
break;
case IP_PREC_BW:
if (length != 4)
THROW (ReportedBoundsError);
proto_tree_add_item (ipprec_tree,
hf_docsis_vsif_cisco_ipprec_bw, tvb,
pos, length, FALSE);
break;
default:
THROW (ReportedBoundsError);
}
pos += length;
}
break;
case IOS_CONFIG_FILE:
proto_tree_add_item (tree, hf_docsis_vsif_cisco_config_file, tvb,
pos, length, FALSE);
}
{
case NUM_PHONES:
proto_tree_add_item (tree, hf_docsis_vsif_cisco_numphones, tvb,
pos, length, FALSE);
break;
case IP_PREC:
ipprec_it =
proto_tree_add_text (tree, tvb, pos, length, "IP Precedence");
ipprec_tree =
proto_item_add_subtree (ipprec_it, ett_docsis_vsif_ipprec);
/* Handle Sub-TLVs in IP Precedence */
templen = pos + length;
while (pos < templen)
{
type = tvb_get_guint8 (tvb, pos++);
length = tvb_get_guint8 (tvb, pos++);
switch (type)
{
case IP_PREC_VAL:
if (length != 1)
THROW (ReportedBoundsError);
proto_tree_add_item (ipprec_tree,
hf_docsis_vsif_cisco_ipprec_val, tvb,
pos, length, FALSE);
break;
case IP_PREC_BW:
if (length != 4)
THROW (ReportedBoundsError);
proto_tree_add_item (ipprec_tree,
hf_docsis_vsif_cisco_ipprec_bw, tvb,
pos, length, FALSE);
break;
default:
THROW (ReportedBoundsError);
}
pos += length;
}
break;
case IOS_CONFIG_FILE:
proto_tree_add_item (tree, hf_docsis_vsif_cisco_config_file, tvb,
pos, length, FALSE);
}
pos += length;
}
@ -274,7 +274,7 @@ proto_register_docsis_vsif (void)
/* Register the protocol name and description */
proto_docsis_vsif =
proto_register_protocol ("DOCSIS Vendor Specific Encodings",
"DOCSIS VSIF", "docsis_vsif");
"DOCSIS VSIF", "docsis_vsif");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array (proto_docsis_vsif, hf, array_length (hf));
@ -291,9 +291,10 @@ proto_register_docsis_vsif (void)
void
proto_reg_handoff_docsis_vsif (void)
{
#if 0
dissector_handle_t docsis_vsif_handle;
docsis_vsif_handle = find_dissector ("docsis_vsif");
dissector_add_uint ("docsis", 0xFD, docsis_vsif_handle);
#endif
}