diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2009-06-02 21:44:00 +0000 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2009-06-02 21:44:00 +0000 |
commit | a27093be2ec4e9d22c666989a4d841022af346fc (patch) | |
tree | f219384f640984a1e3ac2ca6ee7a5b45755a1f06 | |
parent | d9b405deb98be4c06b53b7a9050fa27a65ff5ed5 (diff) |
Remove the module globals.
Clean up the source code.
svn path=/trunk/; revision=28615
-rw-r--r-- | epan/dissectors/packet-capwap.c | 534 |
1 files changed, 257 insertions, 277 deletions
diff --git a/epan/dissectors/packet-capwap.c b/epan/dissectors/packet-capwap.c index ecb15ee07f..5076afc3b8 100644 --- a/epan/dissectors/packet-capwap.c +++ b/epan/dissectors/packet-capwap.c @@ -46,8 +46,8 @@ static guint global_capwap_data_udp_port = UDP_PORT_CAPWAP_DATA; /* TODO LIST ! * add support of optional Header (Radio Mac/Wireless Specific Information : Section 4.3) -* add dencryption of DLTS Message -* add Support of All Messages Element Type +* add decryption of DLTS Message +* add support of all Messages Element Type */ /* Forward declaration we need below */ @@ -96,7 +96,6 @@ static int hf_capwap_msg_element_type_ac_descriptor_stations = -1; static int hf_capwap_msg_element_type_ac_descriptor_limit = -1; static int hf_capwap_msg_element_type_ac_descriptor_active_wtp = -1; static int hf_capwap_msg_element_type_ac_descriptor_max_wtp = -1; - /* AC Descriptor Security Flags... */ static int hf_capwap_msg_element_type_ac_descriptor_security = -1; static int hf_capwap_msg_element_type_ac_descriptor_security_s = -1; @@ -104,7 +103,6 @@ static int hf_capwap_msg_element_type_ac_descriptor_security_x = -1; static int hf_capwap_msg_element_type_ac_descriptor_security_r = -1; static int hf_capwap_msg_element_type_ac_descriptor_rmac_field = -1; static int hf_capwap_msg_element_type_ac_descriptor_reserved = -1; - /* AC Descriptor DTLS Policy Flags... */ static int hf_capwap_msg_element_type_ac_descriptor_dtls_policy = -1; static int hf_capwap_msg_element_type_ac_descriptor_dtls_policy_d = -1; @@ -163,20 +161,18 @@ static dissector_handle_t data_handle; /* Initialize the subtree pointers */ static gint ett_capwap = -1; + /* ************************************************************************* */ -/* Header Type */ +/* Header Type */ /* ************************************************************************* */ - static const value_string type_header_vals[] = { { 0, "CAPWAP Header" }, { 1, "CAPWAP DTLS Header" }, { 0, NULL } }; - /* ************************************************************************* */ /* Wireless Binding IDentifier (WBID) */ /* ************************************************************************* */ - static const value_string type_wbid[] = { { 0, "Reserved" }, { 1, "IEEE 802.11" }, @@ -184,57 +180,50 @@ static const value_string type_wbid[] = { { 3, "EPCGlobal" }, { 0, NULL } }; - /* ************************************************************************* */ -/* flag Type Transported (payload) */ +/* flag Type Transported (payload) */ /* ************************************************************************* */ static const true_false_string flag_type_t = { "Native frame format (see Wireless Binding ID field)", "IEEE 802.3 frame" }; - /* ************************************************************************* */ -/* flag Type Fragment */ +/* flag Type Fragment */ /* ************************************************************************* */ static const true_false_string flag_type_f = { "Fragmented", "Don't Fragment" }; - /* ************************************************************************* */ -/* flag Type Last Fragment */ +/* flag Type Last Fragment */ /* ************************************************************************* */ static const true_false_string flag_type_l = { "This is the last fragment", "More fragments follow" }; - /* ************************************************************************* */ -/* flag Type Wireless */ +/* flag Type Wireless */ /* ************************************************************************* */ static const true_false_string flag_type_w = { "Wireless Specific Information is present", "No Wireless Specific Information" }; - /* ************************************************************************* */ -/* flag Type Radio Mac */ +/* flag Type Radio Mac */ /* ************************************************************************* */ static const true_false_string flag_type_m = { "Radio MAC Address is present", "No Radio MAC Address" }; - /* ************************************************************************* */ -/* flag Type Keep Alive */ +/* flag Type Keep Alive */ /* ************************************************************************* */ static const true_false_string flag_type_k = { "Keep-Alive Packet", "No Keep-Alive" }; - /* ************************************************************************* */ -/* Message Type Value */ +/* Message Type Value */ /* ************************************************************************* */ static const value_string message_type[] = { { 1, "Discovery Request" }, @@ -265,12 +254,11 @@ static const value_string message_type[] = { { 26, "Station Configuration Response" }, { 0, NULL } }; - /* ************************************************************************* */ -/* Message Element Type */ +/* Message Element Type */ /* ************************************************************************* */ -#define TYPE_AC_DESCRIPTOR 1 -#define TYPE_AC_IPV4_LIST 2 +#define TYPE_AC_DESCRIPTOR 1 +#define TYPE_AC_IPV4_LIST 2 #define TYPE_AC_IPV6_LIST 3 #define TYPE_AC_NAME 4 #define TYPE_AC_NAME_W_PRIORITY 5 @@ -279,7 +267,7 @@ static const value_string message_type[] = { #define TYPE_ADD_STATION 8 #define TYPE_RESERVED_9 9 #define TYPE_CAPWAP_CONTROL_IPV4_ADDRESS 10 -#define TYPE_CAPWAP_CONTROL_IPV6_ADDRESS 11 +#define TYPE_CAPWAP_CONTROL_IPV6_ADDRESS 11 #define TYPE_CAPWAP_TIMERS 12 #define TYPE_DATA_TRANSFER_DATA 13 #define TYPE_DATA_TRANSFER_MODE 14 @@ -287,7 +275,7 @@ static const value_string message_type[] = { #define TYPE_DECRYPTION_ERROR_REPORT_PERIOD 16 #define TYPE_DELETE_MAC_ENTRY 17 #define TYPE_DELETE_STATION 18 -#define TYPE_RESERVED_19 19 +#define TYPE_RESERVED_19 19 #define TYPE_DISCOVERY_TYPE 20 #define TYPE_DUPLICATE_IPV4_ADDRESS 21 #define TYPE_DUPLICATE_IPV6_ADDRESS 22 @@ -322,9 +310,8 @@ static const value_string message_type[] = { #define TYPE_CAPWAP_TRANSPORT_PROTOCOL 51 #define TYPE_MTU_DISCOVERY_PADDING 52 #define TYPE_ECN_SUPPORT 53 - /* ************************************************************************* */ -/* Message Element Type Value */ +/* Message Element Type Value */ /* ************************************************************************* */ static const value_string message_element_type_vals[] = { { TYPE_AC_DESCRIPTOR, "AC Descriptor" }, @@ -345,7 +332,7 @@ static const value_string message_element_type_vals[] = { { TYPE_DECRYPTION_ERROR_REPORT_PERIOD, "Decryption Error Report Period" }, { TYPE_DELETE_MAC_ENTRY, "Delete MAC ACL Entry" }, { TYPE_DELETE_STATION, "Delete Station" }, - { TYPE_RESERVED_19, "Reserved" }, + { TYPE_RESERVED_19, "Reserved" }, { TYPE_DISCOVERY_TYPE, "Discovery Type" }, { TYPE_DUPLICATE_IPV4_ADDRESS, "Duplicate IPv4 Address" }, { TYPE_DUPLICATE_IPV6_ADDRESS, "Duplicate IPv6 Address" }, @@ -382,9 +369,8 @@ static const value_string message_element_type_vals[] = { { TYPE_ECN_SUPPORT, "ECN Support" }, { 0, NULL } }; - /* ************************************************************************* */ -/* Discovery Type */ +/* Discovery Type */ /* ************************************************************************* */ static const value_string discovery_type_vals[] = { { 0, "Unknown" }, @@ -394,9 +380,8 @@ static const value_string discovery_type_vals[] = { { 4, "AC Referral" }, { 0, NULL } }; - /* ************************************************************************* */ -/* Radio MAC Address Field */ +/* Radio MAC Address Field */ /* ************************************************************************* */ static const value_string rmac_field_vals[] = { { 0, "Reserved" }, @@ -404,9 +389,8 @@ static const value_string rmac_field_vals[] = { { 2, "Not Supported" }, { 0, NULL } }; - /* ************************************************************************* */ -/* Board Data Type Value */ +/* Board Data Type Value */ /* ************************************************************************* */ #define BOARD_DATA_WTP_MODEL_NUMBER 0 #define BOARD_DATA_WTP_SERIAL_NUMBER 1 @@ -422,9 +406,8 @@ static const value_string board_data_type_vals[] = { { BOARD_DATA_BASE_MAC_ADDRESS, "Base MAC Address" }, { 0, NULL } }; - /* ************************************************************************* */ -/* Descriptor WTP Type Value */ +/* Descriptor WTP Type Value */ /* ************************************************************************* */ #define WTP_DESCRIPTOR_HARDWARE_VERSION 0 #define WTP_DESCRIPTOR_ACTIVE_SOFTWARE_VERSION 1 @@ -438,9 +421,8 @@ static const value_string wtp_descriptor_type_vals[] = { { WTP_DESCRIPTOR_OTHER_SOFTWARE_VERSION, "WTP Other Software Version" }, { 0, NULL } }; - /* ************************************************************************* */ -/* AC Information Type Value */ +/* AC Information Type Value */ /* ************************************************************************* */ #define AC_INFORMATION_HARDWARE_VERSION 4 #define AC_INFORMATION_SOFTWARE_VERSION 5 @@ -450,9 +432,8 @@ static const value_string ac_information_type_vals[] = { { AC_INFORMATION_SOFTWARE_VERSION, "AC Software Version" }, { 0, NULL } }; - /* ************************************************************************* */ -/* WTP MAC Type */ +/* WTP MAC Type */ /* ************************************************************************* */ static const value_string wtp_mac_vals[] = { { 0, "Local MAC" }, @@ -461,10 +442,6 @@ static const value_string wtp_mac_vals[] = { { 0, NULL } }; -/* Variable */ -static guint8 type_header = 0; -static guint8 payload_type = 0; -static guint8 payload_wbid = 0; static void dissect_capwap_encryption_capabilities(tvbuff_t *tvb, proto_tree *encryption_capabilities_tree, guint offset) @@ -472,16 +449,16 @@ dissect_capwap_encryption_capabilities(tvbuff_t *tvb, proto_tree *encryption_cap guint wbid,encryption_capabilities = 0; proto_item *encryption_capabilities_item; proto_tree *sub_encryption_capabilities_tree; - + encryption_capabilities = tvb_get_ntohs(tvb, offset+1); wbid = tvb_get_bits8(tvb, offset*8+3,5); - encryption_capabilities_item = proto_tree_add_text(encryption_capabilities_tree, tvb, offset, 3, "Encryption Capabilities: (WBID=%d) %d", wbid,encryption_capabilities); + encryption_capabilities_item = proto_tree_add_text(encryption_capabilities_tree, tvb, offset, 3, "Encryption Capabilities: (WBID=%d) %d", wbid, encryption_capabilities); sub_encryption_capabilities_tree = proto_item_add_subtree(encryption_capabilities_item, ett_capwap); - proto_tree_add_uint(sub_encryption_capabilities_tree,hf_capwap_msg_element_type_wtp_descriptor_encrypt_reserved, tvb, offset, 1, tvb_get_bits8(tvb, offset*8,3)); + proto_tree_add_uint(sub_encryption_capabilities_tree,hf_capwap_msg_element_type_wtp_descriptor_encrypt_reserved, tvb, offset, 1, tvb_get_bits8(tvb, offset*8,3)); - proto_tree_add_uint(sub_encryption_capabilities_tree,hf_capwap_msg_element_type_wtp_descriptor_encrypt_wbid, tvb, offset, 1, wbid); + proto_tree_add_uint(sub_encryption_capabilities_tree,hf_capwap_msg_element_type_wtp_descriptor_encrypt_wbid, tvb, offset, 1, wbid); proto_tree_add_item(sub_encryption_capabilities_tree, hf_capwap_msg_element_type_wtp_descriptor_encrypt_capabilities, tvb, offset+1, 2, FALSE); } @@ -493,18 +470,18 @@ dissect_capwap_ac_information(tvbuff_t *tvb, proto_tree *ac_information_type_tre guint optlen,ac_information_type = 0; proto_item *ac_information_type_item; proto_tree *sub_ac_information_type_tree; - + ac_information_type = tvb_get_ntohs(tvb, offset+4); optlen = tvb_get_ntohs(tvb, offset+6); - ac_information_type_item = proto_tree_add_text(ac_information_type_tree, tvb, offset, 4+2+2+optlen, "AC Information Type: (t=%d,l=%d) %s", ac_information_type, optlen, val_to_str(ac_information_type,ac_information_type_vals,"Unknown AC Information Type (%02d)") ); + ac_information_type_item = proto_tree_add_text(ac_information_type_tree, tvb, offset, 4+2+2+optlen, "AC Information Type: (t=%d,l=%d) %s", ac_information_type, optlen, val_to_str(ac_information_type,ac_information_type_vals,"Unknown AC Information Type (%02d)") ); sub_ac_information_type_tree = proto_item_add_subtree(ac_information_type_item, ett_capwap); - proto_tree_add_item(sub_ac_information_type_tree, hf_capwap_msg_element_type_ac_information_vendor, tvb, offset, 4, FALSE); + proto_tree_add_item(sub_ac_information_type_tree, hf_capwap_msg_element_type_ac_information_vendor, tvb, offset, 4, FALSE); + + proto_tree_add_item(sub_ac_information_type_tree, hf_capwap_msg_element_type_ac_information_type, tvb, offset+4, 2, FALSE); - proto_tree_add_item(sub_ac_information_type_tree, hf_capwap_msg_element_type_ac_information_type, tvb, offset+4, 2, FALSE ); - proto_tree_add_item(sub_ac_information_type_tree, hf_capwap_msg_element_type_ac_information_length, tvb, offset+6, 2, FALSE); - + proto_tree_add_item(sub_ac_information_type_tree, hf_capwap_msg_element_type_ac_information_value, tvb, offset+8, optlen, FALSE); switch (ac_information_type) { case AC_INFORMATION_HARDWARE_VERSION: @@ -519,7 +496,6 @@ dissect_capwap_ac_information(tvbuff_t *tvb, proto_tree *ac_information_type_tre /* No Default Action */ break; } - return 4+2+2+optlen; } @@ -530,18 +506,18 @@ dissect_capwap_wtp_descriptor(tvbuff_t *tvb, proto_tree *wtp_descriptor_type_tre guint optlen,wtp_descriptor_type = 0; proto_item *wtp_descriptor_type_item; proto_tree *sub_wtp_descriptor_type_tree; - + wtp_descriptor_type = tvb_get_ntohs(tvb, offset+4); optlen = tvb_get_ntohs(tvb, offset+6); - wtp_descriptor_type_item = proto_tree_add_text(wtp_descriptor_type_tree, tvb, offset, 4+2+2+optlen, "WTP Descriptor Type: (t=%d,l=%d) %s", wtp_descriptor_type, optlen, val_to_str(wtp_descriptor_type,wtp_descriptor_type_vals,"Unknown WTP Descriptor Type (%02d)") ); + wtp_descriptor_type_item = proto_tree_add_text(wtp_descriptor_type_tree, tvb, offset, 4+2+2+optlen, "WTP Descriptor Type: (t=%d,l=%d) %s", wtp_descriptor_type, optlen, val_to_str(wtp_descriptor_type,wtp_descriptor_type_vals,"Unknown WTP Descriptor Type (%02d)") ); sub_wtp_descriptor_type_tree = proto_item_add_subtree(wtp_descriptor_type_item, ett_capwap); - proto_tree_add_item(sub_wtp_descriptor_type_tree, hf_capwap_msg_element_type_wtp_descriptor_vendor, tvb, offset, 4, FALSE); + proto_tree_add_item(sub_wtp_descriptor_type_tree, hf_capwap_msg_element_type_wtp_descriptor_vendor, tvb, offset, 4, FALSE); + + proto_tree_add_item(sub_wtp_descriptor_type_tree, hf_capwap_msg_element_type_wtp_descriptor_type, tvb, offset+4, 2, FALSE); - proto_tree_add_item(sub_wtp_descriptor_type_tree, hf_capwap_msg_element_type_wtp_descriptor_type, tvb, offset+4, 2, FALSE ); - proto_tree_add_item(sub_wtp_descriptor_type_tree, hf_capwap_msg_element_type_wtp_descriptor_length, tvb, offset+6, 2, FALSE); - + proto_tree_add_item(sub_wtp_descriptor_type_tree, hf_capwap_msg_element_type_wtp_descriptor_value, tvb, offset+8, optlen, FALSE); switch (wtp_descriptor_type) { @@ -576,16 +552,16 @@ dissect_capwap_board_data(tvbuff_t *tvb, proto_tree *board_data_type_tree, guint guint optlen,board_data_type = 0; proto_item *board_data_type_item; proto_tree *sub_board_data_type_tree; - + board_data_type = tvb_get_ntohs(tvb, offset); optlen = tvb_get_ntohs(tvb, offset+2); - board_data_type_item = proto_tree_add_text(board_data_type_tree, tvb, offset, 2+2+optlen, "Board Data Type: (t=%d,l=%d) %s", board_data_type, optlen, val_to_str(board_data_type,board_data_type_vals,"Unknown Board Data Type (%02d)") ); + board_data_type_item = proto_tree_add_text(board_data_type_tree, tvb, offset, 2+2+optlen, "Board Data Type: (t=%d,l=%d) %s", board_data_type, optlen, val_to_str(board_data_type,board_data_type_vals,"Unknown Board Data Type (%02d)") ); sub_board_data_type_tree = proto_item_add_subtree(board_data_type_item, ett_capwap); - proto_tree_add_item(sub_board_data_type_tree, hf_capwap_msg_element_type_wtp_board_data_type,tvb, offset, 2, FALSE ); - + proto_tree_add_item(sub_board_data_type_tree, hf_capwap_msg_element_type_wtp_board_data_type,tvb, offset, 2, FALSE); + proto_tree_add_item(sub_board_data_type_tree, hf_capwap_msg_element_type_wtp_board_data_length, tvb, offset+2, 2, FALSE); - + proto_tree_add_item(sub_board_data_type_tree, hf_capwap_msg_element_type_wtp_board_data_value, tvb, offset+4, optlen, FALSE); switch (board_data_type) { case BOARD_DATA_WTP_MODEL_NUMBER: @@ -605,16 +581,17 @@ dissect_capwap_board_data(tvbuff_t *tvb, proto_tree *board_data_type_tree, guint break; case BOARD_DATA_BASE_MAC_ADDRESS: - proto_tree_add_item (sub_board_data_type_tree, hf_capwap_msg_element_type_wtp_board_data_base_mac_address , tvb, offset+4, 6,FALSE); + proto_tree_add_item(sub_board_data_type_tree, hf_capwap_msg_element_type_wtp_board_data_base_mac_address, tvb, offset+4, 6, FALSE); break; default: /* No Default Action */ - break; + break; } return 2+2+optlen; } + /* Returns the number of bytes consumed by this option. */ static int dissect_capwap_message_element_type(tvbuff_t *tvb, proto_tree *msg_element_type_tree, guint offset) @@ -625,15 +602,14 @@ dissect_capwap_message_element_type(tvbuff_t *tvb, proto_tree *msg_element_type_ msg_element_type = tvb_get_ntohs(tvb, offset); optlen = tvb_get_ntohs(tvb, offset+2); - msg_element_type_item = proto_tree_add_text(msg_element_type_tree, tvb, offset, 2+2+optlen, "Type: (t=%d,l=%d) %s", msg_element_type, optlen, val_to_str(msg_element_type,message_element_type_vals,"Unknown Message Element Type (%02d)") ); + msg_element_type_item = proto_tree_add_text(msg_element_type_tree, tvb, offset, 2+2+optlen, "Type: (t=%d,l=%d) %s", msg_element_type, optlen, val_to_str(msg_element_type,message_element_type_vals,"Unknown Message Element Type (%02d)") ); sub_msg_element_type_tree = proto_item_add_subtree(msg_element_type_item, ett_capwap); - proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type,tvb, offset, 2, FALSE ); + proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type,tvb, offset, 2, FALSE); proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_length, tvb, offset+2, 2, FALSE); - - proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_value, tvb, offset+4, optlen, FALSE); + proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_value, tvb, offset+4, optlen, FALSE); switch (msg_element_type) { case TYPE_AC_DESCRIPTOR: /* AC Descriptor (1) */ @@ -643,28 +619,28 @@ dissect_capwap_message_element_type(tvbuff_t *tvb, proto_tree *msg_element_type_ proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_ac_descriptor_max_wtp, tvb, offset+10, 2, FALSE); /* AC Descriptor Security Flags... */ - msg_element_type_item_flag = proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_ac_descriptor_security, tvb, offset+12, 1 ,FALSE); - sub_msg_element_type_flag_tree = proto_item_add_subtree(msg_element_type_item_flag, ett_capwap); + msg_element_type_item_flag = proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_ac_descriptor_security, tvb, offset+12, 1, FALSE); + sub_msg_element_type_flag_tree = proto_item_add_subtree(msg_element_type_item_flag, ett_capwap); - proto_tree_add_boolean(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_security_r, tvb, offset+12, 1,FALSE); - proto_tree_add_boolean(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_security_s, tvb, offset+12, 1,FALSE); - proto_tree_add_boolean (sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_security_x, tvb, offset+12, 1,FALSE); + proto_tree_add_boolean(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_security_r, tvb, offset+12, 1, FALSE); + proto_tree_add_boolean(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_security_s, tvb, offset+12, 1, FALSE); + proto_tree_add_boolean(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_security_x, tvb, offset+12, 1, FALSE); proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_ac_descriptor_rmac_field, tvb, offset+13, 1, FALSE); proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_ac_descriptor_reserved, tvb, offset+14, 1, FALSE); /* AC Descriptor DTLS Flags... */ - msg_element_type_item_flag = proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_ac_descriptor_dtls_policy, tvb, offset+15, 1 ,FALSE); - sub_msg_element_type_flag_tree = proto_item_add_subtree(msg_element_type_item_flag, ett_capwap); + msg_element_type_item_flag = proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_ac_descriptor_dtls_policy, tvb, offset+15, 1, FALSE); + sub_msg_element_type_flag_tree = proto_item_add_subtree(msg_element_type_item_flag, ett_capwap); - proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_dtls_policy_r, tvb, offset+15, 1,FALSE); - proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_dtls_policy_d, tvb, offset+15, 1,FALSE); - proto_tree_add_item (sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_dtls_policy_c, tvb, offset+15, 1,FALSE); + proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_dtls_policy_r, tvb, offset+15, 1, FALSE); + proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_dtls_policy_d, tvb, offset+15, 1, FALSE); + proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_ac_descriptor_dtls_policy_c, tvb, offset+15, 1, FALSE); - offset_end = offset + optlen -4; + offset_end = offset + optlen -4; offset += 4 + 12; while (offset < offset_end) { - offset += dissect_capwap_ac_information(tvb, sub_msg_element_type_tree, offset); + offset += dissect_capwap_ac_information(tvb, sub_msg_element_type_tree, offset); } break; @@ -683,10 +659,10 @@ dissect_capwap_message_element_type(tvbuff_t *tvb, proto_tree *msg_element_type_ case TYPE_WTP_BOARD_DATA: /* WTP Board Data (38) */ proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_wtp_board_data_vendor, tvb, offset+4, 4, FALSE); - offset += 8; + offset += 8; offset_end = offset + optlen -4; while (offset < offset_end) { - offset += dissect_capwap_board_data(tvb, sub_msg_element_type_tree, offset); + offset += dissect_capwap_board_data(tvb, sub_msg_element_type_tree, offset); } break; @@ -695,27 +671,27 @@ dissect_capwap_message_element_type(tvbuff_t *tvb, proto_tree *msg_element_type_ proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_wtp_descriptor_radio_in_use, tvb, offset+5, 1, FALSE); number_encrypt = tvb_get_guint8(tvb,offset+6); - msg_element_type_item_flag = proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_wtp_descriptor_number_encrypt, tvb, offset+6, 1,FALSE); - sub_msg_element_type_flag_tree = proto_item_add_subtree(msg_element_type_item_flag, ett_capwap); + msg_element_type_item_flag = proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_wtp_descriptor_number_encrypt, tvb, offset+6, 1, FALSE); + sub_msg_element_type_flag_tree = proto_item_add_subtree(msg_element_type_item_flag, ett_capwap); for (i=0; i < number_encrypt; i++) { dissect_capwap_encryption_capabilities(tvb, sub_msg_element_type_flag_tree, offset+4+3+i*3); } - offset_end = offset + optlen -4; + offset_end = offset + optlen -4; offset += 4 + 3 + number_encrypt * 3; while (offset < offset_end) { - offset += dissect_capwap_wtp_descriptor(tvb, sub_msg_element_type_tree, offset); + offset += dissect_capwap_wtp_descriptor(tvb, sub_msg_element_type_tree, offset); } break; case TYPE_WTP_FRAME_TUNNEL_MODE: /* WTP Frame Tunnel Mode (41) */ - msg_element_type_item_flag = proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode, tvb, offset+4, 1 ,FALSE); - sub_msg_element_type_flag_tree = proto_item_add_subtree(msg_element_type_item_flag, ett_capwap); + msg_element_type_item_flag = proto_tree_add_item(sub_msg_element_type_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode, tvb, offset+4, 1, FALSE); + sub_msg_element_type_flag_tree = proto_item_add_subtree(msg_element_type_item_flag, ett_capwap); - proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode_n, tvb, offset+4, 1,FALSE); - proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode_e, tvb, offset+4, 1,FALSE); - proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode_l, tvb, offset+4, 1,FALSE); - proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode_r, tvb, offset+4, 1,FALSE); + proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode_n, tvb, offset+4, 1, FALSE); + proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode_e, tvb, offset+4, 1, FALSE); + proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode_l, tvb, offset+4, 1, FALSE); + proto_tree_add_item(sub_msg_element_type_flag_tree, hf_capwap_msg_element_type_wtp_frame_tunnel_mode_r, tvb, offset+4, 1, FALSE); break; case TYPE_WTP_MAC_TYPE: /* WTP MAC Type (44) */ @@ -724,7 +700,7 @@ dissect_capwap_message_element_type(tvbuff_t *tvb, proto_tree *msg_element_type_ default: /* No Default Action */ - break; + break; } return 2+2+optlen; @@ -737,13 +713,13 @@ dissect_capwap_message_element(tvbuff_t *tvb, proto_tree *capwap_control_tree, g guint plen = 0, offset_end; proto_item *ti; proto_tree *capwap_message_element_tree; - - ti = proto_tree_add_item(capwap_control_tree, hf_capwap_message_element, tvb, offset, tvb_reported_length(tvb) - offset,FALSE); - capwap_message_element_tree = proto_item_add_subtree(ti, ett_capwap); - + + ti = proto_tree_add_item(capwap_control_tree, hf_capwap_message_element, tvb, offset, tvb_reported_length(tvb) - offset, FALSE); + capwap_message_element_tree = proto_item_add_subtree(ti, ett_capwap); + offset_end = tvb_reported_length(tvb); - while (offset+plen < offset_end) { + while (offset+plen < offset_end) { plen += dissect_capwap_message_element_type(tvb, capwap_message_element_tree, offset+plen); } @@ -752,19 +728,19 @@ dissect_capwap_message_element(tvbuff_t *tvb, proto_tree *capwap_control_tree, g /* Returns the number of bytes consumed by this option. */ static int -dissect_capwap_control_header(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint offset, packet_info *pinfo ) +dissect_capwap_control_header(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint offset, packet_info *pinfo) { guint plen = 0; proto_item *ti, *ti_flag; proto_tree *capwap_control_header_tree; proto_tree *capwap_control_msg_type_tree; - - ti = proto_tree_add_item(capwap_control_tree, hf_capwap_control_header, tvb, offset, 8,FALSE); - capwap_control_header_tree = proto_item_add_subtree(ti, ett_capwap); - /* Message Type 32 bits*/ - ti_flag = proto_tree_add_item(capwap_control_header_tree, hf_capwap_control_header_msg_type, tvb, offset, 4, FALSE); - capwap_control_msg_type_tree = proto_item_add_subtree(ti_flag, ett_capwap); + ti = proto_tree_add_item(capwap_control_tree, hf_capwap_control_header, tvb, offset, 8, FALSE); + capwap_control_header_tree = proto_item_add_subtree(ti, ett_capwap); + + /* Message Type 32 bits */ + ti_flag = proto_tree_add_item(capwap_control_header_tree, hf_capwap_control_header_msg_type, tvb, offset, 4, FALSE); + capwap_control_msg_type_tree = proto_item_add_subtree(ti_flag, ett_capwap); proto_tree_add_item(capwap_control_msg_type_tree, hf_capwap_control_header_msg_type_enterprise_nbr, tvb, offset, 3, FALSE); proto_tree_add_item(capwap_control_msg_type_tree, hf_capwap_control_header_msg_type_enterprise_specific, tvb, offset+3, 1, FALSE); @@ -772,25 +748,22 @@ dissect_capwap_control_header(tvbuff_t *tvb, proto_tree *capwap_control_tree, gu col_append_fstr(pinfo->cinfo, COL_INFO, " - %s",val_to_str(tvb_get_guint8(tvb, offset+3),message_type,"Unknown Message Type (0x%02x)")); plen += 4; - /* Sequence 8 bits */ proto_tree_add_uint(capwap_control_header_tree, hf_capwap_control_header_seq_number, tvb, offset+plen, 1, tvb_get_guint8(tvb, offset)); plen += 1; - + /* Message Element Length 16 bits */ proto_tree_add_item(capwap_control_header_tree, hf_capwap_control_header_msg_element_length, tvb, offset+plen, 2, FALSE); plen += 2; - /* Flags 8 bits */ proto_tree_add_item(capwap_control_header_tree, hf_capwap_control_header_flags, tvb, offset+plen, 1, FALSE); plen += 1; - return plen; } /* Returns the number of bytes consumed by this option. */ static int -dissect_capwap_header(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint offset) +dissect_capwap_header(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint offset, guint8 *payload_type, guint8 *payload_wbid) { guint plen = 0; proto_item *ti, *ti_flag; @@ -798,8 +771,8 @@ dissect_capwap_header(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint offs proto_tree *capwap_header_flags_tree; guint flags = 0; - ti = proto_tree_add_item(capwap_control_tree, hf_capwap_header, tvb, offset+plen, tvb_get_bits8(tvb, (offset+plen)*8, 5),FALSE); - capwap_header_tree = proto_item_add_subtree(ti, ett_capwap); + ti = proto_tree_add_item(capwap_control_tree, hf_capwap_header, tvb, offset+plen, tvb_get_bits8(tvb, (offset+plen)*8, 5), FALSE); + capwap_header_tree = proto_item_add_subtree(ti, ett_capwap); /* Header Length : 5 Bits */ proto_tree_add_uint(capwap_header_tree, hf_capwap_header_hlen, tvb, offset+plen, 1, tvb_get_bits8(tvb, (offset+plen)*8, 5)); @@ -808,63 +781,60 @@ dissect_capwap_header(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint offs plen++; /* Wireless Binding ID : 5 Bits */ proto_tree_add_uint(capwap_header_tree, hf_capwap_header_wbid, tvb, offset+plen, 1, tvb_get_bits8(tvb, (offset+plen)*8+10, 5)); - + /* Flags : 9 Bits */ - flags = tvb_get_bits16(tvb, (offset+plen)*8+7, 9,0); - ti_flag = proto_tree_add_uint_format(capwap_header_tree, hf_capwap_header_flags, tvb, offset+plen, 1 ,0,"Header flags"); - capwap_header_flags_tree = proto_item_add_subtree(ti_flag, ett_capwap); - - proto_tree_add_boolean (capwap_header_flags_tree, hf_capwap_header_flags_t, tvb, offset+plen, 1,flags); - proto_tree_add_boolean (capwap_header_flags_tree, hf_capwap_header_flags_f, tvb, offset+plen, 1,flags); - proto_tree_add_boolean (capwap_header_flags_tree, hf_capwap_header_flags_l, tvb, offset+plen, 1,flags); - proto_tree_add_boolean (capwap_header_flags_tree, hf_capwap_header_flags_w, tvb, offset+plen, 1,flags); - proto_tree_add_boolean (capwap_header_flags_tree, hf_capwap_header_flags_m, tvb, offset+plen, 1,flags); - proto_tree_add_boolean (capwap_header_flags_tree, hf_capwap_header_flags_k, tvb, offset+plen, 1,flags); - proto_tree_add_boolean (capwap_header_flags_tree, hf_capwap_header_flags_r, tvb, offset+plen, 1,flags); + flags = tvb_get_bits16(tvb, (offset+plen)*8+7, 9, 0); + ti_flag = proto_tree_add_uint_format(capwap_header_tree, hf_capwap_header_flags, tvb, offset+plen, 1, 0, "Header flags"); + capwap_header_flags_tree = proto_item_add_subtree(ti_flag, ett_capwap); + + proto_tree_add_boolean(capwap_header_flags_tree, hf_capwap_header_flags_t, tvb, offset+plen, 1, flags); + proto_tree_add_boolean(capwap_header_flags_tree, hf_capwap_header_flags_f, tvb, offset+plen, 1, flags); + proto_tree_add_boolean(capwap_header_flags_tree, hf_capwap_header_flags_l, tvb, offset+plen, 1, flags); + proto_tree_add_boolean(capwap_header_flags_tree, hf_capwap_header_flags_w, tvb, offset+plen, 1, flags); + proto_tree_add_boolean(capwap_header_flags_tree, hf_capwap_header_flags_m, tvb, offset+plen, 1, flags); + proto_tree_add_boolean(capwap_header_flags_tree, hf_capwap_header_flags_k, tvb, offset+plen, 1, flags); + proto_tree_add_boolean(capwap_header_flags_tree, hf_capwap_header_flags_r, tvb, offset+plen, 1, flags); /* Type of Payload (for CAPWAP Data Packet) */ - payload_wbid = tvb_get_bits8(tvb, (offset+plen)*8+10, 5); - payload_type = tvb_get_bits8(tvb, (offset+plen)*8+7,1); + *payload_wbid = tvb_get_bits8(tvb, (offset+plen)*8+10, 5); + *payload_type = tvb_get_bits8(tvb, (offset+plen)*8+7,1); plen += 2; - /* Fragment ID : 16 Bits */ + /* Fragment ID : 16 Bits */ proto_tree_add_item(capwap_header_tree, hf_capwap_header_fragment_id, tvb, offset+plen, 2, FALSE); plen += 2; - /* Fragment offset : 13 Bits */ - proto_tree_add_uint(capwap_header_tree, hf_capwap_header_fragment_offset, tvb, offset+plen, 2, tvb_get_bits16(tvb, (offset+plen)*8, 13,0)); - - /* Reserved 3bits */ - proto_tree_add_uint(capwap_header_tree, hf_capwap_header_reserved, tvb, offset+plen+1, 1, tvb_get_bits8(tvb, (offset+plen)*8+13, 3)); - plen += 2; + /* Fragment offset : 13 Bits */ + proto_tree_add_uint(capwap_header_tree, hf_capwap_header_fragment_offset, tvb, offset+plen, 2, tvb_get_bits16(tvb, (offset+plen)*8, 13, 0)); + /* Reserved 3 Bits */ + proto_tree_add_uint(capwap_header_tree, hf_capwap_header_reserved, tvb, offset+plen+1, 1, tvb_get_bits8(tvb, (offset+plen)*8+13, 3)); + plen += 2; return plen; } /* Returns the number of bytes consumed by this option. */ static int -dissect_capwap_preamble(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint offset) +dissect_capwap_preamble(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint offset, guint8 *type_header) { guint plen = 0; proto_item *ti; - proto_tree *capwap_preamble_tree; + proto_tree *capwap_preamble_tree; - ti = proto_tree_add_item(capwap_control_tree, hf_capwap_preamble, tvb, offset+plen, -1,FALSE); - capwap_preamble_tree = proto_item_add_subtree(ti, ett_capwap); + ti = proto_tree_add_item(capwap_control_tree, hf_capwap_preamble, tvb, offset+plen, -1, FALSE); + capwap_preamble_tree = proto_item_add_subtree(ti, ett_capwap); proto_tree_add_uint(capwap_preamble_tree, hf_capwap_preamble_version, tvb, offset+plen, 1, hi_nibble(tvb_get_guint8(tvb, offset+plen))); proto_tree_add_uint(capwap_preamble_tree, hf_capwap_preamble_type, tvb, offset+plen, 1, lo_nibble(tvb_get_guint8(tvb, offset+plen))); - type_header = lo_nibble(tvb_get_guint8(tvb, offset+plen)); + *type_header = lo_nibble(tvb_get_guint8(tvb, offset+plen)); plen++; - /* DTLS Header ? */ - if (type_header == 1) { + if (*type_header == 1) { proto_tree_add_item(capwap_preamble_tree, hf_capwap_preamble_reserved, tvb, offset+plen, 3, FALSE); plen +=3; } - proto_item_set_len(ti,plen); - + proto_item_set_len(ti, plen); return plen; } @@ -872,12 +842,14 @@ dissect_capwap_preamble(tvbuff_t *tvb, proto_tree *capwap_control_tree, guint of static void dissect_capwap_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; proto_tree *capwap_control_tree; - guint offset = 0; + guint offset = 0; tvbuff_t *next_tvb; + guint8 type_header; + guint8 payload_type; + guint8 payload_wbid; /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "CAPWAP"); @@ -885,35 +857,44 @@ dissect_capwap_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(tree, proto_capwap, tvb, 0, -1, FALSE); capwap_control_tree = proto_item_add_subtree(ti, ett_capwap); - + /* CAPWAP Preamble */ - offset += dissect_capwap_preamble(tvb, capwap_control_tree, offset); - + + offset += dissect_capwap_preamble(tvb, capwap_control_tree, offset, &type_header); + if (type_header == 1) { next_tvb = tvb_new_subset (tvb, offset, -1, -1); call_dissector(dtls_handle, next_tvb, pinfo, tree); return; } - + /* CAPWAP Header */ - offset += dissect_capwap_header(tvb, capwap_control_tree, offset); + + offset += dissect_capwap_header(tvb, capwap_control_tree, offset, &payload_type, &payload_wbid); /* CAPWAP Control Header */ - offset += dissect_capwap_control_header(tvb, capwap_control_tree, offset, pinfo); + + offset += dissect_capwap_control_header(tvb, capwap_control_tree, offset, pinfo); /* CAPWAP Message Element */ - offset += dissect_capwap_message_element(tvb, capwap_control_tree, offset); + + offset += dissect_capwap_message_element(tvb, capwap_control_tree, offset); + } /* Code to actually dissect the packets */ static void dissect_capwap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { + /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; proto_tree *capwap_data_tree; - guint offset = 0; + guint offset = 0; tvbuff_t *next_tvb; + guint8 type_header; + guint8 payload_type; + guint8 payload_wbid; /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "CAPWAP"); @@ -921,34 +902,41 @@ dissect_capwap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(tree, proto_capwap, tvb, 0, -1, FALSE); capwap_data_tree = proto_item_add_subtree(ti, ett_capwap); - + /* CAPWAP Preamble */ - offset += dissect_capwap_preamble(tvb, capwap_data_tree, offset); - + + offset += dissect_capwap_preamble(tvb, capwap_data_tree, offset, &type_header); + if (type_header == 1) { next_tvb = tvb_new_subset (tvb, offset, -1, -1); call_dissector(dtls_handle, next_tvb, pinfo, tree); return; } - + /* CAPWAP Header */ - offset += dissect_capwap_header(tvb, capwap_data_tree, offset); + + offset += dissect_capwap_header(tvb, capwap_data_tree, offset, &payload_type, &payload_wbid); /* CAPWAP Data Payload */ + next_tvb = tvb_new_subset (tvb, offset, -1, -1); - + if (payload_type == 0) { - /* IEEE 802.3 Frame */ + /* IEEE 802.3 Frame */ call_dissector(ieee8023_handle, next_tvb, pinfo, tree); - } else if (payload_wbid == 1) { - /* IEEE 802.11 */ - call_dissector(ieee80211_handle, next_tvb, pinfo, tree); } else { - /* Unknown Data */ - call_dissector(data_handle, next_tvb, pinfo, tree); + switch (payload_wbid) { + case 1: /* IEEE 802.11 */ + call_dissector(ieee80211_handle, next_tvb, pinfo, tree); + break; + default: /* Unknown Data */ + call_dissector(data_handle, next_tvb, pinfo, tree); + break; + } } } + void proto_register_capwap_control(void) { @@ -972,115 +960,112 @@ proto_register_capwap_control(void) { "Reserved", "capwap.preamble.reserved", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - /* CAPWAP Header */ { &hf_capwap_header, { "Header", "capwap.header", FT_NONE, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_header_hlen, - { "Header Length", "capwap.header.length", + { "Header Length", "capwap.header.length", FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_header_rid, - { "Radio ID", "capwap.header.rid", + { "Radio ID", "capwap.header.rid", FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_header_wbid, - { "Wireless Binding ID", "capwap.header.wbid", + { "Wireless Binding ID", "capwap.header.wbid", FT_UINT8, BASE_DEC, VALS(type_wbid), 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_header_flags, - { "Header Flags", "capwap.header.flags", + { "Header Flags", "capwap.header.flags", FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_header_flags_t, - { "Payload Type", "capwap.header.flags.t", - FT_BOOLEAN, 9, TFS (&flag_type_t), 0x100, + { "Payload Type", "capwap.header.flags.t", + FT_BOOLEAN, 9, TFS(&flag_type_t), 0x100, NULL, HFILL }}, { &hf_capwap_header_flags_f, { "Fragment", "capwap.header.flags.f", - FT_BOOLEAN, 9, TFS (&flag_type_f), 0x80, + FT_BOOLEAN, 9, TFS(&flag_type_f), 0x80, NULL, HFILL }}, { &hf_capwap_header_flags_l, - { "Last Fragment", "capwap.header.flags.l", - FT_BOOLEAN, 9, TFS (&flag_type_l), 0x40, + { "Last Fragment", "capwap.header.flags.l", + FT_BOOLEAN, 9, TFS(&flag_type_l), 0x40, NULL, HFILL }}, { &hf_capwap_header_flags_w, - { "Wireless header", "capwap.header.flags.w", - FT_BOOLEAN, 9, TFS (&flag_type_w), 0x20, - NULL, HFILL }}, + { "Wireless header", "capwap.header.flags.w", + FT_BOOLEAN, 9, TFS(&flag_type_w), 0x20, + NULL, HFILL }}, { &hf_capwap_header_flags_m, - { "Radio MAC header", "capwap.header.flags.m", - FT_BOOLEAN, 9, TFS (&flag_type_m), 0x10, + { "Radio MAC header", "capwap.header.flags.m", + FT_BOOLEAN, 9, TFS(&flag_type_m), 0x10, NULL, HFILL }}, { &hf_capwap_header_flags_k, - { "Keep-Alive", "capwap.header.flags.k", - FT_BOOLEAN, 9, TFS (&flag_type_k), 0x08, - NULL, HFILL }}, + { "Keep-Alive", "capwap.header.flags.k", + FT_BOOLEAN, 9, TFS(&flag_type_k), 0x08, + NULL, HFILL }}, { &hf_capwap_header_flags_r, - { "Reserved", "capwap.header.flags.r", + { "Reserved", "capwap.header.flags.r", FT_BOOLEAN, 9, TFS(&tfs_set_notset), 0x07, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_header_fragment_id, - { "Fragment ID", "capwap.header.fragment.id", + { "Fragment ID", "capwap.header.fragment.id", FT_UINT16, BASE_DEC, NULL, 0x00, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_header_fragment_offset, - { "Fragment Offset", "capwap.header.fragment.offset", + { "Fragment Offset", "capwap.header.fragment.offset", FT_UINT16, BASE_DEC, NULL, 0x00, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_header_reserved, - { "Reserved", "capwap.header.fragment.reserved", + { "Reserved", "capwap.header.fragment.reserved", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }}, + /* CAPWAP Control Header Message */ - /* CAPWAP Control Header Message */ { &hf_capwap_control_header, { "Control Header", "capwap.control.header", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_control_header_msg_type, - { "Message Type", "capwap.control.header.message_type", + { "Message Type", "capwap.control.header.message_type", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_control_header_msg_type_enterprise_nbr, - { "Message Type (Entreprise Number)", "capwap.control.header.message_type.enterprise_number", + { "Message Type (Enterprise Number)", "capwap.control.header.message_type.enterprise_number", FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, NULL, HFILL }}, { &hf_capwap_control_header_msg_type_enterprise_specific, - { "Message Type (Entreprise Specific)", "capwap.control.header.message_type.enterprise_specific", + { "Message Type (Enterprise Specific)", "capwap.control.header.message_type.enterprise_specific", FT_UINT8, BASE_DEC, VALS(message_type), 0x00, NULL, HFILL }}, { &hf_capwap_control_header_seq_number, - { "Sequence Number", "capwap.control.header.sequence_number", + { "Sequence Number", "capwap.control.header.sequence_number", FT_UINT8, BASE_DEC, NULL, 0x00, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_control_header_msg_element_length, - { "Message Element Length", "capwap.control.header.message_element_length", + { "Message Element Length", "capwap.control.header.message_element_length", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_control_header_flags, - { "Flags", "capwap.control.header.flags", + { "Flags", "capwap.control.header.flags", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }}, - /* CAPWAP Protocol Message Elements */ + /* CAPWAP Protocol Message Elements */ + { &hf_capwap_message_element, - { "Message Element", "capwap.message_element", + { "Message Element", "capwap.message_element", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }}, - { &hf_capwap_msg_element_type, { "Type", "capwap.message_element.type", FT_UINT16, BASE_DEC, VALS(message_element_type_vals), 0x00, "CAPWAP Message Element type", HFILL }}, - { &hf_capwap_msg_element_length, { "Length", "capwap.message_element.length", FT_UINT16, BASE_DEC, NULL, 0x00, "CAPWAP Message Element length", HFILL }}, - { &hf_capwap_msg_element_value, { "Value", "capwap.message_element.value", FT_BYTES, BASE_NONE, NULL, 0x00, @@ -1090,73 +1075,71 @@ proto_register_capwap_control(void) /* AC Descriptor */ { &hf_capwap_msg_element_type_ac_descriptor_stations, - { "Stations", "capwap.control.message_element.ac_descriptor.stations", + { "Stations", "capwap.control.message_element.ac_descriptor.stations", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_limit, - { "Limit Stations", "capwap.control.message_element.ac_descriptor.limit", + { "Limit Stations", "capwap.control.message_element.ac_descriptor.limit", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_active_wtp, - { "Active WTPs", "capwap.control.message_element.ac_descriptor.active_wtp", + { "Active WTPs", "capwap.control.message_element.ac_descriptor.active_wtp", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_max_wtp, - { "Max WTPs", "capwap.control.message_element.ac_descriptor.max_wtp", + { "Max WTPs", "capwap.control.message_element.ac_descriptor.max_wtp", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }}, - /* AC Descriptor Security Flags... */ { &hf_capwap_msg_element_type_ac_descriptor_security, - { "Security Flags", "capwap.control.message_element.ac_descriptor.security", + { "Security Flags", "capwap.control.message_element.ac_descriptor.security", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_security_s, - { "AC supports the pre-shared", "capwap.control.message_element.ac_descriptor.security.s", + { "AC supports the pre-shared", "capwap.control.message_element.ac_descriptor.security.s", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_security_x, - { "AC supports X.509 Certificate", "capwap.control.message_element.ac_descriptor.security.x", + { "AC supports X.509 Certificate", "capwap.control.message_element.ac_descriptor.security.x", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x02, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_security_r, - { "Reserved", "capwap.control.message_element.ac_descriptor.security.r", + { "Reserved", "capwap.control.message_element.ac_descriptor.security.r", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0xF9, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_rmac_field, - { "R-MAC Field", "capwap.control.message_element.ac_descriptor.rmac_field", + { "R-MAC Field", "capwap.control.message_element.ac_descriptor.rmac_field", FT_UINT8, BASE_DEC, VALS(rmac_field_vals), 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_reserved, - { "Reserved", "capwap.control.message_element.ac_descriptor.reserved", + { "Reserved", "capwap.control.message_element.ac_descriptor.reserved", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }}, - /* AC Descriptor DTLS Policy Flags... */ { &hf_capwap_msg_element_type_ac_descriptor_dtls_policy, - { "DTLS Policy Flags", "capwap.control.message_element.ac_descriptor.dtls_policy", + { "DTLS Policy Flags", "capwap.control.message_element.ac_descriptor.dtls_policy", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_dtls_policy_d, - { "DTLS-Enabled Data Channel Supported", "capwap.control.message_element.ac_descriptor.dtls_policy.d", + { "DTLS-Enabled Data Channel Supported", "capwap.control.message_element.ac_descriptor.dtls_policy.d", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_dtls_policy_c, - { "Clear Text Data Channel Supported", "capwap.control.message_element.ac_descriptor.dtls_policy.c", + { "Clear Text Data Channel Supported", "capwap.control.message_element.ac_descriptor.dtls_policy.c", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x02, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_descriptor_dtls_policy_r, - { "Reserved", "capwap.control.message_element.ac_descriptor.dtls_policy.r", + { "Reserved", "capwap.control.message_element.ac_descriptor.dtls_policy.r", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0xF9, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_information_vendor, - { "AC Information Vendor", "capwap.control.message_element.ac_information.vendor", + { "AC Information Vendor", "capwap.control.message_element.ac_information.vendor", FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_information_type, - { "AC Information Type", "capwap.control.message_element.ac_information.type", + { "AC Information Type", "capwap.control.message_element.ac_information.type", FT_UINT16, BASE_DEC, VALS(ac_information_type_vals), 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_information_length, @@ -1167,7 +1150,7 @@ proto_register_capwap_control(void) { &hf_capwap_msg_element_type_ac_information_value, { "AC Information Value", "capwap.control.message_element.ac_information.value", FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_information_hardware_version, { "AC Hardware Version", "capwap.control.message_element.ac_information.hardware_version", FT_STRING, BASE_NONE, NULL, 0x0, @@ -1179,88 +1162,87 @@ proto_register_capwap_control(void) /* CAPWAP Control IPvX Address*/ { &hf_capwap_msg_element_type_capwap_control_ipv4, - { "Control IP Address", "capwap.control.message_element.message_element.capwap_control_ipv4", + { "Control IP Address", "capwap.control.message_element.message_element.capwap_control_ipv4", FT_IPv4, BASE_NONE, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_capwap_control_wtp_count, - { "Control WTP Count", "capwap.control.message_element.capwap_control_wtp_count", + { "Control WTP Count", "capwap.control.message_element.capwap_control_wtp_count", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_ac_name, - { "AC Name", "capwap.control.message_element.ac_name", + { "AC Name", "capwap.control.message_element.ac_name", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_discovery_type, - { "Discovery Type", "capwap.control.message_element.discovery_type", + { "Discovery Type", "capwap.control.message_element.discovery_type", FT_UINT8, BASE_DEC, VALS(discovery_type_vals), 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_board_data_vendor, - { "WTP Board Data Vendor", "capwap.control.message_element.wtp_board_data.vendor", + { "WTP Board Data Vendor", "capwap.control.message_element.wtp_board_data.vendor", FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_board_data_type, { "Board Data Type", "capwap.control.message_element.wtp_board_data.type", FT_UINT16, BASE_DEC, VALS(board_data_type_vals), 0x00, NULL, HFILL }}, - { &hf_capwap_msg_element_type_wtp_board_data_length, { "Board Data Length", "capwap.control.message_element.wtp_board_data.length", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }}, - { &hf_capwap_msg_element_type_wtp_board_data_value, { "Board Data Value", "capwap.control.message_element.wtp_board_data.value", FT_BYTES, BASE_NONE, NULL, 0x00, - NULL, HFILL }}, + NULL, HFILL }}, + { &hf_capwap_msg_element_type_wtp_board_data_wtp_model_number, { "WTP Model Number", "capwap.control.message_element.wtp_board_data.wtp_model_number", FT_STRING, BASE_DEC, NULL, 0x00, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_board_data_wtp_serial_number, { "WTP Serial Number", "capwap.control.message_element.wtp_board_data.wtp_serial_number", FT_STRING, BASE_NONE, NULL, 0x00, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_board_data_wtp_board_id, { "WTP Board ID", "capwap.control.message_element.wtp_board_data.wtp_board_id", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_board_data_wtp_board_revision, { "WTP Board Revision", "capwap.control.message_element.wtp_board_data.wtp_board_revision", FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_board_data_base_mac_address, { "Base Mac Address", "capwap.control.message_element.wtp_board_data.base_mac_address", FT_ETHER, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_max_radios, - { "Max Radios", "capwap.control.message_element.wtp_descriptor.max_radios", + { "Max Radios", "capwap.control.message_element.wtp_descriptor.max_radios", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_radio_in_use, - { "Radio in use", "capwap.control.message_element.wtp_descriptor.radio_in_use", + { "Radio in use", "capwap.control.message_element.wtp_descriptor.radio_in_use", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_number_encrypt, - { "Encryption Capabilities (Number)", "capwap.control.message_element.wtp_descriptor.number_encrypt", + { "Encryption Capabilities (Number)", "capwap.control.message_element.wtp_descriptor.number_encrypt", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_encrypt_reserved, - { "Reserved (Encrypt)", "capwap.control.message_element.wtp_descriptor.encrypt_reserved", + { "Reserved (Encrypt)", "capwap.control.message_element.wtp_descriptor.encrypt_reserved", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_encrypt_wbid, - { "Encrypt WBID", "capwap.control.message_element.wtp_descriptor.encrypt_wbid", + { "Encrypt WBID", "capwap.control.message_element.wtp_descriptor.encrypt_wbid", FT_UINT8, BASE_DEC, VALS(type_wbid), 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_encrypt_capabilities, - { "Encryption Capabilities", "capwap.control.message_element.wtp_descriptor.encrypt_capabilities", + { "Encryption Capabilities", "capwap.control.message_element.wtp_descriptor.encrypt_capabilities", FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_vendor, - { "WTP Descriptor Vendor", "capwap.control.message_element.wtp_descriptor.vendor", + { "WTP Descriptor Vendor", "capwap.control.message_element.wtp_descriptor.vendor", FT_UINT32, BASE_DEC, VALS(sminmpec_values), 0x00, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_descriptor_type, @@ -1293,35 +1275,35 @@ proto_register_capwap_control(void) NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_frame_tunnel_mode, - { "WTP Frame Tunnel Mode", "capwap.control.message_element.wtp_frame_tunnel_mode", + { "WTP Frame Tunnel Mode", "capwap.control.message_element.wtp_frame_tunnel_mode", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_frame_tunnel_mode_n, - { "Native Frame Tunnel Mode", "capwap.control.message_element.wtp_frame_tunnel_mode.n", + { "Native Frame Tunnel Mode", "capwap.control.message_element.wtp_frame_tunnel_mode.n", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x08, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_frame_tunnel_mode_e, - { "802.3 Frame Tunnel Mode", "capwap.control.message_element.wtp_frame_tunnel_mode.e", + { "802.3 Frame Tunnel Mode", "capwap.control.message_element.wtp_frame_tunnel_mode.e", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_frame_tunnel_mode_l, - { "Local Bridging", "capwap.control.message_element.wtp_frame_tunnel_mode.l", + { "Local Bridging", "capwap.control.message_element.wtp_frame_tunnel_mode.l", FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x02, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_frame_tunnel_mode_r, - { "Reserved", "capwap.control.message_element.wtp_frame_tunnel_mode.r", + { "Reserved", "capwap.control.message_element.wtp_frame_tunnel_mode.r", FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0xF1, NULL, HFILL }}, { &hf_capwap_msg_element_type_wtp_mac_type, - { "WTP MAC Type", "capwap.control.message_element.wtp_mac_type", + { "WTP MAC Type", "capwap.control.message_element.wtp_mac_type", FT_UINT8, BASE_DEC, VALS(wtp_mac_vals), 0x0, - "The MAC mode of operation supported by the WTP", HFILL }}, + "The MAC mode of operation supported by the WTP", HFILL }} }; /* Setup protocol subtree array */ static gint *ett[] = { - &ett_capwap, + &ett_capwap }; /* Register the protocol name and description */ @@ -1333,43 +1315,41 @@ proto_register_capwap_control(void) proto_register_subtree_array(ett, array_length(ett)); /* Register preferences module (See Section 2.6 for more on preferences) */ - capwap_module = prefs_register_protocol(proto_capwap,proto_reg_handoff_capwap); + capwap_module = prefs_register_protocol(proto_capwap, proto_reg_handoff_capwap); - prefs_register_uint_preference(capwap_module, "udp.port.control", "CAPWAP Control UDP Port", - "Set the port for CAPWAP Control messages (if other" - " than the default of 5246)", - 10, &global_capwap_control_udp_port); + prefs_register_uint_preference(capwap_module, "udp.port.control", "CAPWAP Control UDP Port", + "Set the port for CAPWAP Control messages (if other than the default of 5246)", + 10, &global_capwap_control_udp_port); prefs_register_uint_preference(capwap_module, "udp.port.data", "CAPWAP Data UDP Port", - "Set the port for CAPWAP Data messages (if other" - " than the default of 5247)", - 10, &global_capwap_data_udp_port); + "Set the port for CAPWAP Data messages (if other than the default of 5247)", + 10, &global_capwap_data_udp_port); + } void proto_reg_handoff_capwap(void) { static gboolean inited = FALSE; - static dissector_handle_t capwap_control_handle, capwap_data_handle; + static dissector_handle_t capwap_control_handle, capwap_data_handle; static guint capwap_control_udp_port, capwap_data_udp_port; - + if (!inited) { - capwap_control_handle = create_dissector_handle(dissect_capwap_control, proto_capwap); + capwap_control_handle = create_dissector_handle(dissect_capwap_control, proto_capwap); capwap_data_handle = create_dissector_handle(dissect_capwap_data, proto_capwap); - dtls_handle = find_dissector("dtls"); + dtls_handle = find_dissector("dtls"); ieee8023_handle = find_dissector("eth_withoutfcs"); ieee80211_handle = find_dissector("wlan"); data_handle = find_dissector("data"); - inited = TRUE; + inited = TRUE; } else { dissector_delete("udp.port", capwap_control_udp_port, capwap_control_handle); dissector_delete("udp.port", capwap_data_udp_port, capwap_data_handle); } - dissector_add("udp.port", global_capwap_control_udp_port, capwap_control_handle); dissector_add("udp.port", global_capwap_data_udp_port, capwap_data_handle); capwap_control_udp_port = global_capwap_control_udp_port; - capwap_data_udp_port = global_capwap_data_udp_port; - + capwap_data_udp_port = global_capwap_data_udp_port; } + |