diff options
author | Bill Meier <wmeier@newsguy.com> | 2012-05-03 19:31:03 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2012-05-03 19:31:03 +0000 |
commit | 580a655675780955a9f7a00b920fc2ac73ce400d (patch) | |
tree | fd0120725ed14adc8b490facdc2652ab0b317caa /epan/dissectors/packet-fcsp.c | |
parent | 41cbf498209349af6e74123b82d4c93c2df67a75 (diff) |
General cleanup to include:
- remove unneeded includes;
- remove "boilerplate" comments;
- reformat hf[] entries;
- reformat long lines;
- unneeded use of check_col();
- whitespace fixes.
svn path=/trunk/; revision=42402
Diffstat (limited to 'epan/dissectors/packet-fcsp.c')
-rw-r--r-- | epan/dissectors/packet-fcsp.c | 472 |
1 files changed, 260 insertions, 212 deletions
diff --git a/epan/dissectors/packet-fcsp.c b/epan/dissectors/packet-fcsp.c index 34a9217d4a..c2f4c97761 100644 --- a/epan/dissectors/packet-fcsp.c +++ b/epan/dissectors/packet-fcsp.c @@ -9,12 +9,6 @@ * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * - * Copied from WHATEVER_FILE_YOU_USED (where "WHATEVER_FILE_YOU_USED" - * is a dissector file; if you just copied this from README.developer, - * don't bother with the "Copied from" - you don't even need to put - * in a "Copied from" if you copied an existing dissector, especially - * if the bulk of the code in the new dissector is your code) - * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -78,23 +72,23 @@ #define FC_AUTH_DHCHAP_PARAM_DHgIDLIST 0x2 /* Initialize the protocol and registered fields */ -static int proto_fcsp = -1; -static int hf_auth_proto_ver = -1; -static int hf_auth_msg_code = -1; -static int hf_auth_flags = -1; -static int hf_auth_len = -1; -static int hf_auth_tid = -1; -static int hf_auth_initiator_wwn = -1; -static int hf_auth_initiator_name = -1; -static int hf_auth_usable_proto = -1; -static int hf_auth_rjt_code = -1; -static int hf_auth_rjt_codedet = -1; -static int hf_auth_responder_wwn = -1; -static int hf_auth_responder_name = -1; -static int hf_auth_dhchap_groupid = -1; -static int hf_auth_dhchap_hashid = -1; +static int proto_fcsp = -1; +static int hf_auth_proto_ver = -1; +static int hf_auth_msg_code = -1; +static int hf_auth_flags = -1; +static int hf_auth_len = -1; +static int hf_auth_tid = -1; +static int hf_auth_initiator_wwn = -1; +static int hf_auth_initiator_name = -1; +static int hf_auth_usable_proto = -1; +static int hf_auth_rjt_code = -1; +static int hf_auth_rjt_codedet = -1; +static int hf_auth_responder_wwn = -1; +static int hf_auth_responder_name = -1; +static int hf_auth_dhchap_groupid = -1; +static int hf_auth_dhchap_hashid = -1; static int hf_auth_dhchap_chal_len = -1; -static int hf_auth_dhchap_val_len = -1; +static int hf_auth_dhchap_val_len = -1; static int hf_auth_dhchap_rsp_len = -1; static int hf_auth_initiator_name_type = -1; static int hf_auth_initiator_name_len = -1; @@ -116,18 +110,18 @@ static gint ett_fcsp = -1; static dissector_handle_t data_handle; static const value_string fcauth_msgcode_vals[] = { - {FC_AUTH_MSG_AUTH_REJECT, "AUTH_Reject"}, + {FC_AUTH_MSG_AUTH_REJECT, "AUTH_Reject"}, {FC_AUTH_MSG_AUTH_NEGOTIATE, "AUTH_Negotiate"}, - {FC_AUTH_MSG_AUTH_DONE, "AUTH_Done"}, - {FC_AUTH_DHCHAP_CHALLENGE, "DHCHAP_Challenge"}, - {FC_AUTH_DHCHAP_REPLY, "DHCHAP_Reply"}, - {FC_AUTH_DHCHAP_SUCCESS, "DHCHAP_Success"}, - {FC_AUTH_FCAP_REQUEST, "FCAP_Request"}, - {FC_AUTH_FCAP_ACKNOWLEDGE, "FCAP_Acknowledge"}, - {FC_AUTH_FCAP_CONFIRM, "FCAP_Confirm"}, - {FC_AUTH_FCPAP_INIT, "FCPAP_Init"}, - {FC_AUTH_FCPAP_ACCEPT, "FCPAP_Accept"}, - {FC_AUTH_FCPAP_COMPLETE, "FCPAP_Complete"}, + {FC_AUTH_MSG_AUTH_DONE, "AUTH_Done"}, + {FC_AUTH_DHCHAP_CHALLENGE, "DHCHAP_Challenge"}, + {FC_AUTH_DHCHAP_REPLY, "DHCHAP_Reply"}, + {FC_AUTH_DHCHAP_SUCCESS, "DHCHAP_Success"}, + {FC_AUTH_FCAP_REQUEST, "FCAP_Request"}, + {FC_AUTH_FCAP_ACKNOWLEDGE, "FCAP_Acknowledge"}, + {FC_AUTH_FCAP_CONFIRM, "FCAP_Confirm"}, + {FC_AUTH_FCPAP_INIT, "FCPAP_Init"}, + {FC_AUTH_FCPAP_ACCEPT, "FCPAP_Accept"}, + {FC_AUTH_FCPAP_COMPLETE, "FCPAP_Complete"}, {0, NULL}, }; @@ -150,13 +144,13 @@ static const value_string fcauth_rjtcode_detail_vals[] = { }; static const value_string fcauth_dhchap_param_vals[] = { - {FC_AUTH_DHCHAP_PARAM_HASHLIST, "HashList"}, + {FC_AUTH_DHCHAP_PARAM_HASHLIST, "HashList"}, {FC_AUTH_DHCHAP_PARAM_DHgIDLIST, "DHgIDList"}, {0, NULL}, }; static const value_string fcauth_dhchap_hash_algo_vals[] = { - {FC_AUTH_DHCHAP_HASH_MD5, "MD5"}, + {FC_AUTH_DHCHAP_HASH_MD5, "MD5"}, {FC_AUTH_DHCHAP_HASH_SHA1, "SHA-1"}, {0, NULL}, }; @@ -168,7 +162,7 @@ static const value_string fcauth_name_type_vals[] = { static const value_string fcauth_proto_type_vals[] = { {FC_AUTH_PROTO_TYPE_DHCHAP, "DHCHAP"}, - {FC_AUTH_PROTO_TYPE_FCAP, "FCAP"}, + {FC_AUTH_PROTO_TYPE_FCAP, "FCAP"}, {0, NULL}, }; @@ -185,32 +179,32 @@ static const value_string fcauth_dhchap_dhgid_vals[] = { that calls all the protocol registration. */ -static void dissect_fcsp_dhchap_auth_param (tvbuff_t *tvb, proto_tree *tree, +static void dissect_fcsp_dhchap_auth_param(tvbuff_t *tvb, proto_tree *tree, int offset, gint32 total_len) { guint16 auth_param_tag; guint16 param_len = 0, i; if (tree) { - auth_param_tag = tvb_get_ntohs (tvb, offset); + auth_param_tag = tvb_get_ntohs(tvb, offset); total_len -= 4; while (total_len > 0) { - proto_tree_add_item (tree, hf_auth_dhchap_param_tag, tvb, offset, - 2, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_auth_dhchap_param_len, tvb, offset+2, - 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_dhchap_param_tag, tvb, offset, + 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_dhchap_param_len, tvb, offset+2, + 2, ENC_BIG_ENDIAN); - auth_param_tag = tvb_get_ntohs (tvb, offset); - param_len = tvb_get_ntohs (tvb, offset+2)*4; + auth_param_tag = tvb_get_ntohs(tvb, offset); + param_len = tvb_get_ntohs(tvb, offset+2)*4; switch (auth_param_tag) { case FC_AUTH_DHCHAP_PARAM_HASHLIST: offset += 4; total_len -= 4; for (i = 0; i < param_len; i += 4) { - proto_tree_add_item (tree, hf_auth_dhchap_hash_type, tvb, - offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_dhchap_hash_type, tvb, + offset, 4, ENC_BIG_ENDIAN); offset += 4; } break; @@ -218,8 +212,8 @@ static void dissect_fcsp_dhchap_auth_param (tvbuff_t *tvb, proto_tree *tree, offset += 4; total_len -= 4; for (i = 0; i < param_len; i += 4) { - proto_tree_add_item (tree, hf_auth_dhchap_group_type, tvb, - offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_dhchap_group_type, tvb, + offset, 4, ENC_BIG_ENDIAN); offset += 4; } break; @@ -232,138 +226,138 @@ static void dissect_fcsp_dhchap_auth_param (tvbuff_t *tvb, proto_tree *tree, } } -static void dissect_fcsp_dhchap_challenge (tvbuff_t *tvb, proto_tree *tree) +static void dissect_fcsp_dhchap_challenge(tvbuff_t *tvb, proto_tree *tree) { - int offset = 12; + int offset = 12; guint16 name_type; guint16 param_len, name_len; if (tree) { - proto_tree_add_item (tree, hf_auth_responder_name_type, tvb, offset, - 2, ENC_BIG_ENDIAN); - name_type = tvb_get_ntohs (tvb, offset); + proto_tree_add_item(tree, hf_auth_responder_name_type, tvb, offset, + 2, ENC_BIG_ENDIAN); + name_type = tvb_get_ntohs(tvb, offset); - proto_tree_add_item (tree, hf_auth_responder_name_len, tvb, offset+2, - 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_responder_name_len, tvb, offset+2, + 2, ENC_BIG_ENDIAN); - name_len = tvb_get_ntohs (tvb, offset+2); + name_len = tvb_get_ntohs(tvb, offset+2); if (name_type == FC_AUTH_NAME_TYPE_WWN) { - proto_tree_add_string (tree, hf_auth_responder_wwn, tvb, offset+4, - 8, tvb_fcwwn_to_str (tvb, offset+4)); + proto_tree_add_string(tree, hf_auth_responder_wwn, tvb, offset+4, + 8, tvb_fcwwn_to_str(tvb, offset+4)); } else { - proto_tree_add_item (tree, hf_auth_responder_name, tvb, offset+4, - name_len, ENC_NA); + proto_tree_add_item(tree, hf_auth_responder_name, tvb, offset+4, + name_len, ENC_NA); } offset += (4+name_len); - proto_tree_add_item (tree, hf_auth_dhchap_hash_type, tvb, offset, - 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_auth_dhchap_group_type, tvb, offset+4, - 4, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_auth_dhchap_chal_len, tvb, offset+8, - 4, ENC_BIG_ENDIAN); - param_len = tvb_get_ntohl (tvb, offset+8); + proto_tree_add_item(tree, hf_auth_dhchap_hash_type, tvb, offset, + 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_dhchap_group_type, tvb, offset+4, + 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_dhchap_chal_len, tvb, offset+8, + 4, ENC_BIG_ENDIAN); + param_len = tvb_get_ntohl(tvb, offset+8); - proto_tree_add_item (tree, hf_auth_dhchap_chal_value, tvb, offset+12, - param_len, ENC_NA); + proto_tree_add_item(tree, hf_auth_dhchap_chal_value, tvb, offset+12, + param_len, ENC_NA); offset += (param_len + 12); - proto_tree_add_item (tree, hf_auth_dhchap_val_len, tvb, offset, 4, ENC_BIG_ENDIAN); - param_len = tvb_get_ntohl (tvb, offset); + proto_tree_add_item(tree, hf_auth_dhchap_val_len, tvb, offset, 4, ENC_BIG_ENDIAN); + param_len = tvb_get_ntohl(tvb, offset); - proto_tree_add_item (tree, hf_auth_dhchap_dhvalue, tvb, offset+4, - param_len, ENC_NA); + proto_tree_add_item(tree, hf_auth_dhchap_dhvalue, tvb, offset+4, + param_len, ENC_NA); } } -static void dissect_fcsp_dhchap_reply (tvbuff_t *tvb, proto_tree *tree) +static void dissect_fcsp_dhchap_reply(tvbuff_t *tvb, proto_tree *tree) { - int offset = 12; + int offset = 12; guint32 param_len; if (tree) { - proto_tree_add_item (tree, hf_auth_dhchap_rsp_len, tvb, offset, 4, ENC_BIG_ENDIAN); - param_len = tvb_get_ntohl (tvb, offset); + proto_tree_add_item(tree, hf_auth_dhchap_rsp_len, tvb, offset, 4, ENC_BIG_ENDIAN); + param_len = tvb_get_ntohl(tvb, offset); - proto_tree_add_item (tree, hf_auth_dhchap_rsp_value, tvb, offset+4, - param_len, ENC_NA); + proto_tree_add_item(tree, hf_auth_dhchap_rsp_value, tvb, offset+4, + param_len, ENC_NA); offset += (param_len + 4); - proto_tree_add_item (tree, hf_auth_dhchap_val_len, tvb, offset, 4, ENC_BIG_ENDIAN); - param_len = tvb_get_ntohl (tvb, offset); + proto_tree_add_item(tree, hf_auth_dhchap_val_len, tvb, offset, 4, ENC_BIG_ENDIAN); + param_len = tvb_get_ntohl(tvb, offset); - proto_tree_add_item (tree, hf_auth_dhchap_dhvalue, tvb, offset+4, - param_len, ENC_NA); + proto_tree_add_item(tree, hf_auth_dhchap_dhvalue, tvb, offset+4, + param_len, ENC_NA); offset += (param_len + 4); - proto_tree_add_item (tree, hf_auth_dhchap_chal_len, tvb, offset, 4, ENC_BIG_ENDIAN); - param_len = tvb_get_ntohl (tvb, offset); + proto_tree_add_item(tree, hf_auth_dhchap_chal_len, tvb, offset, 4, ENC_BIG_ENDIAN); + param_len = tvb_get_ntohl(tvb, offset); - proto_tree_add_item (tree, hf_auth_dhchap_chal_value, tvb, offset+4, - param_len, ENC_NA); + proto_tree_add_item(tree, hf_auth_dhchap_chal_value, tvb, offset+4, + param_len, ENC_NA); } } -static void dissect_fcsp_dhchap_success (tvbuff_t *tvb, proto_tree *tree) +static void dissect_fcsp_dhchap_success(tvbuff_t *tvb, proto_tree *tree) { - int offset = 12; + int offset = 12; guint32 param_len; if (tree) { - proto_tree_add_item (tree, hf_auth_dhchap_rsp_len, tvb, offset, 4, ENC_BIG_ENDIAN); - param_len = tvb_get_ntohl (tvb, offset); + proto_tree_add_item(tree, hf_auth_dhchap_rsp_len, tvb, offset, 4, ENC_BIG_ENDIAN); + param_len = tvb_get_ntohl(tvb, offset); - proto_tree_add_item (tree, hf_auth_dhchap_rsp_value, tvb, offset+4, - param_len, ENC_NA); + proto_tree_add_item(tree, hf_auth_dhchap_rsp_value, tvb, offset+4, + param_len, ENC_NA); } } -static void dissect_fcsp_auth_negotiate (tvbuff_t *tvb, proto_tree *tree) +static void dissect_fcsp_auth_negotiate(tvbuff_t *tvb, proto_tree *tree) { - int offset = 12; + int offset = 12; guint16 name_type, name_len, proto_type, param_len; guint32 num_protos, i; if (tree) { - proto_tree_add_item (tree, hf_auth_initiator_name_type, tvb, offset, - 2, ENC_BIG_ENDIAN); - name_type = tvb_get_ntohs (tvb, offset); + proto_tree_add_item(tree, hf_auth_initiator_name_type, tvb, offset, + 2, ENC_BIG_ENDIAN); + name_type = tvb_get_ntohs(tvb, offset); - proto_tree_add_item (tree, hf_auth_initiator_name_len, tvb, offset+2, - 2, ENC_BIG_ENDIAN); - name_len = tvb_get_ntohs (tvb, offset+2); + proto_tree_add_item(tree, hf_auth_initiator_name_len, tvb, offset+2, + 2, ENC_BIG_ENDIAN); + name_len = tvb_get_ntohs(tvb, offset+2); if (name_type == FC_AUTH_NAME_TYPE_WWN) { - proto_tree_add_string (tree, hf_auth_initiator_wwn, tvb, offset+4, 8, - tvb_fcwwn_to_str (tvb, offset+4)); + proto_tree_add_string(tree, hf_auth_initiator_wwn, tvb, offset+4, 8, + tvb_fcwwn_to_str(tvb, offset+4)); } else { - proto_tree_add_item (tree, hf_auth_initiator_name, tvb, offset+4, - name_len, ENC_NA); + proto_tree_add_item(tree, hf_auth_initiator_name, tvb, offset+4, + name_len, ENC_NA); } offset += (4+name_len); - proto_tree_add_item (tree, hf_auth_usable_proto, tvb, offset, 4, ENC_BIG_ENDIAN); - num_protos = tvb_get_ntohl (tvb, offset); + proto_tree_add_item(tree, hf_auth_usable_proto, tvb, offset, 4, ENC_BIG_ENDIAN); + num_protos = tvb_get_ntohl(tvb, offset); offset += 4; for (i = 0; i < num_protos; i++) { - proto_tree_add_item (tree, hf_auth_proto_param_len, tvb, offset, 4, ENC_BIG_ENDIAN); - param_len = tvb_get_ntohl (tvb, offset); + proto_tree_add_item(tree, hf_auth_proto_param_len, tvb, offset, 4, ENC_BIG_ENDIAN); + param_len = tvb_get_ntohl(tvb, offset); offset += 4; - if (tvb_bytes_exist (tvb, offset, param_len)) { - proto_type = tvb_get_ntohl (tvb, offset); + if (tvb_bytes_exist(tvb, offset, param_len)) { + proto_type = tvb_get_ntohl(tvb, offset); - proto_tree_add_item (tree, hf_auth_proto_type, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_proto_type, tvb, offset, 4, ENC_BIG_ENDIAN); switch (proto_type) { case FC_AUTH_PROTO_TYPE_DHCHAP: - dissect_fcsp_dhchap_auth_param (tvb, tree, offset+4, param_len); + dissect_fcsp_dhchap_auth_param(tvb, tree, offset+4, param_len); break; case FC_AUTH_PROTO_TYPE_FCAP: break; @@ -376,65 +370,65 @@ static void dissect_fcsp_auth_negotiate (tvbuff_t *tvb, proto_tree *tree) } } -static void dissect_fcsp_auth_done (tvbuff_t *tvb _U_, proto_tree *tree _U_) +static void dissect_fcsp_auth_done(tvbuff_t *tvb _U_, proto_tree *tree _U_) { } -static void dissect_fcsp_auth_rjt (tvbuff_t *tvb, proto_tree *tree) +static void dissect_fcsp_auth_rjt(tvbuff_t *tvb, proto_tree *tree) { int offset = 12; if (tree) { - proto_tree_add_item (tree, hf_auth_rjt_code, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_auth_rjt_codedet, tvb, offset+1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_rjt_code, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_auth_rjt_codedet, tvb, offset+1, 1, ENC_BIG_ENDIAN); } } -static void dissect_fcsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static void dissect_fcsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti = NULL; - guint8 opcode; - int offset = 0; + proto_item *ti = NULL; + guint8 opcode; + int offset = 0; proto_tree *fcsp_tree = NULL; /* Make entry in the Info column on summary display */ - opcode = tvb_get_guint8 (tvb, 2); + opcode = tvb_get_guint8(tvb, 2); - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_str (pinfo->cinfo, COL_INFO, - val_to_str (opcode, fcauth_msgcode_vals, "0x%x")); + if (check_col(pinfo->cinfo, COL_INFO)) { + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(opcode, fcauth_msgcode_vals, "0x%x")); } if (tree) { - ti = proto_tree_add_protocol_format (tree, proto_fcsp, tvb, 0, - tvb_length (tvb), "FC-SP"); - fcsp_tree = proto_item_add_subtree (ti, ett_fcsp); + ti = proto_tree_add_protocol_format(tree, proto_fcsp, tvb, 0, + tvb_length(tvb), "FC-SP"); + fcsp_tree = proto_item_add_subtree(ti, ett_fcsp); - proto_tree_add_item (fcsp_tree, hf_auth_flags, tvb, offset+1, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (fcsp_tree, hf_auth_msg_code, tvb, offset+2, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (fcsp_tree, hf_auth_proto_ver, tvb, offset+3, 1, - ENC_BIG_ENDIAN); - proto_tree_add_item (fcsp_tree, hf_auth_len, tvb, offset+4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item (fcsp_tree, hf_auth_tid, tvb, offset+8, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(fcsp_tree, hf_auth_flags, tvb, offset+1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(fcsp_tree, hf_auth_msg_code, tvb, offset+2, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(fcsp_tree, hf_auth_proto_ver, tvb, offset+3, 1, + ENC_BIG_ENDIAN); + proto_tree_add_item(fcsp_tree, hf_auth_len, tvb, offset+4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(fcsp_tree, hf_auth_tid, tvb, offset+8, 4, ENC_BIG_ENDIAN); switch (opcode) { case FC_AUTH_MSG_AUTH_REJECT: - dissect_fcsp_auth_rjt (tvb, tree); + dissect_fcsp_auth_rjt(tvb, tree); break; case FC_AUTH_MSG_AUTH_NEGOTIATE: - dissect_fcsp_auth_negotiate (tvb, tree); + dissect_fcsp_auth_negotiate(tvb, tree); break; case FC_AUTH_MSG_AUTH_DONE: - dissect_fcsp_auth_done (tvb, tree); + dissect_fcsp_auth_done(tvb, tree); break; case FC_AUTH_DHCHAP_CHALLENGE: - dissect_fcsp_dhchap_challenge (tvb, tree); + dissect_fcsp_dhchap_challenge(tvb, tree); break; case FC_AUTH_DHCHAP_REPLY: - dissect_fcsp_dhchap_reply (tvb, tree); + dissect_fcsp_dhchap_reply(tvb, tree); break; case FC_AUTH_DHCHAP_SUCCESS: - dissect_fcsp_dhchap_success (tvb, tree); + dissect_fcsp_dhchap_success(tvb, tree); break; case FC_AUTH_FCAP_REQUEST: case FC_AUTH_FCAP_ACKNOWLEDGE: @@ -442,8 +436,8 @@ static void dissect_fcsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case FC_AUTH_FCPAP_INIT: case FC_AUTH_FCPAP_ACCEPT: case FC_AUTH_FCPAP_COMPLETE: - proto_tree_add_text (fcsp_tree, tvb, offset+12, tvb_length (tvb), - "FCAP Decoding Not Supported"); + proto_tree_add_text(fcsp_tree, tvb, offset+12, tvb_length(tvb), + "FCAP Decoding Not Supported"); break; default: break; @@ -452,101 +446,159 @@ static void dissect_fcsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } void -proto_register_fcsp (void) +proto_register_fcsp(void) { /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { { &hf_auth_proto_ver, - {"Protocol Version", "fcsp.version", FT_UINT8, BASE_HEX, NULL, - 0x0, NULL, HFILL}}, + { "Protocol Version", "fcsp.version", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_msg_code, - {"Message Code", "fcsp.opcode", FT_UINT8, BASE_HEX, - VALS (fcauth_msgcode_vals), 0x0, NULL, HFILL}}, + { "Message Code", "fcsp.opcode", + FT_UINT8, BASE_HEX, VALS(fcauth_msgcode_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_flags, - {"Flags", "fcsp.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, - HFILL}}, + { "Flags", "fcsp.flags", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_len, - {"Packet Length", "fcsp.len", FT_UINT32, BASE_DEC, NULL, 0x0, - NULL, HFILL}}, + { "Packet Length", "fcsp.len", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_tid, - {"Transaction Identifier", "fcsp.tid", FT_UINT32, BASE_HEX, NULL, - 0x0, NULL, HFILL}}, + { "Transaction Identifier", "fcsp.tid", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_initiator_wwn, - {"Initiator Name (WWN)", "fcsp.initwwn", FT_STRING, BASE_NONE, NULL, - 0x0, NULL, HFILL}}, + { "Initiator Name (WWN)", "fcsp.initwwn", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_initiator_name, - {"Initiator Name (Unknown Type)", "fcsp.initname", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL}}, + { "Initiator Name (Unknown Type)", "fcsp.initname", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_initiator_name_type, - {"Initiator Name Type", "fcsp.initnametype", FT_UINT16, BASE_HEX, - VALS (fcauth_name_type_vals), 0x0, NULL, HFILL}}, + { "Initiator Name Type", "fcsp.initnametype", + FT_UINT16, BASE_HEX, VALS(fcauth_name_type_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_initiator_name_len, - {"Initiator Name Length", "fcsp.initnamelen", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + { "Initiator Name Length", "fcsp.initnamelen", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_usable_proto, - {"Number of Usable Protocols", "fcsp.usableproto", FT_UINT32, - BASE_DEC, NULL, 0x0, NULL, HFILL}}, + { "Number of Usable Protocols", "fcsp.usableproto", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_rjt_code, - {"Reason Code", "fcsp.rjtcode", FT_UINT8, BASE_DEC, - VALS (fcauth_rjtcode_vals), 0x0, NULL, HFILL}}, + { "Reason Code", "fcsp.rjtcode", + FT_UINT8, BASE_DEC, VALS(fcauth_rjtcode_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_rjt_codedet, - {"Reason Code Explanation", "fcsp.rjtcodet", FT_UINT8, BASE_DEC, - VALS (fcauth_rjtcode_detail_vals), 0x0, NULL, HFILL}}, + { "Reason Code Explanation", "fcsp.rjtcodet", + FT_UINT8, BASE_DEC, VALS(fcauth_rjtcode_detail_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_responder_wwn, - {"Responder Name (WWN)", "fcsp.rspwwn", FT_STRING, BASE_NONE, NULL, - 0x0, NULL, HFILL}}, + { "Responder Name (WWN)", "fcsp.rspwwn", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_responder_name, - {"Responder Name (Unknown Type)", "fcsp.rspname", FT_BYTES, BASE_NONE, - NULL, 0x0, NULL, HFILL}}, + { "Responder Name (Unknown Type)", "fcsp.rspname", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_responder_name_type, - {"Responder Name Type", "fcsp.rspnametype", FT_UINT16, BASE_HEX, - VALS (fcauth_name_type_vals), 0x0, NULL, HFILL}}, + { "Responder Name Type", "fcsp.rspnametype", + FT_UINT16, BASE_HEX, VALS(fcauth_name_type_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_responder_name_len, - {"Responder Name Type", "fcsp.rspnamelen", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + { "Responder Name Type", "fcsp.rspnamelen", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_hashid, - {"Hash Identifier", "fcsp.dhchap.hashid", FT_UINT32, BASE_HEX, NULL, 0x0, - NULL, HFILL}}, + { "Hash Identifier", "fcsp.dhchap.hashid", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_groupid, - {"DH Group Identifier", "fcsp.dhchap.groupid", FT_UINT32, BASE_HEX, NULL, - 0x0, NULL, HFILL}}, + { "DH Group Identifier", "fcsp.dhchap.groupid", + FT_UINT32, BASE_HEX, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_chal_len, - {"Challenge Value Length", "fcsp.dhchap.challen", FT_UINT32, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + { "Challenge Value Length", "fcsp.dhchap.challen", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_val_len, - {"DH Value Length", "fcsp.dhchap.vallen", FT_UINT32, BASE_DEC, NULL, - 0x0, NULL, HFILL}}, + { "DH Value Length", "fcsp.dhchap.vallen", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_rsp_len, - {"Response Value Length", "fcsp.dhchap.rsplen", FT_UINT32, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + { "Response Value Length", "fcsp.dhchap.rsplen", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_proto_type, - {"Authentication Protocol Type", "fcsp.proto", FT_UINT32, BASE_DEC, - VALS (fcauth_proto_type_vals), 0x0, NULL, HFILL}}, + { "Authentication Protocol Type", "fcsp.proto", + FT_UINT32, BASE_DEC, VALS(fcauth_proto_type_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_proto_param_len, - {"Protocol Parameters Length", "fcsp.protoparamlen", FT_UINT32, - BASE_DEC, NULL, 0x0, NULL, HFILL}}, + { "Protocol Parameters Length", "fcsp.protoparamlen", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_param_tag, - {"Parameter Tag", "fcsp.dhchap.paramtype", FT_UINT16, BASE_HEX, - VALS (fcauth_dhchap_param_vals), 0x0, NULL, HFILL}}, + { "Parameter Tag", "fcsp.dhchap.paramtype", + FT_UINT16, BASE_HEX, VALS(fcauth_dhchap_param_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_param_len, - {"Parameter Length", "fcsp.dhchap.paramlen", FT_UINT16, BASE_DEC, - NULL, 0x0, NULL, HFILL}}, + { "Parameter Length", "fcsp.dhchap.paramlen", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_hash_type, - {"Hash Algorithm", "fcsp.dhchap.hashtype", FT_UINT32, BASE_DEC, - VALS (fcauth_dhchap_hash_algo_vals), 0x0, NULL, HFILL}}, + { "Hash Algorithm", "fcsp.dhchap.hashtype", + FT_UINT32, BASE_DEC, VALS(fcauth_dhchap_hash_algo_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_group_type, - {"DH Group", "fcsp.dhchap.dhgid", FT_UINT32, BASE_DEC, - VALS (fcauth_dhchap_dhgid_vals), 0x0, NULL, HFILL}}, + { "DH Group", "fcsp.dhchap.dhgid", + FT_UINT32, BASE_DEC, VALS(fcauth_dhchap_dhgid_vals), 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_chal_value, - {"Challenge Value", "fcsp.dhchap.chalval", FT_BYTES, BASE_NONE, - NULL, 0x0, NULL, HFILL}}, + { "Challenge Value", "fcsp.dhchap.chalval", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_dhvalue, - {"DH Value", "fcsp.dhchap.dhvalue", FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL}}, - { &hf_auth_dhchap_rsp_value, - {"Response Value", "fcsp.dhchap.rspval", FT_BYTES, BASE_NONE, NULL, - 0x0, NULL, HFILL}}, + { "DH Value", "fcsp.dhchap.dhvalue", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL}}, + { &hf_auth_dhchap_rsp_value, + { "Response Value", "fcsp.dhchap.rspval", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL}}, }; @@ -556,22 +608,18 @@ proto_register_fcsp (void) }; /* Register the protocol name and description */ - proto_fcsp = proto_register_protocol ("Fibre Channel Security Protocol", + proto_fcsp = proto_register_protocol("Fibre Channel Security Protocol", "FC-SP", "fcsp"); register_dissector("fcsp", dissect_fcsp, proto_fcsp); - /* Required function calls to register the header fields and subtrees used */ + proto_register_field_array(proto_fcsp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } -/* If this dissector uses sub-dissector registration add a registration routine. - This format is required because a script is used to find these routines and - create the code that calls these routines. -*/ void -proto_reg_handoff_fcsp (void) +proto_reg_handoff_fcsp(void) { - data_handle = find_dissector ("data"); + data_handle = find_dissector("data"); } |