Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-zbee-tlv.h
blob1952bdef03de7c7585859e45fb0b65ceca12a6a3
2 /* packet-zbee-tlv.h
3 * Dissector routines for the Zbee TLV (R23+)
4 * Copyright 2021 DSR Corporation, http://dsr-wireless.com/
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef _PACKET_ZBEE_TLV_H
14 #define _PACKET_ZBEE_TLV_H
16 #define ZBEE_TLV_HEADER_LENGTH 2
17 #define ZBEE_TLV_GLOBAL_START_NUMBER 64
19 /* Global TLV */
20 #define ZBEE_TLV_TYPE_MANUFACTURER_SPECIFIC 64
21 #define ZBEE_TLV_TYPE_SUPPORTED_KEY_NEGOTIATION_METHODS 65
22 #define ZBEE_TLV_TYPE_PANID_CONFLICT_REPORT 66
23 #define ZBEE_TLV_TYPE_NEXT_PAN_ID 67
24 #define ZBEE_TLV_TYPE_NEXT_CHANNEL_CHANGE 68
25 #define ZBEE_TLV_TYPE_PASSPHRASE 69
26 #define ZBEE_TLV_TYPE_ROUTER_INFORMATION 70
27 #define ZBEE_TLV_TYPE_FRAGMENTATION_PARAMETERS 71
28 #define ZBEE_TLV_TYPE_JOINER_ENCAPSULATION_GLOBAL 72
29 #define ZBEE_TLV_TYPE_BEACON_APPENDIX_ENCAPSULATION_GLOBAL 73
30 /* RESERVED 74 */
31 #define ZBEE_TLV_TYPE_CONFIGURATION_MODE_PARAMETERS 75
32 #define ZBEE_TLV_TYPE_DEVICE_CAPABILITY_EXTENSION 76 /* zb direct */
34 /* ZigBee local TLV source types */
35 #define ZBEE_TLV_SRC_TYPE_DEFAULT 0x00
36 #define ZBEE_TLV_SRC_TYPE_ZBEE_NWK 0x01
37 #define ZBEE_TLV_SRC_TYPE_ZBEE_APS 0x02
38 #define ZBEE_TLV_SRC_TYPE_ZBEE_ZDP 0x03
39 #define ZBEE_TLV_SRC_TYPE_ZB_DIRECT 0x04
41 /* Local TLV Tags*/
42 /* Clear All Bindings Request */
43 #define ZBEE_TLV_TYPE_CLEAR_ALL_BINDIGS_REQ_EUI64 0
44 /* Security Key Update request/response */
45 #define ZBEE_TLV_TYPE_KEY_UPD_REQ_SELECTED_KEY_NEGOTIATION_METHOD 0
46 /* Security Start Key Negotiation request/response */
47 #define ZBEE_TLV_TYPE_KEY_NEG_REQ_CURVE25519_PUBLIC_POINT 0
48 /* Security Get Authentication Token Request */
49 #define ZBEE_TLV_TYPE_REQUESTED_AUTH_TOKEN_ID 0
50 /* Security Get Authentication Token Request */
51 #define ZBEE_TLV_TYPE_TARGET_IEEE_ADDRESS 0
52 /* Security Decommission Request */
53 #define ZBEE_TLV_TYPE_EUI64 0
54 /* Beacon Survey Request */
55 #define ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION 0
56 #define ZBEE_TLV_TYPE_BEACON_SURVEY_RESULTS 1
57 #define ZBEE_TLV_TYPE_BEACON_SURVEY_POTENTIAL_PARENTS 2
59 /* Security Get_Authentication_Level Response */
60 #define ZBEE_TLV_TYPE_GET_AUTH_LEVEL 0
62 /* ZigBee Direct Communication Service */
63 #define ZBEE_TLV_TYPE_COMM_EXT_PAN_ID 0 /* Extended PAN ID */
64 #define ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID 1 /* Short PAN ID */
65 #define ZBEE_TLV_TYPE_COMM_NWK_CH 2 /* Short PAN ID */
66 #define ZBEE_TLV_TYPE_COMM_NWK_KEY 3 /* Network Channel */
67 #define ZBEE_TLV_TYPE_COMM_LNK_KEY 4 /* Link Key */
68 #define ZBEE_TLV_TYPE_COMM_DEV_TYPE 5 /* Device Type */
69 #define ZBEE_TLV_TYPE_COMM_NWK_ADDR 6 /* NWK Address */
70 #define ZBEE_TLV_TYPE_COMM_JOIN_METHOD 7 /* Joining Method */
71 #define ZBEE_TLV_TYPE_COMM_IEEE_ADDR 8 /* IEEE Address */
72 #define ZBEE_TLV_TYPE_COMM_TC_ADDR 9 /* Trust Center Address */
73 #define ZBEE_TLV_TYPE_COMM_NWK_STATUS_MAP 10 /* Network Status Map */
74 #define ZBEE_TLV_TYPE_COMM_NWK_UPD_ID 11 /* NWK Update ID */
75 #define ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM 12 /* NWK Active Key Seq Number */
76 #define ZBEE_TLV_TYPE_COMM_ADMIN_KEY 13 /* Admin Key */
77 #define ZBEE_TLV_TYPE_COMM_STATUS_CODE 14 /* Extended Status Code */
79 /* ZigBee Direct Manage Joiners TLV IDs */
80 #define ZBEE_TLV_TYPE_COMM_MJ_PROVISIONAL_LINK_KEY 0 /* Provisional Link Key */
81 #define ZBEE_TLV_TYPE_COMM_MJ_IEEE_ADDR 1 /* IEEE Address */
82 #define ZBEE_TLV_TYPE_COMM_MJ_CMD 2 /* Manage Joiners Command */
84 /* ZigBee Direct Tunnel Service */
85 #define ZBEE_TLV_TYPE_TUNNELING_NPDU_MESSAGE 0 /* NPDU Message */
87 /* ZigBee Direct Security Service */
88 #define ZBEE_TLV_TYPE_KEY_METHOD 0 /* ZigBee Direct Key Negotiation Method */
89 #define ZBEE_TLV_TYPE_PUB_POINT_P256 1 /* ZigBee Direct Key Negotiation P-256 Public Point */
90 #define ZBEE_TLV_TYPE_PUB_POINT_C25519 2 /* ZigBee Direct Key Negotiation Curve25519 Public Point */
91 #define ZBEE_TLV_TYPE_NWK_KEY_SEQ_NUM 3 /* Network Key Sequence Number */
92 #define ZBEE_TLV_TYPE_MAC_TAG 4 /* MacTag */
94 /* TLV parameters*/
95 #define ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_KEY_REQUEST 1 << 0
96 #define ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ANONYMOUS_ECDHE_USING_CURVE25519_AES_MMO128 1 << 1
97 #define ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ANONYMOUS_ECDHE_USING_CURVE25519_SHA256 1 << 2
98 #define ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ECDHE_AUTHENTICATION_CURVE25519_AES_MMO128 1 << 3
99 #define ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ECDHE_AUTHENTICATION_CURVE25519_SHA256 1 << 4
101 #define ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ZB_30 0x0
102 #define ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ECDHE_USING_CURVE25519_AES_MMO128 0x1
103 #define ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ECDHE_USING_CURVE25519_SHA256 0x2
105 #define ZBEE_TLV_SELECTED_PRE_SHARED_WELL_KNOWN_KEY 0xff
106 #define ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_AUTH_TOKEN 0x00
107 #define ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_LINK_KEY_IC 0x01
108 #define ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_VLEN_PASSCODE 0x02
109 #define ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_BASIC_ACCESS_KEY 0x03
110 #define ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_ADMIN_ACCESS_KEY 0x04
112 #define ZBEE_TLV_ROUTER_INFORMATION_HUB_CONNECTIVITY 1 << 0
113 #define ZBEE_TLV_ROUTER_INFORMATION_UPTIME 1 << 1
114 #define ZBEE_TLV_ROUTER_INFORMATION_PREF_PARENT 1 << 2
115 #define ZBEE_TLV_ROUTER_INFORMATION_BATTERY_BACKUP 1 << 3
116 #define ZBEE_TLV_ROUTER_INFORMATION_ENHANCED_BEACON_REQUEST_SUPPORT 1 << 4
117 #define ZBEE_TLV_ROUTER_INFORMATION_MAC_DATA_POLL_KEEPALIVE_SUPPORT 1 << 5
118 #define ZBEE_TLV_ROUTER_INFORMATION_END_DEVICE_KEEPALIVE_SUPPORT 1 << 6
119 #define ZBEE_TLV_ROUTER_INFORMATION_POWER_NEGOTIATION_SUPPORT 1 << 7
121 #define ZBEE_TLV_LINK_KEY_UNIQUE 1 << 0
122 #define ZBEE_TLV_LINK_KEY_PROVISIONAL 1 << 1
124 #define ZBEE_TLV_STATUS_MAP_JOINED_STATUS 0b00000111
125 #define ZBEE_TLV_STATUS_MAP_OPEN_STATUS 0b00001000
126 #define ZBEE_TLV_STATUS_MAP_NETWORK_TYPE 0b00010000
128 #define ZBEE_TLV_TYPE_MSG_SE1 1
129 #define ZBEE_TLV_TYPE_MSG_SE2 2
130 #define ZBEE_TLV_TYPE_MSG_SE3 3
131 #define ZBEE_TLV_TYPE_MSG_SE4 4
133 #define ZBEE_TLV_TYPE_KEY_ECDHE_KEY_REQUEST_ZB_30 0 /* Static Key Update Request */
134 #define ZBEE_TLV_TYPE_DIRECT_KEY_ECDHE_RESERVED_MIN 0 /* 0 is reserved in zigbee direct */
135 #define ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_25519_HASH_AESMMO128 1
136 #define ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_25519_HASH_SHA256 2
137 #define ZBEE_TLV_TYPE_KEY_ECDHE_RESERVED_MAX 3 /* 3-15 is reserved in r23 */
138 #define ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_P256_HASH_SHA256 3
140 #define ZBEE_TLV_TYPE_PSK_WELL_KNOWN_KEY 0xFF
141 #define ZBEE_TLV_TYPE_PSK_SECRET_AUTH_TOKEN 0
142 #define ZBEE_TLV_TYPE_PSK_SECRET_INSTALL_CODE 1
143 #define ZBEE_TLV_TYPE_PSK_SECRET_PAKE_PASSCODE 2
144 #define ZBEE_TLV_TYPE_PSK_SECRET_BASIC_ACCESS_KEY 3
145 #define ZBEE_TLV_TYPE_PSK_SECRET_ADMINISTRATIVE_ACCESS_KEY 4
147 #define ZBEE_TLV_TYPE_DEV_TYPE_ZC 0
148 #define ZBEE_TLV_TYPE_DEV_TYPE_ZR 1
149 #define ZBEE_TLV_TYPE_DEV_TYPE_ED 2
151 #define ZBEE_TLV_TYPE_JOIN_METHOD_MAC_ASS 0
152 #define ZBEE_TLV_TYPE_JOIN_METHOD_NWK_REJ 1
153 #define ZBEE_TLV_TYPE_JOIN_METHOD_OOB_WITH_CHECK 2
154 #define ZBEE_TLV_TYPE_JOIN_METHOD_OOB_WITHOUT_CHECK 3
156 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_GENERAL 0x00
157 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_FORM 0x01
158 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_JOIN 0x02
159 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_PERMIT_JOIN 0x03
160 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_LEAVE 0x04
161 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_MANAGE_JOINERS 0x05
162 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_IDENTIFY 0x06
163 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_FINDING_BINDING 0x07
164 #define ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_MAX 0x08
166 #define ZBEE_TLV_TYPE_JOINED_STATUS_NO_NWK 0
167 #define ZBEE_TLV_TYPE_JOINED_STATUS_JOINING 1
168 #define ZBEE_TLV_TYPE_JOINED_STATUS_JOINED 2
169 #define ZBEE_TLV_TYPE_JOINED_STATUS_JOINED_NO_PARENT 3
170 #define ZBEE_TLV_TYPE_JOINED_STATUS_LEAVING 4
172 #define ZBEE_TLV_NWK_TYPE_DISTRIBUTED 0
173 #define ZBEE_TLV_NWK_TYPE_CENTRALIZED 1
175 #define ZBEE_TLV_TYPE_NWK_STATE_CLOSED 0
176 #define ZBEE_TLV_TYPE_NWK_STATE_OPENED 1
178 #define ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_DROP 0
179 #define ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_ADD 1
180 #define ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_REMOVE 2
182 #define ZBEE_TLV_TYPE_LINK_KEY_FLAG_GLOBAL 0
183 #define ZBEE_TLV_TYPE_LINK_KEY_FLAG_UNIQUE 1
185 #define ZBEE_TLV_TYPE_LINK_KEY_FLAG_PERMANENT 0
186 #define ZBEE_TLV_TYPE_LINK_KEY_FLAG_PROVISIONAL 1
188 unsigned dissect_zbee_tlvs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, void *data, uint8_t source_type, unsigned cmd_id);
190 #endif