diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-01-11 16:03:30 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-01-12 00:03:58 +0000 |
commit | f6791c1ab99bc19e1f08c8f2d2af0d4086529ff4 (patch) | |
tree | eceb6744dc3eea22daa2996dc573a87a1bc90e40 /epan/dissectors/packet-csm-encaps.c | |
parent | 93ab9e3dbf4ff69517ada73eca3a1990ba52b164 (diff) |
Stylistic and whitespace cleanups.
Change-Id: Ib3a0ca9793925a626ea3121ed2581f23d103bb2c
Reviewed-on: https://code.wireshark.org/review/13196
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-csm-encaps.c')
-rw-r--r-- | epan/dissectors/packet-csm-encaps.c | 53 |
1 files changed, 13 insertions, 40 deletions
diff --git a/epan/dissectors/packet-csm-encaps.c b/epan/dissectors/packet-csm-encaps.c index d1265612e9..40da697bae 100644 --- a/epan/dissectors/packet-csm-encaps.c +++ b/epan/dissectors/packet-csm-encaps.c @@ -20,7 +20,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include "config.h" @@ -28,19 +27,15 @@ #include <epan/packet.h> #include <epan/etypes.h> - #define OPCODE_NOOP 0x0000 #define OPCODE_CONTROL_PACKET 0x0001 #define OPCODE_RELIABLE_DATA 0x0002 - #define CSM_ENCAPS_CTRL_ACK 0x80 #define CSM_ENCAPS_CTRL_ACK_SUPPRESS 0x40 #define CSM_ENCAPS_CTRL_ACK_TO_HOST 0x20 #define CSM_ENCAPS_CTRL_ENDIAN 0x01 - - #define CSM_ENCAPS_TYPE_CHANGE 0x00 #define CSM_ENCAPS_TYPE_QUERY 0x01 #define CSM_ENCAPS_TYPE_RESPONSE 0x02 @@ -63,13 +58,10 @@ static const value_string function_code_vals[] = { { 0, NULL } }; - static const value_string class_type_vals[] = { { 0, NULL } }; - - static const value_string exclusive_to_host_vals[] = { { 0, NULL } }; @@ -78,13 +70,10 @@ static const value_string exclusive_to_host_ct_vals[] = { { 0, NULL } }; - static const value_string error_vals[] = { { 0, NULL } }; - - /* Initialize the protocol and registered fields */ static int proto_csm_encaps = -1; @@ -167,12 +156,9 @@ csm_fc(guint16 fc, guint16 ct) static gboolean csm_to_host(guint16 fc, guint16 ct) { - if (fc == 0x0000) - { + if (fc == 0x0000) { return (try_val_to_str(ct, exclusive_to_host_ct_vals) != NULL); - } - else - { + } else { return (try_val_to_str(fc, exclusive_to_host_vals) != NULL); } } @@ -207,12 +193,10 @@ dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da if (CSM_ENCAPS_CTRL_ACK&control) show_error_param= FALSE; - else - { + else { if (csm_to_host(function_code, class_type)) /* exclusive messages to host */ show_error_param= FALSE; - else - { + else { if (type == CSM_ENCAPS_TYPE_RESPONSE) show_error_param= TRUE; else @@ -220,14 +204,11 @@ dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da } } - col_set_str(pinfo->cinfo, COL_PROTOCOL, "CSM_ENCAPS"); col_clear(pinfo->cinfo, COL_INFO); - - if (CSM_ENCAPS_CTRL_ACK&control) - { + if (CSM_ENCAPS_CTRL_ACK&control) { if (CSM_ENCAPS_CTRL_ACK_TO_HOST&control) col_append_fstr(pinfo->cinfo, COL_INFO, "<-- ACK Ch: 0x%04X, Seq: %2d (To Host)", @@ -236,9 +217,7 @@ dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da col_append_fstr(pinfo->cinfo, COL_INFO, "--> ACK Ch: 0x%04X, Seq: %2d (From Host)", channel, sequence); - } - else - { + } else { str_function_name= csm_fc(function_code, class_type); if ((type == CSM_ENCAPS_TYPE_RESPONSE) || (csm_to_host(function_code, class_type))) col_append_fstr(pinfo->cinfo, COL_INFO, @@ -274,19 +253,18 @@ dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_type, tvb, 8, 1, ENC_BIG_ENDIAN); proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_function_code, tvb, 10, 2, ENC_LITTLE_ENDIAN); - i=6; + i = 6; if (i < length) { proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_reserved, tvb, 12 + i - 6, 2, ENC_LITTLE_ENDIAN); i += 2; } - if (i<length) - { + if (i < length) { if (show_error_param) - proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_param_error, tvb, 12 + i-6, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_param_error, tvb, 12 + i - 6, 2, ENC_LITTLE_ENDIAN); else - proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_param1, tvb, 12 + i-6, 2, ENC_LITTLE_ENDIAN); - i+=2; + proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_param1, tvb, 12 + i - 6, 2, ENC_LITTLE_ENDIAN); + i += 2; } if (i < length) { proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_param2, tvb, 12 + i - 6, 2, ENC_LITTLE_ENDIAN); @@ -445,8 +423,8 @@ dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da i += 2; } - for (; i<length; i+=2) - proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_param, tvb, 12 + i-6, 2, ENC_LITTLE_ENDIAN); + for (; i < length; i += 2) + proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_param, tvb, 12 + i - 6, 2, ENC_LITTLE_ENDIAN); } return tvb_captured_length(tvb); } @@ -459,7 +437,6 @@ proto_register_csm_encaps(void) static struct true_false_string control_ack_bit = {"ACK Packet", "Message Packet"}; static struct true_false_string control_ack_suppress_bit = {"ACK Suppressed", "ACK Required"}; - static hf_register_info hf[] = { { &hf_csm_encaps_opcode, { "Opcode", "csm_encaps.opcode", @@ -471,13 +448,11 @@ proto_register_csm_encaps(void) FT_UINT8, BASE_DEC, NULL, 0, "CSM_ENCAPS Sequence Number", HFILL } }, - { &hf_csm_encaps_ctrl, { "Control", "csm_encaps.ctrl", FT_UINT8, BASE_HEX, NULL, 0, "CSM_ENCAPS Control", HFILL } }, - { &hf_csm_encaps_ctrl_ack, { "Packet Bit", "csm_encaps.ctrl.ack", FT_BOOLEAN, 8, TFS(&control_ack_bit), CSM_ENCAPS_CTRL_ACK, @@ -493,8 +468,6 @@ proto_register_csm_encaps(void) FT_BOOLEAN, 8, TFS(&control_endian_bit), CSM_ENCAPS_CTRL_ENDIAN, "Little Endian/Big Endian", HFILL } }, - - { &hf_csm_encaps_channel, { "Channel Number", "csm_encaps.channel", FT_UINT16, BASE_HEX, NULL, 0, |