diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-12-31 21:15:19 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-01-01 05:16:10 +0000 |
commit | 34aeec604ef1326f5123bfd3e61f9bc6b41af9e0 (patch) | |
tree | 9b190c4886c38e14dfeede657661862e890a8bc6 | |
parent | 1fcf7d7041fc2e10f6b5490cbaacbeb25ec42bde (diff) |
Clean up response matching type preference.
Add #defines for all the value types and use them.
Make the preference static, as it's not used outside this module.
Change-Id: I3ed715701f77d5ea6cc45c8f978d6e2da7b38671
Reviewed-on: https://code.wireshark.org/review/12988
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | asn1/ansi_tcap/packet-ansi_tcap-template.c | 23 | ||||
-rw-r--r-- | epan/dissectors/packet-ansi_tcap.c | 33 |
2 files changed, 33 insertions, 23 deletions
diff --git a/asn1/ansi_tcap/packet-ansi_tcap-template.c b/asn1/ansi_tcap/packet-ansi_tcap-template.c index 1ed85f41e0..93d13dc362 100644 --- a/asn1/ansi_tcap/packet-ansi_tcap-template.c +++ b/asn1/ansi_tcap/packet-ansi_tcap-template.c @@ -43,8 +43,11 @@ void proto_register_ansi_tcap(void); void proto_reg_handoff_ansi_tcap(void); -/* Preferences defaults */ -gint ansi_tcap_response_matching_type = 0; +/* Preference settings */ +#define ANSI_TCAP_TID_ONLY 0 +#define ANSI_TCAP_TID_AND_SOURCE 1 +#define ANSI_TCAP_TID_SOURCE_AND_DEST 2 +static gint ansi_tcap_response_matching_type = ANSI_TCAP_TID_ONLY; /* Initialize the protocol and registered fields */ static int proto_ansi_tcap = -1; @@ -195,12 +198,13 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){ /* Only do this once XXX I hope it's the right thing to do */ /* The hash string needs to contain src and dest to distiguish differnt flows */ switch(ansi_tcap_response_matching_type){ - case 0: + case ANSI_TCAP_TID_ONLY: buf = wmem_strdup(wmem_packet_scope(), ansi_tcap_private.TransactionID_str); break; - case 1: + case ANSI_TCAP_TID_AND_SOURCE: buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",ansi_tcap_private.TransactionID_str,src); break; + case ANSI_TCAP_TID_SOURCE_AND_DEST: default: buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",ansi_tcap_private.TransactionID_str,src,dst); break; @@ -243,12 +247,13 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U buf[0] = '\0'; /* Reverse order to invoke */ switch(ansi_tcap_response_matching_type){ - case 0: + case ANSI_TCAP_TID_ONLY: g_snprintf(buf,MAX_TID_STR_LEN,"%s",ansi_tcap_private.TransactionID_str); break; - case 1: + case ANSI_TCAP_TID_AND_SOURCE: g_snprintf(buf,MAX_TID_STR_LEN,"%s%s",ansi_tcap_private.TransactionID_str,dst); break; + case ANSI_TCAP_TID_SOURCE_AND_DEST: default: g_snprintf(buf,MAX_TID_STR_LEN,"%s%s%s",ansi_tcap_private.TransactionID_str,dst,src); break; @@ -501,9 +506,9 @@ proto_register_ansi_tcap(void) expert_module_t* expert_ansi_tcap; static const enum_val_t ansi_tcap_response_matching_type_values[] = { - {"Only Transaction ID will be used in Invoke/response matching", "Transaction ID only", 0}, - {"Transaction ID and Source will be used in Invoke/response matching", "Transaction ID and Source", 1}, - {"Transaction ID Source and Destination will be used in Invoke/response matching", "Transaction ID Source and Destination", 2}, + {"Only Transaction ID will be used in Invoke/response matching", "Transaction ID only", ANSI_TCAP_TID_ONLY}, + {"Transaction ID and Source will be used in Invoke/response matching", "Transaction ID and Source", ANSI_TCAP_TID_AND_SOURCE}, + {"Transaction ID Source and Destination will be used in Invoke/response matching", "Transaction ID Source and Destination", ANSI_TCAP_TID_SOURCE_AND_DEST}, {NULL, NULL, -1} }; diff --git a/epan/dissectors/packet-ansi_tcap.c b/epan/dissectors/packet-ansi_tcap.c index 46a71b4ae5..c4512d164c 100644 --- a/epan/dissectors/packet-ansi_tcap.c +++ b/epan/dissectors/packet-ansi_tcap.c @@ -51,8 +51,11 @@ void proto_register_ansi_tcap(void); void proto_reg_handoff_ansi_tcap(void); -/* Preferences defaults */ -gint ansi_tcap_response_matching_type = 0; +/* Preference settings */ +#define ANSI_TCAP_TID_ONLY 0 +#define ANSI_TCAP_TID_AND_SOURCE 1 +#define ANSI_TCAP_TID_SOURCE_AND_DEST 2 +static gint ansi_tcap_response_matching_type = ANSI_TCAP_TID_ONLY; /* Initialize the protocol and registered fields */ static int proto_ansi_tcap = -1; @@ -122,7 +125,7 @@ static int hf_ansi_tcap_paramSequence = -1; /* T_paramSequence */ static int hf_ansi_tcap_paramSet = -1; /* T_paramSet */ /*--- End of included file: packet-ansi_tcap-hf.c ---*/ -#line 62 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" +#line 65 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" /* Initialize the subtree pointers */ static gint ett_tcap = -1; @@ -170,7 +173,7 @@ static gint ett_ansi_tcap_T_paramSequence = -1; static gint ett_ansi_tcap_T_paramSet = -1; /*--- End of included file: packet-ansi_tcap-ett.c ---*/ -#line 83 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" +#line 86 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" #define MAX_SSN 254 @@ -286,12 +289,13 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){ /* Only do this once XXX I hope it's the right thing to do */ /* The hash string needs to contain src and dest to distiguish differnt flows */ switch(ansi_tcap_response_matching_type){ - case 0: + case ANSI_TCAP_TID_ONLY: buf = wmem_strdup(wmem_packet_scope(), ansi_tcap_private.TransactionID_str); break; - case 1: + case ANSI_TCAP_TID_AND_SOURCE: buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",ansi_tcap_private.TransactionID_str,src); break; + case ANSI_TCAP_TID_SOURCE_AND_DEST: default: buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",ansi_tcap_private.TransactionID_str,src,dst); break; @@ -334,12 +338,13 @@ find_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U buf[0] = '\0'; /* Reverse order to invoke */ switch(ansi_tcap_response_matching_type){ - case 0: + case ANSI_TCAP_TID_ONLY: g_snprintf(buf,MAX_TID_STR_LEN,"%s",ansi_tcap_private.TransactionID_str); break; - case 1: + case ANSI_TCAP_TID_AND_SOURCE: g_snprintf(buf,MAX_TID_STR_LEN,"%s%s",ansi_tcap_private.TransactionID_str,dst); break; + case ANSI_TCAP_TID_SOURCE_AND_DEST: default: g_snprintf(buf,MAX_TID_STR_LEN,"%s%s%s",ansi_tcap_private.TransactionID_str,dst,src); break; @@ -1405,7 +1410,7 @@ dissect_ansi_tcap_PackageType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int /*--- End of included file: packet-ansi_tcap-fn.c ---*/ -#line 348 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" +#line 353 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" @@ -1750,7 +1755,7 @@ proto_register_ansi_tcap(void) NULL, HFILL }}, /*--- End of included file: packet-ansi_tcap-hfarr.c ---*/ -#line 484 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" +#line 489 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" }; /* Setup protocol subtree array */ @@ -1788,7 +1793,7 @@ proto_register_ansi_tcap(void) &ett_ansi_tcap_T_paramSet, /*--- End of included file: packet-ansi_tcap-ettarr.c ---*/ -#line 495 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" +#line 500 "../../asn1/ansi_tcap/packet-ansi_tcap-template.c" }; static ei_register_info ei[] = { @@ -1798,9 +1803,9 @@ proto_register_ansi_tcap(void) expert_module_t* expert_ansi_tcap; static const enum_val_t ansi_tcap_response_matching_type_values[] = { - {"Only Transaction ID will be used in Invoke/response matching", "Transaction ID only", 0}, - {"Transaction ID and Source will be used in Invoke/response matching", "Transaction ID and Source", 1}, - {"Transaction ID Source and Destination will be used in Invoke/response matching", "Transaction ID Source and Destination", 2}, + {"Only Transaction ID will be used in Invoke/response matching", "Transaction ID only", ANSI_TCAP_TID_ONLY}, + {"Transaction ID and Source will be used in Invoke/response matching", "Transaction ID and Source", ANSI_TCAP_TID_AND_SOURCE}, + {"Transaction ID Source and Destination will be used in Invoke/response matching", "Transaction ID Source and Destination", ANSI_TCAP_TID_SOURCE_AND_DEST}, {NULL, NULL, -1} }; |