Make enumerated types be fields with a value_string table, so that you
can filter on them by name.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4070
f5534014-38df-0310-8fa8-
9805f1628bb7
* Routines for Stream Control Transmission Protocol dissection
* Copyright 2000, Michael Tüxen <Michael.Tuexen@icn.siemens.de>
*
* Routines for Stream Control Transmission Protocol dissection
* Copyright 2000, Michael Tüxen <Michael.Tuexen@icn.siemens.de>
*
- * $Id: packet-sctp.c,v 1.20 2001/08/28 08:28:14 guy Exp $
+ * $Id: packet-sctp.c,v 1.21 2001/10/23 20:14:20 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
address_type = tvb_get_ntohs(parameter_tvb, offset);
proto_tree_add_uint_format(address_list_tree, hf_sctp_supported_address_types_parameter,
parameter_tvb, offset, SUPPORTED_ADDRESS_TYPE_PARAMETER_ADDRESS_TYPE_LENGTH,
address_type = tvb_get_ntohs(parameter_tvb, offset);
proto_tree_add_uint_format(address_list_tree, hf_sctp_supported_address_types_parameter,
parameter_tvb, offset, SUPPORTED_ADDRESS_TYPE_PARAMETER_ADDRESS_TYPE_LENGTH,
- address_type, "Supported address type: %u (%s)",
+ address_type, "Supported address type: 0x%04x (%s)",
address_type, val_to_str(address_type, sctp_parameter_identifier_values, "unknown"));
offset += SUPPORTED_ADDRESS_TYPE_PARAMETER_ADDRESS_TYPE_LENGTH;
};
address_type, val_to_str(address_type, sctp_parameter_identifier_values, "unknown"));
offset += SUPPORTED_ADDRESS_TYPE_PARAMETER_ADDRESS_TYPE_LENGTH;
};
val_to_str(type, sctp_parameter_identifier_values, "Unknown"));
parameter_tree = proto_item_add_subtree(parameter_item, ett_sctp_chunk_parameter);
val_to_str(type, sctp_parameter_identifier_values, "Unknown"));
parameter_tree = proto_item_add_subtree(parameter_item, ett_sctp_chunk_parameter);
- proto_tree_add_uint_format(parameter_tree, hf_sctp_chunk_parameter_type,
- parameter_tvb, PARAMETER_TYPE_OFFSET, PARAMETER_TYPE_LENGTH,
- type, "Parameter type: %u (%s)",
- type, val_to_str(type, sctp_parameter_identifier_values, "unknown"));
+ proto_tree_add_uint(parameter_tree, hf_sctp_chunk_parameter_type,
+ parameter_tvb, PARAMETER_TYPE_OFFSET, PARAMETER_TYPE_LENGTH,
+ type);
proto_tree_add_uint(parameter_tree, hf_sctp_chunk_parameter_length,
parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH,
length);
proto_tree_add_uint(parameter_tree, hf_sctp_chunk_parameter_length,
parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH,
length);
offset = CAUSE_FIRST_MISSING_PARAMETER_TYPE_OFFSET;
for(missing_parameter_number = 1; missing_parameter_number <= number_of_missing_parameters; missing_parameter_number++) {
parameter_type = tvb_get_ntohs(cause_tvb, offset);
offset = CAUSE_FIRST_MISSING_PARAMETER_TYPE_OFFSET;
for(missing_parameter_number = 1; missing_parameter_number <= number_of_missing_parameters; missing_parameter_number++) {
parameter_type = tvb_get_ntohs(cause_tvb, offset);
- proto_tree_add_uint_format(cause_tree, hf_sctp_cause_missing_parameter_type,
- cause_tvb, offset, CAUSE_MISSING_PARAMETER_TYPE_LENGTH,
- parameter_type, "Missing parameter type: %u (%s)",
- parameter_type,
- val_to_str(parameter_type, sctp_parameter_identifier_values, "unknown"));
+ proto_tree_add_uint(cause_tree, hf_sctp_cause_missing_parameter_type,
+ cause_tvb, offset, CAUSE_MISSING_PARAMETER_TYPE_LENGTH,
+ parameter_type);
offset += CAUSE_MISSING_PARAMETER_TYPE_LENGTH;
};
offset += CAUSE_MISSING_PARAMETER_TYPE_LENGTH;
};
dissect_parameter(parameter_tvb, cause_tree);
parameter_type = tvb_get_ntohs(parameter_tvb, PARAMETER_TYPE_OFFSET);
dissect_parameter(parameter_tvb, cause_tree);
parameter_type = tvb_get_ntohs(parameter_tvb, PARAMETER_TYPE_OFFSET);
- proto_item_set_text(cause_item, "Error cause reporting unresolvable address of type %u (%s)",
+ proto_item_set_text(cause_item, "Error cause reporting unresolvable address of type 0x%04x (%s)",
parameter_type, val_to_str(parameter_type, sctp_parameter_identifier_values, "unknown") );
}
parameter_type, val_to_str(parameter_type, sctp_parameter_identifier_values, "unknown") );
}
"BAD ERROR CAUSE");
cause_tree = proto_item_add_subtree(cause_item, ett_sctp_chunk_cause);
"BAD ERROR CAUSE");
cause_tree = proto_item_add_subtree(cause_item, ett_sctp_chunk_cause);
- proto_tree_add_uint_format(cause_tree, hf_sctp_cause_code,
- cause_tvb, CAUSE_CODE_OFFSET, CAUSE_CODE_LENGTH,
- code, "Cause code: %u (%s)",
- code, val_to_str(code, sctp_cause_code_values, "unknown"));
+ proto_tree_add_uint(cause_tree, hf_sctp_cause_code,
+ cause_tvb, CAUSE_CODE_OFFSET, CAUSE_CODE_LENGTH,
+ code);
proto_tree_add_uint(cause_tree, hf_sctp_cause_length,
cause_tvb, CAUSE_LENGTH_OFFSET, CAUSE_LENGTH_LENGTH,
length);
proto_tree_add_uint(cause_tree, hf_sctp_cause_length,
cause_tvb, CAUSE_LENGTH_OFFSET, CAUSE_LENGTH_LENGTH,
length);
chunk_tvb,
DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET, DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH,
stream_seq_number);
chunk_tvb,
DATA_CHUNK_STREAM_SEQ_NUMBER_OFFSET, DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH,
stream_seq_number);
- proto_tree_add_uint_format(chunk_tree, hf_sctp_data_chunk_payload_proto_id,
- chunk_tvb, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH,
- payload_proto_id, "Payload protocol identifier: %u (%s)",
- payload_proto_id, val_to_str(payload_proto_id, sctp_payload_proto_id_values, "unknown"));
+ proto_tree_add_uint(chunk_tree, hf_sctp_data_chunk_payload_proto_id,
+ chunk_tvb, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET, DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH,
+ payload_proto_id);
proto_item_set_text(chunk_item, "DATA chunk with TSN %u (%u:%u) containing %u byte%s of payload",
tsn, stream_id, stream_seq_number,
payload_length, plurality(payload_length, "", "s"));
proto_item_set_text(chunk_item, "DATA chunk with TSN %u (%u:%u) containing %u byte%s of payload",
tsn, stream_id, stream_seq_number,
payload_length, plurality(payload_length, "", "s"));
chunk_tree = proto_item_add_subtree(chunk_item, ett_sctp_chunk);
/* then insert the chunk header components into the protocol tree */
chunk_tree = proto_item_add_subtree(chunk_item, ett_sctp_chunk);
/* then insert the chunk header components into the protocol tree */
- proto_tree_add_uint_format(chunk_tree, hf_sctp_chunk_type,
- chunk_tvb, CHUNK_TYPE_OFFSET, CHUNK_TYPE_LENGTH,
- type, "Identifier: %u (%s)",
- type, val_to_str(type, sctp_chunk_type_values, "unknown"));
+ proto_tree_add_uint(chunk_tree, hf_sctp_chunk_type,
+ chunk_tvb, CHUNK_TYPE_OFFSET, CHUNK_TYPE_LENGTH,
+ type);
flags_item = proto_tree_add_uint(chunk_tree, hf_sctp_chunk_flags,
chunk_tvb, CHUNK_FLAGS_OFFSET, CHUNK_FLAGS_LENGTH,
flags);
flags_item = proto_tree_add_uint(chunk_tree, hf_sctp_chunk_flags,
chunk_tvb, CHUNK_FLAGS_OFFSET, CHUNK_FLAGS_LENGTH,
flags);
},
{ &hf_sctp_chunk_type,
{ "Identifier", "sctp.chunk_type",
},
{ &hf_sctp_chunk_type,
{ "Identifier", "sctp.chunk_type",
- FT_UINT8, BASE_DEC, NULL, 0x0,
+ FT_UINT8, BASE_DEC, VALS(sctp_chunk_type_values), 0x0,
"", HFILL }
},
{ &hf_sctp_chunk_flags,
"", HFILL }
},
{ &hf_sctp_chunk_flags,
"", HFILL }
},
{&hf_sctp_data_chunk_payload_proto_id,
"", HFILL }
},
{&hf_sctp_data_chunk_payload_proto_id,
- { "Payload Protocol identifier", "sctp.payload_proto_id",
- FT_UINT32, BASE_HEX, NULL, 0x0,
+ { "Payload protocol identifier", "sctp.payload_proto_id",
+ FT_UINT32, BASE_DEC, VALS(sctp_payload_proto_id_values), 0x0,
"", HFILL }
},
{&hf_sctp_data_chunk_e_bit,
"", HFILL }
},
{&hf_sctp_data_chunk_e_bit,
},
{&hf_sctp_chunk_parameter_type,
{ "Parameter type", "sctp.parameter.type",
},
{&hf_sctp_chunk_parameter_type,
{ "Parameter type", "sctp.parameter.type",
- FT_UINT16, BASE_HEX, NULL, 0x0,
+ FT_UINT16, BASE_HEX, VALS(sctp_parameter_identifier_values), 0x0,
"", HFILL }
},
{&hf_sctp_chunk_parameter_length,
"", HFILL }
},
{&hf_sctp_chunk_parameter_length,
},
{&hf_sctp_cause_code,
{ "Cause code", "sctp.cause.code",
},
{&hf_sctp_cause_code,
{ "Cause code", "sctp.cause.code",
- FT_UINT16, BASE_DEC, NULL, 0x0,
+ FT_UINT16, BASE_HEX, VALS(sctp_cause_code_values), 0x0,
"", HFILL }
},
{&hf_sctp_cause_length,
"", HFILL }
},
{&hf_sctp_cause_length,
"", HFILL }
},
{&hf_sctp_cause_missing_parameter_type,
"", HFILL }
},
{&hf_sctp_cause_missing_parameter_type,
- { "Missing parameters type", "sctp.cause.missing_parameter_type",
- FT_UINT16, BASE_DEC, NULL, 0x0,
+ { "Missing parameter type", "sctp.cause.missing_parameter_type",
+ FT_UINT16, BASE_HEX, VALS(sctp_parameter_identifier_values), 0x0,
"", HFILL }
},
{&hf_sctp_cause_measure_of_staleness,
"", HFILL }
},
{&hf_sctp_cause_measure_of_staleness,