aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-03-29 00:26:23 +0000
committerEvan Huus <eapache@gmail.com>2013-03-29 00:26:23 +0000
commit37600a157ba2036a79a5ebf466b31b8eee19244e (patch)
tree05b5db07655ce39ffe0c9c42c62d30a0c389b8df /asn1
parent6f19d87f4e3aaa5872bdec1d9f4e50d85eee193d (diff)
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
Diffstat (limited to 'asn1')
-rw-r--r--asn1/gsm_map/packet-gsm_map-template.c2
-rw-r--r--asn1/h248/packet-h248-template.c16
-rw-r--r--asn1/h450/packet-h450-template.c6
-rw-r--r--asn1/isdn-sup/packet-isdn-sup-template.c6
-rw-r--r--asn1/mms/packet-mms-template.c2
-rw-r--r--asn1/mpeg-pes/packet-mpeg-pes-template.c4
-rw-r--r--asn1/qsig/packet-qsig-template.c10
7 files changed, 23 insertions, 23 deletions
diff --git a/asn1/gsm_map/packet-gsm_map-template.c b/asn1/gsm_map/packet-gsm_map-template.c
index 1254839415..ea39f5d1b3 100644
--- a/asn1/gsm_map/packet-gsm_map-template.c
+++ b/asn1/gsm_map/packet-gsm_map-template.c
@@ -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;
diff --git a/asn1/h248/packet-h248-template.c b/asn1/h248/packet-h248-template.c
index b5e13761e2..679fd2ba66 100644
--- a/asn1/h248/packet-h248-template.c
+++ b/asn1/h248/packet-h248-template.c
@@ -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);
diff --git a/asn1/h450/packet-h450-template.c b/asn1/h450/packet-h450-template.c
index f1ac186618..cd0ab0a2e0 100644
--- a/asn1/h450/packet-h450-template.c
+++ b/asn1/h450/packet-h450-template.c
@@ -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)
diff --git a/asn1/isdn-sup/packet-isdn-sup-template.c b/asn1/isdn-sup/packet-isdn-sup-template.c
index a54e600895..8354f72d0d 100644
--- a/asn1/isdn-sup/packet-isdn-sup-template.c
+++ b/asn1/isdn-sup/packet-isdn-sup-template.c
@@ -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);
diff --git a/asn1/mms/packet-mms-template.c b/asn1/mms/packet-mms-template.c
index 8bea578a46..f4deec0ee0 100644
--- a/asn1/mms/packet-mms-template.c
+++ b/asn1/mms/packet-mms-template.c
@@ -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 */
}
diff --git a/asn1/mpeg-pes/packet-mpeg-pes-template.c b/asn1/mpeg-pes/packet-mpeg-pes-template.c
index 32a6f96306..60bce351b7 100644
--- a/asn1/mpeg-pes/packet-mpeg-pes-template.c
+++ b/asn1/mpeg-pes/packet-mpeg-pes-template.c
@@ -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);
diff --git a/asn1/qsig/packet-qsig-template.c b/asn1/qsig/packet-qsig-template.c
index c4261414c4..ed47e62d8d 100644
--- a/asn1/qsig/packet-qsig-template.c
+++ b/asn1/qsig/packet-qsig-template.c
@@ -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);