Rename value string (and similar) functions to use a consistent pattern. This

was done using textual search+replace, not anything syntax-aware, so presumably
it got most comments as well (except where there were typos).

Use a consistent coding style, and make proper use of the WS_DLL_* defines.

Group the functions appropriately in the header.

I ended up getting rid of most of the explanatory comments since many of them
duplicated what was in the value_string.c file (and were out of sync with the
recent updates I made to those in r48633). Presumably most of the comments
should be in the .h file not the .c file, but there's enough churn ahead that
it's not worth fixing yet.

Part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8467

svn path=/trunk/; revision=48634
This commit is contained in:
Evan Huus 2013-03-29 00:26:23 +00:00
parent 6f19d87f4e
commit 37600a157b
135 changed files with 447 additions and 498 deletions

View File

@ -1916,7 +1916,7 @@ dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
}
dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, &asn1_ctx, tree, -1);
match_strval_idx(opcode, gsm_map_opr_code_strings, &op_idx);
try_val_to_str_idx(opcode, gsm_map_opr_code_strings, &op_idx);
if (op_idx != -1) {
tap_rec.invoke = (gsmmap_pdu_type == 1) ? TRUE : FALSE;

View File

@ -774,7 +774,7 @@ extern void h248_param_PkgdName(proto_tree* tree, tvbuff_t* tvb, packet_info* pi
pi = proto_tree_add_uint(package_tree, hf_248_pkg_param, tvb, offset-2, 2, name_minor);
if (pkg->signal_names && ( strval = match_strval(name_minor, pkg->signal_names) )) {
if (pkg->signal_names && ( strval = try_val_to_str(name_minor, pkg->signal_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
@ -916,7 +916,7 @@ void h248_register_package(const h248_package_t* pkg, pkg_reg_action reg_action)
pkg_found->param_names = vst;
pkg_found->hfid = &hf_h248_pkg_name;
pkg_found->ett = &ett_packagename;
match_strval_idx((pkg_found->id)<<16,base_event_name_vals, &j);
try_val_to_str_idx((pkg_found->id)<<16,base_event_name_vals, &j);
/* now look for events and signals that may be defined for package. If found, create value_strings */
if (j != -1) {
j++; idx=j;
@ -934,7 +934,7 @@ void h248_register_package(const h248_package_t* pkg, pkg_reg_action reg_action)
}
}
/* now look at signals */
if (!match_strval_idx((pkg_found->id)<<16, base_signal_name_vals, &j)) {
if (!try_val_to_str_idx((pkg_found->id)<<16, base_signal_name_vals, &j)) {
j++; idx=j;
while((base_signal_name_vals[j].strptr != NULL) && ((base_signal_name_vals[j].value>>16) == (pkg_found->id))) {
};
@ -1031,7 +1031,7 @@ static int dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offse
proto_item* pi = proto_tree_add_uint(package_tree, hf_248_pkg_param, tvb, offset-2, 2, name_minor);
const gchar* strval;
if (pkg->param_names && ( strval = match_strval(name_minor, pkg->param_names) )) {
if (pkg->param_names && ( strval = try_val_to_str(name_minor, pkg->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
@ -1094,7 +1094,7 @@ static int dissect_h248_EventName(gboolean implicit_tag, tvbuff_t *tvb, int offs
proto_item* pi = proto_tree_add_uint(package_tree, hf_h248_event_code, tvb, offset-2, 2, name_minor);
const gchar* strval;
if (pkg->event_names && ( strval = match_strval(name_minor, pkg->event_names) )) {
if (pkg->event_names && ( strval = try_val_to_str(name_minor, pkg->event_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
@ -1159,7 +1159,7 @@ static int dissect_h248_SignalName(gboolean implicit_tag , tvbuff_t *tvb, int of
proto_item* pi = proto_tree_add_uint(package_tree, hf_h248_signal_code, tvb, offset-2, 2, name_minor);
const gchar* strval;
if (pkg->signal_names && ( strval = match_strval(name_minor, pkg->signal_names) )) {
if (pkg->signal_names && ( strval = try_val_to_str(name_minor, pkg->signal_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
@ -1252,7 +1252,7 @@ static int dissect_h248_SigParameterName(gboolean implicit_tag _U_, tvbuff_t *tv
}
}
if (curr_info.sig && curr_info.sig->param_names && ( strval = match_strval(param_id, curr_info.sig->param_names) )) {
if (curr_info.sig && curr_info.sig->param_names && ( strval = try_val_to_str(param_id, curr_info.sig->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,param_id);
} else {
strval = ep_strdup_printf("Unknown (%d)",param_id);
@ -1329,7 +1329,7 @@ static int dissect_h248_EventParameterName(gboolean implicit_tag _U_, tvbuff_t *
curr_info.par = &no_param;
}
if (curr_info.evt && curr_info.evt->param_names && ( strval = match_strval(param_id, curr_info.evt->param_names) )) {
if (curr_info.evt && curr_info.evt->param_names && ( strval = try_val_to_str(param_id, curr_info.evt->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,param_id);
} else {
strval = ep_strdup_printf("Unknown (%d)",param_id);

View File

@ -133,7 +133,7 @@ dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
hidden_item = proto_tree_add_uint(tree, hf_h450_operation, tvb, 0, 0, opcode);
PROTO_ITEM_SET_HIDDEN(hidden_item);
p = match_strval(opcode, VALS(h450_str_operation));
p = try_val_to_str(opcode, VALS(h450_str_operation));
if (p) {
proto_item_append_text(rctx->d.code_item, " - %s", p);
if (rctx->apdu_depth >= 0)
@ -175,7 +175,7 @@ dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
hidden_item = proto_tree_add_uint(tree, hf_h450_operation, tvb, 0, 0, opcode);
PROTO_ITEM_SET_HIDDEN(hidden_item);
p = match_strval(opcode, VALS(h450_str_operation));
p = try_val_to_str(opcode, VALS(h450_str_operation));
if (p) {
proto_item_append_text(rctx->d.code_item, " - %s", p);
if (rctx->apdu_depth >= 0)
@ -217,7 +217,7 @@ dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
hidden_item = proto_tree_add_uint(tree, hf_h450_error, tvb, 0, 0, errcode);
PROTO_ITEM_SET_HIDDEN(hidden_item);
p = match_strval(errcode, VALS(h450_str_error));
p = try_val_to_str(errcode, VALS(h450_str_error));
if (p) {
proto_item_append_text(rctx->d.code_item, " - %s", p);
if (rctx->apdu_depth >= 0)

View File

@ -161,7 +161,7 @@ dissect_isdn_sup_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
isdn_sup_tree = proto_item_add_subtree(ti, ett_isdn_sup);
proto_tree_add_uint(isdn_sup_tree, hf_isdn_sup_operation, tvb, 0, 0, opcode);
p = match_strval(opcode, VALS(isdn_sup_str_operation));
p = try_val_to_str(opcode, VALS(isdn_sup_str_operation));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);
@ -207,7 +207,7 @@ dissect_isdn_sup_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
isdn_sup_tree = proto_item_add_subtree(ti, ett_isdn_sup);
proto_tree_add_uint(isdn_sup_tree, hf_isdn_sup_operation, tvb, 0, 0, opcode);
p = match_strval(opcode, VALS(isdn_sup_str_operation));
p = try_val_to_str(opcode, VALS(isdn_sup_str_operation));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);
@ -254,7 +254,7 @@ dissect_isdn_sup_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
isdn_sup_tree = proto_item_add_subtree(ti, ett_isdn_sup);
proto_tree_add_uint(isdn_sup_tree, hf_isdn_sup_error, tvb, 0, 0, errcode);
p = match_strval(errcode, VALS(isdn_sup_str_error));
p = try_val_to_str(errcode, VALS(isdn_sup_str_error));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);

View File

@ -136,7 +136,7 @@ dissect_mms_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
return FALSE;
/* see if the tag is a valid MMS PDU */
match_strval_idx(tmp_tag, mms_MMSpdu_vals, &idx);
try_val_to_str_idx(tmp_tag, mms_MMSpdu_vals, &idx);
if (idx == -1) {
return FALSE; /* no, it isn't an MMS PDU */
}

View File

@ -405,7 +405,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
stream = tvb_get_guint8(tvb, 3);
if (check_col(pinfo->cinfo, COL_INFO)) {
const char *s = match_strval(stream, mpeg_pes_T_stream_vals);
const char *s = try_val_to_str(stream, mpeg_pes_T_stream_vals);
if (s != NULL)
col_set_str(pinfo->cinfo, COL_INFO, s);
}
@ -423,7 +423,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
frame_type = tvb_get_guint8(tvb, 5) >> 3 & 0x07;
if (check_col(pinfo->cinfo, COL_INFO)) {
const char *s = match_strval(frame_type,
const char *s = try_val_to_str(frame_type,
mpeg_pes_T_frame_type_vals);
if (s != NULL)
col_set_str(pinfo->cinfo, COL_INFO, s);

View File

@ -403,7 +403,7 @@ dissect_qsig_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
qsig_tree = proto_item_add_subtree(ti, ett_qsig);
proto_tree_add_uint(qsig_tree, hf_qsig_operation, tvb, 0, 0, opcode);
p = match_strval(opcode, VALS(qsig_str_operation));
p = try_val_to_str(opcode, VALS(qsig_str_operation));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);
@ -412,7 +412,7 @@ dissect_qsig_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
ti_tmp = proto_tree_add_uint(qsig_tree, hf_qsig_service, tvb, 0, 0, service);
p = match_strval(service, VALS(qsig_str_service_name));
p = try_val_to_str(service, VALS(qsig_str_service_name));
if (p) proto_item_append_text(ti_tmp, " - %s", p);
if (op_ptr->arg_pdu)
@ -454,7 +454,7 @@ dissect_qsig_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
qsig_tree = proto_item_add_subtree(ti, ett_qsig);
proto_tree_add_uint(qsig_tree, hf_qsig_operation, tvb, 0, 0, opcode);
p = match_strval(opcode, VALS(qsig_str_operation));
p = try_val_to_str(opcode, VALS(qsig_str_operation));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);
@ -463,7 +463,7 @@ dissect_qsig_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
ti_tmp = proto_tree_add_uint(qsig_tree, hf_qsig_service, tvb, 0, 0, service);
p = match_strval(service, VALS(qsig_str_service_name));
p = try_val_to_str(service, VALS(qsig_str_service_name));
if (p) proto_item_append_text(ti_tmp, " - %s", p);
if (op_ptr->res_pdu)
@ -504,7 +504,7 @@ dissect_qsig_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
qsig_tree = proto_item_add_subtree(ti, ett_qsig);
proto_tree_add_uint(qsig_tree, hf_qsig_error, tvb, 0, 0, errcode);
p = match_strval(errcode, VALS(qsig_str_error));
p = try_val_to_str(errcode, VALS(qsig_str_error));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);

View File

@ -1463,7 +1463,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
return 0; /* not enough data to check message type */
type = tvb_get_guint8(tvb, offset);
if (match_strval(type, a11_types) == NULL)
if (try_val_to_str(type, a11_types) == NULL)
return 0; /* not a known message type */
/* Make entries in Protocol column and Info column on summary display */

View File

@ -200,7 +200,7 @@ dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
}
if (tree) {
if ((op_str = match_strval(ar_op, op_vals)))
if ((op_str = try_val_to_str(ar_op, op_vals)))
ti = proto_tree_add_protocol_format(tree, proto_aarp, tvb, 0,
MIN_AARP_HEADER_SIZE + 2*ar_hln +
2*ar_pln, "AppleTalk Address Resolution Protocol (%s)", op_str);

View File

@ -813,7 +813,7 @@ dissect_UDPR1(tvbuff_t *tvb, packet_info *pinfo,
guint32 seq_num, status;
status = tvb_get_letohl(tvb, 0);
status_string = match_strval_ext(status, &error_code_mapping_ext);
status_string = try_val_to_str_ext(status, &error_code_mapping_ext);
if (status_string) {
*info_string = ep_strdup_printf("UDPR1 Status: %s", status_string);
} else {
@ -847,7 +847,7 @@ dissect_UDPR2(tvbuff_t *tvb, packet_info *pinfo,
guint32 i, status, seq_num;
status = tvb_get_letohl(tvb, 0);
status_string = match_strval_ext(status, &error_code_mapping_ext);
status_string = try_val_to_str_ext(status, &error_code_mapping_ext);
if (status_string) {
*info_string = ep_strdup_printf("UDPR2 Status: %s", status_string);
} else {
@ -934,7 +934,7 @@ dissect_UDPR4(tvbuff_t *tvb, packet_info *pinfo,
guint32 data_type, i, status, seq_num;
status = tvb_get_letohl(tvb, 0);
status_string = match_strval_ext(status, &error_code_mapping_ext);
status_string = try_val_to_str_ext(status, &error_code_mapping_ext);
if (status_string) {
*info_string = ep_strdup_printf("UDPR4 Status: %s", status_string);
} else {

View File

@ -1167,7 +1167,7 @@ trans_param_tele_id(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset,
ansi_637_trans_tele_id = value;
str = match_strval(value, ansi_tele_id_strings);
str = try_val_to_str(value, ansi_tele_id_strings);
if (NULL == str)
{
@ -1779,7 +1779,7 @@ dissect_ansi_637_tele_param(tvbuff_t *tvb, proto_tree *tree, guint32 *offset)
curr_offset = *offset;
oct = tvb_get_guint8(tvb, curr_offset);
str = match_strval_idx((guint32) oct, ansi_tele_param_strings, &idx);
str = try_val_to_str_idx((guint32) oct, ansi_tele_param_strings, &idx);
if (NULL == str)
{
@ -1868,7 +1868,7 @@ dissect_ansi_637_tele(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* create the ansi_637 protocol tree
*/
str = match_strval(value, ansi_tele_id_strings);
str = try_val_to_str(value, ansi_tele_id_strings);
if (NULL == str)
{
@ -1965,7 +1965,7 @@ dissect_ansi_637_trans_param(tvbuff_t *tvb, proto_tree *tree, guint32 *offset)
curr_offset = *offset;
oct = tvb_get_guint8(tvb, curr_offset);
str = match_strval_idx((guint32) oct, ansi_trans_param_strings, &idx);
str = try_val_to_str_idx((guint32) oct, ansi_trans_param_strings, &idx);
if (NULL == str)
{
@ -2055,7 +2055,7 @@ dissect_ansi_637_trans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, 0);
str = match_strval_idx(oct, ansi_trans_msg_type_strings, &idx);
str = try_val_to_str_idx(oct, ansi_trans_msg_type_strings, &idx);
if (NULL == str)
{

View File

@ -4679,7 +4679,7 @@ dissect_ansi_683_for_message(tvbuff_t *tvb, proto_tree *ansi_683_tree)
msg_type = tvb_get_guint8(tvb, 0);
str = match_strval_idx(msg_type, for_msg_type_strings, &idx);
str = try_val_to_str_idx(msg_type, for_msg_type_strings, &idx);
if (str == NULL)
{
@ -4709,7 +4709,7 @@ dissect_ansi_683_rev_message(tvbuff_t *tvb, proto_tree *ansi_683_tree)
msg_type = tvb_get_guint8(tvb, 0);
str = match_strval_idx(msg_type, rev_msg_type_strings, &idx);
str = try_val_to_str_idx(msg_type, rev_msg_type_strings, &idx);
if (str == NULL)
{

View File

@ -429,7 +429,7 @@ for_req_cancel(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset)
oct = tvb_get_guint8(tvb, offset);
str = match_strval_idx((oct & 0xf0) >> 4, for_req_type_strings, &idx);
str = try_val_to_str_idx((oct & 0xf0) >> 4, for_req_type_strings, &idx);
if (str == NULL)
{
str = "Reserved";
@ -466,7 +466,7 @@ for_reject(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset)
oct = tvb_get_guint8(tvb, offset);
str = match_strval_idx((oct & 0xf0) >> 4, rev_req_type_strings, &idx);
str = try_val_to_str_idx((oct & 0xf0) >> 4, rev_req_type_strings, &idx);
if (str == NULL)
{
str = "Reserved";
@ -1156,7 +1156,7 @@ rev_reject(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset)
oct = tvb_get_guint8(tvb, offset);
str = match_strval_idx((oct & 0xf0) >> 4, for_req_type_strings, &idx);
str = try_val_to_str_idx((oct & 0xf0) >> 4, for_req_type_strings, &idx);
if (str == NULL)
{
str = "Reserved";
@ -1388,7 +1388,7 @@ rev_pr_can_ack(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset)
oct = tvb_get_guint8(tvb, offset);
str = match_strval_idx((oct & 0xf0) >> 4, for_req_type_strings, &idx);
str = try_val_to_str_idx((oct & 0xf0) >> 4, for_req_type_strings, &idx);
if (str == NULL)
{
str = "Reserved";
@ -1494,7 +1494,7 @@ for_request(tvbuff_t *tvb, proto_tree *tree, guint32 *offset_p, guint8 pd_msg_ty
"%s : Reserved",
bigbuf);
str = match_strval_idx(oct & 0x0f, for_req_type_strings, &idx);
str = try_val_to_str_idx(oct & 0x0f, for_req_type_strings, &idx);
if (str == NULL)
{
return;
@ -1569,7 +1569,7 @@ for_response(tvbuff_t *tvb, proto_tree *tree, guint32 *offset_p)
"%s : Unsolicited response indicator",
bigbuf);
str = match_strval_idx(oct & 0x0f, for_rsp_type_strings, &idx);
str = try_val_to_str_idx(oct & 0x0f, for_rsp_type_strings, &idx);
if (str == NULL)
{
@ -1629,7 +1629,7 @@ rev_request(tvbuff_t *tvb, proto_tree *tree, guint32 *offset_p, guint8 pd_msg_ty
"%s : Reserved",
bigbuf);
str = match_strval_idx(oct & 0x0f, rev_req_type_strings, &idx);
str = try_val_to_str_idx(oct & 0x0f, rev_req_type_strings, &idx);
if (str == NULL)
{
return;
@ -1701,7 +1701,7 @@ rev_response(tvbuff_t *tvb, proto_tree *tree, guint32 *offset_p)
"%s : Unsolicited response indicator",
bigbuf);
str = match_strval_idx(oct & 0x0f, rev_rsp_type_strings, &idx);
str = try_val_to_str_idx(oct & 0x0f, rev_rsp_type_strings, &idx);
if (str == NULL)
{

View File

@ -63,7 +63,7 @@ void proto_register_ansi_a(void);
void proto_reg_handoff_ansi_a(void);
static const gchar *
my_match_strval_idx(guint32 val, const ext_value_string_t *vs, gint *idx, gint *dec_idx)
my_try_val_to_str_idx(guint32 val, const ext_value_string_t *vs, gint *idx, gint *dec_idx)
{
gint i = 0;
@ -3381,7 +3381,7 @@ elem_info_rec_req(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint
rec_type = tvb_get_guint8(tvb, curr_offset);
str = match_strval_idx((guint32) rec_type, ansi_rev_ms_info_rec_str, &idx);
str = try_val_to_str_idx((guint32) rec_type, ansi_rev_ms_info_rec_str, &idx);
if (str == NULL)
{
@ -5318,7 +5318,7 @@ elem_adds_user_part(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gui
adds_app = oct & 0x3f;
str = match_strval_idx((guint32) adds_app, ansi_a_adds_strings, &idx);
str = try_val_to_str_idx((guint32) adds_app, ansi_a_adds_strings, &idx);
if (str == NULL)
{
str = "Reserved";
@ -6273,7 +6273,7 @@ elem_fwd_ms_info_recs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, g
rec_type = tvb_get_guint8(tvb, curr_offset);
str = match_strval_idx((guint32) rec_type, ansi_fwd_ms_info_rec_str, &idx);
str = try_val_to_str_idx((guint32) rec_type, ansi_fwd_ms_info_rec_str, &idx);
if (str == NULL)
{
@ -6564,7 +6564,7 @@ elem_rev_ms_info_recs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, g
rec_type = tvb_get_guint8(tvb, curr_offset);
str = match_strval_idx((guint32) rec_type, ansi_rev_ms_info_rec_str, &idx);
str = try_val_to_str_idx((guint32) rec_type, ansi_rev_ms_info_rec_str, &idx);
if (str == NULL)
{
@ -11669,7 +11669,7 @@ dissect_bsmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, offset++);
msg_str = my_match_strval_idx((guint32) oct, ansi_a_bsmap_strings, &idx, &dec_idx);
msg_str = my_try_val_to_str_idx((guint32) oct, ansi_a_bsmap_strings, &idx, &dec_idx);
/*
* create the a protocol tree
@ -11786,7 +11786,7 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, offset++);
msg_str = my_match_strval_idx((guint32) oct, ansi_a_dtap_strings, &idx, &dec_idx);
msg_str = my_try_val_to_str_idx((guint32) oct, ansi_a_dtap_strings, &idx, &dec_idx);
/*
* create the a protocol tree

View File

@ -769,7 +769,7 @@ dissect_aodv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/* Check the type of AODV packet. */
type = tvb_get_guint8(tvb, 0);
if (match_strval(type, type_vals) == NULL) {
if (try_val_to_str(type, type_vals) == NULL) {
/*
* We assume this is not an AODV packet.
*/

View File

@ -127,7 +127,7 @@ is_armagetronad_packet(tvbuff_t * tvb)
* with the table, that's why we don't consider that as
* a heuristic
*/
if (!match_strval(tvb_get_ntohs(tvb, offset), descriptors))
if (!try_val_to_str(tvb_get_ntohs(tvb, offset), descriptors))
/* DescriptorID not found in the table */
return FALSE;
#endif

View File

@ -1118,7 +1118,7 @@ dissect_atmarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if (tree) {
if ((op_str = match_strval(ar_op, atmop_vals)))
if ((op_str = try_val_to_str(ar_op, atmop_vals)))
ti = proto_tree_add_protocol_format(tree, proto_arp, tvb, 0, tot_len,
"ATM Address Resolution Protocol (%s)",
op_str);
@ -1358,7 +1358,7 @@ dissect_ax25arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if (tree) {
if ((op_str = match_strval(ar_op, op_vals))) {
if ((op_str = try_val_to_str(ar_op, op_vals))) {
if (is_gratuitous && (ar_op == ARPOP_REQUEST))
op_str = "request/gratuitous ARP";
if (is_gratuitous && (ar_op == ARPOP_REPLY))
@ -1727,7 +1727,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
if (tree) {
if ((op_str = match_strval(ar_op, op_vals))) {
if ((op_str = try_val_to_str(ar_op, op_vals))) {
if (is_gratuitous && (ar_op == ARPOP_REQUEST))
op_str = "request/gratuitous ARP";
if (is_gratuitous && (ar_op == ARPOP_REPLY))

View File

@ -5693,7 +5693,7 @@ dissect_r3_cmd_alarmconfigure (tvbuff_t *tvb, guint32 start_offset, guint32 leng
const gchar *as;
guint32 alarm_len;
if (!(ai = match_strval_ext (tvb_get_guint8 (payload_tvb, offset + 1), &r3_alarmidnames_ext)))
if (!(ai = try_val_to_str_ext (tvb_get_guint8 (payload_tvb, offset + 1), &r3_alarmidnames_ext)))
{
ai = "[Unknown Alarm ID]";
as = "N/A";

View File

@ -395,7 +395,7 @@ dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *bfcp_tree = NULL;
primitive = tvb_get_guint8(tvb, 1);
str = match_strval(primitive, map_bfcp_primitive);
str = try_val_to_str(primitive, map_bfcp_primitive);
/* Make entries in Protocol column and Info column on summary display*/
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BFCP");
@ -474,7 +474,7 @@ dissect_bfcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
if ((primitive < 1) || (primitive > 18))
return FALSE;
str = match_strval(primitive, map_bfcp_primitive);
str = try_val_to_str(primitive, map_bfcp_primitive);
if (NULL == str)
return FALSE;

View File

@ -624,10 +624,10 @@ dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
msgtype = match_strval(type, bittorrent_messages);
msgtype = try_val_to_str(type, bittorrent_messages);
#if 0
if (msgtype == NULL && isamp) {
msgtype = match_strval(type, azureus_messages);
msgtype = try_val_to_str(type, azureus_messages);
}
#endif
if (msgtype == NULL) {

View File

@ -6347,7 +6347,7 @@ static void get_bssgp_msg_params(guint8 oct, const gchar **msg_str, int *ett_tre
{
gint idx;
*msg_str = match_strval_idx_ext((guint32) (oct & 0xff), &bssgp_msg_strings_ext, &idx);
*msg_str = try_val_to_str_idx_ext((guint32) (oct & 0xff), &bssgp_msg_strings_ext, &idx);
*hf_idx = hf_bssgp_msg_type;
if (*msg_str != NULL) {
*ett_tree = ett_bssgp_msg[idx];

View File

@ -131,7 +131,7 @@ dissect_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/*
* Simple sanity check - make sure the type is one we know about.
*/
if (match_strval(bvlc_type, bvlc_types) == NULL)
if (try_val_to_str(bvlc_type, bvlc_types) == NULL)
return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BVLC");

View File

@ -188,7 +188,7 @@ guint16 dissect_cbs_message_identifier(tvbuff_t *tvb, proto_tree *tree, guint16
const char *msg_id_string = NULL;
msg_id = tvb_get_ntohs(tvb, offset);
msg_id_string = match_strval(msg_id, message_id_values);
msg_id_string = try_val_to_str(msg_id, message_id_values);
if (msg_id_string == NULL)
{
if (msg_id < 1000)

View File

@ -724,7 +724,7 @@ dissect_cimd_operation(tvbuff_t *tvb, proto_tree *tree, gint etxp, guint16 check
break;
PC = decimal_int_value(tvb, offset + 1, CIMD_PC_LENGTH);
match_strval_idx(PC, cimd_vals_PC, &idx);
try_val_to_str_idx(PC, cimd_vals_PC, &idx);
if (idx != -1 && tree)
{
(vals_hdr_PC[idx].diss)(tvb, cimd_tree, idx, offset, endOffset);
@ -813,7 +813,7 @@ dissect_cimd_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
/* Try getting the operation-code */
opcode = decimal_int_value(tvb, CIMD_OC_OFFSET, CIMD_OC_LENGTH);
if (match_strval(opcode, vals_hdr_OC) == NULL)
if (try_val_to_str(opcode, vals_hdr_OC) == NULL)
return FALSE;
if (tvb_get_guint8(tvb, CIMD_OC_OFFSET + CIMD_OC_LENGTH) != CIMD_COLON)

View File

@ -6135,7 +6135,7 @@ dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info
}
/* Check to see if service is 'generic' */
match_strval_idx((service & 0x7F), cip_sc_vals, &service_index);
try_val_to_str_idx((service & 0x7F), cip_sc_vals, &service_index);
if (service_index >= 0)
{
/* See if object dissector wants to override generic service handling */
@ -6211,7 +6211,7 @@ dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info
}
/* Check to see if service is 'generic' */
match_strval_idx(service, cip_sc_vals, &service_index);
try_val_to_str_idx(service, cip_sc_vals, &service_index);
if (service_index >= 0)
{
/* See if object dissector wants to override generic service handling */

View File

@ -248,7 +248,7 @@ dissect_classicstun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
return 0;
/* check if message type is correct */
msg_type_str = match_strval(msg_type, messages);
msg_type_str = try_val_to_str(msg_type, messages);
if (msg_type_str == NULL)
return 0;

View File

@ -556,7 +556,7 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
total_length = tvb_get_ntohl(tvb, 0); /* Get the pdu length */
command_id = tvb_get_ntohl(tvb, 4); /* get the pdu command id */
if (match_strval(command_id, vals_command_Id) == NULL)
if (try_val_to_str(command_id, vals_command_Id) == NULL)
{
/* Should never happen: we checked this in dissect_cmpp() */
return;
@ -648,7 +648,7 @@ dissect_cmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
if (total_length < CMPP_FIX_HEADER_LENGTH || total_length > 1000)
return 0;
if (match_strval(command_id, vals_command_Id) == NULL)
if (try_val_to_str(command_id, vals_command_Id) == NULL)
return 0;
col_clear(pinfo->cinfo, COL_INFO);

View File

@ -177,11 +177,11 @@ csm_to_host(guint16 fc, guint16 ct)
{
if (fc == 0x0000)
{
return (match_strval(ct, exclusive_to_host_ct_vals) != NULL);
return (try_val_to_str(ct, exclusive_to_host_ct_vals) != NULL);
}
else
{
return (match_strval(fc, exclusive_to_host_vals) != NULL);
return (try_val_to_str(fc, exclusive_to_host_vals) != NULL);
}
}

View File

@ -99,7 +99,7 @@ dissect_ddtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
* If we don't recognize the version number, don't dissect this.
*/
if (tvb_length(tvb) >= 4) {
if (match_strval(tvb_get_ntohl(tvb, 0), vals_ddtp_version) == NULL)
if (try_val_to_str(tvb_get_ntohl(tvb, 0), vals_ddtp_version) == NULL)
return 0;
}

View File

@ -928,7 +928,7 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
cmd_vs = (value_string *)(void *)all_cmds->data;
app_item = proto_tree_add_item(diam_tree, hf_diameter_application_id, tvb, 8, 4, ENC_BIG_ENDIAN);
if (match_strval(fourth, dictionary.applications) == NULL) {
if (try_val_to_str(fourth, dictionary.applications) == NULL) {
proto_tree *tu = proto_item_add_subtree(app_item,ett_unknown);
proto_item *iu = proto_tree_add_text(tu, tvb, 8, 4, "Unknown Application Id, "
"if you know what this is you can add it to dictionary.xml");

View File

@ -469,7 +469,7 @@ dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti2)
static int
dissect_dlsw_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
if (match_strval(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
if (try_val_to_str(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
{
/* Probably not a DLSw packet. */
return 0;
@ -503,7 +503,7 @@ get_dlsw_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
static int
dissect_dlsw_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
if (match_strval(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
if (try_val_to_str(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
{
/* Probably not a DLSw packet. */
return 0;

View File

@ -1057,10 +1057,10 @@ dissect_dtls_alert(tvbuff_t *tvb, packet_info *pinfo,
/* first lookup the names for the alert level and description */
byte = tvb_get_guint8(tvb, offset); /* grab the level byte */
level = match_strval(byte, ssl_31_alert_level);
level = try_val_to_str(byte, ssl_31_alert_level);
byte = tvb_get_guint8(tvb, offset+1); /* grab the desc byte */
desc = match_strval(byte, ssl_31_alert_description);
desc = try_val_to_str(byte, ssl_31_alert_description);
/* now set the text in the record layer line */
if (level && desc)
@ -1171,7 +1171,7 @@ dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
}
msg_type = tvb_get_guint8(tvb, offset);
msg_type_str = match_strval(msg_type, ssl_31_handshake_type);
msg_type_str = try_val_to_str(msg_type, ssl_31_handshake_type);
if (!msg_type_str && !first_iteration)
{
@ -1486,7 +1486,7 @@ dissect_dtls_heartbeat(tvbuff_t *tvb, packet_info *pinfo,
/* first lookup the names for the message type and the payload length */
byte = tvb_get_guint8(tvb, offset);
type = match_strval(byte, tls_heartbeat_type);
type = try_val_to_str(byte, tls_heartbeat_type);
payload_length = tvb_get_ntohs(tvb, offset + 1);
padding_length = record_length - 3 - payload_length;

View File

@ -241,7 +241,7 @@ dissect_dvb_ait_descriptor(tvbuff_t *tvb, guint offset,
we dissect it ourselves
otherwise, we assume it's a generic DVB-SI descriptor and pass it
on to packet-mpeg-descriptor */
if (match_strval(tag, ait_descr_tag)) {
if (try_val_to_str(tag, ait_descr_tag)) {
offset_start = offset;
descr_tree_ti = proto_tree_add_text(tree, tvb, offset_start, len+2,

View File

@ -2674,7 +2674,7 @@ dissect_dvbci_payload_dt(guint32 tag, gint len_field,
}
else if (tag==T_DATE_TIME) {
if (len_field!=5 && len_field!=7) {
tag_str = match_strval(tag, dvbci_apdu_tag);
tag_str = try_val_to_str(tag, dvbci_apdu_tag);
pi = proto_tree_add_text(tree, tvb, APDU_TAG_SIZE, offset-APDU_TAG_SIZE,
"Invalid APDU length field");
expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR,
@ -3752,7 +3752,7 @@ dissect_dvbci_apdu(tvbuff_t *tvb, circuit_t *circuit,
app_tree = proto_item_add_subtree(ti, ett_dvbci_application);
tag = tvb_get_ntoh24(tvb, 0);
tag_str = match_strval(tag, dvbci_apdu_tag);
tag_str = try_val_to_str(tag, dvbci_apdu_tag);
offset = APDU_TAG_SIZE;
col_set_str(pinfo->cinfo, COL_INFO,
@ -3880,7 +3880,7 @@ dissect_dvbci_spdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
sess_tree = proto_item_add_subtree(ti, ett_dvbci_session);
tag = tvb_get_guint8(tvb,0);
tag_str = match_strval(tag, dvbci_spdu_tag);
tag_str = try_val_to_str(tag, dvbci_spdu_tag);
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str_const(tag, dvbci_spdu_tag, "Invalid SPDU"));
if (tag_str) {
@ -4071,7 +4071,7 @@ dissect_dvbci_tpdu_status(tvbuff_t *tvb, gint offset,
offset_new++;
sb_value = tvb_get_guint8(tvb, offset_new);
sb_str = match_strval(sb_value, dvbci_sb_value);
sb_str = try_val_to_str(sb_value, dvbci_sb_value);
if (sb_str) {
col_append_sep_fstr(pinfo->cinfo, COL_INFO, ": ", "%s", sb_str);
proto_tree_add_item(tree, hf_dvbci_sb_value, tvb,
@ -4106,7 +4106,7 @@ dissect_dvbci_tpdu_hdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (direction==DATA_HOST_TO_CAM) {
c_tpdu_tag = tvb_get_guint8(tvb, 0);
tag = &c_tpdu_tag;
c_tpdu_str = match_strval(c_tpdu_tag, dvbci_c_tpdu);
c_tpdu_str = try_val_to_str(c_tpdu_tag, dvbci_c_tpdu);
if (c_tpdu_str) {
col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", c_tpdu_str);
proto_tree_add_item(tree, hf_dvbci_c_tpdu_tag, tvb, 0, 1, ENC_BIG_ENDIAN);
@ -4124,7 +4124,7 @@ dissect_dvbci_tpdu_hdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
else {
r_tpdu_tag = tvb_get_guint8(tvb, 0);
tag = &r_tpdu_tag;
r_tpdu_str = match_strval(r_tpdu_tag, dvbci_r_tpdu);
r_tpdu_str = try_val_to_str(r_tpdu_tag, dvbci_r_tpdu);
if (r_tpdu_str) {
col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", r_tpdu_str);
proto_tree_add_item(tree, hf_dvbci_r_tpdu_tag, tvb, 0, 1, ENC_BIG_ENDIAN);
@ -4288,7 +4288,7 @@ dissect_dvbci_lpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(link_tree, hf_dvbci_tcid, tvb, 0, 1, ENC_BIG_ENDIAN);
more_last = tvb_get_guint8(tvb, 1);
if (match_strval(more_last, dvbci_ml)) {
if (try_val_to_str(more_last, dvbci_ml)) {
proto_tree_add_item(link_tree, hf_dvbci_ml, tvb, 1, 1, ENC_BIG_ENDIAN);
}
else {
@ -4644,7 +4644,7 @@ dissect_dvbci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
offset_evt = offset;
event = tvb_get_guint8(tvb, offset++);
event_str = match_strval(event, dvbci_event);
event_str = try_val_to_str(event, dvbci_event);
if (!event_str)
return 0;

View File

@ -2643,7 +2643,7 @@ dissect_e212_mcc_mnc_in_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
mnc = 10 * mnc1 + mnc2;
/* Try to match the MCC and 2 digits MNC with an entry in our list of operators */
if (!match_strval_ext(mcc * 1000 + 10 * mnc, &mcc_mnc_codes_ext)) {
if (!try_val_to_str_ext(mcc * 1000 + 10 * mnc, &mcc_mnc_codes_ext)) {
mnc = 10 * mnc + mnc3;
long_mnc = TRUE;
}

View File

@ -597,7 +597,7 @@ static guint8 edonkey_metatag_name_get_type(tvbuff_t *tvb, gint start, gint leng
{
guint8 *tag_name;
if (match_strval(special_tagtype, edonkey_special_tags) == NULL) {
if (try_val_to_str(special_tagtype, edonkey_special_tags) == NULL) {
gint idx;
tag_name = tvb_get_ephemeral_string(tvb, start, length);
idx = lookup_str_index(tag_name, length, edonkey_special_tags);
@ -613,7 +613,7 @@ static proto_item* edonkey_tree_add_metatag_name(proto_tree *tree, tvbuff_t *tvb
gint start, gint length, guint8 special_tagtype)
{
const gchar *tag_name;
tag_name = match_strval(special_tagtype, edonkey_special_tags);
tag_name = try_val_to_str(special_tagtype, edonkey_special_tags);
if (tag_name == NULL) {
return proto_tree_add_item(tree, hf_edonkey_metatag_name, tvb, start, length, ENC_ASCII|ENC_NA);
}
@ -2955,7 +2955,7 @@ static void dissect_edonkey_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre
protocol = tvb_get_guint8(tvb, offset);
msg_len = tvb_get_letohl(tvb, offset+1);
protocol_name = match_strval(protocol, edonkey_protocols);
protocol_name = try_val_to_str(protocol, edonkey_protocols);
/* Add edonkey message tree */
if (edonkey_tree) {
@ -3034,7 +3034,7 @@ static int dissect_edonkey_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
return 0;
protocol = tvb_get_guint8(tvb, 0);
if (match_strval(protocol, edonkey_protocols) == NULL)
if (try_val_to_str(protocol, edonkey_protocols) == NULL)
return 0; /* Not a known protocol */
col_clear(pinfo->cinfo, COL_INFO);
@ -3058,7 +3058,7 @@ static int dissect_edonkey_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
return 0;
protocol = tvb_get_guint8(tvb, offset);
if (match_strval(protocol, edonkey_protocols) == NULL)
if (try_val_to_str(protocol, edonkey_protocols) == NULL)
return 0; /* Not a known protocol */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "eDonkey");

View File

@ -2089,7 +2089,7 @@ dissect_enip_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* Get the command type and see if it's valid. */
encap_cmd = tvb_get_letohs( tvb, 0 );
if (match_strval(encap_cmd, encap_cmd_vals) == NULL)
if (try_val_to_str(encap_cmd, encap_cmd_vals) == NULL)
return 0; /* not a known command */
dissect_enip_pdu(tvb, pinfo, tree);
@ -2107,7 +2107,7 @@ dissect_enip_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* Get the command type and see if it's valid. */
encap_cmd = tvb_get_letohs( tvb, 0 );
if (match_strval(encap_cmd, encap_cmd_vals) == NULL)
if (try_val_to_str(encap_cmd, encap_cmd_vals) == NULL)
return 0; /* not a known command */
tcp_dissect_pdus(tvb, pinfo, tree, enip_desegment, 4, get_enip_pdu_len, dissect_enip_pdu);

View File

@ -823,7 +823,7 @@ decode_epl_address (guchar adr)
{
const gchar *addr_str;
addr_str = match_strval(adr, addr_str_vals);
addr_str = try_val_to_str(adr, addr_str_vals);
if (addr_str != NULL)
{

View File

@ -167,7 +167,7 @@ void proto_reg_handoff_etch(void);
* a. Upon startup & whenever symbol folder changed: Read from file(s)
* and add all hash/symbol pairs to a GArray;
* b. When file reads complete, sort the GArray and then create a
* value_string_ext from the array for use by match_strval_ext & friends.
* value_string_ext from the array for use by try_val_to_str_ext & friends.
* (Code based upon code in packet-diameter.c)
*/
static GArray *gbl_symbols_array = NULL;
@ -528,7 +528,7 @@ read_number(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
gbl_symbol_buffer = ep_strbuf_new_label(""); /* no symbol found yet */
if (byteLength == 4) {
hash = tvb_get_ntohl(tvb, *offset);
symbol = match_strval_ext(hash, gbl_symbols_vs_ext);
symbol = try_val_to_str_ext(hash, gbl_symbols_vs_ext);
if(symbol != NULL) {
asWhat = hf_etch_symbol;
gbl_have_symbol = TRUE;
@ -693,7 +693,7 @@ get_column_info(tvbuff_t *tvb)
const gchar *symbol;
guint32 hash;
hash = tvb_get_ntohl(tvb, my_offset);
symbol = match_strval_ext(hash, gbl_symbols_vs_ext);
symbol = try_val_to_str_ext(hash, gbl_symbols_vs_ext);
if (symbol != NULL) {
ep_strbuf_append_printf(result_buf, "%s()", symbol);
}

View File

@ -311,7 +311,7 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype,
/* Label protocol */
col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", etype);
description = match_strval(etype, etype_vals);
description = try_val_to_str(etype, etype_vals);
if (description) {
col_add_str(pinfo->cinfo, COL_INFO, description);
}

View File

@ -212,9 +212,9 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
return FALSE; /* the sig field in the FCoIB Encap. header MUST be 2'b01*/
if (!tvb_bytes_exist(tvb, eof_offset + 1, 3) || tvb_get_ntoh24(tvb, eof_offset + 1) != 0)
return FALSE; /* 3 bytes of RESERVED field immediately after eEOF MUST be 0 */
if (!match_strval(sof, fcoib_sof_vals))
if (!try_val_to_str(sof, fcoib_sof_vals))
return FALSE; /* invalid value for SOF */
if (!match_strval(eof, fcoib_eof_vals))
if (!try_val_to_str(eof, fcoib_eof_vals))
return FALSE; /* invalid value for EOF */
}

View File

@ -364,7 +364,7 @@ dissect_operation_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint
type = tvb_get_ntohs(tvb,offset);
ti = proto_tree_add_item(oper_tree, hf_forces_lfbselect_tlv_type_operation_type,
tvb, offset, 2, ENC_BIG_ENDIAN);
if (match_strval(type, operation_type_vals) == NULL)
if (try_val_to_str(type, operation_type_vals) == NULL)
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN,
"Bogus: ForCES Operation TLV (Type:0x%04x) is not supported", type);

View File

@ -1741,7 +1741,7 @@ dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case GG_OWN_RESOURCE_INFO:
default:
{
const char *pkt_name = match_strval(pkt_type, gadu_gadu_packets_type_recv);
const char *pkt_name = try_val_to_str(pkt_type, gadu_gadu_packets_type_recv);
if (pkt_name)
col_set_str(pinfo->cinfo, COL_INFO, pkt_name);
@ -1865,7 +1865,7 @@ dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case GG_LOGIN105:
default:
{
const char *pkt_name = match_strval(pkt_type, gadu_gadu_packets_type_send);
const char *pkt_name = try_val_to_str(pkt_type, gadu_gadu_packets_type_send);
if (pkt_name)
col_set_str(pinfo->cinfo, COL_INFO, pkt_name);

View File

@ -1284,7 +1284,7 @@ dissect_ged125(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
message_type = tvb_get_ntohl(tvb, 4);
/*checks to make sure it's of a ged125 base message type*/
if (match_strval(message_type, base_message_values) == NULL)
if (try_val_to_str(message_type, base_message_values) == NULL)
return 0; /* not a known command */
if (tree)

View File

@ -1759,10 +1759,10 @@ gmr1_get_msg_rr_params(guint8 oct, int dcch, const gchar **msg_str,
gint idx;
if (dcch)
m = match_strval_idx((guint32)oct | 0x100, gmr1_msg_rr_strings, &idx);
m = try_val_to_str_idx((guint32)oct | 0x100, gmr1_msg_rr_strings, &idx);
if (!m)
m = match_strval_idx((guint32)oct, gmr1_msg_rr_strings, &idx);
m = try_val_to_str_idx((guint32)oct, gmr1_msg_rr_strings, &idx);
*msg_str = m;
*hf_idx = hf_rr_msg_type;

View File

@ -4686,7 +4686,7 @@ be_field_element_dissect(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gu
*/
oct = tvb_get_guint8(tvb, curr_offset++);
str = match_strval_idx((guint32) oct, bssmap_field_element_ids, &idx);
str = try_val_to_str_idx((guint32) oct, bssmap_field_element_ids, &idx);
ie_len = tvb_get_guint8(tvb, curr_offset++);
if (!str)
@ -6976,7 +6976,7 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, offset++);
str = match_strval_idx_ext((guint32) oct, &gsm_a_bssmap_msg_strings_ext, &idx);
str = try_val_to_str_idx_ext((guint32) oct, &gsm_a_bssmap_msg_strings_ext, &idx);
if (sccp_msg_p && !sccp_msg_p->data.co.label) {
sccp_msg_p->data.co.label = se_strdup(val_to_str_ext((guint32)oct,

View File

@ -825,7 +825,7 @@ de_rej_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 of
oct = tvb_get_guint8(tvb, offset);
str = match_strrval(oct, gsm_a_dtap_rej_cause_vals);
str = try_rval_to_str(oct, gsm_a_dtap_rej_cause_vals);
if(!str)
{
if(is_uplink == IS_UPLINK_TRUE)
@ -6431,7 +6431,7 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (pd)
{
case 3:
msg_str = match_strval_idx((guint32) (oct & DTAP_CC_IEI_MASK), gsm_a_dtap_msg_cc_strings, &idx);
msg_str = try_val_to_str_idx((guint32) (oct & DTAP_CC_IEI_MASK), gsm_a_dtap_msg_cc_strings, &idx);
if (msg_str != NULL)
{
ett_tree = ett_gsm_dtap_msg_cc[idx];
@ -6443,7 +6443,7 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 5:
msg_str = match_strval_idx((guint32) (oct & DTAP_MM_IEI_MASK), gsm_a_dtap_msg_mm_strings, &idx);
msg_str = try_val_to_str_idx((guint32) (oct & DTAP_MM_IEI_MASK), gsm_a_dtap_msg_mm_strings, &idx);
if (msg_str != NULL)
{
ett_tree = ett_gsm_dtap_msg_mm[idx];
@ -6462,7 +6462,7 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 9:
msg_str = match_strval_idx((guint32) (oct & DTAP_SMS_IEI_MASK), gsm_a_dtap_msg_sms_strings, &idx);
msg_str = try_val_to_str_idx((guint32) (oct & DTAP_SMS_IEI_MASK), gsm_a_dtap_msg_sms_strings, &idx);
hf_idx = hf_gsm_a_dtap_msg_sms_type;
if (msg_str != NULL)
{
@ -6478,7 +6478,7 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 11:
msg_str = match_strval_idx((guint32) (oct & DTAP_SS_IEI_MASK), gsm_a_dtap_msg_ss_strings, &idx);
msg_str = try_val_to_str_idx((guint32) (oct & DTAP_SS_IEI_MASK), gsm_a_dtap_msg_ss_strings, &idx);
hf_idx = hf_gsm_a_dtap_msg_ss_type;
if (msg_str != NULL)
{
@ -6490,7 +6490,7 @@ dissect_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 15:
msg_str = match_strval_idx((guint32) (oct & DTAP_TP_IEI_MASK), gsm_a_dtap_msg_tp_strings, &idx);
msg_str = try_val_to_str_idx((guint32) (oct & DTAP_TP_IEI_MASK), gsm_a_dtap_msg_tp_strings, &idx);
hf_idx = hf_gsm_a_dtap_msg_tp_type;
if (msg_str != NULL)
{

View File

@ -7116,7 +7116,7 @@ get_gmm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx
{
gint idx;
*msg_str = match_strval_idx((guint32) (oct & DTAP_GMM_IEI_MASK), gsm_a_dtap_msg_gmm_strings, &idx);
*msg_str = try_val_to_str_idx((guint32) (oct & DTAP_GMM_IEI_MASK), gsm_a_dtap_msg_gmm_strings, &idx);
*hf_idx = hf_gsm_a_dtap_msg_gmm_type;
if (*msg_str != NULL) {
*ett_tree = ett_gsm_dtap_msg_gmm[idx];
@ -7131,7 +7131,7 @@ get_sm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx,
{
gint idx;
*msg_str = match_strval_idx((guint32) (oct & DTAP_SM_IEI_MASK), gsm_a_dtap_msg_sm_strings, &idx);
*msg_str = try_val_to_str_idx((guint32) (oct & DTAP_SM_IEI_MASK), gsm_a_dtap_msg_sm_strings, &idx);
*hf_idx = hf_gsm_a_dtap_msg_sm_type;
if (*msg_str != NULL) {
*ett_tree = ett_gsm_dtap_msg_sm[idx];

View File

@ -469,7 +469,7 @@ dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, offset++);
str = match_strval_idx((guint32) oct, gsm_rp_msg_strings, &idx);
str = try_val_to_str_idx((guint32) oct, gsm_rp_msg_strings, &idx);
/*
* create the protocol tree

View File

@ -10443,7 +10443,7 @@ void get_rr_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf
{
gint idx;
*msg_str = match_strval_idx((guint32) (oct & DTAP_RR_IEI_MASK), gsm_a_dtap_msg_rr_strings, &idx);
*msg_str = try_val_to_str_idx((guint32) (oct & DTAP_RR_IEI_MASK), gsm_a_dtap_msg_rr_strings, &idx);
*hf_idx = hf_gsm_a_dtap_msg_rr_type;
if (*msg_str != NULL) {
*ett_tree = ett_gsm_dtap_msg_rr[idx];
@ -10680,7 +10680,7 @@ get_rr_short_pd_msg_params(guint8 mess_type, const gchar **msg_str, int *ett_tre
{
gint idx;
*msg_str = match_strval_idx((guint32) mess_type, gsm_a_rr_short_pd_msg_strings, &idx);
*msg_str = try_val_to_str_idx((guint32) mess_type, gsm_a_rr_short_pd_msg_strings, &idx);
*hf_idx = hf_gsm_a_rr_short_pd_msg_type;
if (*msg_str != NULL) {
*ett_tree = ett_gsm_sacch_msg_rr[idx];

View File

@ -1164,10 +1164,10 @@ static void format_custom_msgtype(gchar *out, guint32 in)
switch (global_oml_dialect) {
case OML_DIALECT_SIEMENS:
tmp = match_strval(in, oml_fom_msgtype_vals_bs11);
tmp = try_val_to_str(in, oml_fom_msgtype_vals_bs11);
break;
case OML_DIALECT_IPA:
tmp = match_strval(in, oml_fom_msgtype_vals_ipa);
tmp = try_val_to_str(in, oml_fom_msgtype_vals_ipa);
break;
case OML_DIALECT_ETSI:
default:
@ -1189,10 +1189,10 @@ static void format_custom_attr(gchar *out, guint32 in)
switch (global_oml_dialect) {
case OML_DIALECT_SIEMENS:
tmp = match_strval(in, oml_fom_attr_vals_bs11);
tmp = try_val_to_str(in, oml_fom_attr_vals_bs11);
break;
case OML_DIALECT_IPA:
tmp = match_strval(in, oml_fom_attr_vals_ipa);
tmp = try_val_to_str(in, oml_fom_attr_vals_ipa);
break;
case OML_DIALECT_ETSI:
default:

View File

@ -947,7 +947,7 @@ dissect_bssmap_le(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, offset++);
str = match_strval_idx((guint32) oct, gsm_bssmap_le_msg_strings, &idx);
str = try_val_to_str_idx((guint32) oct, gsm_bssmap_le_msg_strings, &idx);
if (sccp_msg_p && !sccp_msg_p->data.co.label) {
sccp_msg_p->data.co.label = se_strdup(val_to_str((guint32) oct, gsm_bssmap_le_msg_strings, "BSSMAP LE(0x%02x)"));

View File

@ -19762,7 +19762,7 @@ dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
}
dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, &asn1_ctx, tree, -1);
match_strval_idx(opcode, gsm_map_opr_code_strings, &op_idx);
try_val_to_str_idx(opcode, gsm_map_opr_code_strings, &op_idx);
if (op_idx != -1) {
tap_rec.invoke = (gsmmap_pdu_type == 1) ? TRUE : FALSE;

View File

@ -3490,7 +3490,7 @@ dissect_gsm_sms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
msg_type |= ((pinfo->p2p_dir == P2P_DIR_RECV) ? 0x04 : 0x00);
str = match_strval_idx(msg_type, msg_type_strings, &idx);
str = try_val_to_str_idx(msg_type, msg_type_strings, &idx);
/*
* create the GSM_SMS protocol tree

View File

@ -7835,7 +7835,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
return 0;
}
octet = tvb_get_guint8(tvb, 1);
if (octet == GTP_MSG_UNKNOWN || match_strval(octet, gtp_message_type) == NULL) {
if (octet == GTP_MSG_UNKNOWN || try_val_to_str(octet, gtp_message_type) == NULL) {
/* Unknown message type; reject the packet */
return 0;
}

View File

@ -1249,7 +1249,7 @@ extern void h248_param_PkgdName(proto_tree* tree, tvbuff_t* tvb, packet_info* pi
pi = proto_tree_add_uint(package_tree, hf_248_pkg_param, tvb, offset-2, 2, name_minor);
if (pkg->signal_names && ( strval = match_strval(name_minor, pkg->signal_names) )) {
if (pkg->signal_names && ( strval = try_val_to_str(name_minor, pkg->signal_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
@ -1391,7 +1391,7 @@ void h248_register_package(const h248_package_t* pkg, pkg_reg_action reg_action)
pkg_found->param_names = vst;
pkg_found->hfid = &hf_h248_pkg_name;
pkg_found->ett = &ett_packagename;
match_strval_idx((pkg_found->id)<<16,base_event_name_vals, &j);
try_val_to_str_idx((pkg_found->id)<<16,base_event_name_vals, &j);
/* now look for events and signals that may be defined for package. If found, create value_strings */
if (j != -1) {
j++; idx=j;
@ -1409,7 +1409,7 @@ void h248_register_package(const h248_package_t* pkg, pkg_reg_action reg_action)
}
}
/* now look at signals */
if (!match_strval_idx((pkg_found->id)<<16, base_signal_name_vals, &j)) {
if (!try_val_to_str_idx((pkg_found->id)<<16, base_signal_name_vals, &j)) {
j++; idx=j;
while((base_signal_name_vals[j].strptr != NULL) && ((base_signal_name_vals[j].value>>16) == (pkg_found->id))) {
};
@ -1506,7 +1506,7 @@ static int dissect_h248_PkgdName(gboolean implicit_tag, tvbuff_t *tvb, int offse
proto_item* pi = proto_tree_add_uint(package_tree, hf_248_pkg_param, tvb, offset-2, 2, name_minor);
const gchar* strval;
if (pkg->param_names && ( strval = match_strval(name_minor, pkg->param_names) )) {
if (pkg->param_names && ( strval = try_val_to_str(name_minor, pkg->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
@ -1569,7 +1569,7 @@ static int dissect_h248_EventName(gboolean implicit_tag, tvbuff_t *tvb, int offs
proto_item* pi = proto_tree_add_uint(package_tree, hf_h248_event_code, tvb, offset-2, 2, name_minor);
const gchar* strval;
if (pkg->event_names && ( strval = match_strval(name_minor, pkg->event_names) )) {
if (pkg->event_names && ( strval = try_val_to_str(name_minor, pkg->event_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
@ -1634,7 +1634,7 @@ static int dissect_h248_SignalName(gboolean implicit_tag , tvbuff_t *tvb, int of
proto_item* pi = proto_tree_add_uint(package_tree, hf_h248_signal_code, tvb, offset-2, 2, name_minor);
const gchar* strval;
if (pkg->signal_names && ( strval = match_strval(name_minor, pkg->signal_names) )) {
if (pkg->signal_names && ( strval = try_val_to_str(name_minor, pkg->signal_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,name_minor);
} else {
strval = ep_strdup_printf("Unknown (%d)",name_minor);
@ -1727,7 +1727,7 @@ static int dissect_h248_SigParameterName(gboolean implicit_tag _U_, tvbuff_t *tv
}
}
if (curr_info.sig && curr_info.sig->param_names && ( strval = match_strval(param_id, curr_info.sig->param_names) )) {
if (curr_info.sig && curr_info.sig->param_names && ( strval = try_val_to_str(param_id, curr_info.sig->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,param_id);
} else {
strval = ep_strdup_printf("Unknown (%d)",param_id);
@ -1804,7 +1804,7 @@ static int dissect_h248_EventParameterName(gboolean implicit_tag _U_, tvbuff_t *
curr_info.par = &no_param;
}
if (curr_info.evt && curr_info.evt->param_names && ( strval = match_strval(param_id, curr_info.evt->param_names) )) {
if (curr_info.evt && curr_info.evt->param_names && ( strval = try_val_to_str(param_id, curr_info.evt->param_names) )) {
strval = ep_strdup_printf("%s (%d)",strval,param_id);
} else {
strval = ep_strdup_printf("Unknown (%d)",param_id);

View File

@ -2027,7 +2027,7 @@ dissect_h264_par_level(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_,
DISSECTOR_ASSERT(actx);
lvl = tvb_get_ntohs(tvb, offset);
p = match_strval(lvl, VALS(h264_par_level_values));
p = try_val_to_str(lvl, VALS(h264_par_level_values));
if (p) {
proto_item_append_text(actx->created_item, " - Level %s", p);
}

View File

@ -4265,7 +4265,7 @@ dissect_h282_RequestPDU(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
&msg_type);
#line 27 "../../asn1/h282/h282.cnf"
p = match_strval(msg_type, VALS(h282_RequestPDU_vals));
p = try_val_to_str(msg_type, VALS(h282_RequestPDU_vals));
if (p)
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "RequestPDU/%s", p);
@ -4308,7 +4308,7 @@ dissect_h282_ResponsePDU(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_
&msg_type);
#line 38 "../../asn1/h282/h282.cnf"
p = match_strval(msg_type, VALS(h282_ResponsePDU_vals));
p = try_val_to_str(msg_type, VALS(h282_ResponsePDU_vals));
if (p)
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "ResponsePDU/%s", p);
@ -4343,7 +4343,7 @@ dissect_h282_IndicationPDU(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
&msg_type);
#line 49 "../../asn1/h282/h282.cnf"
p = match_strval(msg_type, VALS(h282_IndicationPDU_vals));
p = try_val_to_str(msg_type, VALS(h282_IndicationPDU_vals));
if (p)
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "IndicationPDU/%s", p);

View File

@ -277,7 +277,7 @@ dissect_h283_LCTRequest(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
&msg_type);
#line 61 "../../asn1/h283/h283.cnf"
p = match_strval(msg_type, VALS(h283_LCTRequest_vals));
p = try_val_to_str(msg_type, VALS(h283_LCTRequest_vals));
if (!info_is_set && p ) {
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "LCTRequest/%s", p);
info_is_set = TRUE;
@ -328,7 +328,7 @@ dissect_h283_LCTResponse(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_
&msg_type);
#line 74 "../../asn1/h283/h283.cnf"
p = match_strval(msg_type, VALS(h283_LCTResponse_vals));
p = try_val_to_str(msg_type, VALS(h283_LCTResponse_vals));
if (!info_is_set && p ) {
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "LCTResponse/%s", p);
info_is_set = TRUE;
@ -359,7 +359,7 @@ dissect_h283_LCTIndication(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
&msg_type);
#line 87 "../../asn1/h283/h283.cnf"
p = match_strval(msg_type, VALS(h283_LCTIndication_vals));
p = try_val_to_str(msg_type, VALS(h283_LCTIndication_vals));
if (!info_is_set && p ) {
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "LCTIndication/%s", p);
info_is_set = TRUE;
@ -423,7 +423,7 @@ dissect_h283_LCTMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
&msg_type);
#line 48 "../../asn1/h283/h283.cnf"
p = match_strval(msg_type, VALS(h283_LCTMessage_vals));
p = try_val_to_str(msg_type, VALS(h283_LCTMessage_vals));
if (!info_is_set && p ) {
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "LCTMessage/%s", p);
info_is_set = TRUE;
@ -475,7 +475,7 @@ dissect_h283_T_dataType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
&data_type);
#line 35 "../../asn1/h283/h283.cnf"
p = match_strval(data_type, VALS(h283_T_dataType_vals));
p = try_val_to_str(data_type, VALS(h283_T_dataType_vals));
if (!info_is_set && p ) {
col_add_fstr(actx->pinfo->cinfo, COL_INFO, "RDCData/%s", p);
info_is_set = TRUE;
@ -523,7 +523,7 @@ dissect_h283_T_pduType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
&pdu_type);
#line 22 "../../asn1/h283/h283.cnf"
p = match_strval(pdu_type, VALS(h283_T_pduType_vals));
p = try_val_to_str(pdu_type, VALS(h283_T_pduType_vals));
if (!info_is_set && p ) {
col_set_str(actx->pinfo->cinfo, COL_INFO, p);
info_is_set = TRUE;

View File

@ -4727,7 +4727,7 @@ dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
hidden_item = proto_tree_add_uint(tree, hf_h450_operation, tvb, 0, 0, opcode);
PROTO_ITEM_SET_HIDDEN(hidden_item);
p = match_strval(opcode, VALS(h450_str_operation));
p = try_val_to_str(opcode, VALS(h450_str_operation));
if (p) {
proto_item_append_text(rctx->d.code_item, " - %s", p);
if (rctx->apdu_depth >= 0)
@ -4769,7 +4769,7 @@ dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
hidden_item = proto_tree_add_uint(tree, hf_h450_operation, tvb, 0, 0, opcode);
PROTO_ITEM_SET_HIDDEN(hidden_item);
p = match_strval(opcode, VALS(h450_str_operation));
p = try_val_to_str(opcode, VALS(h450_str_operation));
if (p) {
proto_item_append_text(rctx->d.code_item, " - %s", p);
if (rctx->apdu_depth >= 0)
@ -4811,7 +4811,7 @@ dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
hidden_item = proto_tree_add_uint(tree, hf_h450_error, tvb, 0, 0, errcode);
PROTO_ITEM_SET_HIDDEN(hidden_item);
p = match_strval(errcode, VALS(h450_str_error));
p = try_val_to_str(errcode, VALS(h450_str_error));
if (p) {
proto_item_append_text(rctx->d.code_item, " - %s", p);
if (rctx->apdu_depth >= 0)

View File

@ -2365,7 +2365,7 @@ dissect_h501_MessageBody(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_
&msg_type);
#line 25 "../../asn1/h501/h501.cnf"
p = match_strval(msg_type, VALS(h501_MessageBody_vals));
p = try_val_to_str(msg_type, VALS(h501_MessageBody_vals));
if (p )
col_set_str(actx->pinfo->cinfo, COL_INFO, p);

View File

@ -185,7 +185,7 @@ static void dissect_caps(proto_item *pitem, tvbuff_t *tvb, int offset)
for (bit = 7; bit >= 0; bit--)
{
thisbit = 1 << bit;
strval = match_strval(thisbit, iapp_cap_vals);
strval = try_val_to_str(thisbit, iapp_cap_vals);
if (strval)
{
other_decode_bitfield_value(bitval, val, thisbit, 8);
@ -300,7 +300,7 @@ append_pduval_str(proto_item *ti, int type, int len, tvbuff_t *tvb, int offset,
for (mask = 0x80; mask; mask >>= 1)
if (val & mask)
{
strval = match_strval(mask, iapp_cap_vals);
strval = try_val_to_str(mask, iapp_cap_vals);
if (strval)
{
if (!first)

View File

@ -7435,7 +7435,7 @@ dissect_vendor_ie_wpawme(proto_tree *tree, tvbuff_t *tvb, int offset, guint32 ta
proto_tree_add_item(aci_aifsn_tree, hf_ieee80211_wfa_ie_wme_acp_reserved, tvb, offset, 1, ENC_NA);
aci_aifsn = tvb_get_guint8(tvb, offset);
proto_item_append_text(ac_item, " ACI %u (%s), ACM %s, AIFSN %u",
(aci_aifsn & 0x60) >> 5, match_strval((aci_aifsn & 0x60) >> 5, ieee80211_wfa_ie_wme_acs_vals),
(aci_aifsn & 0x60) >> 5, try_val_to_str((aci_aifsn & 0x60) >> 5, ieee80211_wfa_ie_wme_acs_vals),
(aci_aifsn & 0x10) ? "yes" : "no ", aci_aifsn & 0x0f);
offset += 1;

View File

@ -815,7 +815,7 @@ dissect_jfif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
"Fill bytes");
marker = tvb_get_ntohs(tvb, start_marker);
str = match_strval(marker, vals_marker);
str = try_val_to_str(marker, vals_marker);
if (str) { /* Known marker */
if (marker_has_length(marker)) { /* Marker segment */
/* Length of marker segment = 2 + len */

View File

@ -755,7 +755,7 @@ dissect_ipopt_security(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset,
/* Analyze payload start to decide whether it should be dissected
according to RFC 791 or RFC 1108 */
val = tvb_get_ntohs(tvb, curr_offset);
if (match_strval(val, secl_rfc791_vals)) {
if (try_val_to_str(val, secl_rfc791_vals)) {
/* Dissect as RFC 791 */
proto_tree_add_item(field_tree, hf_ip_opt_sec_rfc791_sec,
tvb, curr_offset, 2, ENC_BIG_ENDIAN);

View File

@ -1040,7 +1040,7 @@ ipmi_get_completion_code(guint8 completion, ipmi_cmd_t *cmd)
}
if (completion >= 0x80 && completion <= 0xbe) {
if (cmd && cmd->cs_cc && (res = match_strval(completion, cmd->cs_cc)) != NULL) {
if (cmd && cmd->cs_cc && (res = try_val_to_str(completion, cmd->cs_cc)) != NULL) {
return res;
}
return "Standard command-specific code";

View File

@ -1967,7 +1967,7 @@ dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_memcpy(tvb, (guint8 *)&ipcomp, 0, sizeof(ipcomp));
if (check_col(pinfo->cinfo, COL_INFO)) {
p = match_strval(g_ntohs(ipcomp.comp_cpi), cpi2val);
p = try_val_to_str(g_ntohs(ipcomp.comp_cpi), cpi2val);
if (p == NULL) {
col_add_fstr(pinfo->cinfo, COL_INFO, "IPComp (CPI=0x%04x)",
g_ntohs(ipcomp.comp_cpi));

View File

@ -538,7 +538,7 @@ spx_conn_ctrl(guint8 ctrl)
{ 0x00, NULL }
};
p = match_strval((ctrl & 0xf0), conn_vals );
p = try_val_to_str((ctrl & 0xf0), conn_vals );
if (p) {
return p;

View File

@ -1502,7 +1502,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
offset = handleHeaderDigest(iscsi_session, ti, tvb, offset, 48);
next_opcode = tvb_get_guint8(tvb, offset) & 0x3f;
next_opcode_str = match_strval(next_opcode, iscsi_opcodes);
next_opcode_str = try_val_to_str(next_opcode, iscsi_opcodes);
tf = proto_tree_add_text(ti, tvb, offset, -1, "Rejected Header");
tt = proto_item_add_subtree(tf, ett_iscsi_RejectHeader);
@ -1850,7 +1850,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
return FALSE;
}
/* Function must be known */
if(!match_strval(tmpbyte&0x7f, iscsi_task_management_functions)){
if(!try_val_to_str(tmpbyte&0x7f, iscsi_task_management_functions)){
return FALSE;
}
/* bytes 2,3 must be null */
@ -1904,7 +1904,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
return FALSE;
}
/* Reason code must be known */
if(!match_strval(tmpbyte&0x7f, iscsi_logout_reasons)){
if(!try_val_to_str(tmpbyte&0x7f, iscsi_logout_reasons)){
return FALSE;
}
/* bytes 2,3 must be null */
@ -1935,7 +1935,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
return FALSE;
}
/* type must be known */
if(!match_strval(tmpbyte&0x0f, iscsi_snack_types)){
if(!try_val_to_str(tmpbyte&0x0f, iscsi_snack_types)){
return FALSE;
}
/* for status/snack and datack itt must be 0xffffffff
@ -2003,7 +2003,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
return FALSE;
}
/* reason must be known */
if(!match_strval(tvb_get_guint8(tvb,offset+2), iscsi_reject_reasons)){
if(!try_val_to_str(tvb_get_guint8(tvb,offset+2), iscsi_reject_reasons)){
return FALSE;
}
/* byte 3 must be 0 */
@ -2119,7 +2119,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
return FALSE;
}
/* status must be known */
if(!match_strval(tvb_get_guint8(tvb,offset+3), scsi_status_val)){
if(!try_val_to_str(tvb_get_guint8(tvb,offset+3), scsi_status_val)){
return FALSE;
}
/* the 32bit words at offsets 8, 12
@ -2165,7 +2165,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
return FALSE;
}
/* response must be known */
if(!match_strval(tvb_get_guint8(tvb,offset+2), iscsi_logout_response)){
if(!try_val_to_str(tvb_get_guint8(tvb,offset+2), iscsi_logout_response)){
return FALSE;
}
/* byte 3 must be 0 */
@ -2245,7 +2245,7 @@ dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean chec
opcode = tvb_get_guint8(tvb, offset + 0);
opcode &= OPCODE_MASK;
opcode_str = match_strval(opcode, iscsi_opcodes);
opcode_str = try_val_to_str(opcode, iscsi_opcodes);
if(opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION ||
opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION_RESPONSE ||
opcode == ISCSI_OPCODE_R2T ||

View File

@ -2641,7 +2641,7 @@ dissect_isdn_sup_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
isdn_sup_tree = proto_item_add_subtree(ti, ett_isdn_sup);
proto_tree_add_uint(isdn_sup_tree, hf_isdn_sup_operation, tvb, 0, 0, opcode);
p = match_strval(opcode, VALS(isdn_sup_str_operation));
p = try_val_to_str(opcode, VALS(isdn_sup_str_operation));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);
@ -2687,7 +2687,7 @@ dissect_isdn_sup_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
isdn_sup_tree = proto_item_add_subtree(ti, ett_isdn_sup);
proto_tree_add_uint(isdn_sup_tree, hf_isdn_sup_operation, tvb, 0, 0, opcode);
p = match_strval(opcode, VALS(isdn_sup_str_operation));
p = try_val_to_str(opcode, VALS(isdn_sup_str_operation));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);
@ -2734,7 +2734,7 @@ dissect_isdn_sup_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
isdn_sup_tree = proto_item_add_subtree(ti, ett_isdn_sup);
proto_tree_add_uint(isdn_sup_tree, hf_isdn_sup_error, tvb, 0, 0, errcode);
p = match_strval(errcode, VALS(isdn_sup_str_error));
p = try_val_to_str(errcode, VALS(isdn_sup_str_error));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);

View File

@ -720,7 +720,7 @@ dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* Get the function id from the packet */
function_id = tvb_get_ntohs(tvb, 2);
if (match_strval_ext(function_id, &isns_function_ids_ext) == NULL) {
if (try_val_to_str_ext(function_id, &isns_function_ids_ext) == NULL) {
/* Unknown function ID */
return 0;
}
@ -751,7 +751,7 @@ dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* Get the function id from the packet */
function_id = tvb_get_ntohs(tvb, 2);
if (match_strval_ext(function_id, &isns_function_ids_ext) == NULL) {
if (try_val_to_str_ext(function_id, &isns_function_ids_ext) == NULL) {
/* Unknown function ID */
return 0;
}

View File

@ -10832,7 +10832,7 @@ msg_stats_tree_init(stats_tree *st)
static int
msg_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p)
{
const gchar *msg = match_strval_ext(((const isup_tap_rec_t*)p)->message_type, &isup_message_type_value_acro_ext);
const gchar *msg = try_val_to_str_ext(((const isup_tap_rec_t*)p)->message_type, &isup_message_type_value_acro_ext);
gchar *dir;
int msg_node;
int dir_node;

View File

@ -230,7 +230,7 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
/* the function code must be known */
kfp->function = tvb_get_guint8( tvb, 6 );
if (match_strval(kfp->function, function_code_vals) == NULL) {
if (try_val_to_str(kfp->function, function_code_vals) == NULL) {
/* This appears not to be a kingfisher packet */
return FALSE;
}

View File

@ -86,7 +86,7 @@ dissect_laplink_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
if (!tvb_bytes_exist(tvb, offset, 4))
return 0; /* not enough bytes to check */
udp_ident = tvb_get_ntohl(tvb, offset);
udp_ident_string = match_strval(udp_ident, laplink_udp_magic);
udp_ident_string = try_val_to_str(udp_ident, laplink_udp_magic);
if (udp_ident_string == NULL)
return 0; /* unknown */

View File

@ -2633,7 +2633,7 @@ dissect_llrp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(llrp_tree, hf_llrp_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
if (match_strval_ext(type, &message_types_ext))
if (try_val_to_str_ext(type, &message_types_ext))
dissect_llrp_message(tvb, pinfo, llrp_tree, type, offset);
}

View File

@ -2934,7 +2934,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* Flag unknown lcid values in expert info */
if (match_strval(lcids[number_of_headers],
if (try_val_to_str(lcids[number_of_headers],
(direction == DIRECTION_UPLINK) ? ulsch_lcid_vals : dlsch_lcid_vals) == NULL) {
expert_add_info_format(pinfo, pdu_subheader_ti, PI_MALFORMED, PI_ERROR,
"%cL-SCH: Unexpected LCID received (%u)",
@ -3968,7 +3968,7 @@ static void dissect_mch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pro
/* Flag unknown lcid values in expert info */
if (match_strval(lcids[number_of_headers],mch_lcid_vals) == NULL) {
if (try_val_to_str(lcids[number_of_headers],mch_lcid_vals) == NULL) {
expert_add_info_format(pinfo, pdu_subheader_ti, PI_MALFORMED, PI_ERROR,
"MCH: Unexpected LCID received (%u)",
lcids[number_of_headers]);

View File

@ -530,7 +530,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item (memcache_tree, hf_magic, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (match_strval (magic, magic_vals) == NULL) {
if (try_val_to_str (magic, magic_vals) == NULL) {
expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown magic byte: %d", magic);
}
@ -538,7 +538,7 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item (memcache_tree, hf_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (match_strval (opcode, opcode_vals) == NULL) {
if (try_val_to_str (opcode, opcode_vals) == NULL) {
expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown opcode: %d", opcode);
}
@ -1915,7 +1915,7 @@ dissect_memcache_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
magic = tvb_get_guint8 (tvb, offset);
if (match_strval (magic, magic_vals) != NULL) {
if (try_val_to_str (magic, magic_vals) != NULL) {
tcp_dissect_pdus (tvb, pinfo, tree, memcache_desegment_body, 12,
get_memcache_pdu_len, dissect_memcache);
} else {
@ -1932,7 +1932,7 @@ dissect_memcache_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
magic = tvb_get_guint8 (tvb, offset);
if (match_strval (magic, magic_vals) != NULL) {
if (try_val_to_str (magic, magic_vals) != NULL) {
dissect_memcache (tvb, pinfo, tree);
} else {
dissect_memcache_message (tvb, 0, pinfo, tree);

View File

@ -10021,7 +10021,7 @@ dissect_mms_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
return FALSE;
/* see if the tag is a valid MMS PDU */
match_strval_idx(tmp_tag, mms_MMSpdu_vals, &idx);
try_val_to_str_idx(tmp_tag, mms_MMSpdu_vals, &idx);
if (idx == -1) {
return FALSE; /* no, it isn't an MMS PDU */
}

View File

@ -642,7 +642,7 @@ dissect_mmse_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
if (tvb_get_guint8(tvb, 0) != MM_MTYPE_HDR)
return FALSE;
pdut = tvb_get_guint8(tvb, 1);
if (match_strval(pdut, vals_message_type) == NULL)
if (try_val_to_str(pdut, vals_message_type) == NULL)
return FALSE;
if ((tvb_get_guint8(tvb, 2) != MM_TID_HDR) &&
(tvb_get_guint8(tvb, 2) != MM_VERSION_HDR))

View File

@ -793,7 +793,7 @@ dissect_mp4ves_par_profile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
DISSECTOR_ASSERT(actx);
lvl = tvb_get_ntohs(tvb, offset);
p = match_strval(lvl, VALS(mp4ves_level_indication_vals));
p = try_val_to_str(lvl, VALS(mp4ves_level_indication_vals));
if (p) {
proto_item_append_text(actx->created_item, " - profileAndLevel %s", p);
}
@ -812,7 +812,7 @@ dissect_mp4ves_par_video_object_type(tvbuff_t *tvb, packet_info *pinfo _U_, prot
DISSECTOR_ASSERT(actx);
lvl = tvb_get_ntohs(tvb, offset);
p = match_strval(lvl, VALS(mp4ves_video_object_type_vals));
p = try_val_to_str(lvl, VALS(mp4ves_video_object_type_vals));
if (p) {
proto_item_append_text(actx->created_item, " - video_object_type %s", p);
}

View File

@ -2529,7 +2529,7 @@ proto_mpeg_descriptor_dissect_private_ciplus(tvbuff_t *tvb, guint offset, proto_
offset_start=offset;
tag = tvb_get_guint8(tvb, offset);
tag_str = match_strval(tag, mpeg_descriptor_ciplus_tag_vals);
tag_str = try_val_to_str(tag, mpeg_descriptor_ciplus_tag_vals);
if (!tag_str)
return 0;
@ -2768,7 +2768,7 @@ proto_mpeg_descriptor_loop_dissect(tvbuff_t *tvb, guint offset, guint loop_len,
/* the default descriptor function takes precedence
however, if it does not know the current descriptor, we search for a context-specific subfunction
this subfunction gets to see the entire descriptor, including tag and len */
if (match_strval(tag, mpeg_descriptor_tag_vals)) {
if (try_val_to_str(tag, mpeg_descriptor_tag_vals)) {
desc_len = proto_mpeg_descriptor_dissect(tvb, offset, tree);
}
else {

View File

@ -846,7 +846,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
stream = tvb_get_guint8(tvb, 3);
if (check_col(pinfo->cinfo, COL_INFO)) {
const char *s = match_strval(stream, mpeg_pes_T_stream_vals);
const char *s = try_val_to_str(stream, mpeg_pes_T_stream_vals);
if (s != NULL)
col_set_str(pinfo->cinfo, COL_INFO, s);
}
@ -864,7 +864,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
frame_type = tvb_get_guint8(tvb, 5) >> 3 & 0x07;
if (check_col(pinfo->cinfo, COL_INFO)) {
const char *s = match_strval(frame_type,
const char *s = try_val_to_str(frame_type,
mpeg_pes_T_frame_type_vals);
if (s != NULL)
col_set_str(pinfo->cinfo, COL_INFO, s);

View File

@ -651,7 +651,7 @@ static gint dissect_msmms_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
/* Flag value is in 5th byte */
value = tvb_get_letohs(tvb, 4) & 0xff00;
/* Reject packet if not a recognised packet type */
if (match_strval(value, tcp_flags_vals) == NULL)
if (try_val_to_str(value, tcp_flags_vals) == NULL)
{
return 0;
}

View File

@ -4577,7 +4577,7 @@ get_nas_esm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf
{
gint idx;
*msg_str = match_strval_idx_ext((guint32) (oct & 0xff), &nas_msg_esm_strings_ext, &idx);
*msg_str = try_val_to_str_idx_ext((guint32) (oct & 0xff), &nas_msg_esm_strings_ext, &idx);
*hf_idx = hf_nas_eps_msg_esm_type;
if (*msg_str != NULL) {
*ett_tree = ett_nas_msg_esm[idx];
@ -4635,7 +4635,7 @@ get_nas_emm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf
{
gint idx;
*msg_str = match_strval_idx_ext((guint32) (oct & 0xff), &nas_msg_emm_strings_ext, &idx);
*msg_str = try_val_to_str_idx_ext((guint32) (oct & 0xff), &nas_msg_emm_strings_ext, &idx);
*hf_idx = hf_nas_eps_msg_emm_type;
if (*msg_str != NULL) {
*ett_tree = ett_nas_msg_emm[idx];

View File

@ -335,7 +335,7 @@ dissect_portcontrol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
}
start_opcode_offset = offset;
if (match_strval(opcode, opcode_vals) != NULL)
if (try_val_to_str(opcode, opcode_vals) != NULL)
{
opcode_ti = proto_tree_add_text(pcp_tree, tvb, offset, 0, "%s", op_str);
opcode_tree = proto_item_add_subtree (opcode_ti, ett_opcode);
@ -420,7 +420,7 @@ dissect_portcontrol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
/* Now see if there are any options for the supported opcodes */
if ((tvb_reported_length_remaining(tvb, offset) > 0) &&
(match_strval(opcode, opcode_vals) != NULL))
(try_val_to_str(opcode, opcode_vals) != NULL))
{
start_option_offset = offset;
option_ti = proto_tree_add_text(opcode_tree, tvb, offset, 0, "Options");

View File

@ -594,7 +594,7 @@ dissect_nmas_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guin
break;
case 7:
encrypt_error = tvb_get_ntohl(tvb, foffset);
str = match_strval(encrypt_error, nmas_errors_enum);
str = try_val_to_str(encrypt_error, nmas_errors_enum);
if (str)
{
col_add_fstr(pinfo->cinfo, COL_INFO, "R Payload Error - %s", str);
@ -618,7 +618,7 @@ dissect_nmas_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guin
break;
}
}
str = match_strval(return_code, nmas_errors_enum);
str = try_val_to_str(return_code, nmas_errors_enum);
if (str)
{
expert_item = proto_tree_add_item(atree, hf_return_code, tvb, roffset, 4, ENC_LITTLE_ENDIAN);

View File

@ -697,7 +697,7 @@ dissect_sss_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guint
case 2:
if (request_value) {
subverb = request_value->req_nds_flags;
str = match_strval(subverb, sss_verb_enum);
str = try_val_to_str(subverb, sss_verb_enum);
if (str) {
proto_tree_add_text(atree, tvb, foffset, tvb_length_remaining(tvb, foffset), "Verb: %s", str);
}
@ -713,7 +713,7 @@ dissect_sss_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guint
{
foffset += 4;
return_code = tvb_get_letohl(tvb, foffset);
str = match_strval(return_code, sss_errors_enum);
str = try_val_to_str(return_code, sss_errors_enum);
if (str)
{
expert_item = proto_tree_add_item(atree, hf_return_code, tvb, foffset, 4, ENC_LITTLE_ENDIAN);

View File

@ -349,9 +349,9 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
commhdr += 4;
}
/* Check to see if this is a valid offset, otherwise increment for packet signature */
if (match_strval(tvb_get_ntohs(tvb, commhdr), ncp_type_vals)==NULL) {
if (try_val_to_str(tvb_get_ntohs(tvb, commhdr), ncp_type_vals)==NULL) {
/* Check to see if we have a valid type after packet signature length */
if (match_strval(tvb_get_ntohs(tvb, commhdr+8), ncp_type_vals)!=NULL) {
if (try_val_to_str(tvb_get_ntohs(tvb, commhdr+8), ncp_type_vals)!=NULL) {
proto_tree_add_item(ncp_tree, hf_ncp_ip_packetsig, tvb, commhdr, 8, ENC_NA);
commhdr += 8;
}

View File

@ -2064,7 +2064,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
{
case 9:
label_value = tvb_get_ntohl(tvb, foffset+5);
label = match_strval(label_value, object_ids_7);
label = try_val_to_str(label_value, object_ids_7);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2075,7 +2075,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 10:
label_value = tvb_get_ntohl(tvb, foffset+6);
label = match_strval(label_value, object_ids_8);
label = try_val_to_str(label_value, object_ids_8);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2086,7 +2086,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 11:
label_value = tvb_get_ntohl(tvb, foffset+7);
label = match_strval(label_value, object_ids_9);
label = try_val_to_str(label_value, object_ids_9);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2097,7 +2097,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 12:
label_value = tvb_get_ntohl(tvb, foffset+8);
label = match_strval(label_value, object_ids_10);
label = try_val_to_str(label_value, object_ids_10);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2108,7 +2108,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 13:
label_value = tvb_get_ntohl(tvb, foffset+9);
label = match_strval(label_value, object_ids_11);
label = try_val_to_str(label_value, object_ids_11);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2119,7 +2119,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 14:
label_value = tvb_get_ntohl(tvb, foffset+10);
label = match_strval(label_value, object_ids_12);
label = try_val_to_str(label_value, object_ids_12);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2130,7 +2130,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 15:
label_value = tvb_get_ntohl(tvb, foffset+11);
label = match_strval(label_value, object_ids_13);
label = try_val_to_str(label_value, object_ids_13);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2141,7 +2141,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 16:
label_value = tvb_get_ntohl(tvb, foffset+12);
label = match_strval(label_value, object_ids_14);
label = try_val_to_str(label_value, object_ids_14);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2152,7 +2152,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 17:
label_value = tvb_get_ntohl(tvb, foffset+13);
label = match_strval(label_value, object_ids_15);
label = try_val_to_str(label_value, object_ids_15);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2163,7 +2163,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
break;
case 18:
label_value = tvb_get_ntohl(tvb, foffset+14);
label = match_strval(label_value, object_ids_16);
label = try_val_to_str(label_value, object_ids_16);
if (label==NULL)
{
aitem = proto_tree_add_text(ndps_tree, tvb, foffset, length, "Unknown ID");
@ -2180,7 +2180,7 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
if (!found)
{
label_value = 1;
label = match_strval(label_value, object_ids_7);
label = try_val_to_str(label_value, object_ids_7);
}
if (ndps_show_oids)
{
@ -2705,7 +2705,7 @@ attribute_value(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset)
if (global_attribute_name==NULL)
{
label_value = 1;
label = match_strval(label_value, object_ids_7);
label = try_val_to_str(label_value, object_ids_7);
global_attribute_name = label;
}
attribute_type = tvb_get_ntohl(tvb, foffset);
@ -4222,7 +4222,7 @@ dissect_ndps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree)
proto_tree_add_item(ndps_tree, hf_ndps_rpc_version, tvb, foffset, 4, ENC_BIG_ENDIAN);
foffset += 4;
ndps_prog = tvb_get_ntohl(tvb, foffset);
ndps_program_string = match_strval(ndps_prog, spx_ndps_program_vals);
ndps_program_string = try_val_to_str(ndps_prog, spx_ndps_program_vals);
if( ndps_program_string != NULL)
{
proto_tree_add_item(ndps_tree, hf_spx_ndps_program, tvb, foffset, 4, ENC_BIG_ENDIAN);
@ -4239,27 +4239,27 @@ dissect_ndps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree)
{
case 0x060976:
ndps_hfname = hf_spx_ndps_func_print;
ndps_func_string = match_strval(ndps_func, spx_ndps_print_func_vals);
ndps_func_string = try_val_to_str(ndps_func, spx_ndps_print_func_vals);
break;
case 0x060977:
ndps_hfname = hf_spx_ndps_func_broker;
ndps_func_string = match_strval(ndps_func, spx_ndps_broker_func_vals);
ndps_func_string = try_val_to_str(ndps_func, spx_ndps_broker_func_vals);
break;
case 0x060978:
ndps_hfname = hf_spx_ndps_func_registry;
ndps_func_string = match_strval(ndps_func, spx_ndps_registry_func_vals);
ndps_func_string = try_val_to_str(ndps_func, spx_ndps_registry_func_vals);
break;
case 0x060979:
ndps_hfname = hf_spx_ndps_func_notify;
ndps_func_string = match_strval(ndps_func, spx_ndps_notify_func_vals);
ndps_func_string = try_val_to_str(ndps_func, spx_ndps_notify_func_vals);
break;
case 0x06097a:
ndps_hfname = hf_spx_ndps_func_resman;
ndps_func_string = match_strval(ndps_func, spx_ndps_resman_func_vals);
ndps_func_string = try_val_to_str(ndps_func, spx_ndps_resman_func_vals);
break;
case 0x06097b:
ndps_hfname = hf_spx_ndps_func_delivery;
ndps_func_string = match_strval(ndps_func, spx_ndps_deliver_func_vals);
ndps_func_string = try_val_to_str(ndps_func, spx_ndps_deliver_func_vals);
break;
default:
ndps_hfname = 0;
@ -7028,7 +7028,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int
proto_tree_add_uint(ndps_tree, hf_ndps_error_val, tvb, foffset, 4, error_val);
foffset += 4;
/* Some functions return an error with no data, 0 is ok */
if (match_strval(tvb_get_ntohl(tvb, foffset), ndps_error_types) && tvb_length_remaining(tvb,foffset) < 8 && (tvb_get_ntohl(tvb, foffset)!=0))
if (try_val_to_str(tvb_get_ntohl(tvb, foffset), ndps_error_types) && tvb_length_remaining(tvb,foffset) < 8 && (tvb_get_ntohl(tvb, foffset)!=0))
{
expert_status = tvb_get_ntohl(tvb, foffset);
expert_item = proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN);

View File

@ -122,8 +122,8 @@ dissect_oicq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/* heuristic: OICQ iff (([0] == STX) && ([3/4] == <valid_command>) ) */
/* (Supposedly each OICQ message ends with an ETX so a test for */
/* same could also be part of the heuristic). */
if ( (match_strval(tvb_get_guint8(tvb, 0), oicq_flag_vals) == NULL) ||
(match_strval(tvb_get_ntohs(tvb, 3), oicq_command_vals) == NULL) )
if ( (try_val_to_str(tvb_get_guint8(tvb, 0), oicq_flag_vals) == NULL) ||
(try_val_to_str(tvb_get_ntohs(tvb, 3), oicq_command_vals) == NULL) )
return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "OICQ");

View File

@ -1117,7 +1117,7 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
col_set_str(pinfo->cinfo, COL_PROTOCOL, "OMRON");
cmd_str = match_strval_idx(command_code, command_code_cv, &cmd_str_idx);
cmd_str = try_val_to_str_idx(command_code, command_code_cv, &cmd_str_idx);
if (cmd_str_idx == -1)
cmd_str = ep_strdup_printf("Unknown (%d)", command_code);

View File

@ -1504,7 +1504,7 @@ dissect_cell_header(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
proto_tree_add_uint(tree2, hf_cell_h_vci, tvb, 1, 3, (unsigned)pd->vci);
item2 = proto_tree_add_item(tree2, hf_cell_h_pti, tvb, 3, 1, ENC_BIG_ENDIAN);
if (NULL == match_strval(pd->pti, atm_pt_vals))
if (NULL == try_val_to_str(pd->pti, atm_pt_vals))
{
expert_add_info_format(pinfo, item2, PI_UNDECODED, PI_WARN,
"Unknown value of PTI field (%d) in the ATM cell header",
@ -1568,7 +1568,7 @@ dissect_cell_header(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
if (MODE_11(pd->mode))
{
item2 = proto_tree_add_item(tree2, hf_cell_h_pti, tvb, 0, 1, ENC_BIG_ENDIAN);
if (NULL == match_strval(pd->pti, atm_pt_vals))
if (NULL == try_val_to_str(pd->pti, atm_pt_vals))
{
expert_add_info_format(pinfo, item2, PI_UNDECODED, PI_WARN,
"Unknown value of PTI field (%d) in the atm-specific byte"

View File

@ -191,7 +191,7 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original
{
guint8 cw_lm;
cw_lm = tvb_get_guint8(tvb_original, 0) & 0x0b /*l+mod*/;
if (NULL == match_strval(cw_lm, vals_cw_lm))
if (NULL == try_val_to_str(cw_lm, vals_cw_lm))
{
properties |= PWC_CW_SUSPECT_LM;
}

View File

@ -12411,7 +12411,7 @@ dissect_qsig_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
qsig_tree = proto_item_add_subtree(ti, ett_qsig);
proto_tree_add_uint(qsig_tree, hf_qsig_operation, tvb, 0, 0, opcode);
p = match_strval(opcode, VALS(qsig_str_operation));
p = try_val_to_str(opcode, VALS(qsig_str_operation));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);
@ -12420,7 +12420,7 @@ dissect_qsig_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
ti_tmp = proto_tree_add_uint(qsig_tree, hf_qsig_service, tvb, 0, 0, service);
p = match_strval(service, VALS(qsig_str_service_name));
p = try_val_to_str(service, VALS(qsig_str_service_name));
if (p) proto_item_append_text(ti_tmp, " - %s", p);
if (op_ptr->arg_pdu)
@ -12462,7 +12462,7 @@ dissect_qsig_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
qsig_tree = proto_item_add_subtree(ti, ett_qsig);
proto_tree_add_uint(qsig_tree, hf_qsig_operation, tvb, 0, 0, opcode);
p = match_strval(opcode, VALS(qsig_str_operation));
p = try_val_to_str(opcode, VALS(qsig_str_operation));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);
@ -12471,7 +12471,7 @@ dissect_qsig_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
ti_tmp = proto_tree_add_uint(qsig_tree, hf_qsig_service, tvb, 0, 0, service);
p = match_strval(service, VALS(qsig_str_service_name));
p = try_val_to_str(service, VALS(qsig_str_service_name));
if (p) proto_item_append_text(ti_tmp, " - %s", p);
if (op_ptr->res_pdu)
@ -12512,7 +12512,7 @@ dissect_qsig_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
qsig_tree = proto_item_add_subtree(ti, ett_qsig);
proto_tree_add_uint(qsig_tree, hf_qsig_error, tvb, 0, 0, errcode);
p = match_strval(errcode, VALS(qsig_str_error));
p = try_val_to_str(errcode, VALS(qsig_str_error));
if (p) {
proto_item_append_text(ti, ": %s", p);
proto_item_append_text(rctx->d.code_item, " - %s", p);

View File

@ -1316,7 +1316,7 @@ is_radius(tvbuff_t *tvb)
guint16 length;
code=tvb_get_guint8(tvb, 0);
if (match_strval_ext(code, &radius_pkt_type_codes_ext) == NULL) {
if (try_val_to_str_ext(code, &radius_pkt_type_codes_ext) == NULL) {
return FALSE;
}

View File

@ -105,7 +105,7 @@ dissect_rmcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
type = (rmcp_class & RMCP_TYPE_MASK) >> 7;
rmcp_class &= RMCP_CLASS_MASK;
class_str = match_strval(rmcp_class, rmcp_class_vals);
class_str = try_val_to_str(rmcp_class, rmcp_class_vals);
if (class_str == NULL)
return 0; /* unknown class value */

View File

@ -1020,7 +1020,7 @@ check_rpcap_heur (tvbuff_t *tvb, gboolean tcp)
/* UDP is only used for packets */
return FALSE;
}
if (match_strval(msg_type, message_type) == NULL)
if (try_val_to_str(msg_type, message_type) == NULL)
/* Unknown message type */
return FALSE;
offset++;
@ -1029,7 +1029,7 @@ check_rpcap_heur (tvbuff_t *tvb, gboolean tcp)
if (msg_value > 0) {
if (msg_type == RPCAP_MSG_ERROR) {
/* Must have a valid error code */
if (match_strval(msg_value, error_codes) == NULL)
if (try_val_to_str(msg_value, error_codes) == NULL)
return FALSE;
} else if (msg_type != RPCAP_MSG_FINDALLIF_REPLY) {
return FALSE;

View File

@ -3571,7 +3571,7 @@ dissect_rsvp_adspec(proto_item *ti, proto_tree *rsvp_object_tree,
id = tvb_get_guint8(tvb, offset2);
phdr_length = tvb_get_ntohs(tvb, offset2+2);
str = match_strval_ext(id, &adspec_params_ext);
str = try_val_to_str_ext(id, &adspec_params_ext);
if (str) {
switch(id) {
case 4:

View File

@ -724,7 +724,7 @@ rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_
if (tp->len<2 || remain<2) return NULL;
iUCM = tvb_get_ntohs(tvb, offset);
sFunc = match_strval(iUCM, rtmpt_ucm_vals);
sFunc = try_val_to_str(iUCM, rtmpt_ucm_vals);
if (sFunc==NULL) {
*deschasopcode = TRUE;
sFunc = ep_strdup_printf("User Control Message 0x%01x", iUCM);

View File

@ -568,7 +568,7 @@ dissect_rtmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
flags = tvb_get_guint8(tvb, offset+3);
if (ver == 1) {
type_str = match_strval(type, rtmac_type_vals);
type_str = try_val_to_str(type, rtmac_type_vals);
if (!type_str) {
dissector = dissector_get_uint_handle(ethertype_table, type);
}

Some files were not shown because too many files have changed in this diff Show More