Clarify dissector description, protocol short name, and protocol ong name.

Rename dissector_handle_get_long_name() and
dissector_handle_get_short_name() to
dissector_handle_get_protocol_long_name() and
dissector_handle_get_protocol_short_name(), to clarify that they fetch
names for the protocol that the dissector dissects, not for the
dissector *itself*.  Leave a deprecated
dissector_handle_get_short_name() wrapper, and export
dissector_handle_get_protocol_long_name(), as it's now used in some
dissectors.

Change some calls to dissector_handle_get_description() back to
dissector_handle_get_protocol_short_name(), as they appear to be made in
order to display a *protocol* name.

Rename some methods, variables, enums, and table column names to reflect
cases where the dissector description is being used.
This commit is contained in:
Guy Harris 2022-09-13 00:47:24 -07:00
parent 623317fe47
commit c9342873e5
21 changed files with 113 additions and 100 deletions

View File

@ -97,19 +97,19 @@ static void
decode_proto_add_to_list (const gchar *table_name, gpointer value, gpointer user_data)
{
struct decode_as_default_populate* populate = (struct decode_as_default_populate*)user_data;
const gchar *proto_name;
const gchar *dissector_description;
gint i;
dissector_handle_t handle;
handle = (dissector_handle_t)value;
proto_name = dissector_handle_get_description(handle);
dissector_description = dissector_handle_get_description(handle);
i = dissector_handle_get_protocol_index(handle);
if (i >= 0 && !proto_is_protocol_enabled(find_protocol_by_id(i)))
return;
populate->add_to_list(table_name, proto_name, value, populate->ui_element);
populate->add_to_list(table_name, dissector_description, value, populate->ui_element);
}
void decode_as_default_populate_list(const gchar *table_name, decode_as_add_to_list_func add_to_list, gpointer ui_element)
@ -311,18 +311,18 @@ decode_as_write_entry (const gchar *table_name, ftenum_t selector_type,
{
GList **decode_as_rows_list = (GList **)user_data;
dissector_handle_t current, initial;
const gchar *current_proto_name, *initial_proto_name, *decode_as_row;
const gchar *current_dissector_name, *initial_dissector_name, *decode_as_row;
current = dtbl_entry_get_handle((dtbl_entry_t *)value);
if (current == NULL)
current_proto_name = DECODE_AS_NONE;
current_dissector_name = DECODE_AS_NONE;
else
current_proto_name = dissector_handle_get_description(current);
current_dissector_name = dissector_handle_get_description(current);
initial = dtbl_entry_get_initial_handle((dtbl_entry_t *)value);
if (initial == NULL)
initial_proto_name = DECODE_AS_NONE;
initial_dissector_name = DECODE_AS_NONE;
else
initial_proto_name = dissector_handle_get_description(initial);
initial_dissector_name = dissector_handle_get_description(initial);
switch (selector_type) {
@ -342,8 +342,8 @@ decode_as_write_entry (const gchar *table_name, ftenum_t selector_type,
*/
decode_as_row = ws_strdup_printf(
DECODE_AS_ENTRY ": %s,%u,%s,%s\n",
table_name, GPOINTER_TO_UINT(key), initial_proto_name,
current_proto_name);
table_name, GPOINTER_TO_UINT(key), initial_dissector_name,
current_dissector_name);
break;
case FT_NONE:
/*
@ -353,8 +353,8 @@ decode_as_write_entry (const gchar *table_name, ftenum_t selector_type,
*/
decode_as_row = ws_strdup_printf(
DECODE_AS_ENTRY ": %s,0,%s,%s\n",
table_name, initial_proto_name,
current_proto_name);
table_name, initial_dissector_name,
current_dissector_name);
break;
case FT_STRING:
@ -364,8 +364,8 @@ decode_as_write_entry (const gchar *table_name, ftenum_t selector_type,
case FT_STRINGZTRUNC:
decode_as_row = ws_strdup_printf(
DECODE_AS_ENTRY ": %s,%s,%s,%s\n",
table_name, (gchar *)key, initial_proto_name,
current_proto_name);
table_name, (gchar *)key, initial_dissector_name,
current_dissector_name);
break;
default:

View File

@ -1714,7 +1714,7 @@ dcerpc_get_proto_name(e_guid_t *uuid, guint16 ver)
return NULL;
}
return dissector_handle_get_description(handle);
return dissector_handle_get_protocol_short_name(handle);
}
/* Function to find the opnum hf-field of a registered protocol

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_long_name(session->app_handle)
? dissector_handle_get_protocol_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_long_name(session->app_handle));
ti = proto_tree_add_string(dtls_record_tree, hf_dtls_record_appdata_proto, tvb, 0, 0, dissector_handle_get_protocol_long_name(session->app_handle));
proto_item_set_generated(ti);
}

View File

@ -1585,7 +1585,7 @@ dissect_ip_options(tvbuff_t *tvb, int offset, guint length,
if (option_dissector == NULL) {
name = wmem_strdup_printf(pinfo->pool, "Unknown (0x%02x)", opt);
} else {
name = dissector_handle_get_description(option_dissector);
name = dissector_handle_get_protocol_short_name(option_dissector);
}
/* Option has a length. Is it in the packet? */

