Dissector names are not protocol names.

A given protocol's packet format may depend, for example, on which
lower-level protocol is transporting the protocol in question.  For
example, protocols that run atop both byte-stream protocols such as TCP
and TLS, and packet-oriented protocols such as UDP or DTLS, might begin
the packet with a length when running atop a byte-stream protocol, to
indicate where this packet ends and the next packet begins in the byte
stream, but not do so when running atop a packet-oriented protocol.

Dissectors can handle this in various ways:

For example, the dissector could attempt to determine the protocol over
which the packet was transported.

Unfortunately, many of those mechanisms do so by fetching data from the
packet_info structure, and many items in that structure act as global
variables, so that, for example, if there are two two PDUs for protocol
A inside a TCP segment, and the first protocol for PDU A contains a PDU
for protocol B, and protocol B's dissector, or a dissector it calls,
modifies the information in the packet_info structure so that it no
longer indicates that the parent protocol is TCP, the second PDU for
protocol A might not be correctly dissected.

Another such mechanism is to query the previous element in the layers
structure of the packet_info structure, which is a list of protocol IDs.

Unfortunately, that is not a list of earlier protocols in the protocol
stack, it's a list of earlier protocols in the dissection, which means
that, in the above example, when the second PDU for protocol A is
dissected, the list is {...,TCP,A,B,...,A}, which means that the
previous element in the list is not TCP, so, again, the second PDU for
protocol A will not be correctly dissected.

An alternative is to have multiple dissectors for the same protocol,
with the part of the protocol that's independent of the protocol
transporting the PDU being dissected by common code.  Protocol B might
have an "over a byte-stream transport" dissector and an "over a packet
transport" dissector, with the first dissector being registered for use
over TCP and TLS and the other dissector being registered for use over
packet protocols.  This mechanism, unlike the other mechanisms, is not
dependent on information in the packet_info structure that might be
affected by dissectors other than the one for the protocol that
transports protocol B.

Furthermore, in a LINKTYPE_WIRESHARK_UPPER_PDU pcap or pcapng packet for
protocol B, there might not be any information to indicate the protocol
that transports protocol B, so there would have to be separate
dissectors for protocol B, with separate names, so that a tag giving the
protocol name would differ for B-over-byte-stream and B-over-packets.

So:

We rename EXP_PDU_TAG_PROTO_NAME and EXP_PDU_TAG_HEUR_PROTO_NAME to
EXP_PDU_TAG_DISSECTOR_NAME and EXP_PDU_TAG_HEUR_DISSECTOR_NAME, to
emphasize that they are *not* protocol names, they are dissector names
(which has always been the case - if there's a protocol with that name,
but no dissector with that name, Wireshark will not be able to handle
the packet, as it will try to look up a dissector given that name and
fail).

We fix that exported PDU dissector to refer to those tags as dissector
names, not protocol names.

We update documentation to refer to them as DISSECTOR_NAME tags, not
PROTO_NAME tags.  (If there is any documentation for this outside the
Wireshark source, it should be updated as well.)

We add comments for calls to dissector_handle_get_dissector_name() where
the dissector name is shown to the user, to indicate that it might be
that the protocol name should be used.

We update the TLS and DTLS dissectors to show the encapsulated protocol
as the string returned by dissector_handle_get_long_name(); as the
default is "Application Data", it appeaers that a descriptive name,
rather than a short API name, should be used.  (We continue to use the
dissector name in debugging messages, to indicate which dissector was
called.)
This commit is contained in:
Guy Harris 2022-09-10 22:37:11 -07:00
parent 8f34e3df98
commit e5951765d8
35 changed files with 93 additions and 74 deletions

View File

@ -290,13 +290,14 @@ direction indicators or timestamps after the first byte along with any offsets.
-P <dissector>::
+
--
Include an EXPORTED_PDU header before each packet. Specify, as a string,
the dissector to be called for the packet (PROTO_NAME tag). Use this option
if your dump is the payload for a single upper layer protocol (so specifying a
link layer type would not work) and you wish to create a capture file without
a full dummy protocol stack. Automatically sets the link layer type to
Wireshark Upper PDU export. Without this option, if the Upper PDU export
link layer type (252) is selected the dissector defaults to "data".
Include an EXPORTED_PDU header before each packet. Specify, as a
string, the dissector to be called for the packet (DISSECTOR_NAME tag).
Use this option if your dump is the payload for a single upper layer
protocol (so specifying a link layer type would not work) and you wish
to create a capture file without a full dummy protocol stack.
Automatically sets the link layer type to Wireshark Upper PDU export.
Without this option, if the Upper PDU export link layer type (252) is
selected the dissector defaults to "data".
--
-q::

