Cleanup packet-sccp.c in preparation of trying to remove sccp_info member of packet_info.

Convert a handful of global variables into function parameters that get passed through the dissector, so we shouldn't be dependent on pinfo->sccp_info anymore. Removal of pinfo->sccp_info will be done in a separate patch (when the dissectors that use it can be updated).

packet-sua.c may need similar treatment.

Change-Id: If0001638d666afc07e04b02aa32ef31d6223a5de
Reviewed-on: https://code.wireshark.org/review/5343
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Michael Mann 2014-11-16 10:22:34 -05:00 committed by Alexis La Goutte
parent e2b597a898
commit 534b5967c0
3 changed files with 234 additions and 241 deletions

File diff suppressed because it is too large Load Diff

View File

@ -103,10 +103,20 @@ typedef struct _sccp_assoc_info_t {
} sccp_assoc_info_t;
extern void reset_sccp_assoc(void);
extern sccp_assoc_info_t* get_sccp_assoc(packet_info* pinfo, guint offset, guint32 src_lr, guint32 dst_lr, guint msg_type);
typedef struct _sccp_decode_context_t {
guint8 message_type;
guint dlr;
guint slr;
sccp_assoc_info_t* assoc;
sccp_msg_info_t* sccp_msg;
} sccp_decode_context_t;
extern sccp_assoc_info_t* get_sccp_assoc(packet_info* pinfo, guint offset, sccp_decode_context_t* value);
extern gboolean looks_like_valid_sccp(guint32 frame_num, tvbuff_t *tvb, guint8 my_mtp3_standard);
#define INVALID_LR 0xffffff /* a reserved value */
#define GT_SIGNAL_LENGTH 1
#define GT_ODD_SIGNAL_MASK 0x0f
#define GT_EVEN_SIGNAL_MASK 0xf0

View File

@ -397,15 +397,15 @@ typedef struct _sua_assoc_info_t {
} sua_assoc_info_t;
static wmem_tree_t* assocs = NULL;
sua_assoc_info_t* assoc;
sua_assoc_info_t no_sua_assoc = {
static sua_assoc_info_t* assoc;
static sua_assoc_info_t no_sua_assoc = {
0, /* assoc_id */
0, /* calling_routing_ind */
0, /* called_routing_ind */
0, /* calling_dpc */
0, /* called_dpc */
0, /* calling_ssn */
0, /* called_ssn */
INVALID_SSN, /* calling_ssn */
INVALID_SSN, /* called_ssn */
FALSE, /* has_bw_key */
FALSE /* has_fw_key */
};
@ -2177,7 +2177,7 @@ dissect_sua_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *sua_t
* or with "load sharing"?
*/
sccp_assoc_info_t* sccp_assoc;
reset_sccp_assoc();
sccp_decode_context_t sccp_info;
/* sua assoc */
switch (message_type) {
@ -2227,7 +2227,13 @@ dissect_sua_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *sua_t
#endif /* 0 */
}
sccp_assoc = get_sccp_assoc(pinfo, tvb_offset_from_real_beginning(message_tvb), srn, drn, message_type);
sccp_info.message_type = message_type;
sccp_info.dlr = drn;
sccp_info.slr = srn;
sccp_info.assoc = NULL;
sccp_info.sccp_msg = NULL; /* Unused, but initialized */
sccp_assoc = get_sccp_assoc(pinfo, tvb_offset_from_real_beginning(message_tvb), &sccp_info);
if (sccp_assoc && sccp_assoc->curr_msg) {
pinfo->sccp_info = sccp_assoc->curr_msg;
tap_queue_packet(sua_tap,pinfo,sccp_assoc->curr_msg);