forked from osmocom/wireshark
Add FT_SYSTEM_ID type and convert the dissectors that use print_system_id with FT_BYTES to now use FT_SYSTEM_ID type.
svn path=/trunk/; revision=54383
This commit is contained in:
parent
5b8f078f4b
commit
7ec4582b4f
|
@ -232,8 +232,7 @@ esis_dissect_redirect_pdu( guint8 len, tvbuff_t *tvb, proto_tree *tree) {
|
|||
proto_tree_add_text( tree, tvb, offset, tmpl + 1,
|
||||
"### Subnetwork Address Section ###");
|
||||
proto_tree_add_uint_format_value(tree, hf_esis_bsnpal, tvb, offset++, 1, tmpl, "%2u Octets", tmpl);
|
||||
proto_tree_add_string( tree, hf_esis_bsnpa, tvb, offset, tmpl,
|
||||
print_system_id( tvb_get_ptr(tvb, offset, tmpl), tmpl ) );
|
||||
proto_tree_add_item( tree, hf_esis_bsnpa, tvb, offset, tmpl, ENC_NA);
|
||||
offset += tmpl;
|
||||
len -= ( tmpl + 1 );
|
||||
tmpl = (int) tvb_get_guint8(tvb, offset);
|
||||
|
@ -438,7 +437,7 @@ proto_register_esis(void) {
|
|||
{ &hf_esis_bsnpal, { "BSNPAL", "esis.bsnpal", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_esis_net, { "NET", "esis.net", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_esis_da, { "DA", "esis.da", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_esis_bsnpa, { "BSNPA", "esis.bsnpa", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_esis_bsnpa, { "BSNPA", "esis.bsnpa", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
};
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -323,7 +323,6 @@ dissect_hello_restart_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
|
|||
proto_item *restart_flags_item;
|
||||
proto_item *hold_time_item;
|
||||
const char *sep;
|
||||
const guint8 *neighbor_id;
|
||||
|
||||
if (length >= 1) {
|
||||
restart_options = tvb_get_guint8(tvb, offset);
|
||||
|
@ -364,11 +363,7 @@ dissect_hello_restart_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
|
|||
* set.
|
||||
*/
|
||||
if (length >= 3 + id_length && ISIS_MASK_RESTART_RA(restart_options)) {
|
||||
neighbor_id = tvb_get_ptr(tvb, offset+3, id_length);
|
||||
proto_tree_add_bytes_format_value( tree,
|
||||
hf_isis_hello_clv_restart_neighbor, tvb, offset+3,
|
||||
id_length, neighbor_id, "%s",
|
||||
print_system_id( neighbor_id, id_length ) );
|
||||
proto_tree_add_item( tree, hf_isis_hello_clv_restart_neighbor, tvb, offset+3, id_length, ENC_NA);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -621,8 +616,6 @@ static void
|
|||
dissect_hello_ptp_adj_clv(tvbuff_t *tvb, packet_info* pinfo,
|
||||
proto_tree *tree, int offset, int id_length, int length)
|
||||
{
|
||||
const guint8 *source_id;
|
||||
|
||||
switch(length)
|
||||
{
|
||||
case 1:
|
||||
|
@ -635,16 +628,12 @@ dissect_hello_ptp_adj_clv(tvbuff_t *tvb, packet_info* pinfo,
|
|||
case 11:
|
||||
proto_tree_add_item(tree, hf_isis_hello_adjacency_state, tvb, offset, 1, ENC_NA);
|
||||
proto_tree_add_item(tree, hf_isis_hello_extended_local_circuit_id, tvb, offset+1, 4, ENC_BIG_ENDIAN);
|
||||
source_id = tvb_get_ptr(tvb, offset+5, id_length);
|
||||
proto_tree_add_bytes_format_value(tree, hf_isis_hello_neighbor_systemid, tvb,
|
||||
offset+5, id_length, source_id, "%s", print_system_id(source_id, id_length ));
|
||||
proto_tree_add_item(tree, hf_isis_hello_neighbor_systemid, tvb, offset+5, id_length, ENC_NA);
|
||||
break;
|
||||
case 15:
|
||||
proto_tree_add_item(tree, hf_isis_hello_adjacency_state, tvb, offset, 1, ENC_NA);
|
||||
proto_tree_add_item(tree, hf_isis_hello_extended_local_circuit_id, tvb, offset+1, 4, ENC_BIG_ENDIAN);
|
||||
source_id = tvb_get_ptr(tvb, offset+5, id_length);
|
||||
proto_tree_add_bytes_format_value(tree, hf_isis_hello_neighbor_systemid, tvb,
|
||||
offset+5, id_length, source_id, "%s", print_system_id( source_id, id_length ));
|
||||
proto_tree_add_item(tree, hf_isis_hello_neighbor_systemid, tvb, offset+5, id_length, ENC_NA);
|
||||
proto_tree_add_item(tree, hf_isis_hello_neighbor_extended_local_circuit_id, tvb, offset+5+id_length, 4, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
default:
|
||||
|
@ -959,10 +948,7 @@ dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offs
|
|||
{
|
||||
proto_item *ti;
|
||||
proto_tree *hello_tree;
|
||||
const guint8 *source_id;
|
||||
int pdu_length;
|
||||
const guint8 *lan_id;
|
||||
gchar* system_id;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS HELLO");
|
||||
|
||||
|
@ -973,12 +959,8 @@ dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offs
|
|||
proto_tree_add_item(hello_tree, hf_isis_hello_circuit_reserved, tvb, offset, 1, ENC_NA);
|
||||
offset += 1;
|
||||
|
||||
source_id = tvb_get_ptr(tvb, offset, id_length);
|
||||
system_id = print_system_id( source_id, id_length );
|
||||
proto_tree_add_bytes_format_value(hello_tree, hf_isis_hello_source_id, tvb,
|
||||
offset, id_length, source_id,
|
||||
"%s", system_id);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", System-ID: %s", system_id);
|
||||
proto_tree_add_item(hello_tree, hf_isis_hello_source_id, tvb, offset, id_length, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", System-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ));
|
||||
|
||||
offset += id_length;
|
||||
|
||||
|
@ -1000,10 +982,7 @@ dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offs
|
|||
proto_tree_add_item(hello_tree, hf_isis_hello_priority_reserved, tvb, offset, 1, ENC_NA);
|
||||
offset += 1;
|
||||
|
||||
lan_id = tvb_get_ptr(tvb, offset, id_length+1);
|
||||
proto_tree_add_bytes_format_value(hello_tree, hf_isis_hello_lan_id, tvb,
|
||||
offset, id_length + 1, lan_id,
|
||||
"%s", print_system_id( lan_id, id_length + 1 ) );
|
||||
proto_tree_add_item(hello_tree, hf_isis_hello_lan_id, tvb, offset, id_length + 1, ENC_NA);
|
||||
offset += id_length + 1;
|
||||
}
|
||||
|
||||
|
@ -1076,7 +1055,7 @@ proto_register_isis_hello(void)
|
|||
|
||||
{ &hf_isis_hello_source_id,
|
||||
{ "SystemID {Sender of PDU}", "isis.hello.source_id",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_isis_hello_holding_timer,
|
||||
{ "Holding timer", "isis.hello.holding_timer",
|
||||
|
@ -1096,7 +1075,7 @@ proto_register_isis_hello(void)
|
|||
|
||||
{ &hf_isis_hello_lan_id,
|
||||
{ "SystemID {Designated IS}", "isis.hello.lan_id",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_isis_hello_local_circuit_id,
|
||||
{ "Local circuit ID", "isis.hello.local_circuit_id",
|
||||
|
@ -1146,7 +1125,7 @@ proto_register_isis_hello(void)
|
|||
|
||||
{ &hf_isis_hello_clv_restart_neighbor,
|
||||
{ "Restarting Neighbor ID", "isis.hello.clv_restart.neighbor",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0,
|
||||
FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
|
||||
"The System ID of the restarting neighbor", HFILL }},
|
||||
|
||||
/* Generated from convert_proto_tree_add_text.pl */
|
||||
|
@ -1157,7 +1136,7 @@ proto_register_isis_hello(void)
|
|||
{ &hf_isis_hello_checksum, { "Checksum", "isis.hello.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_hello_adjacency_state, { "Adjacency State", "isis.hello.adjacency_state", FT_UINT8, BASE_DEC, VALS(adj_state_vals), 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_hello_extended_local_circuit_id, { "Extended Local circuit ID", "isis.hello.extended_local_circuit_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_hello_neighbor_systemid, { "Neighbor SystemID", "isis.hello.neighbor_systemid", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_hello_neighbor_systemid, { "Neighbor SystemID", "isis.hello.neighbor_systemid", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_hello_neighbor_extended_local_circuit_id, { "Neighbor Extended Local circuit ID", "isis.hello.neighbor_extended_local_circuit_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_hello_is_neighbor, { "IS Neighbor", "isis.hello.is_neighbor", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
};
|
||||
|
|
|
@ -1667,13 +1667,9 @@ dissect_lsp_eis_neighbors_clv_inner(tvbuff_t *tvb, packet_info *pinfo, proto_tre
|
|||
*/
|
||||
if ( tree ) {
|
||||
if ( is_eis ) {
|
||||
ti = proto_tree_add_bytes_format_value(tree, hf_isis_lsp_eis_neighbors_es_neighbor, tvb, offset, tlen,
|
||||
tvb_get_ptr(tvb, offset+4, id_length), "%s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset+4, id_length), id_length ) );
|
||||
ti = proto_tree_add_text(tree, tvb, offset, tlen, "ES Neighbor");
|
||||
} else {
|
||||
ti = proto_tree_add_bytes_format_value(tree, hf_isis_lsp_eis_neighbors_is_neighbor, tvb, offset, tlen,
|
||||
tvb_get_ptr(tvb, offset+4, id_length), "%s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset+4, id_length), id_length ) );
|
||||
ti = proto_tree_add_text(tree, tvb, offset, tlen, "IS Neighbor");
|
||||
}
|
||||
ntree = proto_item_add_subtree(ti, ett_isis_lsp_clv_is_neighbors);
|
||||
|
||||
|
@ -1692,6 +1688,8 @@ dissect_lsp_eis_neighbors_clv_inner(tvbuff_t *tvb, packet_info *pinfo, proto_tre
|
|||
proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_error_metric, tvb, offset, 1, ENC_NA);
|
||||
proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_error_metric_supported, tvb, offset, 1, ENC_NA);
|
||||
proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_error_metric_ie, tvb, offset+3, 1, ENC_NA);
|
||||
proto_tree_add_item(ntree, is_eis ? hf_isis_lsp_eis_neighbors_es_neighbor : hf_isis_lsp_eis_neighbors_is_neighbor,
|
||||
tvb, offset+4, id_length, ENC_NA);
|
||||
}
|
||||
offset += tlen;
|
||||
length -= tlen;
|
||||
|
@ -1977,8 +1975,8 @@ dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tre
|
|||
guint clv_code, clv_len;
|
||||
|
||||
while (length > 0) {
|
||||
ti = proto_tree_add_bytes_format_value(tree, hf_isis_lsp_ext_is_reachability_is_neighbor, tvb, offset, -1,
|
||||
tvb_get_ptr(tvb, offset, 7), "%s", print_system_id (tvb_get_ptr(tvb, offset, 7), 7) );
|
||||
ti = proto_tree_add_item(tree, hf_isis_lsp_ext_is_reachability_is_neighbor, tvb, offset, 7, ENC_NA);
|
||||
proto_item_set_len(ti, -1);
|
||||
ntree = proto_item_add_subtree (ti, ett_isis_lsp_part_of_clv_ext_is_reachability );
|
||||
|
||||
proto_tree_add_item(ntree, hf_isis_lsp_ext_is_reachability_metric, tvb, offset+7, 3, ENC_BIG_ENDIAN);
|
||||
|
@ -2175,11 +2173,8 @@ dissect_lsp_partition_dis_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tre
|
|||
/*
|
||||
* Gotta build a sub-tree for all our pieces
|
||||
*/
|
||||
if ( tree ) {
|
||||
proto_tree_add_bytes_format_value( tree, hf_isis_lsp_partition_designated_l2_is, tvb, offset, id_length,
|
||||
tvb_get_ptr(tvb, offset, id_length), "%s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ) );
|
||||
}
|
||||
proto_tree_add_item( tree, hf_isis_lsp_partition_designated_l2_is, tvb, offset, id_length, ENC_NA);
|
||||
|
||||
length -= id_length;
|
||||
offset += id_length;
|
||||
if ( length > 0 ) {
|
||||
|
@ -2602,12 +2597,8 @@ dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
|
|||
offset += 2;
|
||||
offset_checksum = offset;
|
||||
|
||||
system_id = print_system_id( tvb_get_ptr(tvb, offset, id_length+2),
|
||||
id_length+2);
|
||||
proto_tree_add_bytes_format_value(lsp_tree, hf_isis_lsp_lsp_id,
|
||||
tvb, offset, id_length + 2,
|
||||
tvb_get_ptr(tvb, offset, id_length+2), "%s", system_id);
|
||||
|
||||
proto_tree_add_item(lsp_tree, hf_isis_lsp_lsp_id, tvb, offset, id_length + 2, ENC_NA);
|
||||
system_id = print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP-ID: %s", system_id);
|
||||
|
||||
offset += (id_length + 2);
|
||||
|
@ -2720,7 +2711,7 @@ proto_register_isis_lsp(void)
|
|||
BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_isis_lsp_lsp_id,
|
||||
{ "LSP-ID", "isis.lsp.lsp_id", FT_BYTES,
|
||||
{ "LSP-ID", "isis.lsp.lsp_id", FT_SYSTEM_ID,
|
||||
BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_isis_lsp_hostname,
|
||||
|
@ -2864,22 +2855,22 @@ proto_register_isis_lsp(void)
|
|||
{ &hf_isis_lsp_mt_cap_spbm_service_identifier_base_vid, { "Base-VID", "isis.lsp.mt_cap_spbm_service_identifier.base_vid", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_mt_cap_mtid, { "MTID", "isis.lsp.mt_cap.mtid", FT_UINT16, BASE_HEX, NULL, 0xfff, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_reserved, { "Reserved", "isis.lsp.eis_neighbors_clv_inner.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_es_neighbor, { "ES Neighbor", "isis.lsp.eis_neighbors.es_neighbor", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_is_neighbor, { "IS Neighbor", "isis.lsp.eis_neighbors.is_neighbor", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_es_neighbor, { "ES Neighbor", "isis.lsp.eis_neighbors.es_neighbor", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_is_neighbor, { "IS Neighbor", "isis.lsp.eis_neighbors.is_neighbor", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_default_metric, { "Default Metric", "isis.lsp.eis_neighbors.default_metric", FT_UINT8, BASE_DEC, NULL, 0x3F, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_delay_metric, { "Delay Metric", "isis.lsp.eis_neighbors.delay_metric", FT_UINT8, BASE_DEC, NULL, 0x3F, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_expense_metric, { "Expense Metric", "isis.lsp.eis_neighbors.expense_metric", FT_UINT8, BASE_DEC, NULL, 0x3F, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_eis_neighbors_error_metric, { "Error Metric", "isis.lsp.eis_neighbors.error_metric", FT_UINT8, BASE_DEC, NULL, 0x3F, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_maximum_link_bandwidth, { "Maximum link bandwidth", "isis.lsp.maximum_link_bandwidth", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_reservable_link_bandwidth, { "Reservable link bandwidth", "isis.lsp.reservable_link_bandwidth", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_ext_is_reachability_is_neighbor, { "IS neighbor", "isis.lsp.ext_is_reachability.is_neighbor", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_ext_is_reachability_is_neighbor, { "IS neighbor", "isis.lsp.ext_is_reachability.is_neighbor", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_ext_is_reachability_metric, { "Metric", "isis.lsp.ext_is_reachability.metric", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_ext_is_reachability_link_local_identifier, { "Link Local Identifier", "isis.lsp.ext_is_reachability.link_local_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_ext_is_reachability_link_remote_identifier, { "Link Remote Identifier", "isis.lsp.ext_is_reachability.link_remote_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_ext_is_reachability_ipv4_interface_address, { "IPv4 interface address", "isis.lsp.ext_is_reachability.ipv4_interface_address", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_ext_is_reachability_ipv4_neighbor_address, { "IPv4 neighbor address", "isis.lsp.ext_is_reachability.ipv4_neighbor_address", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_ext_is_reachability_traffic_engineering_default_metric, { "Traffic engineering default metric", "isis.lsp.ext_is_reachability.traffic_engineering_default_metric", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_partition_designated_l2_is, { "Partition designated L2 IS", "isis.lsp.partition_designated_l2_is", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_partition_designated_l2_is, { "Partition designated L2 IS", "isis.lsp.partition_designated_l2_is", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_error_metric, { "Error metric", "isis.lsp.error_metric", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x08, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_expense_metric, { "Expense metric", "isis.lsp.expense_metric", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04, NULL, HFILL }},
|
||||
{ &hf_isis_lsp_delay_metric, { "Delay metric", "isis.lsp.delay_metric", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02, NULL, HFILL }},
|
||||
|
|
|
@ -151,7 +151,6 @@ dissect_snp_lsp_entries_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
|
|||
{
|
||||
proto_item *ti;
|
||||
proto_tree *subtree;
|
||||
const guint8 *source_id;
|
||||
|
||||
while ( length > 0 ) {
|
||||
if ( length < 2+id_length+2+4+2 ) {
|
||||
|
@ -163,9 +162,7 @@ dissect_snp_lsp_entries_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
|
|||
ti = proto_tree_add_text(tree, tvb, offset, 2+id_length+2+4+2, "LSP Entry");
|
||||
subtree = proto_item_add_subtree(ti,ett_isis_csnp_lsp_entry);
|
||||
|
||||
source_id = tvb_get_ptr(tvb, offset+2, id_length+2);
|
||||
proto_tree_add_bytes_format_value(tree, hf_isis_csnp_lsp_id, tvb,
|
||||
offset+2, 8, source_id, "%s", print_system_id(source_id, id_length+2));
|
||||
proto_tree_add_item(tree, hf_isis_csnp_lsp_id, tvb, offset+2, id_length+2, ENC_NA);
|
||||
|
||||
proto_tree_add_item(subtree, hf_isis_csnp_lsp_seq_num, tvb, offset+2+id_length+2, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(subtree, hf_isis_csnp_lsp_remain_life, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
|
@ -305,8 +302,6 @@ dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
|
|||
proto_tree *csnp_tree = NULL;
|
||||
guint16 pdu_length;
|
||||
int len;
|
||||
const guint8 *source_id;
|
||||
gchar* system_id;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS CSNP");
|
||||
|
||||
|
@ -318,28 +313,18 @@ dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
|
|||
offset, 2, pdu_length);
|
||||
offset += 2;
|
||||
|
||||
source_id = tvb_get_ptr(tvb, offset, id_length);
|
||||
system_id = print_system_id( source_id, id_length );
|
||||
proto_tree_add_bytes_format_value(csnp_tree, hf_isis_csnp_source_id, tvb,
|
||||
offset, id_length, source_id,
|
||||
"%s", system_id);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", system_id);
|
||||
proto_tree_add_item(csnp_tree, hf_isis_csnp_source_id, tvb, offset, id_length, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ));
|
||||
offset += id_length + 1;
|
||||
|
||||
source_id = tvb_get_ptr(tvb, offset, id_length+2);
|
||||
system_id = print_system_id( source_id, id_length+2 );
|
||||
proto_tree_add_bytes_format_value(csnp_tree, hf_isis_csnp_start_lsp_id, tvb,
|
||||
offset, id_length + 2, source_id,
|
||||
"%s", system_id);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP-ID: %s", system_id);
|
||||
proto_tree_add_item(csnp_tree, hf_isis_csnp_start_lsp_id, tvb, offset, id_length + 2, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP-ID: %s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ));
|
||||
offset += id_length + 2;
|
||||
|
||||
source_id = tvb_get_ptr(tvb, offset, id_length+2);
|
||||
system_id = print_system_id( source_id, id_length+2 );
|
||||
proto_tree_add_bytes_format_value(csnp_tree, hf_isis_csnp_end_lsp_id, tvb,
|
||||
offset, id_length + 2, source_id,
|
||||
"%s", system_id);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP-ID: %s", system_id);
|
||||
proto_tree_add_item(csnp_tree, hf_isis_csnp_end_lsp_id, tvb, offset, id_length + 2, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP-ID: %s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ));
|
||||
offset += id_length + 2;
|
||||
|
||||
len = pdu_length - header_length;
|
||||
|
@ -380,8 +365,6 @@ dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
|
|||
proto_tree *psnp_tree;
|
||||
guint16 pdu_length;
|
||||
int len;
|
||||
const guint8 *source_id;
|
||||
gchar* system_id;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS PSNP");
|
||||
|
||||
|
@ -393,12 +376,8 @@ dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
|
|||
offset, 2, pdu_length);
|
||||
offset += 2;
|
||||
|
||||
source_id = tvb_get_ptr(tvb, offset, id_length);
|
||||
system_id = print_system_id( source_id, id_length );
|
||||
proto_tree_add_bytes_format_value(psnp_tree, hf_isis_psnp_source_id, tvb,
|
||||
offset, id_length, source_id,
|
||||
"%s", system_id);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", system_id);
|
||||
proto_tree_add_item(psnp_tree, hf_isis_psnp_source_id, tvb, offset, id_length, ENC_NA);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source-ID: %s", print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ));
|
||||
|
||||
offset += id_length + 1;
|
||||
|
||||
|
@ -440,16 +419,16 @@ proto_register_isis_csnp(void)
|
|||
BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_csnp_source_id,
|
||||
{ "Source-ID", "isis.csnp.source_id",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_csnp_start_lsp_id,
|
||||
{ "Start LSP-ID", "isis.csnp.start_lsp_id",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_csnp_end_lsp_id,
|
||||
{ "End LSP-ID", "isis.csnp.end_lsp_id",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_csnp_lsp_id,
|
||||
{ "LSP-ID", "isis.csnp.lsp_id",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_isis_csnp_lsp_seq_num,
|
||||
{ "LSP Sequence Number", "isis.csnp.lsp_seq_num", FT_UINT32,
|
||||
BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
|
|
|
@ -564,9 +564,7 @@ dissect_osi_options(guchar opt_len, tvbuff_t *tvb, int offset, proto_tree *tree)
|
|||
break;
|
||||
|
||||
case OSI_OPT_SNPA_MASK:
|
||||
proto_tree_add_bytes_format(osi_option_tree, hf_osi_options_snpa_mask, tvb, offset, parm_len,
|
||||
tvb_get_ptr(tvb, offset, parm_len), "%s",
|
||||
print_system_id(tvb_get_ptr(tvb, offset, parm_len), parm_len));
|
||||
proto_tree_add_item(osi_option_tree, hf_osi_options_snpa_mask, tvb, offset, parm_len, ENC_NA);
|
||||
break;
|
||||
|
||||
case OSI_OPT_ES_CONFIG_TIMER:
|
||||
|
@ -639,7 +637,7 @@ proto_register_osi_options(void) {
|
|||
{ &hf_osi_options_security_type, { "Security type", "osi.options.security_type", FT_UINT8, BASE_DEC, VALS(osi_opt_sec_vals), OSI_OPT_SEC_MASK, NULL, HFILL }},
|
||||
{ &hf_osi_options_priority, { "Priority", "osi.options.priority", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_osi_options_address_mask, { "Address Mask", "osi.options.address_mask", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_osi_options_snpa_mask, { "SNPA Mask", "osi.options.snpa_mask", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_osi_options_snpa_mask, { "SNPA Mask", "osi.options.snpa_mask", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_osi_options_esct, { "ESCT (seconds)", "osi.options.esct", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_osi_options_padding, { "Padding", "osi.options.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
};
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <epan/addr_resolv.h>
|
||||
#include <epan/strutil.h>
|
||||
#include <epan/oids.h>
|
||||
#include <epan/osi-utils.h>
|
||||
|
||||
#define CMP_MATCHES cmp_matches
|
||||
|
||||
|
@ -133,6 +134,12 @@ rel_oid_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf)
|
|||
strncpy(buf,oid_str,REL_OID_REPR_LEN(fv));
|
||||
}
|
||||
|
||||
static void
|
||||
system_id_to_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
|
||||
{
|
||||
print_system_id_buf(fv->value.bytes->data,fv->value.bytes->len, buf, bytes_repr_len(fv, rtype));
|
||||
}
|
||||
|
||||
static void
|
||||
bytes_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf)
|
||||
{
|
||||
|
@ -197,6 +204,16 @@ oid_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied)
|
|||
fv->value.bytes = (GByteArray *)value;
|
||||
}
|
||||
|
||||
static void
|
||||
system_id_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied)
|
||||
{
|
||||
g_assert(already_copied);
|
||||
|
||||
/* Free up the old value, if we have one */
|
||||
bytes_fvalue_free(fv);
|
||||
|
||||
fv->value.bytes = (GByteArray *)value;
|
||||
}
|
||||
|
||||
static gpointer
|
||||
value_get(fvalue_t *fv)
|
||||
|
@ -430,6 +447,30 @@ rel_oid_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, L
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
system_id_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value, LogFunc logfunc)
|
||||
{
|
||||
/*
|
||||
* Don't log a message if this fails; we'll try looking it
|
||||
* up as another way if it does, and if that fails,
|
||||
* we'll log a message.
|
||||
*/
|
||||
if (bytes_from_unparsed(fv, s, TRUE, NULL)) {
|
||||
if (fv->value.bytes->len > MAX_SYSTEMID_LEN) {
|
||||
logfunc("\"%s\" contains too many bytes to be a valid OSI System-ID.",
|
||||
s);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* XXX - need better validation of Vines address */
|
||||
|
||||
logfunc("\"%s\" is not a valid OSI System-ID.", s);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static guint
|
||||
len(fvalue_t *fv)
|
||||
{
|
||||
|
@ -901,6 +942,44 @@ ftype_register_bytes(void)
|
|||
slice,
|
||||
};
|
||||
|
||||
static ftype_t system_id_type = {
|
||||
FT_SYSTEM_ID, /* ftype */
|
||||
"FT_SYSTEM_ID", /* name */
|
||||
"OSI System-ID", /* pretty_name */
|
||||
0, /* wire_size */
|
||||
bytes_fvalue_new, /* new_value */
|
||||
bytes_fvalue_free, /* free_value */
|
||||
system_id_from_unparsed, /* val_from_unparsed */
|
||||
NULL, /* val_from_string */
|
||||
system_id_to_repr, /* val_to_string_repr */
|
||||
bytes_repr_len, /* len_string_repr */
|
||||
|
||||
system_id_fvalue_set, /* set_value */
|
||||
NULL, /* set_value_uinteger */
|
||||
NULL, /* set_value_sinteger */
|
||||
NULL, /* set_value_integer64 */
|
||||
NULL, /* set_value_floating */
|
||||
|
||||
value_get, /* get_value */
|
||||
NULL, /* get_value_uinteger */
|
||||
NULL, /* get_value_sinteger */
|
||||
NULL, /* get_value_integer64 */
|
||||
NULL, /* get_value_floating */
|
||||
|
||||
cmp_eq,
|
||||
cmp_ne,
|
||||
cmp_gt,
|
||||
cmp_ge,
|
||||
cmp_lt,
|
||||
cmp_le,
|
||||
cmp_bitwise_and,
|
||||
cmp_contains,
|
||||
NULL, /* cmp_matches */
|
||||
|
||||
len,
|
||||
slice,
|
||||
};
|
||||
|
||||
ftype_register(FT_BYTES, &bytes_type);
|
||||
ftype_register(FT_UINT_BYTES, &uint_bytes_type);
|
||||
ftype_register(FT_AX25, &ax25_type);
|
||||
|
@ -908,4 +987,5 @@ ftype_register_bytes(void)
|
|||
ftype_register(FT_ETHER, ðer_type);
|
||||
ftype_register(FT_OID, &oid_type);
|
||||
ftype_register(FT_REL_OID, &rel_oid_type);
|
||||
ftype_register(FT_SYSTEM_ID, &system_id_type);
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ enum ftenum {
|
|||
FT_AX25,
|
||||
FT_VINES,
|
||||
FT_REL_OID, /* RELATIVE-OID */
|
||||
FT_SYSTEM_ID,
|
||||
FT_NUM_TYPES /* last item number plus one */
|
||||
};
|
||||
|
||||
|
|
47
epan/proto.c
47
epan/proto.c
|
@ -52,6 +52,7 @@
|
|||
#include "column-utils.h"
|
||||
#include "to_str-int.h"
|
||||
#include "to_str.h"
|
||||
#include "osi-utils.h"
|
||||
#include "expert.h"
|
||||
#include "show_exception.h"
|
||||
|
||||
|
@ -213,6 +214,10 @@ proto_tree_set_oid(field_info *fi, const guint8* value_ptr, gint length);
|
|||
static void
|
||||
proto_tree_set_oid_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length);
|
||||
static void
|
||||
proto_tree_set_system_id(field_info *fi, const guint8* value_ptr, gint length);
|
||||
static void
|
||||
proto_tree_set_system_id_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length);
|
||||
static void
|
||||
proto_tree_set_boolean(field_info *fi, guint32 value);
|
||||
static void
|
||||
proto_tree_set_float(field_info *fi, float value);
|
||||
|
@ -1482,6 +1487,10 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree,
|
|||
proto_tree_set_oid_tvb(new_fi, tvb, start, length);
|
||||
break;
|
||||
|
||||
case FT_SYSTEM_ID:
|
||||
proto_tree_set_system_id_tvb(new_fi, tvb, start, length);
|
||||
break;
|
||||
|
||||
case FT_FLOAT:
|
||||
/*
|
||||
* NOTE: to support code written when
|
||||
|
@ -2516,6 +2525,27 @@ proto_tree_set_oid_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length)
|
|||
proto_tree_set_oid(fi, tvb_get_ptr(tvb, start, length), length);
|
||||
}
|
||||
|
||||
/* Set the FT_SYSTEM_ID value */
|
||||
static void
|
||||
proto_tree_set_system_id(field_info *fi, const guint8* value_ptr, gint length)
|
||||
{
|
||||
GByteArray *bytes;
|
||||
|
||||
DISSECTOR_ASSERT(value_ptr != NULL || length == 0);
|
||||
|
||||
bytes = g_byte_array_new();
|
||||
if (length > 0) {
|
||||
g_byte_array_append(bytes, value_ptr, length);
|
||||
}
|
||||
fvalue_set(&fi->value, bytes, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
proto_tree_set_system_id_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length)
|
||||
{
|
||||
proto_tree_set_system_id(fi, tvb_get_ptr(tvb, start, length), length);
|
||||
}
|
||||
|
||||
static void
|
||||
proto_tree_set_uint64(field_info *fi, guint64 value)
|
||||
{
|
||||
|
@ -4028,6 +4058,16 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
|
|||
size-offset_e);
|
||||
break;
|
||||
|
||||
case FT_SYSTEM_ID:
|
||||
bytes = (guint8 *)fvalue_get(&finfo->value);
|
||||
offset_r += protoo_strlcpy(result+offset_r,
|
||||
print_system_id(bytes, fvalue_length(&finfo->value)),
|
||||
size-offset_r);
|
||||
offset_e += protoo_strlcpy(expr+offset_e,
|
||||
print_system_id(bytes, fvalue_length(&finfo->value)),
|
||||
size-offset_e);
|
||||
break;
|
||||
|
||||
case FT_FLOAT:
|
||||
g_snprintf(result+offset_r, size-offset_r,
|
||||
"%." G_STRINGIFY(FLT_DIG) "g", fvalue_get_floating(&finfo->value));
|
||||
|
@ -4075,6 +4115,7 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
|
|||
case FT_INT32:
|
||||
case FT_OID:
|
||||
case FT_REL_OID:
|
||||
case FT_SYSTEM_ID:
|
||||
/* for these types, "expr" is filled in the loop above */
|
||||
break;
|
||||
|
||||
|
@ -4963,6 +5004,7 @@ static const value_string hf_types[] = {
|
|||
{ FT_GUID, "FT_GUID" },
|
||||
{ FT_OID, "FT_OID" },
|
||||
{ FT_REL_OID, "FT_REL_OID" },
|
||||
{ FT_SYSTEM_ID, "FT_SYSTEM_ID" },
|
||||
{ 0, NULL } };
|
||||
|
||||
static const value_string hf_display[] = {
|
||||
|
@ -5604,6 +5646,11 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
|
|||
}
|
||||
break;
|
||||
|
||||
case FT_SYSTEM_ID:
|
||||
bytes = (guint8 *)fvalue_get(&fi->value);
|
||||
label_fill(label_str, 0, hfinfo, print_system_id(bytes, fvalue_length(&fi->value)));
|
||||
break;
|
||||
|
||||
case FT_EUI64:
|
||||
integer64 = fvalue_get_integer64(&fi->value);
|
||||
label_fill_descr(label_str, 0, hfinfo,
|
||||
|
|
|
@ -158,6 +158,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
|
|||
case FT_GUID:
|
||||
case FT_PROTOCOL:
|
||||
case FT_REL_OID:
|
||||
case FT_SYSTEM_ID:
|
||||
case FT_OID: {
|
||||
ByteArray ba = g_byte_array_new();
|
||||
g_byte_array_append(ba, (const guint8 *)tvb_memdup(wmem_packet_scope(),fi->ds_tvb,fi->start,fi->length),fi->length);
|
||||
|
|
|
@ -460,6 +460,7 @@ static const wslua_ft_types_t ftenums[] = {
|
|||
{"ftypes.FRAMENUM", FT_FRAMENUM},
|
||||
{"ftypes.GUID", FT_GUID},
|
||||
{"ftypes.OID", FT_OID},
|
||||
{"ftypes.SYSTEM_ID", FT_SYSTEM_ID},
|
||||
{"ftypes.REL_OID", FT_REL_OID},
|
||||
{NULL, FT_NONE}
|
||||
};
|
||||
|
@ -779,6 +780,7 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) { /* Creates a new field to be us
|
|||
case FT_UINT_BYTES:
|
||||
case FT_GUID:
|
||||
case FT_OID:
|
||||
case FT_SYSTEM_ID:
|
||||
case FT_REL_OID:
|
||||
if (base != BASE_NONE) {
|
||||
WSLUA_OPTARG_ERROR(ProtoField_new,BASE,"Base must be base.NONE");
|
||||
|
@ -1256,6 +1258,7 @@ PROTOFIELD_OTHER(ubytes,FT_UINT_BYTES)
|
|||
PROTOFIELD_OTHER(guid,FT_GUID)
|
||||
PROTOFIELD_OTHER(oid,FT_OID)
|
||||
PROTOFIELD_OTHER(rel_oid,FT_REL_OID)
|
||||
PROTOFIELD_OTHER(systemid,FT_SYSTEM_ID)
|
||||
|
||||
WSLUA_METAMETHOD ProtoField__tostring(lua_State* L) {
|
||||
/* Returns a string with info about a protofield (for debugging purposes) */
|
||||
|
|
|
@ -226,6 +226,7 @@ static int TreeItem_add_item_any(lua_State *L, gboolean little_endian) {
|
|||
case FT_GUID:
|
||||
case FT_OID:
|
||||
case FT_REL_OID:
|
||||
case FT_SYSTEM_ID:
|
||||
default:
|
||||
luaL_error(L,"FT_ not yet supported");
|
||||
return 0;
|
||||
|
|
|
@ -1256,6 +1256,8 @@ static const char* ftenum_to_string(header_field_info *hfi)
|
|||
return "FT_OID";
|
||||
case FT_REL_OID:
|
||||
return "FT_REL_OID";
|
||||
case FT_SYSTEM_ID:
|
||||
return "FT_SYSTEM_ID";
|
||||
case FT_NUM_TYPES:
|
||||
return "FT_NUM_TYPES";
|
||||
default:
|
||||
|
|
|
@ -633,7 +633,7 @@ not_supported:
|
|||
FT_INT64, FT_UINT64, ; should work with FT_INT[8,16,24,32] code
|
||||
FT_FLOAT, FT_DOUBLE,
|
||||
FT_IPXNET, FT_IPv6, FT_ETHER,
|
||||
FT_GUID, FT_OID,
|
||||
FT_GUID, FT_OID, FT_SYSTEM_ID
|
||||
FT_UINT_STRING,
|
||||
FT_ABSOLUTE_TIME, FT_RELATIVE_TIME
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue