diff options
author | Gerald Combs <gerald@wireshark.org> | 2006-07-07 00:45:54 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2006-07-07 00:45:54 +0000 |
commit | 7976c442db7d58ee9be01679597952074f5c5b46 (patch) | |
tree | 7510059331b05daa1e1a8109aa7e8f686aef3949 /epan/dissectors/packet-mq.c | |
parent | 1f4873db0be82e0e119204532ee40be433cdc805 (diff) |
Fix a few format string bugs found by Ilja van Sprundel.
svn path=/trunk/; revision=18677
Diffstat (limited to 'epan/dissectors/packet-mq.c')
-rw-r--r-- | epan/dissectors/packet-mq.c | 354 |
1 files changed, 177 insertions, 177 deletions
diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c index d0b3d2660c..87f996e937 100644 --- a/epan/dissectors/packet-mq.c +++ b/epan/dissectors/packet-mq.c @@ -31,15 +31,15 @@ * MQ can be transported on top of TCP, UDP, HTTP, NetBIOS, SPX, SNA LU 6.2, DECnet. * MQ has language bindings for C, C++, Java, .NET, COBOL, PL/I, OS/390 assembler, TAL, Visual Basic. * -* The basic MQ topology is on one side the queue manager which hosts the queues. On the other side the +* The basic MQ topology is on one side the queue manager which hosts the queues. On the other side the * applications connect to the queue manager, open a queue, and put or get messages to/from that queue. * -* The MQ middleware allows very generic operations (send, receive) and can be compared to the +* The MQ middleware allows very generic operations (send, receive) and can be compared to the * socket API in terms of genericity, but it is more abstract and offers higher-level functionalities * (eg transactions, ...) * * The MQ middleware is not really intended to be run over public networks between parties -* that do not know each other in advance, but is rather used on private corporate networks +* that do not know each other in advance, but is rather used on private corporate networks * between business applications (it can be compared to a database server for that aspect). * * The wire format of an MQ segment is a sequence of structures. Most structures start with a 4-letter struct identifier. @@ -57,7 +57,7 @@ * TSH [ XA ] [ XINFO | XID ] * where PAYLOAD = [ DH ] [ DLH ] [ MDE ] BUFF * -* This dissector is a beta version. To be improved +* This dissector is a beta version. To be improved * - Translate the integers/flags into their descriptions * - Find the semantics of the unknown fields * - Display EBCDIC strings as ASCII @@ -403,18 +403,18 @@ static GHashTable *mq_reassembled_table = NULL; #define MQ_STRUCTID_DH_EBCDIC 0xC4C84040 #define MQ_STRUCTID_DLH_EBCDIC 0xC4D3C840 #define MQ_STRUCTID_GMO_EBCDIC 0xC7D4D640 -#define MQ_STRUCTID_ID_EBCDIC 0xC9C44040 -#define MQ_STRUCTID_IIH_EBCDIC 0xC9C9C840 +#define MQ_STRUCTID_ID_EBCDIC 0xC9C44040 +#define MQ_STRUCTID_IIH_EBCDIC 0xC9C9C840 #define MQ_STRUCTID_MD_EBCDIC 0xD4C44040 #define MQ_STRUCTID_MDE_EBCDIC 0xD4C4C540 -#define MQ_STRUCTID_MSH_EBCDIC 0xD4E2C840 +#define MQ_STRUCTID_MSH_EBCDIC 0xD4E2C840 #define MQ_STRUCTID_OD_EBCDIC 0xD6C44040 #define MQ_STRUCTID_PMO_EBCDIC 0xD7D4D640 #define MQ_STRUCTID_RFH_EBCDIC 0xD9C6C840 #define MQ_STRUCTID_RMH_EBCDIC 0xD9D4C840 #define MQ_STRUCTID_TM_EBCDIC 0xE3D44040 #define MQ_STRUCTID_TMC2_EBCDIC 0xE3D4C3F2 -#define MQ_STRUCTID_TSH_EBCDIC 0xE3E2C840 +#define MQ_STRUCTID_TSH_EBCDIC 0xE3E2C840 #define MQ_STRUCTID_UID_EBCDIC 0xE4C9C440 #define MQ_STRUCTID_WIH_EBCDIC 0xE6C9C840 #define MQ_STRUCTID_XQH_EBCDIC 0xE7D8C840 @@ -541,20 +541,20 @@ static GHashTable *mq_reassembled_table = NULL; #define MQ_CONN_VERSION 0x01 #define MQ_CONNX_VERSION 0x03 -#define MQ_STATUS_E_REMOTE_CHANNEL_NOT_FOUND 0x01 -#define MQ_STATUS_E_BAD_REMOTE_CHANNEL_TYPE 0x02 -#define MQ_STATUS_E_REMOTE_QM_UNAVAILABLE 0x03 -#define MQ_STATUS_E_MSG_SEQUENCE_ERROR 0x04 -#define MQ_STATUS_E_REMOTE_QM_TERMINATING 0x05 -#define MQ_STATUS_E_MSG_NOT_RECEIVED 0x06 -#define MQ_STATUS_I_CHANNEL_CLOSED 0x07 -#define MQ_STATUS_I_DISCINTERVAL_EXPIRED 0x08 -#define MQ_STATUS_E_REMOTE_PROTOCOL_ERROR 0x0A -#define MQ_STATUS_E_BIND_FAILED 0x14 -#define MQ_STATUS_E_MSGWRAP_DIFFERENT 0x15 -#define MQ_STATUS_E_REMOTE_CHANNEL_UNAVAILABLE 0x16 -#define MQ_STATUS_E_TERMINATED_BY_REMOTE_EXIT 0x17 -#define MQ_STATUS_E_SSL_REMOTE_BAD_CIPHER 0x18 +#define MQ_STATUS_E_REMOTE_CHANNEL_NOT_FOUND 0x01 +#define MQ_STATUS_E_BAD_REMOTE_CHANNEL_TYPE 0x02 +#define MQ_STATUS_E_REMOTE_QM_UNAVAILABLE 0x03 +#define MQ_STATUS_E_MSG_SEQUENCE_ERROR 0x04 +#define MQ_STATUS_E_REMOTE_QM_TERMINATING 0x05 +#define MQ_STATUS_E_MSG_NOT_RECEIVED 0x06 +#define MQ_STATUS_I_CHANNEL_CLOSED 0x07 +#define MQ_STATUS_I_DISCINTERVAL_EXPIRED 0x08 +#define MQ_STATUS_E_REMOTE_PROTOCOL_ERROR 0x0A +#define MQ_STATUS_E_BIND_FAILED 0x14 +#define MQ_STATUS_E_MSGWRAP_DIFFERENT 0x15 +#define MQ_STATUS_E_REMOTE_CHANNEL_UNAVAILABLE 0x16 +#define MQ_STATUS_E_TERMINATED_BY_REMOTE_EXIT 0x17 +#define MQ_STATUS_E_SSL_REMOTE_BAD_CIPHER 0x18 /* These errors codes are documented in javax.transaction.xa.XAException */ #define MQ_XA_RBROLLBACK 100 @@ -568,7 +568,7 @@ static GHashTable *mq_reassembled_table = NULL; #define MQ_XA_NOMIGRATE 9 #define MQ_XA_HEURHAZ 8 #define MQ_XA_HEURCOM 7 -#define MQ_XA_HEURRB 6 +#define MQ_XA_HEURRB 6 #define MQ_XA_HEURMIX 5 #define MQ_XA_RETRY 4 #define MQ_XA_RDONLY 3 @@ -593,12 +593,12 @@ static GHashTable *mq_reassembled_table = NULL; #define MQ_XA_TMFAIL 0x20000000 #define MQ_XA_TMONEPHASE 0x40000000 -#define MQ_PMRF_NONE 0x00 -#define MQ_PMRF_MSG_ID 0x01 -#define MQ_PMRF_CORREL_ID 0x02 -#define MQ_PMRF_GROUP_ID 0x04 -#define MQ_PMRF_FEEDBACK 0x08 -#define MQ_PMRF_ACCOUNTING_TOKEN 0x10 +#define MQ_PMRF_NONE 0x00 +#define MQ_PMRF_MSG_ID 0x01 +#define MQ_PMRF_CORREL_ID 0x02 +#define MQ_PMRF_GROUP_ID 0x04 +#define MQ_PMRF_FEEDBACK 0x08 +#define MQ_PMRF_ACCOUNTING_TOKEN 0x10 /* MQ structures */ /* Undocumented structures */ @@ -833,7 +833,7 @@ static gint strip_trailing_blanks(guint8* a_string, gint a_size) { for (i = 0; i < a_size; i++) { - if (a_string[i] == ' ' || a_string[i] == '\0') + if (a_string[i] == ' ' || a_string[i] == '\0') { a_string[i] = '\0'; break; @@ -858,7 +858,7 @@ dissect_mq_md(tvbuff_t *tvb, proto_tree *tree, gboolean bLittleEndian, gint offs guint32 iVersionMD = 0; iVersionMD = tvb_get_guint32_endian(tvb, offset + 4, bLittleEndian); /* Compute length according to version */ - switch (iVersionMD) + switch (iVersionMD) { case 1: iSizeMD = 324; break; case 2: iSizeMD = 364; break; @@ -874,7 +874,7 @@ dissect_mq_md(tvbuff_t *tvb, proto_tree *tree, gboolean bLittleEndian, gint offs proto_item *ti = NULL; ti = proto_tree_add_text(tree, tvb, offset, iSizeMD, MQ_TEXT_MD); mq_tree = proto_item_add_subtree(ti, ett_mq_md); - + proto_tree_add_item(mq_tree, hf_mq_md_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_md_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_md_report, tvb, offset + 8, 4, bLittleEndian); @@ -899,7 +899,7 @@ dissect_mq_md(tvbuff_t *tvb, proto_tree *tree, gboolean bLittleEndian, gint offs proto_tree_add_item(mq_tree, hf_mq_md_putdate, tvb, offset + 304, 8, FALSE); proto_tree_add_item(mq_tree, hf_mq_md_puttime, tvb, offset + 312, 8, FALSE); proto_tree_add_item(mq_tree, hf_mq_md_applorigindata, tvb, offset + 320, 4, FALSE); - + if (iVersionMD >= 2) { proto_tree_add_item(mq_tree, hf_mq_md_groupid, tvb, offset + 324, 24, FALSE); @@ -931,7 +931,7 @@ dissect_mq_or(tvbuff_t *tvb, proto_tree *tree, gint offset, gint iNbrRecords, gi { gint iOffsetOR = 0; gint iRecord = 0; - for (iRecord = 0; iRecord < iNbrRecords ; iRecord++) + for (iRecord = 0; iRecord < iNbrRecords ; iRecord++) { ti = proto_tree_add_text(tree, tvb, offset + iOffsetOR, 96, MQ_TEXT_OR); mq_tree = proto_item_add_subtree(ti, ett_mq_or); @@ -961,7 +961,7 @@ dissect_mq_rr(tvbuff_t *tvb, proto_tree *tree, gboolean bLittleEndian, gint offs { gint iOffsetRR = 0; gint iRecord = 0; - for (iRecord = 0; iRecord < iNbrRecords; iRecord++) + for (iRecord = 0; iRecord < iNbrRecords; iRecord++) { ti = proto_tree_add_text(tree, tvb, offset + iOffsetRR, 8, MQ_TEXT_RR); mq_tree = proto_item_add_subtree(ti, ett_mq_rr); @@ -998,7 +998,7 @@ dissect_mq_pmr(tvbuff_t *tvb, proto_tree *tree, gboolean bLittleEndian, gint off { gint iOffsetPMR = 0; gint iRecord = 0; - for (iRecord = 0; iRecord < iNbrRecords; iRecord++) + for (iRecord = 0; iRecord < iNbrRecords; iRecord++) { ti = proto_tree_add_text(tree, tvb, offset + iOffsetPMR, iSizePMR1, MQ_TEXT_PMR); mq_tree = proto_item_add_subtree(ti, ett_mq_pmr); @@ -1051,7 +1051,7 @@ dissect_mq_gmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi guint32 iVersionGMO = 0; iVersionGMO = tvb_get_guint32_endian(tvb, offset + 4, bLittleEndian); /* Compute length according to version */ - switch (iVersionGMO) + switch (iVersionGMO) { case 1: iSizeGMO = 72; break; case 2: iSizeGMO = 80; break; @@ -1060,7 +1060,7 @@ dissect_mq_gmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi if (iSizeGMO != 0 && tvb_length_remaining(tvb, offset) >= iSizeGMO) { - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { guint8* sQueue; sQueue = tvb_get_ephemeral_string(tvb, offset + 24, 48); @@ -1069,12 +1069,12 @@ dissect_mq_gmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi col_append_fstr(pinfo->cinfo, COL_INFO, " Q=%s", sQueue); } } - + if (tree) { ti = proto_tree_add_text(tree, tvb, offset, iSizeGMO, MQ_TEXT_GMO); mq_tree = proto_item_add_subtree(ti, ett_mq_gmo); - + proto_tree_add_item(mq_tree, hf_mq_gmo_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_gmo_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_gmo_options, tvb, offset + 8, 4, bLittleEndian); @@ -1082,7 +1082,7 @@ dissect_mq_gmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi proto_tree_add_item(mq_tree, hf_mq_gmo_signal1, tvb, offset + 16, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_gmo_signal2, tvb, offset + 20, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_gmo_resolvedqname, tvb, offset + 24, 48, FALSE); - + if (iVersionGMO >= 2) { proto_tree_add_item(mq_tree, hf_mq_gmo_matchoptions, tvb, offset + 72, 4, FALSE); @@ -1091,7 +1091,7 @@ dissect_mq_gmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi proto_tree_add_item(mq_tree, hf_mq_gmo_segmentation, tvb, offset + 78, 1, FALSE); proto_tree_add_item(mq_tree, hf_mq_gmo_reserved, tvb, offset + 79, 1, FALSE); } - + if (iVersionGMO >= 3) { proto_tree_add_item(mq_tree, hf_mq_gmo_msgtoken, tvb, offset + 80, 16, FALSE); @@ -1120,7 +1120,7 @@ dissect_mq_pmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi guint32 iVersionPMO = 0; iVersionPMO = tvb_get_guint32_endian(tvb, offset + 4, bLittleEndian); /* Compute length according to version */ - switch (iVersionPMO) + switch (iVersionPMO) { case 1: iSizePMO = 128; break; case 2: iSizePMO = 152;break; @@ -1135,8 +1135,8 @@ dissect_mq_pmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi iNbrRecords = tvb_get_guint32_endian(tvb, offset + 128, bLittleEndian); iRecFlags = tvb_get_guint32_endian(tvb, offset + 132, bLittleEndian); } - - if (check_col(pinfo->cinfo, COL_INFO)) + + if (check_col(pinfo->cinfo, COL_INFO)) { guint8* sQueue; sQueue = tvb_get_ephemeral_string(tvb, offset + 32, 48); @@ -1145,7 +1145,7 @@ dissect_mq_pmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi col_append_fstr(pinfo->cinfo, COL_INFO, " Q=%s", sQueue); } } - + if (tree) { ti = proto_tree_add_text(tree, tvb, offset, iSizePMO, MQ_TEXT_PMO); @@ -1160,7 +1160,7 @@ dissect_mq_pmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi proto_tree_add_item(mq_tree, hf_mq_pmo_invaliddestcount, tvb, offset + 28, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_pmo_resolvedqname, tvb, offset + 32, 48, FALSE); proto_tree_add_item(mq_tree, hf_mq_pmo_resolvedqmgrname, tvb, offset + 80, 48, FALSE); - + if (iVersionPMO >= 2) { proto_tree_add_item(mq_tree, hf_mq_pmo_recspresent, tvb, offset + 128, 4, bLittleEndian); @@ -1170,14 +1170,14 @@ dissect_mq_pmo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean bLi proto_tree_add_item(mq_tree, hf_mq_pmo_putmsgrecptr, tvb, offset + 144, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_pmo_responserecptr, tvb, offset + 148, 4, bLittleEndian); } - + } if (iNbrRecords > 0) { gint iOffsetPMR = 0; gint iOffsetRR = 0; gint iSizePMRRR = 0; - + *iDistributionListSize = iNbrRecords; iOffsetPMR = tvb_get_guint32_endian(tvb, offset + 136, bLittleEndian); iOffsetRR = tvb_get_guint32_endian(tvb, offset + 140, bLittleEndian); @@ -1205,24 +1205,24 @@ dissect_mq_xid(tvbuff_t *tvb, proto_tree *tree, gboolean bLittleEndian, gint off iXidLength = tvb_get_guint8(tvb, offset + 4); iBqLength = tvb_get_guint8(tvb, offset + 5); iSizeXid = 6 + iXidLength + iBqLength; - - if (tvb_length_remaining(tvb, offset) >= iSizeXid) + + if (tvb_length_remaining(tvb, offset) >= iSizeXid) { if (tree) { ti = proto_tree_add_text(tree, tvb, offset, iSizeXid, MQ_TEXT_XID); mq_tree = proto_item_add_subtree(ti, ett_mq_xa_xid); - + proto_tree_add_item(mq_tree, hf_mq_xa_xid_formatid, tvb, offset, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_xa_xid_globalxid_length, tvb, offset + 4, 1, FALSE); proto_tree_add_item(mq_tree, hf_mq_xa_xid_brq_length, tvb, offset + 5, 1, FALSE); proto_tree_add_item(mq_tree, hf_mq_xa_xid_globalxid, tvb, offset + 6, iXidLength, FALSE); - proto_tree_add_item(mq_tree, hf_mq_xa_xid_brq, tvb, offset + 6 + iXidLength, iBqLength, FALSE); + proto_tree_add_item(mq_tree, hf_mq_xa_xid_brq, tvb, offset + 6 + iXidLength, iBqLength, FALSE); } iSizeXid += (4 - (iSizeXid % 4)) % 4; /* Pad for alignment with 4 byte word boundary */ if (tvb_length_remaining(tvb, offset) < iSizeXid) iSizeXid = 0; } - else iSizeXid = 0; + else iSizeXid = 0; } return iSizeXid; } @@ -1246,12 +1246,12 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) struct mq_msg_properties tMsgProps; static gint iPreviousFrameNumber = -1; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MQ"); + if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MQ"); if (check_col(pinfo->cinfo, COL_INFO)) { - /* This is a trick to know whether this is the first PDU in this packet or not */ + /* This is a trick to know whether this is the first PDU in this packet or not */ if (iPreviousFrameNumber != (gint) pinfo->fd->num) - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); else col_append_str(pinfo->cinfo, COL_INFO, " | "); } @@ -1270,7 +1270,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) iSegmentLength = tvb_get_ntohl(tvb, offset + 4); iControlFlags = tvb_get_guint8(tvb, offset + 10); - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(opcode, mq_opcode_vals, "Unknown (0x%02x)")); } @@ -1313,12 +1313,12 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(mq_tree, hf_mq_tsh_luwid, tvb, offset + 12, 8, FALSE); proto_tree_add_item(mq_tree, hf_mq_tsh_encoding, tvb, offset + 20, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_tsh_ccsid, tvb, offset + 24, 2, bLittleEndian); - proto_tree_add_item(mq_tree, hf_mq_tsh_padding, tvb, offset + 26, 2, FALSE); + proto_tree_add_item(mq_tree, hf_mq_tsh_padding, tvb, offset + 26, 2, FALSE); } offset += iSizeTSH; /* Now dissect the embedded structures */ - if (tvb_length_remaining(tvb, offset) >= 4) + if (tvb_length_remaining(tvb, offset) >= 4) { structId = tvb_get_ntohl(tvb, offset); if (((iControlFlags & MQ_TCF_FIRST) != 0) || opcode < 0x80) @@ -1329,7 +1329,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint32 iReturnCode = 0; iReturnCode = tvb_get_guint32_endian(tvb, offset + 8, bLittleEndian); - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { if (iReturnCode != 0) col_append_fstr(pinfo->cinfo, COL_INFO, " [RC=%d]", iReturnCode); @@ -1339,7 +1339,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeAPI, MQ_TEXT_API); mq_tree = proto_item_add_subtree(ti, ett_mq_api); - + proto_tree_add_item(mq_tree, hf_mq_api_replylength, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_api_completioncode, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_api_reasoncode, tvb, offset + 8, 4, bLittleEndian); @@ -1357,7 +1357,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeMSH, MQ_TEXT_MSH); mq_tree = proto_item_add_subtree(ti, ett_mq_msh); - + proto_tree_add_item(mq_tree, hf_mq_msh_structid, tvb, offset + 0, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_msh_seqnum, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_msh_datalength, tvb, offset + 8, 4, bLittleEndian); @@ -1376,7 +1376,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_length_remaining(tvb, offset) >= iStatusLength) { - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { if (iStatus != 0) col_append_fstr(pinfo->cinfo, COL_INFO, ": Code=%s", val_to_str(iStatus, mq_status_vals, "Unknown (0x%08x)")); @@ -1385,10 +1385,10 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, 8, MQ_TEXT_STAT); mq_tree = proto_item_add_subtree(ti, ett_mq_status); - + proto_tree_add_item(mq_tree, hf_mq_status_length, tvb, offset, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_status_code, tvb, offset + 4, 4, bLittleEndian); - + if (iStatusLength >= 12) proto_tree_add_item(mq_tree, hf_mq_status_value, tvb, offset + 8, 4, bLittleEndian); } @@ -1401,7 +1401,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, -1, MQ_TEXT_PING); mq_tree = proto_item_add_subtree(ti, ett_mq_ping); - + proto_tree_add_item(mq_tree, hf_mq_ping_length, tvb, offset, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_ping_buffer, tvb, offset + 4, -1, FALSE); } @@ -1413,7 +1413,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, -1, MQ_TEXT_RESET); mq_tree = proto_item_add_subtree(ti, ett_mq_reset); - + proto_tree_add_item(mq_tree, hf_mq_reset_length, tvb, offset, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_reset_seqnum, tvb, offset + 4, 4, bLittleEndian); } @@ -1423,15 +1423,15 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { gint iSizeCONN = 0; /*iSizeCONN = ((iVersionID == 4 || iVersionID == 6) ? 120 : 112);*/ /* guess */ - /* The iVersionID is available in the previous ID segment, we should keep a state + /* The iVersionID is available in the previous ID segment, we should keep a state * Instead we rely on the segment length announced in the TSH */ /* The MQCONN structure is special because it does not start with a structid */ iSizeCONN = iSegmentLength - iSizeTSH - iSizeAPI; if (iSizeCONN != 112 && iSizeCONN != 120) iSizeCONN = 0; - + if (iSizeCONN != 0 && tvb_length_remaining(tvb, offset) >= iSizeCONN) { - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { guint8* sApplicationName; guint8* sQueueManager; @@ -1446,24 +1446,24 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, " QM=%s", sQueueManager); } } - - + + if (tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeCONN, MQ_TEXT_CONN); mq_tree = proto_item_add_subtree(ti, ett_mq_conn); - + proto_tree_add_item(mq_tree, hf_mq_conn_queuemanager, tvb, offset, 48, FALSE); proto_tree_add_item(mq_tree, hf_mq_conn_appname, tvb, offset + 48, 28, FALSE); proto_tree_add_item(mq_tree, hf_mq_conn_apptype, tvb, offset + 76, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_conn_acttoken, tvb, offset + 80, 32, FALSE); - + if (iSizeCONN >= 120) { proto_tree_add_item(mq_tree, hf_mq_conn_version, tvb, offset + 112, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_conn_options, tvb, offset + 116, 4, bLittleEndian); } - } + } offset += iSizeCONN; } } @@ -1475,21 +1475,21 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint iCharLen = 0; gint iOffsetINQ = 0; gint iSelector = 0; - + iNbSelectors = tvb_get_guint32_endian(tvb, offset, bLittleEndian); iNbIntegers = tvb_get_guint32_endian(tvb, offset + 4, bLittleEndian); iCharLen = tvb_get_guint32_endian(tvb, offset + 8, bLittleEndian); - + if (tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, -1, MQ_TEXT_INQ); mq_tree = proto_item_add_subtree(ti, ett_mq_inq); - + proto_tree_add_item(mq_tree, hf_mq_inq_nbsel, tvb, offset, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_inq_nbint, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_inq_charlen, tvb, offset + 8, 4, bLittleEndian); } - iOffsetINQ = 12; + iOffsetINQ = 12; if (tvb_length_remaining(tvb, offset + iOffsetINQ) >= iNbSelectors * 4) { if (tree) @@ -1531,23 +1531,23 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { gint iOffsetSPI = 0; guint32 iSpiVerb = 0; - + iSpiVerb = tvb_get_guint32_endian(tvb, offset, bLittleEndian); - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", val_to_str(iSpiVerb, mq_spi_verbs_vals, "Unknown (0x%08x)")); } - + if (tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, 12, MQ_TEXT_SPI); mq_tree = proto_item_add_subtree(ti, ett_mq_spi); - + proto_tree_add_item(mq_tree, hf_mq_spi_verb, tvb, offset, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_spi_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_spi_length, tvb, offset + 8, 4, bLittleEndian); } - + offset += 12; structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL; if ((structId == MQ_STRUCTID_SPQU || structId == MQ_STRUCTID_SPAU_EBCDIC @@ -1561,22 +1561,22 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8* sStructId; sStructId = tvb_get_ephemeral_string(tvb, offset, 4); - ti = proto_tree_add_text(mqroot_tree, tvb, offset, 12, (const char*)sStructId); + ti = proto_tree_add_text(mqroot_tree, tvb, offset, 12, "%s", sStructId); mq_tree = proto_item_add_subtree(ti, ett_mq_spi_base); - + proto_tree_add_item(mq_tree, hf_mq_spi_base_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_spi_base_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_spi_base_length, tvb, offset + 8, 4, bLittleEndian); } offset += 12; structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL; - + if ((iSizeSPIMD = dissect_mq_md(tvb, mqroot_tree, bLittleEndian, offset, &tMsgProps)) != 0) { gint iSizeGMO = 0; gint iSizePMO = 0; offset += iSizeSPIMD; - + if ((iSizeGMO = dissect_mq_gmo(tvb, pinfo, mqroot_tree, bLittleEndian, offset)) != 0) { offset += iSizeGMO; @@ -1587,7 +1587,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL; } - + if ((structId == MQ_STRUCTID_SPQO || structId == MQ_STRUCTID_SPQO_EBCDIC || structId == MQ_STRUCTID_SPQI || structId == MQ_STRUCTID_SPQI_EBCDIC || structId == MQ_STRUCTID_SPPO || structId == MQ_STRUCTID_SPPO_EBCDIC @@ -1595,7 +1595,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) || structId == MQ_STRUCTID_SPGO || structId == MQ_STRUCTID_SPGO_EBCDIC || structId == MQ_STRUCTID_SPGI || structId == MQ_STRUCTID_SPGI_EBCDIC || structId == MQ_STRUCTID_SPAO || structId == MQ_STRUCTID_SPAO_EBCDIC - || structId == MQ_STRUCTID_SPAI || structId == MQ_STRUCTID_SPAI_EBCDIC) + || structId == MQ_STRUCTID_SPAI || structId == MQ_STRUCTID_SPAI_EBCDIC) && tvb_length_remaining(tvb, offset) >= 12) { if (tree) @@ -1603,14 +1603,14 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Dissect the common part of these structures */ guint8* sStructId; sStructId = tvb_get_ephemeral_string(tvb, offset, 4); - ti = proto_tree_add_text(mqroot_tree, tvb, offset, -1, "%s", (const char*)sStructId); + ti = proto_tree_add_text(mqroot_tree, tvb, offset, -1, "%s", sStructId); mq_tree = proto_item_add_subtree(ti, ett_mq_spi_base); - + proto_tree_add_item(mq_tree, hf_mq_spi_base_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_spi_base_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_spi_base_length, tvb, offset + 8, 4, bLittleEndian); } - + if (structId == MQ_STRUCTID_SPQO && tvb_length_remaining(tvb, offset) >= 16) { if (tree) @@ -1618,11 +1618,11 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint iVerbNumber = 0; proto_tree_add_item(mq_tree, hf_mq_spi_spqo_nbverb, tvb, offset + 12, 4, bLittleEndian); iVerbNumber = tvb_get_guint32_endian(tvb, offset + 12, bLittleEndian); - + if (tvb_length_remaining(tvb, offset) >= iVerbNumber * 20 + 16) { gint iVerb = 0; - iOffsetSPI = offset + 16; + iOffsetSPI = offset + 16; for (iVerb = 0; iVerb < iVerbNumber; iVerb++) { proto_tree_add_item(mq_tree, hf_mq_spi_spqo_verbid, tvb, iOffsetSPI, 4, bLittleEndian); @@ -1665,11 +1665,11 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *mq_tree_sub = NULL; gint iOptionsFlags; - + ti = proto_tree_add_item(mq_tree, hf_mq_spi_spgo_options, tvb, offset + 12, 4, bLittleEndian); mq_tree_sub = proto_item_add_subtree(ti, ett_mq_spi_options); iOptionsFlags = tvb_get_guint32_endian(tvb, offset + 12, bLittleEndian); - + proto_tree_add_boolean(mq_tree_sub, hf_mq_spi_options_deferred, tvb, offset + 12, 4, iOptionsFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_spi_options_syncpoint, tvb, offset + 12, 4, iOptionsFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_spi_options_blank, tvb, offset + 12, 4, iOptionsFlags); @@ -1690,24 +1690,24 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else if ((opcode >= 0xA0 && opcode <= 0xB9) && tvb_length_remaining(tvb, offset) >= 16) { - /* The XA structures are special because they do not start with a structid */ + /* The XA structures are special because they do not start with a structid */ if (tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, 16, "%s (%s)", MQ_TEXT_XA, val_to_str(opcode, mq_opcode_vals, "Unknown (0x%02x)")); mq_tree = proto_item_add_subtree(ti, ett_mq_xa); - + proto_tree_add_item(mq_tree, hf_mq_xa_length, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_xa_returnvalue, tvb, offset + 4, 4, bLittleEndian); - + /* Transaction Manager flags */ { proto_tree *mq_tree_sub = NULL; guint32 iTMFlags; - + ti = proto_tree_add_item(mq_tree, hf_mq_xa_tmflags, tvb, offset + 8, 4, bLittleEndian); mq_tree_sub = proto_item_add_subtree(ti, ett_mq_xa_tmflags); iTMFlags = tvb_get_guint32_endian(tvb, offset + 8, bLittleEndian); - + proto_tree_add_boolean(mq_tree_sub, hf_mq_xa_tmflags_onephase, tvb, offset + 8, 4, iTMFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_xa_tmflags_fail, tvb, offset + 8, 4, iTMFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_xa_tmflags_resume, tvb, offset + 8, 4, iTMFlags); @@ -1717,7 +1717,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_boolean(mq_tree_sub, hf_mq_xa_tmflags_endrscan, tvb, offset + 8, 4, iTMFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_xa_tmflags_join, tvb, offset + 8, 4, iTMFlags); } - + proto_tree_add_item(mq_tree, hf_mq_xa_rmid, tvb, offset + 12, 4, bLittleEndian); } offset += 16; @@ -1740,7 +1740,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iXAInfoLength + 1, MQ_TEXT_XINF); mq_tree = proto_item_add_subtree(ti, ett_mq_xa_info); - + proto_tree_add_item(mq_tree, hf_mq_xa_xainfo_length, tvb, offset, 1, FALSE); proto_tree_add_item(mq_tree, hf_mq_xa_xainfo_value, tvb, offset + 1, iXAInfoLength, FALSE); } @@ -1766,7 +1766,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ((iSizeXid = dissect_mq_xid(tvb, mqroot_tree, bLittleEndian, offset)) != 0) offset += iSizeXid; else - break; + break; } } } @@ -1778,10 +1778,10 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) iVersionID = tvb_get_guint8(tvb, offset + 4); iSizeID = (iVersionID < 4 ? 44 : 104); /* guess */ /* actually 102 but must be aligned to multiple of 4 */ - + if (iSizeID != 0 && tvb_length_remaining(tvb, offset) >= iSizeID) { - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { guint8* sChannel; sChannel = tvb_get_ephemeral_string(tvb, offset + 24, 20); @@ -1790,24 +1790,24 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, ": CHL=%s", sChannel); } } - + if (tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeID, MQ_TEXT_ID); mq_tree = proto_item_add_subtree(ti, ett_mq_id); - + proto_tree_add_item(mq_tree, hf_mq_id_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_id_level, tvb, offset + 4, 1, FALSE); - + /* ID flags */ { proto_tree *mq_tree_sub = NULL; guint8 iIDFlags; - + ti = proto_tree_add_item(mq_tree, hf_mq_id_flags, tvb, offset + 5, 1, FALSE); mq_tree_sub = proto_item_add_subtree(ti, ett_mq_id_icf); iIDFlags = tvb_get_guint8(tvb, offset + 5); - + proto_tree_add_boolean(mq_tree_sub, hf_mq_id_icf_runtime, tvb, offset + 5, 1, iIDFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_id_icf_svrsec, tvb, offset + 5, 1, iIDFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_id_icf_mqreq, tvb, offset + 5, 1, iIDFlags); @@ -1815,18 +1815,18 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_boolean(mq_tree_sub, hf_mq_id_icf_convcap, tvb, offset + 5, 1, iIDFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_id_icf_msgseq, tvb, offset + 5, 1, iIDFlags); } - + proto_tree_add_item(mq_tree, hf_mq_id_unknown2, tvb, offset + 6, 1, FALSE); - + /* Error flags */ { proto_tree *mq_tree_sub = NULL; guint8 iErrorFlags; - + ti = proto_tree_add_item(mq_tree, hf_mq_id_ieflags, tvb, offset + 7, 1, FALSE); mq_tree_sub = proto_item_add_subtree(ti, ett_mq_id_ief); iErrorFlags = tvb_get_guint8(tvb, offset + 7); - + proto_tree_add_boolean(mq_tree_sub, hf_mq_id_ief_hbint, tvb, offset + 7, 1, iErrorFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_id_ief_seqwrap, tvb, offset + 7, 1, iErrorFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_id_ief_mxmsgpb, tvb, offset + 7, 1, iErrorFlags); @@ -1836,7 +1836,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_boolean(mq_tree_sub, hf_mq_id_ief_enc, tvb, offset + 7, 1, iErrorFlags); proto_tree_add_boolean(mq_tree_sub, hf_mq_id_ief_ccsid, tvb, offset + 7, 1, iErrorFlags); } - + proto_tree_add_item(mq_tree, hf_mq_id_unknown4, tvb, offset + 8, 2, FALSE); proto_tree_add_item(mq_tree, hf_mq_id_maxmsgperbatch, tvb, offset + 10, 2, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_id_maxtransmissionsize, tvb, offset + 12, 4, bLittleEndian); @@ -1844,10 +1844,10 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(mq_tree, hf_mq_id_sequencewrapvalue, tvb, offset + 20, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_id_channel, tvb, offset + 24, 20, FALSE); } - + if (iVersionID >= 4) { - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { guint8* sQueueManager; sQueueManager = tvb_get_ephemeral_string(tvb, offset + 48, 48); @@ -1856,7 +1856,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, " QM=%s", sQueueManager); } } - + if (tree) { proto_tree_add_item(mq_tree, hf_mq_id_capflags, tvb, offset + 44, 1, FALSE); @@ -1865,7 +1865,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(mq_tree, hf_mq_id_queuemanager, tvb, offset + 48, 48, FALSE); proto_tree_add_item(mq_tree, hf_mq_id_heartbeatinterval, tvb, offset + 96, 4, bLittleEndian); } - + } offset += iSizeID; } @@ -1878,10 +1878,10 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Instead we rely on the segment length announced in the TSH */ iSizeUID = iSegmentLength - iSizeTSH; if (iSizeUID != 28 && iSizeUID != 132) iSizeUID = 0; - + if (iSizeUID != 0 && tvb_length_remaining(tvb, offset) >= iSizeUID) { - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { guint8* sUserId; sUserId = tvb_get_ephemeral_string(tvb, offset + 4, 12); @@ -1890,17 +1890,17 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, ": User=%s", sUserId); } } - + if (tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeUID, MQ_TEXT_UID); mq_tree = proto_item_add_subtree(ti, ett_mq_uid); - + proto_tree_add_item(mq_tree, hf_mq_uid_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_uid_userid, tvb, offset + 4, 12, FALSE); proto_tree_add_item(mq_tree, hf_mq_uid_password, tvb, offset + 16, 12, FALSE); } - + if (iSizeUID == 132) { if (tree) @@ -1919,20 +1919,20 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 iVersionOD = 0; iVersionOD = tvb_get_guint32_endian(tvb, offset + 4, bLittleEndian); /* Compute length according to version */ - switch (iVersionOD) + switch (iVersionOD) { case 1: iSizeOD = 168; break; case 2: iSizeOD = 200; break; case 3: iSizeOD = 336; break; } - + if (iSizeOD != 0 && tvb_length_remaining(tvb, offset) >= iSizeOD) { gint iNbrRecords = 0; if (iVersionOD >= 2) iNbrRecords = tvb_get_guint32_endian(tvb, offset + 168, bLittleEndian); - - if (check_col(pinfo->cinfo, COL_INFO)) + + if (check_col(pinfo->cinfo, COL_INFO)) { guint8* sQueue; sQueue = tvb_get_ephemeral_string(tvb, offset + 12, 48); @@ -1941,12 +1941,12 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_fstr(pinfo->cinfo, COL_INFO, " Obj=%s", sQueue); } } - + if (tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeOD, MQ_TEXT_OD); mq_tree = proto_item_add_subtree(ti, ett_mq_od); - + proto_tree_add_item(mq_tree, hf_mq_od_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_od_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_od_objecttype, tvb, offset + 8, 4, bLittleEndian); @@ -1954,7 +1954,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(mq_tree, hf_mq_od_objectqmgrname, tvb, offset + 60, 48, FALSE); proto_tree_add_item(mq_tree, hf_mq_od_dynamicqname, tvb, offset + 108, 48, FALSE); proto_tree_add_item(mq_tree, hf_mq_od_alternateuserid, tvb, offset + 156, 12, FALSE); - + if (iVersionOD >= 2) { proto_tree_add_item(mq_tree, hf_mq_od_recspresent, tvb, offset + 168, 4, bLittleEndian); @@ -1966,23 +1966,23 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(mq_tree, hf_mq_od_objectrecptr, tvb, offset + 192, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_od_responserecptr, tvb, offset + 196, 4, bLittleEndian); } - + if (iVersionOD >= 3) { proto_tree_add_item(mq_tree, hf_mq_od_alternatesecurityid, tvb, offset + 200, 40, FALSE); proto_tree_add_item(mq_tree, hf_mq_od_resolvedqname, tvb, offset + 240, 48, FALSE); proto_tree_add_item(mq_tree, hf_mq_od_resolvedqmgrname, tvb, offset + 288, 48, FALSE); } - + } offset += iSizeOD; - + if (iNbrRecords > 0) { gint iOffsetOR = 0; gint iOffsetRR = 0; gint iSizeORRR = 0; - + iDistributionListSize = iNbrRecords; iOffsetOR = tvb_get_guint32_endian(tvb, offset - iSizeOD + 184, bLittleEndian); iOffsetRR = tvb_get_guint32_endian(tvb, offset - iSizeOD + 188, bLittleEndian); @@ -1994,8 +1994,8 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL; } - if ((opcode == MQ_TST_MQOPEN || opcode == MQ_TST_MQCLOSE - || opcode == MQ_TST_MQOPEN_REPLY || opcode == MQ_TST_MQCLOSE_REPLY) + if ((opcode == MQ_TST_MQOPEN || opcode == MQ_TST_MQCLOSE + || opcode == MQ_TST_MQOPEN_REPLY || opcode == MQ_TST_MQCLOSE_REPLY) && tvb_length_remaining(tvb, offset) >= 4) { if (tree) @@ -2012,7 +2012,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint iSizeGMO = 0; gint iSizePMO = 0; offset += iSizeMD; - + if ((iSizeGMO = dissect_mq_gmo(tvb, pinfo, mqroot_tree, bLittleEndian, offset)) != 0) { offset += iSizeGMO; @@ -2040,22 +2040,22 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (iDistributionListSize > 0) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, " (Distribution List, Size=%d)", iDistributionListSize); + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, " (Distribution List, Size=%d)", iDistributionListSize); } if (bPayload == TRUE) { if (iSizePayload != 0 && tvb_length_remaining(tvb, offset) > 0) { /* For the following header structures, each structure has a "format" field - which announces the type of the following structure. For dissection we + which announces the type of the following structure. For dissection we do not use it and rely on the structid instead. */ guint32 iHeadersLength = 0; if (tvb_length_remaining(tvb, offset) >= 4) { gint iSizeMD = 0; structId = tvb_get_ntohl(tvb, offset); - + if ((structId == MQ_STRUCTID_XQH || structId == MQ_STRUCTID_XQH_EBCDIC) && tvb_length_remaining(tvb, offset) >= 104) { /* if MD.format == MQXMIT */ @@ -2064,7 +2064,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeXQH, MQ_TEXT_XQH); mq_tree = proto_item_add_subtree(ti, ett_mq_xqh); - + proto_tree_add_item(mq_tree, hf_mq_xqh_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_xqh_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_xqh_remoteq, tvb, offset + 8, 48, FALSE); @@ -2072,13 +2072,13 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } offset += iSizeXQH; iHeadersLength += iSizeXQH; - + if ((iSizeMD = dissect_mq_md(tvb, mqroot_tree, bLittleEndian, offset, &tMsgProps)) != 0) { offset += iSizeMD; iHeadersLength += iSizeMD; } - + structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL; } if ((structId == MQ_STRUCTID_DH || structId == MQ_STRUCTID_DH_EBCDIC) && tvb_length_remaining(tvb, offset) >= 48) @@ -2087,7 +2087,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint iSizeDH = 48; gint iNbrRecords = 0; guint32 iRecFlags = 0; - + iNbrRecords = tvb_get_guint32_endian(tvb, offset + 36, bLittleEndian); iRecFlags = tvb_get_guint32_endian(tvb, offset + 32, bLittleEndian); tMsgProps.iOffsetEncoding = offset + 12; @@ -2098,7 +2098,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeDH, MQ_TEXT_DH); mq_tree = proto_item_add_subtree(ti, ett_mq_dh); - + proto_tree_add_item(mq_tree, hf_mq_head_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_head_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_head_length, tvb, offset + 8, 4, bLittleEndian); @@ -2113,13 +2113,13 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } offset += iSizeDH; iHeadersLength += iSizeDH; - + if (iNbrRecords > 0) { gint iOffsetOR = 0; gint iOffsetPMR = 0; gint iSizeORPMR = 0; - + iOffsetOR = tvb_get_guint32_endian(tvb, offset - iSizeDH + 40, bLittleEndian); iOffsetPMR = tvb_get_guint32_endian(tvb, offset - iSizeDH + 44, bLittleEndian); if ((iSizeORPMR = dissect_mq_or(tvb, mqroot_tree, offset, iNbrRecords, iOffsetOR)) != 0) @@ -2133,7 +2133,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) iHeadersLength += iSizeORPMR; } } - + structId = (tvb_length_remaining(tvb, offset) >= 4) ? tvb_get_ntohl(tvb, offset) : MQ_STRUCTID_NULL; } if ((structId == MQ_STRUCTID_DLH || structId == MQ_STRUCTID_DLH_EBCDIC) && tvb_length_remaining(tvb, offset) >= 172) @@ -2147,7 +2147,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeDLH, MQ_TEXT_DLH); mq_tree = proto_item_add_subtree(ti, ett_mq_dlh); - + proto_tree_add_item(mq_tree, hf_mq_dlh_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_dlh_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_dlh_reason, tvb, offset + 8, 4, bLittleEndian); @@ -2176,7 +2176,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeMDE, MQ_TEXT_MDE); mq_tree = proto_item_add_subtree(ti, ett_mq_mde); - + proto_tree_add_item(mq_tree, hf_mq_head_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_head_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_head_length, tvb, offset + 8, 4, bLittleEndian); @@ -2205,7 +2205,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* We assume that only one such header is present */ gint iSizeHeader = 0; iSizeHeader = tvb_get_guint32_endian(tvb, offset + 8, bLittleEndian); - + if (tvb_length_remaining(tvb, offset) >= iSizeHeader) { tMsgProps.iOffsetEncoding = offset + 12; @@ -2215,7 +2215,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { ti = proto_tree_add_text(mqroot_tree, tvb, offset, iSizeHeader, val_to_str(structId, mq_structid_vals, "Unknown (0x%08x)")); mq_tree = proto_item_add_subtree(ti, ett_mq_head); - + proto_tree_add_item(mq_tree, hf_mq_head_structid, tvb, offset, 4, FALSE); proto_tree_add_item(mq_tree, hf_mq_head_version, tvb, offset + 4, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_head_length, tvb, offset + 8, 4, bLittleEndian); @@ -2224,7 +2224,7 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(mq_tree, hf_mq_head_format, tvb, offset + 20, 8, FALSE); proto_tree_add_item(mq_tree, hf_mq_head_flags, tvb, offset + 28, 4, bLittleEndian); proto_tree_add_item(mq_tree, hf_mq_head_struct, tvb, offset + 32, iSizeHeader - 32, bLittleEndian); - + } offset += iSizeHeader; iHeadersLength += iSizeHeader; @@ -2232,13 +2232,13 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } - + if (tMsgProps.iOffsetFormat != 0) { guint8* sFormat = NULL; sFormat = tvb_get_ephemeral_string(tvb, tMsgProps.iOffsetFormat, 8); if (strip_trailing_blanks(sFormat, 8) == 0) sFormat = (guint8*)g_strdup("MQNONE"); - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " Fmt=%s", sFormat); } @@ -2247,11 +2247,11 @@ dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_string_hidden(tree, hf_mq_md_hidden_lastformat, tvb, tMsgProps.iOffsetFormat, 8, (const char*)sFormat); } } - if (check_col(pinfo->cinfo, COL_INFO)) + if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " (%d bytes)", iSizePayload - iHeadersLength); } - + { /* Call subdissector for the payload */ tvbuff_t* next_tvb = NULL; @@ -2310,13 +2310,13 @@ reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 structId; structId = tvb_get_ntohl(tvb, 0); - if (structId == MQ_STRUCTID_TSH || structId == MQ_STRUCTID_TSH_EBCDIC) + if (structId == MQ_STRUCTID_TSH || structId == MQ_STRUCTID_TSH_EBCDIC) { guint8 iControlFlags = 0; guint32 iSegmentLength = 0; guint32 iBeginLength = 0; guint8 opcode; - gboolean bFirstSegment; + gboolean bFirstSegment; gboolean bLastSegment; opcode = tvb_get_guint8(tvb, 9); iControlFlags = tvb_get_guint8(tvb, 10); @@ -2324,7 +2324,7 @@ reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) bFirstSegment = ((iControlFlags & MQ_TCF_FIRST) != 0); bLastSegment = ((iControlFlags & MQ_TCF_LAST) != 0); - if (opcode > 0x80 && !(bFirstSegment && bLastSegment)) + if (opcode > 0x80 && !(bFirstSegment && bLastSegment)) { /* Optimisation : only fragmented segments go through the reassembly process */ if (mq_reassembly) @@ -2334,10 +2334,10 @@ reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 iConnectionId = (pinfo->srcport + pinfo->destport); if (opcode > 0x80 && !bFirstSegment) iBeginLength = 28; fd_head = fragment_add_seq_next(tvb, iBeginLength, pinfo, iConnectionId, mq_fragment_table, mq_reassembled_table, iSegmentLength - iBeginLength, !bLastSegment); - if (fd_head != NULL && pinfo->fd->num == fd_head->reassembled_in) + if (fd_head != NULL && pinfo->fd->num == fd_head->reassembled_in) { /* Reassembly finished */ - if (fd_head->next != NULL) + if (fd_head->next != NULL) { /* 2 or more fragments */ next_tvb = tvb_new_real_data(fd_head->data, fd_head->len, fd_head->len); @@ -2355,7 +2355,7 @@ reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { /* Reassembly in progress */ - if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MQ"); + if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "MQ"); if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "%s [Reassembled MQ]", val_to_str(opcode, mq_opcode_vals, "Unknown (0x%02x)")); if (tree) { @@ -2364,7 +2364,7 @@ reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ti, " (%s) [Reassembled MQ]", val_to_str(opcode, mq_opcode_vals, "Unknown (0x%02x)")); } return; - } + } } else { @@ -2374,7 +2374,7 @@ reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* MQ segment is the first of a unreassembled series */ if (check_col(pinfo->cinfo, COL_INFO)) col_append_str(pinfo->cinfo, COL_INFO, " [Unreassembled MQ]"); } - return; + return; } } /* Reassembly not enabled or non-fragmented message */ @@ -2389,7 +2389,7 @@ get_mq_pdu_len(tvbuff_t *tvb, int offset) { if (tvb_length_remaining(tvb, offset) >= 8) { - if ((tvb_get_ntohl(tvb, 0) == MQ_STRUCTID_TSH || tvb_get_ntohl(tvb, 0) == MQ_STRUCTID_TSH_EBCDIC)) + if ((tvb_get_ntohl(tvb, 0) == MQ_STRUCTID_TSH || tvb_get_ntohl(tvb, 0) == MQ_STRUCTID_TSH_EBCDIC)) return tvb_get_ntohl(tvb, offset + 4); } return 0; @@ -2418,17 +2418,17 @@ dissect_mq_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint iProto structId = tvb_get_ntohl(tvb, 0); cEndian = tvb_get_guint8(tvb, 8); - if ((structId == MQ_STRUCTID_TSH || structId == MQ_STRUCTID_TSH_EBCDIC) + if ((structId == MQ_STRUCTID_TSH || structId == MQ_STRUCTID_TSH_EBCDIC) && (cEndian == MQ_LITTLE_ENDIAN || cEndian == MQ_BIG_ENDIAN)) { /* Register this dissector for this conversation */ conversation_t *conversation = NULL; conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); - if (conversation == NULL) + if (conversation == NULL) { conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); } - if (iProto == MQ_XPT_TCP) conversation_set_dissector(conversation, mq_tcp_handle); + if (iProto == MQ_XPT_TCP) conversation_set_dissector(conversation, mq_tcp_handle); /* Dissect the packet */ reassemble_mq(tvb, pinfo, tree); @@ -2484,16 +2484,16 @@ proto_register_mq(void) { &hf_mq_tsh_reserved, { "Reserved", "mq.tsh.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, "TSH Reserved", HFILL }}, - + { &hf_mq_tsh_luwid, { "Logical unit of work identifier", "mq.tsh.luwid", FT_BYTES, BASE_HEX, NULL, 0x0, "TSH logical unit of work identifier", HFILL }}, - + { &hf_mq_tsh_encoding, { "Encoding", "mq.tsh.encoding", FT_UINT32, BASE_DEC, NULL, 0x0, "TSH Encoding", HFILL }}, { &hf_mq_tsh_ccsid, { "Character set", "mq.tsh.ccsid", FT_UINT16, BASE_DEC, NULL, 0x0, "TSH CCSID", HFILL }}, - + { &hf_mq_tsh_padding, { "Padding", "mq.tsh.padding", FT_UINT16, BASE_HEX, NULL, 0x0, "TSH Padding", HFILL }}, |