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);
{ &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 }},
};
/*
*
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);
* 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);
}
}
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:
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:
{
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");
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;
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;
}
{ &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",
{ &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",
{ &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 */
{ &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 }},
};
*/
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);
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;
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);
/*
* 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 ) {
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);
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,
{ &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 }},
{
proto_item *ti;
proto_tree *subtree;
- const guint8 *source_id;
while ( length > 0 ) {
if ( length < 2+id_length+2+4+2 ) {
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);
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");
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;
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");
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;
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 }},
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:
{ &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 }},
};
#include <epan/addr_resolv.h>
#include <epan/strutil.h>
#include <epan/oids.h>
+#include <epan/osi-utils.h>
#define CMP_MATCHES cmp_matches
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)
{
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)
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)
{
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);
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);
}
FT_AX25,
FT_VINES,
FT_REL_OID, /* RELATIVE-OID */
+ FT_SYSTEM_ID,
FT_NUM_TYPES /* last item number plus one */
};
#include "column-utils.h"
#include "to_str-int.h"
#include "to_str.h"
+#include "osi-utils.h"
#include "expert.h"
#include "show_exception.h"
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);
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
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)
{
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));
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;
{ 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[] = {
}
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,
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);
{"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}
};
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");
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) */
case FT_GUID:
case FT_OID:
case FT_REL_OID:
+ case FT_SYSTEM_ID:
default:
luaL_error(L,"FT_ not yet supported");
return 0;
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:
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
*/