aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gsm_map.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-06-26 19:56:52 +0000
committerGuy Harris <guy@alum.mit.edu>2005-06-26 19:56:52 +0000
commitab797734ddebd50f40deae437f27392ca4651c92 (patch)
tree82a95df0652f9df59634fd7a7f8dd36026fa4ea7 /epan/dissectors/packet-gsm_map.c
parent2b07720c2fde93c0ee91e88969e76493ee7f86de (diff)
Get rid of the private "my_match_strval()" routine in many dissectors;
add a "match_strval_idx()" routine that does the same thing, and have "match_strval()" call it. Make those routines, and "val_to_str()", return a "const" pointer. Update dissectors as necessary to squelch compiler warnings produced by that. Use "val_to_str()" rather than using "match_strval()" and then, if the result is null, substituting a specific string. Clean up some other "match_strval()"/"val_to_str()" usages. Add a null pointer check in the NDPS dissector's "attribute_value()" routine, as it's not clear that "global_attribute_name" won't be null at that point. Make some global variables in the AFS4INT dissector local. Make some routines not used outside the module they're in static. Make some tables "static const". Clean up white space. Fix Gerald's address in some files. svn path=/trunk/; revision=14786
Diffstat (limited to 'epan/dissectors/packet-gsm_map.c')
-rw-r--r--epan/dissectors/packet-gsm_map.c52
1 files changed, 14 insertions, 38 deletions
diff --git a/epan/dissectors/packet-gsm_map.c b/epan/dissectors/packet-gsm_map.c
index 64c4256f55..606cc8669c 100644
--- a/epan/dissectors/packet-gsm_map.c
+++ b/epan/dissectors/packet-gsm_map.c
@@ -12652,27 +12652,6 @@ dissect_gsm_map_UnknownOrUnreachableLCSClient_Param(gboolean implicit_tag _U_, t
/*--- End of included file: packet-gsm_map-fn.c ---*/
-/* Stuff included from the "old" packet-gsm_map.c for tapping purposes */
-static gchar *
-my_match_strval(guint32 val, const value_string *vs, gint *idx)
-{
- gint i = 0;
-
- while (vs[i].strptr) {
- if (vs[i].value == val)
- {
- *idx = i;
- return(vs[i].strptr);
- }
-
- i++;
- }
-
- *idx = -1;
- return(NULL);
-}
-/* End includes from old" packet-gsm_map.c */
-
const value_string gsm_map_opr_code_strings[] = {
{ 2, "updateLocation" },
{ 3, "cancelLocation" },
@@ -13554,10 +13533,9 @@ dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
proto_item *item=NULL;
proto_tree *tree=NULL;
- /* Used for gsm_map TAP */
- static gsm_map_tap_rec_t tap_rec;
- gint op_idx;
- gchar *str = NULL;
+ /* Used for gsm_map TAP */
+ static gsm_map_tap_rec_t tap_rec;
+ gint op_idx;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
@@ -13565,26 +13543,24 @@ dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM MAP");
}
- top_tree = parent_tree;
- dissector_add("tcap.itu_ssn",pinfo->match_port, map_handle);
+ top_tree = parent_tree;
+ dissector_add("tcap.itu_ssn",pinfo->match_port, map_handle);
/* create display subtree for the protocol */
if(parent_tree){
- item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, FALSE);
- tree = proto_item_add_subtree(item, ett_gsm_map);
+ item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, FALSE);
+ tree = proto_item_add_subtree(item, ett_gsm_map);
}
dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, pinfo, tree, -1);
- str = my_match_strval(opcode, gsm_map_opr_code_strings, &op_idx);
-
- tap_rec.invoke = FALSE;
- if ( gsmmap_pdu_type == 1 )
- tap_rec.invoke = TRUE;
- tap_rec.opr_code_idx = op_idx;
- tap_rec.size = gsm_map_pdu_size;
-
- tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
+ match_strval_idx(opcode, gsm_map_opr_code_strings, &op_idx);
+ tap_rec.invoke = FALSE;
+ if ( gsmmap_pdu_type == 1 )
+ tap_rec.invoke = TRUE;
+ tap_rec.opr_code_idx = op_idx;
+ tap_rec.size = gsm_map_pdu_size;
+ tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
}
static const value_string ssCode_vals[] = {