View File

@ -3717,7 +3717,7 @@ dissect_mipv6_options(tvbuff_t *tvb, int offset, guint length,
if (option_dissector == NULL) {
name = wmem_strdup_printf(pinfo->pool, "Unknown (0x%02x)", opt);
} else {
name = dissector_handle_get_description(option_dissector);
name = dissector_handle_get_protocol_short_name(option_dissector);
}
/* Option has a length. Is it in the packet? */

View File

@ -2328,7 +2328,7 @@ dissect_obex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
current_handle = dissector_get_uint_handle(obex_profile_table, profile);
default_handle = dissector_get_default_uint_handle("obex.profile", profile);
if (current_handle != default_handle) {
expert_add_info_format(pinfo, main_item, &ei_decoded_as_profile, "Decoded As %s", dissector_handle_get_long_name(current_handle));
expert_add_info_format(pinfo, main_item, &ei_decoded_as_profile, "Decoded As %s", dissector_handle_get_protocol_long_name(current_handle));
}
complete = FALSE;

View File

@ -1298,7 +1298,7 @@ ppp_dissect_options(tvbuff_t *tvb, int offset, guint length, dissector_table_t c
if (option_dissector == NULL) {
name = wmem_strdup_printf(pinfo->pool, "Unknown (0x%02x)", opt);
} else {
name = dissector_handle_get_description(option_dissector);
name = dissector_handle_get_protocol_short_name(option_dissector);
}
} else {
name = wmem_strdup_printf(pinfo->pool, "Unknown (0x%02x)", opt);

View File

@ -582,7 +582,7 @@ dissect_rtmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
if (ver == 1) {
if (!type_str) {
if (dissector != data_handle)
type_str = dissector_handle_get_description(dissector);
type_str = dissector_handle_get_protocol_short_name(dissector);
else
type_str = "Unknown";
}
@ -591,7 +591,7 @@ dissect_rtmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
type_str = val_to_str_const(type, rtmac_type_vals, "Unknown");
else {
if (dissector != data_handle)
type_str = dissector_handle_get_description(dissector);
type_str = dissector_handle_get_protocol_short_name(dissector);
else
type_str = "Unknown";
}

View File

@ -2104,9 +2104,9 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
#endif
if (p_conv_data && p_conv_data->bta2dp_info && p_conv_data->bta2dp_info->codec_dissector) {
rtp_info->info_payload_type_str = (const char *) dissector_handle_get_description(p_conv_data->bta2dp_info->codec_dissector);
rtp_info->info_payload_type_str = (const char *) dissector_handle_get_protocol_short_name(p_conv_data->bta2dp_info->codec_dissector);
} else if (p_conv_data && p_conv_data->btvdp_info && p_conv_data->btvdp_info->codec_dissector) {
rtp_info->info_payload_type_str = (const char *) dissector_handle_get_description(p_conv_data->btvdp_info->codec_dissector);
rtp_info->info_payload_type_str = (const char *) dissector_handle_get_protocol_short_name(p_conv_data->btvdp_info->codec_dissector);
}
/* if it is dynamic payload, let use the conv data to see if it is defined */
@ -2142,9 +2142,9 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
}
if (p_conv_data && p_conv_data->bta2dp_info) {
pt = (p_conv_data->bta2dp_info->codec_dissector) ? dissector_handle_get_description(p_conv_data->bta2dp_info->codec_dissector) : "Unknown";
pt = (p_conv_data->bta2dp_info->codec_dissector) ? dissector_handle_get_protocol_short_name(p_conv_data->bta2dp_info->codec_dissector) : "Unknown";
} else if (p_conv_data && p_conv_data->btvdp_info) {
pt = (p_conv_data->btvdp_info->codec_dissector) ? dissector_handle_get_description(p_conv_data->btvdp_info->codec_dissector) : "Unknown";
pt = (p_conv_data->btvdp_info->codec_dissector) ? dissector_handle_get_protocol_short_name(p_conv_data->btvdp_info->codec_dissector) : "Unknown";
} else {
pt = (payload_type_str ? payload_type_str : val_to_str_ext(payload_type, &rtp_payload_type_vals_ext, "Unknown (%u)"));
}

View File

@ -1970,8 +1970,8 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
guint8 national = 0xFFU, routing_ind, gti, pci, ssni, ssn;
tvbuff_t *gt_tvb;
dissector_handle_t ssn_dissector = NULL, tcap_ssn_dissector = NULL;
const char *ssn_dissector_short_name = NULL;
const char *tcap_ssn_dissector_short_name = NULL;
const char *ssn_dissector_description = NULL;
const char *tcap_ssn_dissector_description = NULL;
call_tree = proto_tree_add_subtree_format(tree, tvb, 0, length,
called ? ett_sccp_called : ett_sccp_calling, NULL,
@ -2102,19 +2102,19 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info *
ssn_dissector = dissector_get_uint_handle(sccp_ssn_dissector_table, ssn);
if (ssn_dissector) {
ssn_dissector_short_name = dissector_handle_get_description(ssn_dissector);
ssn_dissector_description = dissector_handle_get_description(ssn_dissector);
if (ssn_dissector_short_name) {
if (ssn_dissector_description) {
item = proto_tree_add_string_format(call_tree, hf_sccp_linked_dissector, tvb, offset - 1, ADDRESS_SSN_LENGTH,
ssn_dissector_short_name, "Linked to %s", ssn_dissector_short_name);
ssn_dissector_description, "Linked to %s", ssn_dissector_description);
proto_item_set_generated(item);
if (g_ascii_strncasecmp("TCAP", ssn_dissector_short_name, 4)== 0) {
if (g_ascii_strncasecmp("TCAP", ssn_dissector_description, 4)== 0) {
tcap_ssn_dissector = get_itu_tcap_subdissector(ssn);
if (tcap_ssn_dissector) {
tcap_ssn_dissector_short_name = dissector_handle_get_description(tcap_ssn_dissector);
proto_item_append_text(item,", TCAP SSN linked to %s", tcap_ssn_dissector_short_name);
tcap_ssn_dissector_description = dissector_handle_get_description(tcap_ssn_dissector);
proto_item_append_text(item,", TCAP SSN linked to %s", tcap_ssn_dissector_description);
}
}
} /* short name */

View File

@ -7037,7 +7037,7 @@ tcp_dissect_options(tvbuff_t *tvb, int offset, guint length,
name = wmem_strdup_printf(pinfo->pool, "Unknown (0x%02x)", opt);
option_dissector = tcp_opt_unknown_handle;
} else {
name = dissector_handle_get_description(option_dissector);
name = dissector_handle_get_protocol_short_name(option_dissector);
}
/* Option has a length. Is it in the packet? */

View File

@ -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_long_name(app_handle)
app_handle ? dissector_handle_get_protocol_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_long_name(app_handle));
ti = proto_tree_add_string(ssl_record_tree, hf_tls_record_appdata_proto, tvb, 0, 0, dissector_handle_get_protocol_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_long_name(session->app_handle));
dissector_handle_get_protocol_long_name(session->app_handle));
break;
}

View File

@ -148,7 +148,7 @@ static int dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, voi
export_pdu(hdr_tvb, pinfo, encap->header_proto_name);
call_dissector(encap->header_proto, hdr_tvb, pinfo, tree);
if (encap->header_proto_name) {
const char *proto_name = dissector_handle_get_long_name(encap->header_proto);
const char *proto_name = dissector_handle_get_protocol_long_name(encap->header_proto);
if (proto_name) {
proto_item_append_text(item, ", Header: %s (%s)", encap->header_proto_name, proto_name);
}
@ -162,7 +162,7 @@ static int dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, voi
export_pdu(payload_tvb, pinfo, encap->payload_proto_name);
call_dissector(encap->payload_proto, payload_tvb, pinfo, tree);
if (encap->payload_proto_name) {
const char *proto_name = dissector_handle_get_long_name(encap->payload_proto);
const char *proto_name = dissector_handle_get_protocol_long_name(encap->payload_proto);
if (proto_name) {
proto_item_append_text(item, ", Payload: %s (%s)", encap->payload_proto_name, proto_name);
}
@ -173,7 +173,7 @@ static int dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, voi
export_pdu(trailer_tvb, pinfo, encap->trailer_proto_name);
call_dissector(encap->trailer_proto, trailer_tvb, pinfo, tree);
if (encap->trailer_proto_name) {
const char *proto_name = dissector_handle_get_long_name(encap->trailer_proto);
const char *proto_name = dissector_handle_get_protocol_long_name(encap->trailer_proto);
if (proto_name) {
proto_item_append_text(item, ", Trailer: %s (%s)", encap->trailer_proto_name, proto_name);
}

View File

@ -3143,7 +3143,7 @@ register_heur_dissector_list(const char *name, const int proto)
/* Get the long name of the protocol for a dissector handle, if it has
a protocol. */
const char *
dissector_handle_get_long_name(const dissector_handle_t handle)
dissector_handle_get_protocol_long_name(const dissector_handle_t handle)
{
if (handle == NULL || handle->protocol == NULL) {
return NULL;
@ -3154,7 +3154,7 @@ dissector_handle_get_long_name(const dissector_handle_t handle)
/* Get the short name of the protocol for a dissector handle, if it has
a protocol. */
const char *
dissector_handle_get_short_name(const dissector_handle_t handle)
dissector_handle_get_protocol_short_name(const dissector_handle_t handle)
{
if (handle == NULL || handle->protocol == NULL) {
return NULL;
@ -3162,6 +3162,13 @@ dissector_handle_get_short_name(const dissector_handle_t handle)
return proto_get_protocol_short_name(handle->protocol);
}
/* For backwards source and binary compatibility */
const char *
dissector_handle_get_short_name(const dissector_handle_t handle)
{
return dissector_handle_get_protocol_short_name(handle);
}
/* Get the description for what the dissector in the dissector handle
dissects, if it has one. */
const char *
@ -3209,7 +3216,7 @@ dissector_handle_t find_dissector_add_dependency(const char *name, const int par
dissector_handle_t handle = (dissector_handle_t)g_hash_table_lookup(registered_dissectors, name);
if ((handle != NULL) && (parent_proto > 0))
{
register_depend_dissector(proto_get_protocol_short_name(find_protocol_by_id(parent_proto)), dissector_handle_get_description(handle));
register_depend_dissector(proto_get_protocol_short_name(find_protocol_by_id(parent_proto)), dissector_handle_get_protocol_short_name(handle));
}
return handle;

View File

@ -563,9 +563,13 @@ WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name,
void deregister_dissector(const char *name);
/** Get the long name of the protocol for a dissector handle. */
extern const char *dissector_handle_get_long_name(const dissector_handle_t handle);
WS_DLL_PUBLIC const char *dissector_handle_get_protocol_long_name(const dissector_handle_t handle);
/** Get the short name of the protocol for a dissector handle. */
WS_DLL_PUBLIC const char *dissector_handle_get_protocol_short_name(const dissector_handle_t handle);
/* For backwards source and binary compatibility */
G_DEPRECATED_FOR(dissector_handle_get_protocol_short_name)
WS_DLL_PUBLIC const char *dissector_handle_get_short_name(const dissector_handle_t handle);
/** Get the description for what the dissector for a dissector handle dissects. */

View File

@ -118,11 +118,11 @@ WSLUA_METAMETHOD Dissector__call(lua_State* L) {
}
WSLUA_METAMETHOD Dissector__tostring(lua_State* L) {
/* Gets the Dissector's protocol short name. */
/* Gets the Dissector's description. */
Dissector d = checkDissector(L,1);
if (!d) return 0;
lua_pushstring(L,dissector_handle_get_description(d));
WSLUA_RETURN(1); /* A string of the protocol's short name. */
WSLUA_RETURN(1); /* A string of the Dissector's description. */
}
/* Gets registered as metamethod automatically by WSLUA_REGISTER_CLASS/META */

View File

@ -520,6 +520,8 @@ libwireshark.so.0 libwireshark0 #MINVER#
dissector_handle_get_description@Base 4.0.0-rc2
dissector_handle_get_dissector_name@Base 1.12.0~rc1
dissector_handle_get_protocol_index@Base 1.9.1
dissector_handle_get_protocol_long_name@Base 4.0.0-rc2
dissector_handle_get_protocol_short_name@Base 4.0.0-rc2
dissector_handle_get_short_name@Base 1.9.1
dissector_hostlist_init@Base 1.99.0
dissector_is_string_changed@Base 3.5.1

View File

@ -34,8 +34,8 @@ DecodeAsItem::DecodeAsItem()
selectorUint_(0),
selectorString_(""),
selectorDCERPC_(NULL),
default_proto_(DECODE_AS_NONE),
current_proto_(DECODE_AS_NONE),
default_dissector_(DECODE_AS_NONE),
current_dissector_(DECODE_AS_NONE),
dissector_handle_(NULL)
{
}
@ -169,9 +169,9 @@ QVariant DecodeAsModel::data(const QModelIndex &index, int role) const
break;
}
case colDefault:
return item->default_proto_;
return item->default_dissector_;
case colProtocol:
return item->current_proto_;
return item->current_dissector_;
}
return QVariant();
@ -262,7 +262,7 @@ bool DecodeAsModel::setData(const QModelIndex &cur_index, const QVariant &value,
}
break;
case DecodeAsModel::colProtocol:
item->current_proto_ = value.toString();
item->current_dissector_ = value.toString();
break;
case DecodeAsModel::colSelector:
{
@ -311,7 +311,7 @@ bool DecodeAsModel::insertRows(int row, int count, const QModelIndex &/*parent*/
//reset the default and current protocols in case previous layer
//populated it and this layer doesn't have a handle for it
item->default_proto_ = item->current_proto_ = DECODE_AS_NONE;
item->default_dissector_ = item->current_dissector_ = DECODE_AS_NONE;
item->tableName_ = entry->table_name;
item->tableUIName_ = get_dissector_table_ui_name(entry->table_name);
@ -359,10 +359,10 @@ bool DecodeAsModel::insertRows(int row, int count, const QModelIndex &/*parent*/
lastItemIsOk = itemOk;
if (dissector != NULL) {
item->default_proto_ = dissector_handle_get_description(dissector);
item->default_dissector_ = dissector_handle_get_description(dissector);
//When adding a new record, "default" should equal "current", so the user can
//explicitly change it
item->current_proto_ = item->default_proto_;
item->current_dissector_ = item->default_dissector_;
}
}
}
@ -428,8 +428,8 @@ bool DecodeAsModel::copyRow(int dst_row, int src_row)
dst->selectorUint_ = src->selectorUint_;
dst->selectorString_ = src->selectorString_;
dst->selectorDCERPC_ = src->selectorDCERPC_;
dst->default_proto_ = src->default_proto_;
dst->current_proto_ = src->current_proto_;
dst->default_dissector_ = src->default_dissector_;
dst->current_dissector_ = src->current_dissector_;
dst->dissector_handle_ = src->dissector_handle_;
QVector<int> roles;
@ -483,10 +483,10 @@ prefs_set_pref_e DecodeAsModel::readDecodeAsEntry(gchar *key, const gchar *value
item->selectorUint_ = selector.toUInt(Q_NULLPTR, 0);
}
item->default_proto_ = values[2];
item->default_dissector_ = values[2];
item->dissector_handle_ = dissector_table_get_dissector_handle(dissector_table, values[3]);
if (item->dissector_handle_) {
item->current_proto_ = values[3];
item->current_dissector_ = values[3];
}
model->decode_as_items_ << item;
@ -610,7 +610,7 @@ void DecodeAsModel::buildChangedList(const gchar *table_name, ftenum_t, gpointer
return;
dissector_handle_t default_dh, current_dh;
QString default_proto_name(DECODE_AS_NONE), current_proto_name(DECODE_AS_NONE);
QString default_dissector(DECODE_AS_NONE), current_dissector(DECODE_AS_NONE);
DecodeAsItem* item = new DecodeAsItem();
ftenum_t selector_type = get_dissector_table_selector_type(table_name);
@ -624,15 +624,15 @@ void DecodeAsModel::buildChangedList(const gchar *table_name, ftenum_t, gpointer
default_dh = dtbl_entry_get_initial_handle((dtbl_entry_t *)value);
if (default_dh) {
default_proto_name = dissector_handle_get_description(default_dh);
default_dissector = dissector_handle_get_description(default_dh);
}
item->default_proto_ = default_proto_name;
item->default_dissector_ = default_dissector;
current_dh = dtbl_entry_get_handle((dtbl_entry_t *)value);
if (current_dh) {
current_proto_name = QString(dissector_handle_get_description(current_dh));
current_dissector = QString(dissector_handle_get_description(current_dh));
}
item->current_proto_ = current_proto_name;
item->current_dissector_ = current_dissector;
item->dissector_handle_ = current_dh;
model->decode_as_items_ << item;
@ -643,7 +643,7 @@ void DecodeAsModel::buildDceRpcChangedList(gpointer data, gpointer user_data)
dissector_table_t sub_dissectors;
guid_key guid_val;
decode_dcerpc_bind_values_t *binding = (decode_dcerpc_bind_values_t *)data;
QString default_proto_name(DECODE_AS_NONE), current_proto_name(DECODE_AS_NONE);
QString default_dissector(DECODE_AS_NONE), current_dissector(DECODE_AS_NONE);
DecodeAsModel *model = (DecodeAsModel*)user_data;
if (model == NULL)
@ -662,10 +662,10 @@ void DecodeAsModel::buildDceRpcChangedList(gpointer data, gpointer user_data)
guid_val.guid = binding->uuid;
item->dissector_handle_ = dissector_get_guid_handle(sub_dissectors, &guid_val);
if (item->dissector_handle_) {
current_proto_name = QString(dissector_handle_get_description(item->dissector_handle_));
current_dissector = QString(dissector_handle_get_description(item->dissector_handle_));
}
item->current_proto_ = current_proto_name;
item->default_proto_ = default_proto_name;
item->current_dissector_ = current_dissector;
item->default_dissector_ = default_dissector;
model->decode_as_items_ << item;
}
@ -745,7 +745,7 @@ void DecodeAsModel::applyChanges()
foreach(DecodeAsItem *item, decode_as_items_) {
decode_as_t *decode_as_entry;
if (item->current_proto_.isEmpty()) {
if (item->current_dissector_.isEmpty()) {
continue;
}
@ -789,7 +789,7 @@ void DecodeAsModel::applyChanges()
continue;
}
if ((item->current_proto_ == DECODE_AS_NONE) || !item->dissector_handle_) {
if ((item->current_dissector_ == DECODE_AS_NONE) || !item->dissector_handle_) {
decode_as_entry->reset_value(decode_as_entry->table_name, selector_value);
sub_dissectors = find_dissector_table(decode_as_entry->table_name);
@ -806,7 +806,7 @@ void DecodeAsModel::applyChanges()
}
break;
} else {
decode_as_entry->change_value(decode_as_entry->table_name, selector_value, &item->dissector_handle_, item->current_proto_.toUtf8().constData());
decode_as_entry->change_value(decode_as_entry->table_name, selector_value, &item->dissector_handle_, item->current_dissector_.toUtf8().constData());
sub_dissectors = find_dissector_table(decode_as_entry->table_name);
/* For now, only numeric dissector tables can use preferences */

View File

@ -38,8 +38,8 @@ public:
QString selectorString_;
decode_dcerpc_bind_values_t* selectorDCERPC_; //for special handling of DCE/RPC
QString default_proto_;
QString current_proto_;
QString default_dissector_;
QString current_dissector_;
dissector_handle_t dissector_handle_;
};

View File

@ -22,7 +22,7 @@ static const char* HEURISTIC_TABLE_NAME = "Heuristic Tables";
class IntegerTablesItem : public DissectorTablesItem
{
public:
IntegerTablesItem(unsigned int value, QString shortName, DissectorTablesItem* parent);
IntegerTablesItem(unsigned int value, QString dissectorDescription, DissectorTablesItem* parent);
virtual ~IntegerTablesItem();
virtual bool lessThan(DissectorTablesItem &right) const;
@ -32,10 +32,10 @@ protected:
};
DissectorTablesItem::DissectorTablesItem(QString tableName, QString shortName, DissectorTablesItem* parent) :
DissectorTablesItem::DissectorTablesItem(QString tableName, QString dissectorDescription, DissectorTablesItem* parent) :
ModelHelperTreeItem<DissectorTablesItem>(parent),
tableName_(tableName),
shortName_(shortName)
dissectorDescription_(dissectorDescription)
{
}
@ -52,8 +52,8 @@ bool DissectorTablesItem::lessThan(DissectorTablesItem &right) const
}
IntegerTablesItem::IntegerTablesItem(unsigned int value, QString shortName, DissectorTablesItem* parent)
: DissectorTablesItem(QString("%1").arg(value), shortName, parent)
IntegerTablesItem::IntegerTablesItem(unsigned int value, QString dissectorDescription, DissectorTablesItem* parent)
: DissectorTablesItem(QString("%1").arg(value), dissectorDescription, parent)
, value_(value)
{
}
@ -170,8 +170,8 @@ QVariant DissectorTablesModel::data(const QModelIndex &index, int role) const
{
case colTableName:
return item->tableName();
case colShortName:
return item->shortName();
case colDissectorDescription:
return item->dissectorDescription();
default:
break;
}
@ -187,7 +187,7 @@ static void gatherProtocolDecodes(const char *, ftenum_t selector_type, gpointer
dtbl_entry_t *dtbl_entry = (dtbl_entry_t*)value;
dissector_handle_t handle = dtbl_entry_get_handle(dtbl_entry);
const QString proto_name = dissector_handle_get_description(handle);
const QString dissector_description = dissector_handle_get_description(handle);
DissectorTablesItem *ti = NULL;
switch (selector_type) {
@ -195,7 +195,7 @@ static void gatherProtocolDecodes(const char *, ftenum_t selector_type, gpointer
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
ti = new IntegerTablesItem(GPOINTER_TO_UINT(key), proto_name, pdl_ptr);
ti = new IntegerTablesItem(GPOINTER_TO_UINT(key), dissector_description, pdl_ptr);
pdl_ptr->prependChild(ti);
break;
@ -204,12 +204,12 @@ static void gatherProtocolDecodes(const char *, ftenum_t selector_type, gpointer
case FT_UINT_STRING:
case FT_STRINGZPAD:
case FT_STRINGZTRUNC:
ti = new DissectorTablesItem((const char *)key, proto_name, pdl_ptr);
ti = new DissectorTablesItem((const char *)key, dissector_description, pdl_ptr);
pdl_ptr->prependChild(ti);
break;
case FT_BYTES:
ti = new DissectorTablesItem(dissector_handle_get_dissector_name(handle), proto_name, pdl_ptr);
ti = new DissectorTablesItem(dissector_handle_get_description(handle), dissector_description, pdl_ptr);
pdl_ptr->prependChild(ti);
break;
@ -323,7 +323,7 @@ void DissectorTablesModel::populate()
DissectorTablesProxyModel::DissectorTablesProxyModel(QObject * parent)
: QSortFilterProxyModel(parent),
tableName_(tr("Table Type")),
shortName_(),
dissectorDescription_(),
filter_()
{
}
@ -335,8 +335,8 @@ QVariant DissectorTablesProxyModel::headerData(int section, Qt::Orientation orie
switch ((enum DissectorTablesModel::DissectorTablesColumn)section) {
case DissectorTablesModel::colTableName:
return tableName_;
case DissectorTablesModel::colShortName:
return shortName_;
case DissectorTablesModel::colDissectorDescription:
return dissectorDescription_;
default:
break;
}
@ -362,7 +362,7 @@ bool DissectorTablesProxyModel::filterAcceptItem(DissectorTablesItem& item) cons
if (filter_.isEmpty())
return true;
if (item.tableName().contains(filter_, Qt::CaseInsensitive) || item.shortName().contains(filter_, Qt::CaseInsensitive))
if (item.tableName().contains(filter_, Qt::CaseInsensitive) || item.dissectorDescription().contains(filter_, Qt::CaseInsensitive))
return true;
DissectorTablesItem *child_item;
@ -398,7 +398,7 @@ void DissectorTablesProxyModel::setFilter(const QString& filter)
void DissectorTablesProxyModel::adjustHeader(const QModelIndex &currentIndex)
{
tableName_ = tr("Table Type");
shortName_ = QString();
dissectorDescription_ = QString();
if (currentIndex.isValid() && currentIndex.parent().isValid()) {
QString table;
@ -407,13 +407,13 @@ void DissectorTablesProxyModel::adjustHeader(const QModelIndex &currentIndex)
if ((table.compare(CUSTOM_TABLE_NAME) == 0) ||
(table.compare(STRING_TABLE_NAME) == 0)) {
tableName_ = tr("String");
shortName_ = tr("Dissector");
dissectorDescription_ = tr("Dissector Description");
} else if (table.compare(INTEGER_TABLE_NAME) == 0) {
tableName_ = tr("Integer");
shortName_ = tr("Dissector");
dissectorDescription_ = tr("Dissector Description");
} else if (table.compare(HEURISTIC_TABLE_NAME) == 0) {
tableName_ = tr("Protocol");
shortName_ = tr("Short Name");
dissectorDescription_ = tr("Short Name");
}
} else {
table = data(index(currentIndex.parent().row(), DissectorTablesModel::colTableName), Qt::DisplayRole).toString();
@ -421,10 +421,10 @@ void DissectorTablesProxyModel::adjustHeader(const QModelIndex &currentIndex)
(table.compare(INTEGER_TABLE_NAME) == 0) ||
(table.compare(STRING_TABLE_NAME) == 0)) {
tableName_ = tr("Table Name");
shortName_ = tr("Selector Name");
dissectorDescription_ = tr("Selector Name");
} else if (table.compare(HEURISTIC_TABLE_NAME) == 0) {
tableName_ = tr("Protocol");
shortName_ = tr("Short Name");
dissectorDescription_ = tr("Short Name");
}
}
}

View File

@ -19,17 +19,17 @@
class DissectorTablesItem : public ModelHelperTreeItem<DissectorTablesItem>
{
public:
DissectorTablesItem(QString tableName, QString shortName, DissectorTablesItem* parent);
DissectorTablesItem(QString tableName, QString dissectorDescription, DissectorTablesItem* parent);
virtual ~DissectorTablesItem();
QString tableName() const {return tableName_;}
QString shortName() const {return shortName_;}
QString dissectorDescription() const {return dissectorDescription_;}
virtual bool lessThan(DissectorTablesItem &right) const;
protected:
QString tableName_;
QString shortName_;
QString dissectorDescription_;
};
class DissectorTablesModel : public QAbstractItemModel
@ -42,7 +42,7 @@ public:
enum DissectorTablesColumn {
colTableName = 0,
colShortName,
colDissectorDescription,
colLast
};
@ -82,7 +82,7 @@ protected:
private:
QString tableName_;
QString shortName_;
QString dissectorDescription_;
QString filter_;
};