View File

@ -118,7 +118,7 @@ dissect_credssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
ver = tvb_get_guint8(tvb, offset);
if((length == 1) && (ver > 1) && (ver < 99)) {
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "credssp", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "credssp", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -1430,7 +1430,7 @@ static void
export_h248_pdu(packet_info *pinfo, tvbuff_t *tvb)
{
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "h248", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "h248", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -10664,6 +10664,7 @@ btatt_dissect_attribute_handle(guint16 handle, tvbuff_t *tvb, packet_info *pinfo
if (attribute_handler == NULL)
return 0;
/* XXX - dissector name, or protocol name? */
attribute_name = dissector_handle_get_dissector_name(attribute_handler); /* abbrev */
DISSECTOR_ASSERT(attribute_name);

View File

@ -390,6 +390,7 @@ static void dissect_header_pair(dissector_table_t dis_table, cose_header_context
key.principal = NULL;
dissector = dissector_get_custom_table_handle(dis_table, &key);
}
/* XXX - dissector name, or protocol name? */
const char *dis_name = dissector_handle_get_dissector_name(dissector);
if (dis_name) {
proto_item_set_text(item_label, "Label: %s (%s)", dis_name, label_str);

View File

@ -581,7 +581,7 @@ dissect_credssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
ver = tvb_get_guint8(tvb, offset);
if((length == 1) && (ver > 1) && (ver < 99)) {
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "credssp", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "credssp", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -356,7 +356,7 @@ static const char *avpflags_str[] = {
static void
export_diameter_pdu(packet_info *pinfo, tvbuff_t *tvb)
{
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "diameter", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "diameter", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -1011,14 +1011,14 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
val_to_str_const(session->version, ssl_version_short_names, "DTLS"),
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
session->app_handle
? dissector_handle_get_dissector_name(session->app_handle)
? dissector_handle_get_long_name(session->app_handle)
: "Application Data");
proto_tree_add_item(dtls_record_tree, hf_dtls_record_appdata, tvb,
offset, record_length, ENC_NA);
if (session->app_handle) {
ti = proto_tree_add_string(dtls_record_tree, hf_dtls_record_appdata_proto, tvb, 0, 0, dissector_handle_get_dissector_name(session->app_handle));
ti = proto_tree_add_string(dtls_record_tree, hf_dtls_record_appdata_proto, tvb, 0, 0, dissector_handle_get_long_name(session->app_handle));
proto_item_set_generated(ti);
}
@ -1045,7 +1045,7 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
ssl_print_data("decrypted app data", record->plain_data, record->data_len);
if (have_tap_listener(exported_pdu_tap)) {
export_pdu_packet(decrypted, pinfo, EXP_PDU_TAG_PROTO_NAME,
export_pdu_packet(decrypted, pinfo, EXP_PDU_TAG_DISSECTOR_NAME,
dissector_handle_get_dissector_name(session->app_handle));
}
@ -1055,7 +1055,7 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
/* try heuristic subdissectors */
dissected = dissector_try_heuristic(heur_subdissector_list, decrypted, pinfo, top_tree, &hdtbl_entry, NULL);
if (dissected && have_tap_listener(exported_pdu_tap)) {
export_pdu_packet(decrypted, pinfo, EXP_PDU_TAG_HEUR_PROTO_NAME, hdtbl_entry->short_name);
export_pdu_packet(decrypted, pinfo, EXP_PDU_TAG_HEUR_DISSECTOR_NAME, hdtbl_entry->short_name);
}
}
pinfo->match_uint = saved_match_port;

View File

@ -3470,7 +3470,7 @@ dissect_sac_msg(guint32 tag, tvbuff_t *tvb, gint offset,
tvb_composite_append(clear_sac_msg_tvb, clear_sac_body_tvb);
tvb_composite_finalize(clear_sac_msg_tvb);
exp_pdu_data = export_pdu_create_tags(pinfo, EXPORTED_SAC_MSG_PROTO, EXP_PDU_TAG_PROTO_NAME, dvbci_exp_pdu_items);
exp_pdu_data = export_pdu_create_tags(pinfo, EXPORTED_SAC_MSG_PROTO, EXP_PDU_TAG_DISSECTOR_NAME, dvbci_exp_pdu_items);
exp_pdu_data->tvb_captured_length = tvb_captured_length(clear_sac_msg_tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(clear_sac_msg_tvb);

View File

@ -63,17 +63,17 @@ static int ss7pc_address_type = -1;
static dissector_handle_t exported_pdu_handle;
#define EXPORTED_PDU_NEXT_PROTO_STR 0
#define EXPORTED_PDU_NEXT_HEUR_PROTO_STR 1
#define EXPORTED_PDU_NEXT_DIS_TABLE_STR 2
#define EXPORTED_PDU_NEXT_DISSECTOR_STR 0
#define EXPORTED_PDU_NEXT_HEUR_DISSECTOR_STR 1
#define EXPORTED_PDU_NEXT_DIS_TABLE_STR 2
static const value_string exported_pdu_tag_vals[] = {
{ EXP_PDU_TAG_END_OF_OPT, "End-of-options" },
/* 1 - 9 reserved */
{ EXP_PDU_TAG_OPTIONS_LENGTH, "Total length of the options excluding this TLV" },
{ EXP_PDU_TAG_LINKTYPE, "Linktype value" },
{ EXP_PDU_TAG_PROTO_NAME, "PDU content protocol name" },
{ EXP_PDU_TAG_HEUR_PROTO_NAME, "PDU content heuristic protocol name" },
{ EXP_PDU_TAG_DISSECTOR_NAME, "PDU content dissector name" },
{ EXP_PDU_TAG_HEUR_DISSECTOR_NAME, "PDU content heuristic dissector name" },
{ EXP_PDU_TAG_DISSECTOR_TABLE_NAME, "PDU content dissector table name" },
/* Add protocol type related tags here */
/* 14 - 19 reserved */
@ -209,12 +209,12 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
offset+=2;
switch(tag) {
case EXP_PDU_TAG_PROTO_NAME:
next_proto_type = EXPORTED_PDU_NEXT_PROTO_STR;
case EXP_PDU_TAG_DISSECTOR_NAME:
next_proto_type = EXPORTED_PDU_NEXT_DISSECTOR_STR;
proto_tree_add_item_ret_string(tag_tree, hf_exported_pdu_prot_name, tvb, offset, tag_len, ENC_UTF_8|ENC_NA, pinfo->pool, &proto_name);
break;
case EXP_PDU_TAG_HEUR_PROTO_NAME:
next_proto_type = EXPORTED_PDU_NEXT_HEUR_PROTO_STR;
case EXP_PDU_TAG_HEUR_DISSECTOR_NAME:
next_proto_type = EXPORTED_PDU_NEXT_HEUR_DISSECTOR_STR;
proto_tree_add_item_ret_string(tag_tree, hf_exported_pdu_heur_prot_name, tvb, offset, tag_len, ENC_UTF_8|ENC_NA, pinfo->pool, &proto_name);
break;
case EXP_PDU_TAG_DISSECTOR_TABLE_NAME:
@ -348,7 +348,7 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
proto_tree_add_item(exported_pdu_tree, hf_exported_pdu_exported_pdu, payload_tvb, 0, -1, ENC_NA);
switch(next_proto_type) {
case EXPORTED_PDU_NEXT_PROTO_STR:
case EXPORTED_PDU_NEXT_DISSECTOR_STR:
proto_handle = find_dissector(proto_name);
if (proto_handle) {
if (col_proto_str) {
@ -359,7 +359,7 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
call_dissector_with_data(proto_handle, payload_tvb, pinfo, tree, dissector_data);
}
break;
case EXPORTED_PDU_NEXT_HEUR_PROTO_STR:
case EXPORTED_PDU_NEXT_HEUR_DISSECTOR_STR:
{
heur_dtbl_entry_t *heur_diss = find_heur_dissector_by_unique_short_name(proto_name);
if (heur_diss) {

View File

@ -1905,7 +1905,7 @@ static void
export_h248_pdu(packet_info *pinfo, tvbuff_t *tvb)
{
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "h248", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "h248", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -1197,7 +1197,7 @@ static void
export_ipsec_pdu(dissector_handle_t dissector_handle, packet_info *pinfo, tvbuff_t *tvb)
{
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, dissector_handle_get_dissector_name(dissector_handle), EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, dissector_handle_get_dissector_name(dissector_handle), EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -213,7 +213,7 @@ static void add_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, const char * sub
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data;
exp_pdu_data = export_pdu_create_tags(pinfo, subdissector_name, EXP_PDU_TAG_PROTO_NAME, NULL);
exp_pdu_data = export_pdu_create_tags(pinfo, subdissector_name, EXP_PDU_TAG_DISSECTOR_NAME, NULL);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -178,7 +178,7 @@ dissect_logcat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_tags(pinfo, "logcat", EXP_PDU_TAG_PROTO_NAME, NULL);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_tags(pinfo, "logcat", EXP_PDU_TAG_DISSECTOR_NAME, NULL);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -424,7 +424,7 @@ megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const
static void
export_megaco_pdu(packet_info *pinfo, tvbuff_t *tvb)
{
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "megaco", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "megaco", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -163,7 +163,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
}
if (from_dtls && have_tap_listener(exported_pdu_tap)) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "reload-framing", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "reload-framing", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = effective_length;
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -477,6 +477,7 @@ rpc_proc_name_internal(wmem_allocator_t *allocator, guint32 prog, guint32 vers,
key.proc = proc;
/* Look at both tables for possible procedure names */
/* XXX - dissector name, or protocol name? */
if ((dissect_function = dissector_get_custom_table_handle(subdissector_call_table, &key)) != NULL)
procname = wmem_strdup(allocator, dissector_handle_get_dissector_name(dissect_function));
else if ((dissect_function = dissector_get_custom_table_handle(subdissector_reply_table, &key)) != NULL)
@ -1937,6 +1938,7 @@ dissect_rpc_indir_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
dissect_function = dissector_get_custom_table_handle(subdissector_reply_table, &key);
if (dissect_function != NULL) {
/* XXX - dissector name, or protocol name? */
procname = dissector_handle_get_dissector_name(dissect_function);
}
else {
@ -2371,6 +2373,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
key.proc = proc;
if ((dissect_function = dissector_get_custom_table_handle(subdissector_call_table, &key)) != NULL) {
/* XXX - dissector name, or protocol name? */
procname = dissector_handle_get_dissector_name(dissect_function);
}
else {
@ -2552,6 +2555,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
dissect_function = dissector_get_custom_table_handle(subdissector_reply_table, &key);
if (dissect_function != NULL) {
/* XXX - dissector name, or protocol name? */
procname = dissector_handle_get_dissector_name(dissect_function);
}
else {

View File

@ -3212,7 +3212,7 @@ create_exp_pdu_table(packet_info *pinfo, tvbuff_t *tvb, const char *table_name,
static exp_pdu_data_t*
create_exp_pdu_proto_name(packet_info *pinfo, tvbuff_t *tvb, const gchar *proto_name)
{
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, proto_name, EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, proto_name, EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -1394,7 +1394,7 @@ sip_cleanup_protocol(void)
static void
export_sip_pdu(packet_info *pinfo, tvbuff_t *tvb)
{
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "sip", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "sip", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -2409,7 +2409,7 @@ get_smpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _
static void
export_smpp_pdu(packet_info *pinfo, tvbuff_t *tvb)
{
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "smpp", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "smpp", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -1428,7 +1428,7 @@ handle_export_pdu_heuristic(packet_info *pinfo, tvbuff_t *tvb, heur_dtbl_entry_t
if (have_tap_listener(exported_pdu_tap)) {
if ((!hdtbl_entry->enabled) ||
(hdtbl_entry->protocol != NULL && !proto_is_protocol_enabled(hdtbl_entry->protocol))) {
exp_pdu_data = export_pdu_create_common_tags(pinfo, "data", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data = export_pdu_create_common_tags(pinfo, "data", EXP_PDU_TAG_DISSECTOR_NAME);
} else if (hdtbl_entry->protocol != NULL) {
exp_pdu_data_item_t exp_pdu_data_dissector_data = {exp_pdu_tcp_dissector_data_size, exp_pdu_tcp_dissector_data_populate_data, NULL};
const exp_pdu_data_item_t *tcp_exp_pdu_items[] = {
@ -1444,7 +1444,7 @@ handle_export_pdu_heuristic(packet_info *pinfo, tvbuff_t *tvb, heur_dtbl_entry_t
exp_pdu_data_dissector_data.data = tcpinfo;
exp_pdu_data = export_pdu_create_tags(pinfo, hdtbl_entry->short_name, EXP_PDU_TAG_HEUR_PROTO_NAME, tcp_exp_pdu_items);
exp_pdu_data = export_pdu_create_tags(pinfo, hdtbl_entry->short_name, EXP_PDU_TAG_HEUR_DISSECTOR_NAME, tcp_exp_pdu_items);
}
if (exp_pdu_data != NULL) {
@ -1483,7 +1483,7 @@ handle_export_pdu_conversation(packet_info *pinfo, tvbuff_t *tvb, int src_port,
exp_pdu_data_dissector_data.data = tcpinfo;
exp_pdu_data = export_pdu_create_tags(pinfo, dissector_handle_get_dissector_name(handle), EXP_PDU_TAG_PROTO_NAME, tcp_exp_pdu_items);
exp_pdu_data = export_pdu_create_tags(pinfo, dissector_handle_get_dissector_name(handle), EXP_PDU_TAG_DISSECTOR_NAME, tcp_exp_pdu_items);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
@ -7276,7 +7276,7 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data = export_pdu_create_common_tags(pinfo, "data", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data = export_pdu_create_common_tags(pinfo, "data", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(next_tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(next_tvb);
exp_pdu_data->pdu_tvb = next_tvb;

View File

@ -1539,6 +1539,7 @@ dissect_v4_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
extitem_offset += 2;
dissector_handle_t subdis = dissector_get_uint_handle(xfer_ext_dissectors, extitem_type);
/* XXX - dissector name, or protocol name? */
const char *subname = dissector_handle_get_dissector_name(subdis);
if (subdis) {
proto_item_set_text(item_type, "Item Type: %s (0x%04" PRIx16 ")", subname, extitem_type);
@ -1663,6 +1664,7 @@ dissect_v4_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
extitem_offset += 2;
dissector_handle_t subdis = dissector_get_uint_handle(xfer_ext_dissectors, extitem_type);
/* XXX - dissector name, or protocol name? */
const char *subname = dissector_handle_get_dissector_name(subdis);
if (subdis) {
proto_item_set_text(item_type, "Item Type: %s (0x%04" PRIx16 ")", subname, extitem_type);

View File

@ -1678,7 +1678,7 @@ process_ssl_payload(tvbuff_t *tvb, int offset, packet_info *pinfo,
(void *)session->app_handle,
dissector_handle_get_dissector_name(session->app_handle));
if (have_tap_listener(exported_pdu_tap)) {
export_pdu_packet(next_tvb, pinfo, EXP_PDU_TAG_HEUR_PROTO_NAME, hdtbl_entry->short_name);
export_pdu_packet(next_tvb, pinfo, EXP_PDU_TAG_HEUR_DISSECTOR_NAME, hdtbl_entry->short_name);
}
return;
}
@ -1702,7 +1702,7 @@ process_ssl_payload(tvbuff_t *tvb, int offset, packet_info *pinfo,
dissector_handle_get_dissector_name(session->app_handle));
if (have_tap_listener(exported_pdu_tap)) {
export_pdu_packet(next_tvb, pinfo, EXP_PDU_TAG_PROTO_NAME,
export_pdu_packet(next_tvb, pinfo, EXP_PDU_TAG_DISSECTOR_NAME,
dissector_handle_get_dissector_name(session->app_handle));
}
saved_match_port = pinfo->match_uint;
@ -2058,14 +2058,14 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
"%s Record Layer: %s Protocol: %s",
val_to_str_const(version, ssl_version_short_names, "SSL"),
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
app_handle ? dissector_handle_get_dissector_name(app_handle)
app_handle ? dissector_handle_get_long_name(app_handle)
: "Application Data");
proto_tree_add_item(ssl_record_tree, hf_tls_record_appdata, tvb,
offset, record_length, ENC_NA);
if (app_handle) {
ti = proto_tree_add_string(ssl_record_tree, hf_tls_record_appdata_proto, tvb, 0, 0, dissector_handle_get_dissector_name(app_handle));
ti = proto_tree_add_string(ssl_record_tree, hf_tls_record_appdata_proto, tvb, 0, 0, dissector_handle_get_long_name(app_handle));
proto_item_set_generated(ti);
}
@ -2079,7 +2079,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
"%s Record Layer: %s Protocol: %s",
val_to_str_const(version, ssl_version_short_names, "SSL"),
val_to_str_const(content_type, ssl_31_content_type, "unknown"),
dissector_handle_get_dissector_name(session->app_handle));
dissector_handle_get_long_name(session->app_handle));
break;
}

View File

@ -514,10 +514,10 @@ handle_export_pdu_heuristic(packet_info *pinfo, tvbuff_t *tvb, heur_dtbl_entry_t
if (have_tap_listener(exported_pdu_tap)) {
if ((!hdtbl_entry->enabled) ||
(hdtbl_entry->protocol != NULL && !proto_is_protocol_enabled(hdtbl_entry->protocol))) {
exp_pdu_data = export_pdu_create_common_tags(pinfo, "data", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data = export_pdu_create_common_tags(pinfo, "data", EXP_PDU_TAG_DISSECTOR_NAME);
}
else if (hdtbl_entry->protocol != NULL) {
exp_pdu_data = export_pdu_create_common_tags(pinfo, hdtbl_entry->short_name, EXP_PDU_TAG_HEUR_PROTO_NAME);
exp_pdu_data = export_pdu_create_common_tags(pinfo, hdtbl_entry->short_name, EXP_PDU_TAG_HEUR_DISSECTOR_NAME);
}
if (exp_pdu_data != NULL) {
@ -538,7 +538,7 @@ handle_export_pdu_conversation(packet_info *pinfo, tvbuff_t *tvb, int uh_dport,
if (conversation != NULL) {
dissector_handle_t handle = (dissector_handle_t)wmem_tree_lookup32_le(conversation->dissector_tree, pinfo->num);
if (handle != NULL) {
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, dissector_handle_get_dissector_name(handle), EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, dissector_handle_get_dissector_name(handle), EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
@ -705,7 +705,7 @@ decode_udp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
call_data_dissector(next_tvb, pinfo, tree);
if (have_tap_listener(exported_pdu_tap)) {
exp_pdu_data = export_pdu_create_common_tags(pinfo, "data", EXP_PDU_TAG_PROTO_NAME);
exp_pdu_data = export_pdu_create_common_tags(pinfo, "data", EXP_PDU_TAG_DISSECTOR_NAME);
exp_pdu_data->tvb_captured_length = tvb_captured_length(next_tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(next_tvb);
exp_pdu_data->pdu_tvb = next_tvb;

View File

@ -85,7 +85,7 @@ static void export_pdu(tvbuff_t *tvb, packet_info* pinfo, char *proto_name)
NULL
};
exp_pdu_data_t *exp_pdu_data = export_pdu_create_tags(pinfo, proto_name, EXP_PDU_TAG_PROTO_NAME, user_encap_exp_pdu_items);
exp_pdu_data_t *exp_pdu_data = export_pdu_create_tags(pinfo, proto_name, EXP_PDU_TAG_DISSECTOR_NAME, user_encap_exp_pdu_items);
exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);

View File

@ -224,7 +224,7 @@ export_pdu_create_tags(packet_info *pinfo, const char* proto_name, guint16 tag_t
guint8* buffer_data;
DISSECTOR_ASSERT(proto_name != NULL);
DISSECTOR_ASSERT((tag_type == EXP_PDU_TAG_PROTO_NAME) || (tag_type == EXP_PDU_TAG_HEUR_PROTO_NAME) || (tag_type == EXP_PDU_TAG_DISSECTOR_TABLE_NAME));
DISSECTOR_ASSERT((tag_type == EXP_PDU_TAG_DISSECTOR_NAME) || (tag_type == EXP_PDU_TAG_HEUR_DISSECTOR_NAME) || (tag_type == EXP_PDU_TAG_DISSECTOR_TABLE_NAME));
exp_pdu_data = wmem_new(pinfo->pool, exp_pdu_data_t);

View File

@ -92,7 +92,7 @@ typedef struct _exp_pdu_data_t {
@param pinfo Packet info that may contain data for the PDU items
@param proto_name Name of protocol that is exporting PDU
@param tag_type Tag type for protocol's PDU. Must be EXP_PDU_TAG_PROTO_NAME or EXP_PDU_TAG_HEUR_PROTO_NAME.
@param tag_type Tag type for protocol's PDU. Must be EXP_PDU_TAG_DISSECTOR_NAME or EXP_PDU_TAG_HEUR_DISSECTOR_NAME.
@param items PDU items to be exported
@return filled exp_pdu_data_t struct
*/
@ -109,7 +109,7 @@ WS_DLL_PUBLIC exp_pdu_data_t *export_pdu_create_tags(packet_info *pinfo, const c
6. Original frame number
@param pinfo Packet info that may contain data for the PDU items
@param tag_type Tag type for protocol's PDU. Must be EXP_PDU_TAG_PROTO_NAME, EXP_PDU_TAG_HEUR_PROTO_NAME or EXP_PDU_TAG_DISSECTOR_TABLE_NAME
@param tag_type Tag type for protocol's PDU. Must be EXP_PDU_TAG_DISSECTOR_NAME, EXP_PDU_TAG_HEUR_DISSECTOR_NAME or EXP_PDU_TAG_DISSECTOR_TABLE_NAME
@param proto_name Name of protocol that is exporting PDU
@return filled exp_pdu_data_t struct
*/

View File

@ -2029,7 +2029,7 @@ static int capture_android_logcat_text(char *interface, char *fifo,
extcap_dumper = extcap_dumper_open(fifo, EXTCAP_ENCAP_WIRESHARK_UPPER_PDU);
exported_pdu_header_protocol_normal.tag = GUINT16_TO_BE(EXP_PDU_TAG_PROTO_NAME);
exported_pdu_header_protocol_normal.tag = GUINT16_TO_BE(EXP_PDU_TAG_DISSECTOR_NAME);
exported_pdu_header_protocol_normal.length = GUINT16_TO_BE(strlen(wireshark_protocol_logcat_text) + 2);
serial_number = get_serial_from_interface(interface);
@ -2182,10 +2182,10 @@ static int capture_android_logcat(char *interface, char *fifo,
extcap_dumper = extcap_dumper_open(fifo, EXTCAP_ENCAP_WIRESHARK_UPPER_PDU);
exported_pdu_header_protocol_events.tag = GUINT16_TO_BE(EXP_PDU_TAG_PROTO_NAME);
exported_pdu_header_protocol_events.tag = GUINT16_TO_BE(EXP_PDU_TAG_DISSECTOR_NAME);
exported_pdu_header_protocol_events.length = GUINT16_TO_BE(strlen(wireshark_protocol_logcat_events) + 2);
exported_pdu_header_protocol_normal.tag = GUINT16_TO_BE(EXP_PDU_TAG_PROTO_NAME);
exported_pdu_header_protocol_normal.tag = GUINT16_TO_BE(EXP_PDU_TAG_DISSECTOR_NAME);
exported_pdu_header_protocol_normal.length = GUINT16_TO_BE(strlen(wireshark_protocol_logcat) + 2);
serial_number = get_serial_from_interface(interface);

View File

@ -177,7 +177,7 @@ static void add_proto_name(guint8* mbuf, guint* offset, const char* proto_name)
size_t proto_str_len = strlen(proto_name);
guint16 proto_name_len = (guint16)((proto_str_len + 3) & 0xfffffffc);
phton16(mbuf + *offset, EXP_PDU_TAG_PROTO_NAME);
phton16(mbuf + *offset, EXP_PDU_TAG_DISSECTOR_NAME);
*offset += 2;
phton16(mbuf + *offset, proto_name_len);
*offset += 2;

View File

@ -256,8 +256,8 @@ print_usage (FILE *output)
" Automatically prepends a dummy SCTP DATA\n"
" chunk header with payload protocol identifier ppi.\n"
" Example: -S 30,40,34\n"
" -P <dissector> prepend EXPORTED_PDU header with specifieddissector\n"
" as the payload PROTO_NAME tag.\n"
" -P <dissector> prepend EXPORTED_PDU header with specified dissector\n"
" as the payload DISSECTOR_NAME tag.\n"
" Automatically sets link type to Upper PDU Export.\n"
" EXPORTED_PDU payload defaults to \"data\" otherwise.\n"
"\n",

View File

@ -674,7 +674,7 @@ write_current_packet(gboolean cont)
/* Write ExportPDU header */
if (hdr_export_pdu) {
guint payload_len = (guint)strlen(info_p->payload);
HDR_EXPORT_PDU.tag_type = g_htons(EXP_PDU_TAG_PROTO_NAME);
HDR_EXPORT_PDU.tag_type = g_htons(EXP_PDU_TAG_DISSECTOR_NAME);
HDR_EXPORT_PDU.payload_len = g_htons(payload_len);
memcpy(&packet_buf[prefix_index], &HDR_EXPORT_PDU, sizeof(HDR_EXPORT_PDU));
prefix_index += sizeof(HDR_EXPORT_PDU);

View File

@ -85,7 +85,7 @@ busmaster_gen_packet(wtap_rec *rec, Buffer *buf,
memset(buf_data, 0, packet_length);
phton16(buf_data + 0, EXP_PDU_TAG_PROTO_NAME);
phton16(buf_data + 0, EXP_PDU_TAG_DISSECTOR_NAME);
phton16(buf_data + 2, proto_name_length);
memcpy(buf_data + 4, proto_name, strlen(proto_name));

View File

@ -59,7 +59,7 @@ candump_write_packet(wtap_rec *rec, Buffer *buf, const msg_t *msg)
memset(buf_data, 0, packet_length);
phton16(buf_data + 0, EXP_PDU_TAG_PROTO_NAME);
phton16(buf_data + 0, EXP_PDU_TAG_DISSECTOR_NAME);
phton16(buf_data + 2, proto_name_length);
memcpy(buf_data + 4, proto_name, strlen(proto_name));

View File

@ -496,7 +496,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re
/* Fill packet buff */
if (use_proto_table == FALSE) {
phton16(packet_buf, EXP_PDU_TAG_PROTO_NAME);
phton16(packet_buf, EXP_PDU_TAG_DISSECTOR_NAME);
packet_buf += 2;
phton16(packet_buf, tag_str_len);
packet_buf += 2;

View File

@ -59,18 +59,24 @@
* changed to do so (as that would destroy their ability to read captures
* using that value for that other purpose).
*/
#define EXP_PDU_TAG_END_OF_OPT 0 /**< End-of-options Tag. */
#define EXP_PDU_TAG_END_OF_OPT 0 /**< End-of-options Tag. */
/* 1 - 9 reserved */
#define EXP_PDU_TAG_OPTIONS_LENGTH 10 /**< Total length of the options excluding this TLV
* Deprecated - do not use
*/
#define EXP_PDU_TAG_LINKTYPE 11 /**< Deprecated - do not use */
#define EXP_PDU_TAG_PROTO_NAME 12 /**< The value part should be an ASCII non NULL terminated string
* of the registered dissector used by Wireshark e.g "sip"
* Will be used to call the next dissector.
*/
#define EXP_PDU_TAG_HEUR_PROTO_NAME 13 /**< The value part should be an ASCII non NULL terminated string
* containing the heuristic unique short protocol name given
#define EXP_PDU_TAG_OPTIONS_LENGTH 10 /**< Total length of the options excluding this TLV
* Deprecated - do not use
*/
#define EXP_PDU_TAG_LINKTYPE 11 /**< Deprecated - do not use */
#define EXP_PDU_TAG_DISSECTOR_NAME 12 /**< The value part should be an ASCII non NULL terminated string
* of the registered dissector used by Wireshark e.g "sip"
* Will be used to call the next dissector.
* NOTE: this is NOT a protocol name;
* a given protocol may have multiple
* dissectors, if, for example, the
* protocol headers depend on the
* protocol being used to transport
* the protocol in question.
*/
#define EXP_PDU_TAG_HEUR_DISSECTOR_NAME 13 /**< The value part should be an ASCII non NULL terminated string
* containing the heuristic dissector unique short name given
* during registration, e.g "sip_udp"
* Will be used to call the next dissector.
*/
@ -80,6 +86,10 @@
* Will be used to call the next dissector.
*/
/* For backwards source compatibility */
#define EXP_PDU_TAG_PROTO_NAME EXP_PDU_TAG_DISSECTOR_NAME
#define EXP_PDU_TAG_HEUR_PROTO_NAME EXP_PDU_TAG_HEUR_DISSECTOR_NAME
/* Add protocol type related tags here.
* NOTE Only one protocol type tag may be present in a packet, the first one
* found will be used*/