aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-srp.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2014-05-27 20:33:22 -0400
committerBill Meier <wmeier@newsguy.com>2014-05-28 15:40:39 +0000
commit48ce5629b0daaf0246f55d219d8d1ea8fd5c9699 (patch)
tree1b4e1a31ff45bccebe0bdd5ee7a3d25974ec43d3 /epan/dissectors/packet-srp.c
parente5705070c8c170ef35e92abf22f18828a9db2120 (diff)
Minor: use VALS macro (as per convention); Add editor modelines; Do whitespace changes.
Change-Id: I6007c1b2098d06e4a892474dd07f06a7538f94ef Reviewed-on: https://code.wireshark.org/review/1843 Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan/dissectors/packet-srp.c')
-rw-r--r--epan/dissectors/packet-srp.c139
1 files changed, 76 insertions, 63 deletions
diff --git a/epan/dissectors/packet-srp.c b/epan/dissectors/packet-srp.c
index 53eacf912e..65f2fad8e9 100644
--- a/epan/dissectors/packet-srp.c
+++ b/epan/dissectors/packet-srp.c
@@ -60,16 +60,16 @@ static dissector_handle_t h245dg_handle;
#define SRP_NSRP_RESPONSE 247
static const value_string srp_frame_types[] = {
- {SRP_SRP_COMMAND, "SRP command"},
- {SRP_SRP_RESPONSE, "SRP response"},
- {SRP_NSRP_RESPONSE, "NSRP response"},
- {0,NULL}
+ {SRP_SRP_COMMAND, "SRP command"},
+ {SRP_SRP_RESPONSE, "SRP response"},
+ {SRP_NSRP_RESPONSE, "NSRP response"},
+ {0,NULL}
};
static const value_string ccsrl_ls_vals[] = {
- {0xFF, "Yes"},
- {0x00, "No"},
- {0,NULL}
+ {0xFF, "Yes"},
+ {0x00, "No"},
+ {0,NULL}
};
/*****************************************************************************/
@@ -83,9 +83,9 @@ static void dissect_ccsrl(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree
/* add the 'ccsrl' tree to the main tree */
if (tree) {
- ccsrl_item = proto_tree_add_item (tree, proto_ccsrl, tvb, 0, -1, ENC_NA);
- ccsrl_tree = proto_item_add_subtree (ccsrl_item, ett_ccsrl);
- proto_tree_add_uint(ccsrl_tree,hf_ccsrl_ls,tvb,0,1,lastseg);
+ ccsrl_item = proto_tree_add_item (tree, proto_ccsrl, tvb, 0, -1, ENC_NA);
+ ccsrl_tree = proto_item_add_subtree (ccsrl_item, ett_ccsrl);
+ proto_tree_add_uint(ccsrl_tree,hf_ccsrl_ls,tvb,0,1,lastseg);
}
/* XXX add support for reassembly of fragments */
@@ -103,7 +103,7 @@ static void dissect_srp_command(tvbuff_t * tvb, packet_info * pinfo, proto_tree
guint payload_len;
if( srp_tree )
- proto_tree_add_item(srp_tree,hf_srp_seqno,tvb,1,1,ENC_BIG_ENDIAN);
+ proto_tree_add_item(srp_tree,hf_srp_seqno,tvb,1,1,ENC_BIG_ENDIAN);
payload_len = tvb_reported_length_remaining(tvb,4);
next_tvb = tvb_new_subset(tvb, 2, payload_len, payload_len );
@@ -124,50 +124,50 @@ static void dissect_srp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
/* add the 'srp' tree to the main tree */
if (tree) {
- srp_item = proto_tree_add_item (tree, proto_srp, tvb, 0, -1, ENC_NA);
- srp_tree = proto_item_add_subtree (srp_item, ett_srp);
- proto_tree_add_uint(srp_tree,hf_srp_header,tvb,0,1,header);
+ srp_item = proto_tree_add_item (tree, proto_srp, tvb, 0, -1, ENC_NA);
+ srp_tree = proto_item_add_subtree (srp_item, ett_srp);
+ proto_tree_add_uint(srp_tree,hf_srp_header,tvb,0,1,header);
}
switch( header ) {
- case SRP_SRP_COMMAND:
- dissect_srp_command(tvb,pinfo,srp_tree);
- break;
+ case SRP_SRP_COMMAND:
+ dissect_srp_command(tvb,pinfo,srp_tree);
+ break;
- case SRP_SRP_RESPONSE:
- break;
+ case SRP_SRP_RESPONSE:
+ break;
- case SRP_NSRP_RESPONSE:
- if( srp_tree )
- proto_tree_add_item(srp_tree,hf_srp_seqno,tvb,1,1,ENC_BIG_ENDIAN);
- break;
+ case SRP_NSRP_RESPONSE:
+ if( srp_tree )
+ proto_tree_add_item(srp_tree,hf_srp_seqno,tvb,1,1,ENC_BIG_ENDIAN);
+ break;
- default:
- break;
+ default:
+ break;
}
if( srp_tree ) {
- guint16 crc, calc_crc;
- guint crc_offset = tvb_reported_length(tvb)-2;
- crc = tvb_get_letohs(tvb,-2);
-
- /* crc includes the header */
- calc_crc = crc16_ccitt_tvb(tvb,crc_offset);
-
- if( crc == calc_crc ) {
- proto_tree_add_uint_format_value(srp_tree, hf_srp_crc, tvb,
- crc_offset, 2, crc,
- "0x%04x (correct)", crc);
- } else {
- hidden_item = proto_tree_add_boolean(srp_tree, hf_srp_crc_bad, tvb,
- crc_offset, 2, TRUE);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- proto_tree_add_uint_format_value(srp_tree, hf_srp_crc, tvb,
- crc_offset, 2, crc,
- "0x%04x (incorrect, should be 0x%04x)",
- crc,
- calc_crc);
- }
+ guint16 crc, calc_crc;
+ guint crc_offset = tvb_reported_length(tvb)-2;
+ crc = tvb_get_letohs(tvb,-2);
+
+ /* crc includes the header */
+ calc_crc = crc16_ccitt_tvb(tvb,crc_offset);
+
+ if( crc == calc_crc ) {
+ proto_tree_add_uint_format_value(srp_tree, hf_srp_crc, tvb,
+ crc_offset, 2, crc,
+ "0x%04x (correct)", crc);
+ } else {
+ hidden_item = proto_tree_add_boolean(srp_tree, hf_srp_crc_bad, tvb,
+ crc_offset, 2, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ proto_tree_add_uint_format_value(srp_tree, hf_srp_crc, tvb,
+ crc_offset, 2, crc,
+ "0x%04x (incorrect, should be 0x%04x)",
+ crc,
+ calc_crc);
+ }
}
}
@@ -175,13 +175,13 @@ static void dissect_srp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
void proto_register_ccsrl (void)
{
static hf_register_info hf[] = {
- { &hf_ccsrl_ls,
- { "Last Segment","ccsrl.ls",FT_UINT8, BASE_HEX, ccsrl_ls_vals, 0x0,
- "Last segment indicator", HFILL}},
+ { &hf_ccsrl_ls,
+ { "Last Segment","ccsrl.ls",FT_UINT8, BASE_HEX, VALS(ccsrl_ls_vals), 0x0,
+ "Last segment indicator", HFILL}},
};
static gint *ett[] = {
- &ett_ccsrl,
+ &ett_ccsrl,
};
proto_ccsrl = proto_register_protocol ("H.324/CCSRL", "CCSRL", "ccsrl");
@@ -193,22 +193,22 @@ void proto_register_ccsrl (void)
void proto_register_srp (void)
{
static hf_register_info hf[] = {
- {&hf_srp_header,
- { "Header", "srp.header", FT_UINT8, BASE_DEC, srp_frame_types, 0x0,
- "SRP header octet", HFILL }},
- {&hf_srp_seqno,
- { "Sequence Number", "srp.seqno", FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
- {&hf_srp_crc,
- { "CRC", "srp.crc", FT_UINT16, BASE_HEX, NULL, 0x0,
- NULL, HFILL }},
- { &hf_srp_crc_bad,
- { "Bad CRC","srp.crc_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ {&hf_srp_header,
+ { "Header", "srp.header", FT_UINT8, BASE_DEC, VALS(srp_frame_types), 0x0,
+ "SRP header octet", HFILL }},
+ {&hf_srp_seqno,
+ { "Sequence Number", "srp.seqno", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+ {&hf_srp_crc,
+ { "CRC", "srp.crc", FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+ { &hf_srp_crc_bad,
+ { "Bad CRC","srp.crc_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
};
static gint *ett[] = {
- &ett_srp,
+ &ett_srp,
};
proto_srp = proto_register_protocol ("H.324/SRP", "SRP", "srp");
@@ -227,3 +227,16 @@ void proto_reg_handoff_srp(void) {
ccsrl_handle = find_dissector("ccsrl");
h245dg_handle = find_dissector("h245dg");
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */