Coverage Report

Created: 2025-12-27 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-rf4ce-profile.c
Line
Count
Source
1
/* packet-rf4ce-profile.c
2
 * Profile layer related functions and objects for RF4CE dissector
3
 * Copyright (C) Atmosic 2023
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include "config.h"
13
14
#include <stdbool.h>
15
#include <stdio.h>
16
#include <epan/packet.h>
17
#include <epan/tfs.h>
18
#include <wsutil/array.h>
19
#include "packet-rf4ce-secur.h"
20
21
/* TLV Node-elements */
22
static int proto_rf4ce_profile;
23
24
static int ett_rf4ce_profile;
25
static int ett_rf4ce_profile_cmd_frame;
26
static int ett_rf4ce_profile_attrs;
27
static int ett_rf4ce_profile_attrs_sub;
28
static int ett_rf4ce_profile_zrc20_ident_cap;
29
static int ett_rf4ce_profile_zrc20_mappable_actions_entry;
30
static int ett_rf4ce_profile_zrc20_action_control;
31
static int ett_rf4ce_profile_zrc20_action_mappings_flags;
32
static int ett_rf4ce_profile_zrc20_action_mappings_rf_descr;
33
static int ett_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf;
34
static int ett_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts;
35
static int ett_rf4ce_profile_zrc20_action_mappings_ir_descr;
36
static int ett_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf;
37
static int ett_rf4ce_profile_gdp_poll_constraints_polling_rec;
38
static int ett_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap;
39
static int ett_rf4ce_profile_gdp_poll_configuration_polling_trig_conf;
40
static int ett_rf4ce_profile_action_records;
41
static int ett_rf4ce_profile_action_records_sub;
42
static int ett_rf4ce_profile_zrc10_supported_commands;
43
static int ett_rf4ce_profile_zrc10_supported_commands_sub;
44
45
static dissector_table_t rf4ce_profile_dissector_table;
46
47
static dissector_handle_t rf4ce_profile_handle;
48
49
/* RF4CE Profile header */
50
static int hf_rf4ce_profile_fcf;
51
static int hf_rf4ce_profile_fcf_cmd_id;
52
static int hf_rf4ce_zrc20_fcf_cmd_id;
53
static int hf_rf4ce_profile_fcf_reserved;
54
static int hf_rf4ce_profile_fcf_cmd_frame;
55
static int hf_rf4ce_profile_fcf_data_pending;
56
57
/* RF4CE Profile command - Generic Response */
58
static int hf_rf4ce_profile_cmd_generic_resp_status;
59
60
/* RF4CE Profile command - Configuration Complete */
61
static int hf_rf4ce_profile_cmd_configuration_complete_status;
62
63
/* RF4CE Profile command - Heartbeat */
64
static int hf_rf4ce_profile_cmd_heartbeat_trigger;
65
66
/* RF4CE Profile Attributes - general */
67
static int hf_rf4ce_profile_gdp_attr_id;
68
static int hf_rf4ce_profile_zrc20_attr_id;
69
static int hf_rf4ce_profile_attr_entry_id;
70
static int hf_rf4ce_profile_attr_status;
71
static int hf_rf4ce_profile_attr_length;
72
static int hf_rf4ce_profile_attr_value;
73
74
/* RF4CE Profile command - Check Validation */
75
static int hf_rf4ce_profile_cmd_check_validation_sub_type;
76
static int hf_rf4ce_profile_cmd_check_validation_control;
77
static int hf_rf4ce_profile_cmd_check_validation_status;
78
79
/* RF4CE Profile command - Client Notification */
80
static int hf_rf4ce_profile_cmd_client_notification_sub_type;
81
82
static int hf_rf4ce_profile_cmd_client_notification_identify_flags;
83
static int hf_rf4ce_profile_cmd_client_notification_identify_flags_stop_on_action;
84
static int hf_rf4ce_profile_cmd_client_notification_identify_flags_flash_light;
85
static int hf_rf4ce_profile_cmd_client_notification_identify_flags_make_sound;
86
static int hf_rf4ce_profile_cmd_client_notification_identify_flags_vibrate;
87
static int hf_rf4ce_profile_cmd_client_notification_identify_flags_reserved;
88
89
static int hf_rf4ce_profile_cmd_client_notification_identify_time;
90
91
/* RF4CE Profile command - Key Exchange */
92
static int hf_rf4ce_profile_cmd_key_exchange_sub_type;
93
94
static int hf_rf4ce_profile_cmd_key_exchange_flags;
95
static int hf_rf4ce_profile_cmd_key_exchange_flags_default_secret;
96
static int hf_rf4ce_profile_cmd_key_exchange_flags_initiator_vendor_specific_secret;
97
static int hf_rf4ce_profile_cmd_key_exchange_flags_responder_vendor_specific_secret;
98
static int hf_rf4ce_profile_cmd_key_exchange_flags_reserved;
99
static int hf_rf4ce_profile_cmd_key_exchange_flags_vendor_specific_parameter;
100
101
static int hf_rf4ce_profile_cmd_key_exchange_rand_a;
102
static int hf_rf4ce_profile_cmd_key_exchange_rand_b;
103
static int hf_rf4ce_profile_cmd_key_exchange_tag_b;
104
static int hf_rf4ce_profile_cmd_key_exchange_tag_a;
105
106
#if 0
107
/* RF4CE ZRC 2.0 Profile command - Actions */
108
static int hf_rf4ce_zrc20_cmd_actions;
109
#endif
110
111
static int hf_rf4ce_zrc20_cmd_actions_action_control;
112
static int hf_rf4ce_zrc20_cmd_actions_action_control_action_type;
113
static int hf_rf4ce_zrc20_cmd_actions_action_control_reserved;
114
static int hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_gui;
115
static int hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_alt;
116
static int hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_shift;
117
static int hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_ctrl;
118
119
static int hf_rf4ce_zrc20_cmd_actions_action_data_payload_length;
120
static int hf_rf4ce_zrc20_cmd_actions_action_data_action_bank;
121
static int hf_rf4ce_zrc20_cmd_actions_action_data_action_code;
122
static int hf_rf4ce_zrc20_cmd_actions_action_data_action_vendor;
123
static int hf_rf4ce_zrc20_cmd_actions_action_data_action_payload;
124
125
/* RF4CE ZRC 1.0 profile header */
126
static int hf_rf4ce_zrc10_fcf;
127
static int hf_rf4ce_zrc10_fcf_cmd_id;
128
static int hf_rf4ce_zrc10_fcf_reserved;
129
130
#define RF4CE_ZRC10_FCF_CMD_ID_RESERVED                       0b00000000
131
1
#define RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_PRESSED           0b00000001
132
0
#define RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_REPEATED          0b00000010
133
0
#define RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_RELEASED          0b00000011
134
1
#define RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_CMD_DISCOVERY_REQ 0b00000100
135
0
#define RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_CMD_DISCOVERY_RSP 0b00000101
136
137
23
#define RF4CE_ZRC10_FCF_CMD_ID_MASK   0b00001111
138
14
#define RF4CE_ZRC10_FCF_RESERVED_MASK 0b11110000
139
140
static const value_string rf4ce_zrc10_fcf_cmd_id_vals[] = {
141
    { RF4CE_ZRC10_FCF_CMD_ID_RESERVED,                       "Reserved" },
142
    { RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_PRESSED,           "User Control Pressed" },
143
    { RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_REPEATED,          "User Control Repeated" },
144
    { RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_RELEASED,          "User Control Released" },
145
    { RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_CMD_DISCOVERY_REQ, "Command Discovery Request" },
146
    { RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_CMD_DISCOVERY_RSP, "Command Discovery Response" },
147
    { 0, NULL }
148
};
149
150
static int hf_rf4ce_zrc10_cmd_common_rc_command_code;
151
static int hf_rf4ce_zrc10_cmd_common_rc_command_payload;
152
static int hf_rf4ce_zrc10_cmd_disc_reserved;
153
static int hf_rf4ce_zrc10_cmd_disc_rsp_supported_commands;
154
155
static int hf_rf4ce_profile_unparsed_payload;
156
157
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_RESERVED 0b00000000
158
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_START    0b00000001
159
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_REPEAT   0b00000010
160
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_ATOMIC   0b00000011
161
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_RESERVED             0b00001100
162
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_MODIFIER_BITS_GUI    0b00010000
163
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_MODIFIER_BITS_ALT    0b00100000
164
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_MODIFIER_BITS_SHIFT  0b01000000
165
14
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_MODIFIER_BITS_CTRL   0b10000000
166
167
#define RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_MASK     \
168
14
    (RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_RESERVED    \
169
14
     | RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_START     \
170
14
     | RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_REPEAT    \
171
14
     | RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_ATOMIC)
172
173
static const value_string rf4ce_zrc20_cmd_actions_action_control_action_type_vals[] = {
174
    { RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_RESERVED, "Reserved" },
175
    { RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_START,    "Start" },
176
    { RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_REPEAT,   "Repeat" },
177
    { RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_ATOMIC,   "Atomic" },
178
    { 0, NULL }
179
};
180
181
/* RF4CE Profile frame control field */
182
113
#define RF4CE_PROFILE_FCF_CMD_ID_MASK       0b00001111
183
14
#define RF4CE_PROFILE_FCF_RESERVED_MASK     0b00110000
184
99
#define RF4CE_PROFILE_FCF_CMD_FRAME_MASK    0b01000000
185
14
#define RF4CE_PROFILE_FCF_DATA_PENDING_MASK 0b10000000
186
187
/* RF4CE Profile commands */
188
1
#define RF4CE_PROFILE_CMD_GENERIC_RESPONSE         0x00
189
0
#define RF4CE_PROFILE_CMD_CONFIGURATION_COMPLETE   0x01
190
1
#define RF4CE_PROFILE_CMD_HEARTBEAT                0x02
191
10
#define RF4CE_PROFILE_CMD_GET_ATTRIBUTES           0x03
192
4
#define RF4CE_PROFILE_CMD_GET_ATTRIBUTES_RESPONSE  0x04
193
1
#define RF4CE_PROFILE_CMD_PUSH_ATTRIBUTES          0x05
194
18
#define RF4CE_PROFILE_CMD_SET_ATTRIBUTES           0x06
195
11
#define RF4CE_PROFILE_CMD_PULL_ATTRIBUTES          0x07
196
17
#define RF4CE_PROFILE_CMD_PULL_ATTRIBUTES_RESPONSE 0x08
197
1
#define RF4CE_PROFILE_CMD_CHECK_VALIDATION         0x09
198
1
#define RF4CE_PROFILE_CMD_CLIENT_NOTIFICATION      0x0a
199
1
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE             0x0b
200
201
static const value_string rf4ce_profile_fcf_cmd_id_vals[] = {
202
    { RF4CE_PROFILE_CMD_GENERIC_RESPONSE,         "Generic Response" },
203
    { RF4CE_PROFILE_CMD_CONFIGURATION_COMPLETE,   "Configuration Complete" },
204
    { RF4CE_PROFILE_CMD_HEARTBEAT,                "Heartbeat" },
205
    { RF4CE_PROFILE_CMD_GET_ATTRIBUTES,           "Get Attributes" },
206
    { RF4CE_PROFILE_CMD_GET_ATTRIBUTES_RESPONSE,  "Get Attributes Response" },
207
    { RF4CE_PROFILE_CMD_PUSH_ATTRIBUTES,          "Push Attributes" },
208
    { RF4CE_PROFILE_CMD_SET_ATTRIBUTES,           "Set Attributes" },
209
    { RF4CE_PROFILE_CMD_PULL_ATTRIBUTES,          "Pull Attributes" },
210
    { RF4CE_PROFILE_CMD_PULL_ATTRIBUTES_RESPONSE, "Pull Attributes Response" },
211
    { RF4CE_PROFILE_CMD_CHECK_VALIDATION,         "Check Validation" },
212
    { RF4CE_PROFILE_CMD_CLIENT_NOTIFICATION,      "Client Notification" },
213
    { RF4CE_PROFILE_CMD_KEY_EXCHANGE,             "Key Exchange" },
214
    { 0, NULL }
215
};
216
217
#define RF4CE_PROFILE_FCF_CMD_PROFILE_SPECIFIC_COMMAND 0
218
#define RF4CE_PROFILE_FCF_CMD_GDP_COMMAND     1
219
220
static const value_string rf4ce_profile_fcf_cmd_frame_vals[] = {
221
    { RF4CE_PROFILE_FCF_CMD_PROFILE_SPECIFIC_COMMAND, "Profile Specific Command" },
222
    { RF4CE_PROFILE_FCF_CMD_GDP_COMMAND,              "GDP Command" },
223
    { 0, NULL }
224
};
225
226
/* RF4CE ZRC 2.0 Profile commands */
227
                             /* 0x00 - 0x05 - Reserved */
228
14
#define RF4CE_ZRC20_CMD_ACTIONS 0x06
229
                             /* 0x07 - 0x0f - Reserved */
230
231
static const value_string rf4ce_zrc20_fcf_cmd_id_vals[] = {
232
    { RF4CE_ZRC20_CMD_ACTIONS, "Actions" },    { 0, NULL }
233
};
234
235
/* RF4CE Profile command - Generic Response */
236
#define RF4CE_PROFILE_CMD_GENERIC_RESP_STATUS_SUCCESS               0x00
237
#define RF4CE_PROFILE_CMD_GENERIC_RESP_STATUS_UNSUPPORTED_REQUEST   0x01
238
#define RF4CE_PROFILE_CMD_GENERIC_RESP_STATUS_INVALID_PARAMETER     0x02
239
#define RF4CE_PROFILE_CMD_GENERIC_RESP_STATUS_CONFIGURATION_FAILURE 0x03
240
                                                                 /* 0x04 – 0x3f Reserved error codes */
241
                                                                 /* 0x40 – 0xff Profile specific error codes */
242
243
static const value_string hf_rf4ce_profile_cmd_generic_resp_status_vals[] = {
244
    { RF4CE_PROFILE_CMD_GENERIC_RESP_STATUS_SUCCESS,               "Success" },
245
    { RF4CE_PROFILE_CMD_GENERIC_RESP_STATUS_UNSUPPORTED_REQUEST,   "Unsupported Request" },
246
    { RF4CE_PROFILE_CMD_GENERIC_RESP_STATUS_INVALID_PARAMETER,     "Invalid Parameter" },
247
    { RF4CE_PROFILE_CMD_GENERIC_RESP_STATUS_CONFIGURATION_FAILURE, "Configuration Failure" },
248
    { 0, NULL }
249
};
250
251
/* RF4CE Profile command - Configuration Complete */
252
#define RF4CE_PROFILE_CMD_CONFIGURATION_COMPLETE_STATUS_SUCCESS               0x00
253
                                                                           /* 0x01 – 0x02 Reserved error codes */
254
#define RF4CE_PROFILE_CMD_CONFIGURATION_COMPLETE_STATUS_CONFIGURATION_FAILURE 0x03
255
                                                                           /* 0x04 – 0x3f Reserved error codes */
256
                                                                           /* 0x40 – 0xff Profile specific error codes */
257
258
static const value_string hf_rf4ce_profile_cmd_configuration_complete_status_vals[] = {
259
    { RF4CE_PROFILE_CMD_CONFIGURATION_COMPLETE_STATUS_SUCCESS,               "Success" },
260
    { RF4CE_PROFILE_CMD_CONFIGURATION_COMPLETE_STATUS_CONFIGURATION_FAILURE, "Configuration Failure" },
261
    { 0, NULL }
262
};
263
264
/* RF4CE Profile command - Heartbeat */
265
#define RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_GENERIC_ACTIVITY               0x00
266
#define RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_TIME_BASED_POLLING             0x01
267
#define RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_KEY_PRESS           0x02
268
#define RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_PICKUP              0x03
269
#define RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_RESET               0x04
270
#define RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_MICROPHONE_ACTIVITY 0x05
271
#define RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_OTHER_USER_ACTIVITY 0x06
272
                                                                        /* 0x07 – 0xff Reserved */
273
274
static const value_string hf_rf4ce_profile_cmd_heartbeat_trigger_vals[] = {
275
    { RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_GENERIC_ACTIVITY,               "Generic Activity" },
276
    { RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_TIME_BASED_POLLING,             "Time Based Polling" },
277
    { RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_KEY_PRESS,           "Polling on Key Press" },
278
    { RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_PICKUP,              "Polling on Pickup" },
279
    { RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_RESET,               "Polling on Reset" },
280
    { RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_MICROPHONE_ACTIVITY, "Polling on Microphone Activity" },
281
    { RF4CE_PROFILE_CMD_HEARTBEAT_TRIGGER_POLLING_ON_OTHER_USER_ACTIVITY, "Polling on other User Activity" },
282
    { 0, NULL }
283
};
284
285
/* RF4CE Profile Attributes common */
286
2.71k
#define RF4CE_PROFILE_ATTR_DISSECT_NOT_SET                      0b00000000
287
1.42k
#define RF4CE_PROFILE_ATTR_DISSECT_ATTR_ID_MASK                 0b00000001
288
1.42k
#define RF4CE_PROFILE_ATTR_DISSECT_ENTRY_ID_MASK                0b00000010
289
1.38k
#define RF4CE_PROFILE_ATTR_DISSECT_ATTR_STATUS_MASK             0b00000100
290
1.10k
#define RF4CE_PROFILE_ATTR_DISSECT_ATTR_LENGTH_MASK             0b00001000
291
2.46k
#define RF4CE_PROFILE_ATTR_DISSECT_ATTR_VALUE_MASK              0b00010000
292
293
#define RF4CE_PROFILE_ATTR_DISSECT_GET_ATTRS_MASK       \
294
10
    (RF4CE_PROFILE_ATTR_DISSECT_ATTR_ID_MASK            \
295
10
     | RF4CE_PROFILE_ATTR_DISSECT_ENTRY_ID_MASK)
296
297
#define RF4CE_PROFILE_ATTR_DISSECT_GET_ATTRS_RESP_MASK  \
298
4
    (RF4CE_PROFILE_ATTR_DISSECT_ATTR_ID_MASK            \
299
4
     | RF4CE_PROFILE_ATTR_DISSECT_ENTRY_ID_MASK         \
300
4
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_STATUS_MASK      \
301
4
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_LENGTH_MASK      \
302
4
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_VALUE_MASK)      \
303
304
#define RF4CE_PROFILE_ATTR_DISSECT_PUSH_ATTRS_MASK      \
305
1
    (RF4CE_PROFILE_ATTR_DISSECT_ATTR_ID_MASK            \
306
1
     | RF4CE_PROFILE_ATTR_DISSECT_ENTRY_ID_MASK         \
307
1
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_LENGTH_MASK      \
308
1
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_VALUE_MASK)
309
310
#define RF4CE_PROFILE_ATTR_DISSECT_SET_ATTRS_MASK       \
311
18
    (RF4CE_PROFILE_ATTR_DISSECT_ATTR_ID_MASK            \
312
18
     | RF4CE_PROFILE_ATTR_DISSECT_ENTRY_ID_MASK         \
313
18
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_LENGTH_MASK      \
314
18
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_VALUE_MASK)
315
316
#define RF4CE_PROFILE_ATTR_DISSECT_PULL_ATTRS_MASK      \
317
11
    (RF4CE_PROFILE_ATTR_DISSECT_ATTR_ID_MASK            \
318
11
     | RF4CE_PROFILE_ATTR_DISSECT_ENTRY_ID_MASK)
319
320
#define RF4CE_PROFILE_ATTR_DISSECT_PULL_ATTRS_RESP_MASK \
321
17
    (RF4CE_PROFILE_ATTR_DISSECT_ATTR_ID_MASK            \
322
17
     | RF4CE_PROFILE_ATTR_DISSECT_ENTRY_ID_MASK         \
323
17
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_STATUS_MASK      \
324
17
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_LENGTH_MASK      \
325
17
     | RF4CE_PROFILE_ATTR_DISSECT_ATTR_VALUE_MASK)
326
327
/* RF4CE GDP Attributes */
328
329
/* GDP Attribute - Identification Capabilities */
330
static int hf_rf4ce_profile_gdp_ident_cap;
331
static int hf_rf4ce_profile_gdp_ident_cap_reserved;
332
static int hf_rf4ce_profile_gdp_ident_cap_support_flash_light;
333
static int hf_rf4ce_profile_gdp_ident_cap_support_make_short_sound;
334
static int hf_rf4ce_profile_gdp_ident_cap_support_vibrate;
335
static int hf_rf4ce_profile_gdp_ident_cap_reserved2;
336
337
14
#define RF4CE_PROFILE_GDP_IDENT_CAP_RESERVED_MASK                 0b00000001
338
14
#define RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_FLASH_LIGHT_MASK      0b00000010
339
14
#define RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_MAKE_SHORT_SOUND_MASK 0b00000100
340
14
#define RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_VIBRATE_MASK          0b00001000
341
14
#define RF4CE_PROFILE_GDP_IDENT_CAP_RESERVED2_MASK                0b11110000
342
343
#define RF4CE_PROFILE_GDP_IDENT_CAP_MASK                            \
344
    (RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_FLASH_LIGHT_MASK           \
345
     | RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_MAKE_SHORT_SOUND_MASK    \
346
     | RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_VIBRATE_MASK             \
347
     | RF4CE_PROFILE_GDP_IDENT_CAP_RESERVED2_MASK)
348
349
/* GDP Attribute - Poll Constraints */
350
static int hf_rf4ce_profile_gdp_poll_constraints_methods_num;
351
352
/* Polling constraint record - Polling method ID */
353
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_method_id;
354
355
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_METHOD_ID_DIS           0x00
356
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_METHOD_ID_GDP_HEARTBEAT 0x01
357
358
static const value_string rf4ce_profile_gdp_poll_constraints_polling_rec_method_id_vals[] = {
359
    { RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_METHOD_ID_DIS,           "Disabled" },
360
    { RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_METHOD_ID_GDP_HEARTBEAT, "GDP heartbeat based polling" },
361
    { 0, NULL}
362
};
363
364
/* Polling constraint record - Polling trigger capabilities */
365
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap;
366
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_tbased;
367
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_k_press;
368
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_pick_up;
369
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_reset;
370
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_micro_act;
371
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_user_act;
372
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_reserved;
373
374
28
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_TBASED_MASK       (0b0000000000000001)
375
28
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_K_PRESS_MASK   (0b0000000000000010)
376
28
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_PICK_UP_MASK   (0b0000000000000100)
377
28
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_RESET_MASK     (0b0000000000001000)
378
28
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_MICRO_ACT_MASK (0b0000000000010000)
379
28
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_USER_ACT_MASK  (0b0000000000100000)
380
28
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_RESERVED_MASK     (0b1111111111000000)
381
382
#define RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_MASK                \
383
14
    (RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_TBASED_MASK            \
384
14
     | RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_K_PRESS_MASK      \
385
14
     | RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_PICK_UP_MASK      \
386
14
     | RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_RESET_MASK        \
387
14
     | RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_MICRO_ACT_MASK    \
388
14
     | RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_USER_ACT_MASK     \
389
14
     | RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_RESERVED_MASK)
390
391
/* Polling constraint record - other fields */
392
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_min_polling_key_press_cnt;
393
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_max_polling_key_press_cnt;
394
395
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_min_polling_time_interval;
396
static int hf_rf4ce_profile_gdp_poll_constraints_polling_rec_max_polling_time_interval;
397
398
/* GDP Attribute - Poll Configuration */
399
static int hf_rf4ce_profile_gdp_poll_configuration_method_id;
400
401
/* GDP Attribute - Poll Configuration - Polling Trigger Configuration */
402
static int hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf;
403
static int hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_tbased;
404
static int hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_k_press;
405
static int hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_pick_up;
406
static int hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_reset;
407
static int hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_micro_act;
408
static int hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_user_act;
409
static int hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_reserved;
410
411
14
#define RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_TBASED_MASK       (0b0000000000000001)
412
14
#define RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_K_PRESS_MASK   (0b0000000000000010)
413
14
#define RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_PICK_UP_MASK   (0b0000000000000100)
414
14
#define RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_RESET_MASK     (0b0000000000001000)
415
14
#define RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_MICRO_ACT_MASK (0b0000000000010000)
416
14
#define RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_USER_ACT_MASK  (0b0000000000100000)
417
14
#define RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_RESERVED_MASK     (0b1111111111000000)
418
419
#define RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_MASK             \
420
    (RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_TBASED_MASK         \
421
     | RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_K_PRESS_MASK   \
422
     | RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_PICK_UP_MASK   \
423
     | RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_RESET_MASK     \
424
     | RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_MICRO_ACT_MASK \
425
     | RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_USER_ACT_MASK  \
426
     | RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_RESERVED_MASK)
427
428
static int hf_rf4ce_profile_gdp_poll_configuration_polling_key_press_cnt;
429
static int hf_rf4ce_profile_gdp_poll_configuration_polling_time_interval;
430
static int hf_rf4ce_profile_gdp_poll_configuration_polling_timeout;
431
432
                                                             /* 0x00 - 0x7f - Reserved */
433
#define RF4CE_GDP_ATTR_GDP_PROFILE_VERSION                      0x80
434
#define RF4CE_GDP_ATTR_GDP_PROFILE_CAPABILITIES                 0x81
435
#define RF4CE_GDP_ATTR_KEY_EXCHANGE_TRANSFER_COUNT              0x82
436
#define RF4CE_GDP_ATTR_POWER_STATUS                             0x83
437
35
#define RF4CE_GDP_ATTR_POLL_CONSTRAINTS                         0x84
438
35
#define RF4CE_GDP_ATTR_POLL_CONFIGURATION                       0x85
439
#define RF4CE_GDP_ATTR_MAX_BINDING_CANDIDATES                   0x86
440
#define RF4CE_GDP_ATTR_AUTO_CHECK_VALID_PERIOD                  0x87
441
#define RF4CE_GDP_ATTR_BINDING_RECIPIENT_VALIDATION_WAIT_TIME   0x88
442
#define RF4CE_GDP_ATTR_BINDING_ORIGINATOR_VALIDATION_WAIT_TIME  0x89
443
#define RF4CE_GDP_ATTR_LINK_LOST_WAIT_TIME                      0x8a
444
36
#define RF4CE_GDP_ATTR_IDENTIFICATION_CAPABILITIES              0x8b
445
446
/* Reserved for scalar Profile attributes */
447
#define RF4CE_GDP_ATTR_SCALAR1_RESERVED_MIN                     0x8c
448
#define RF4CE_GDP_ATTR_SCALAR1_RESERVED_MAX                     0x8f
449
450
/* Reserved for arrayed Profile attributes */
451
1.96k
#define RF4CE_GDP_ATTR_ARRAYED1_RESERVED_MIN                    0x90
452
384
#define RF4CE_GDP_ATTR_ARRAYED1_RESERVED_MAX                    0x90
453
454
/* Reserved for scalar Profile attributes */
455
#define RF4CE_GDP_ATTR_SCALAR2_RESERVED_MIN                     0xa0
456
#define RF4CE_GDP_ATTR_SCALAR2_RESERVED_MAX                     0xbf
457
458
/* Reserved for arrayed Profile attributes */
459
1.95k
#define RF4CE_GDP_ATTR_ARRAYED2_RESERVED_MIN                    0xc0
460
185
#define RF4CE_GDP_ATTR_ARRAYED2_RESERVED_MAX                    0xdf
461
462
/* Reserved for scalar Profile attributes */
463
#define RF4CE_GDP_ATTR_SCALAR3_RESERVED_MIN                     0xe0
464
#define RF4CE_GDP_ATTR_SCALAR3_RESERVED_MAX                     0xff
465
466
static const value_string rf4ce_profile_gdp_attr_vals[] = {
467
    { RF4CE_GDP_ATTR_GDP_PROFILE_VERSION,                     "Profile Version" },
468
    { RF4CE_GDP_ATTR_GDP_PROFILE_CAPABILITIES,                "Profile Capabilities" },
469
    { RF4CE_GDP_ATTR_KEY_EXCHANGE_TRANSFER_COUNT,             "KEY Exchange Transfer Count" },
470
    { RF4CE_GDP_ATTR_POWER_STATUS,                            "Power Status" },
471
    { RF4CE_GDP_ATTR_POLL_CONSTRAINTS,                        "Poll Constraints" },
472
    { RF4CE_GDP_ATTR_POLL_CONFIGURATION,                      "Poll Configuration" },
473
    { RF4CE_GDP_ATTR_MAX_BINDING_CANDIDATES,                  "Max Binding Candidates" },
474
    { RF4CE_GDP_ATTR_AUTO_CHECK_VALID_PERIOD,                 "Auto Check Valid Period" },
475
    { RF4CE_GDP_ATTR_BINDING_RECIPIENT_VALIDATION_WAIT_TIME,  "Binding Recipient Validation Wait Time" },
476
    { RF4CE_GDP_ATTR_BINDING_ORIGINATOR_VALIDATION_WAIT_TIME, "Binding Originator Validation Wait Time" },
477
    { RF4CE_GDP_ATTR_LINK_LOST_WAIT_TIME,                     "Link Lost Wait Time" },
478
    { RF4CE_GDP_ATTR_IDENTIFICATION_CAPABILITIES,             "Identification Capabilities" },
479
    { 0, NULL }
480
};
481
482
/* RF4CE ZRC 2.0 Attributes */
483
#define RF4CE_ZRC20_ATTR_ZRC_PROFILE_VERSION            0xA0
484
#define RF4CE_ZRC20_ATTR_ZRC_PROFILE_CAPABILITIES       0xA1
485
#define RF4CE_ZRC20_ATTR_ACTION_REPEAT_TRIGGER_INTERVAL 0xA2
486
#define RF4CE_ZRC20_ATTR_ACTION_REPEAT_WAIT_TIME        0xA3
487
#define RF4CE_ZRC20_ATTR_ACTION_BANKS_SUPPORTED_RX      0xA4
488
#define RF4CE_ZRC20_ATTR_ACTION_BANKS_SUPPORTED_TX      0xA5
489
31
#define RF4CE_ZRC20_ATTR_IRDB_VENDOR_SUPPORT            0xA6
490
#define RF4CE_ZRC20_ATTR_ZRC_ACTION_BANKS_VERSION       0xA7
491
492
/* Reserved for scalar profile attributes */
493
#define RF4CE_ZRC20_ATTR_SCALAR1_MIN                    0xA8
494
#define RF4CE_ZRC20_ATTR_SCALAR1_MAX                    0xBF
495
496
752
#define RF4CE_ZRC20_ATTR_ACTION_CODES_SUPPORTED_RX      0xC0
497
752
#define RF4CE_ZRC20_ATTR_ACTION_CODES_SUPPORTED_TX      0xC1
498
784
#define RF4CE_ZRC20_ATTR_MAPPABLE_ACTIONS               0xC2
499
782
#define RF4CE_ZRC20_ATTR_ACTION_MAPPINGS                0xC3
500
751
#define RF4CE_ZRC20_ATTR_HOME_AUTOMATION                0xC4
501
745
#define RF4CE_ZRC20_ATTR_HOME_AUTOMATION_SUPPORTED      0xC5
502
503
/* Reserved for arrayed profile attributes */
504
738
#define RF4CE_ZRC20_ATTR_ARRAYED1_MIN                   0xC6
505
159
#define RF4CE_ZRC20_ATTR_ARRAYED2_MAX                   0xDF
506
507
/* Reserved for scalar profile attributes */
508
#define RF4CE_ZRC20_ATTR_SCALAR2_MIN                    0xE0
509
#define RF4CE_ZRC20_ATTR_SCALAR2_MAX                    0xFF
510
511
static const value_string rf4ce_profile_zrc20_attr_vals[] = {
512
    { RF4CE_ZRC20_ATTR_ZRC_PROFILE_VERSION,            "ZRC Profile Version" },
513
    { RF4CE_ZRC20_ATTR_ZRC_PROFILE_CAPABILITIES,       "ZRC Profile Capabilities" },
514
    { RF4CE_ZRC20_ATTR_ACTION_REPEAT_TRIGGER_INTERVAL, "Action Repeat Trigger Interval" },
515
    { RF4CE_ZRC20_ATTR_ACTION_REPEAT_WAIT_TIME,        "Action Repeat Wait Time" },
516
    { RF4CE_ZRC20_ATTR_ACTION_BANKS_SUPPORTED_RX,      "Action Banks Supported RX" },
517
    { RF4CE_ZRC20_ATTR_ACTION_BANKS_SUPPORTED_TX,      "Action Banks Supported TX" },
518
    { RF4CE_ZRC20_ATTR_IRDB_VENDOR_SUPPORT,            "IRDB Vendor Support" },
519
    { RF4CE_ZRC20_ATTR_ZRC_ACTION_BANKS_VERSION,       "ZRC Action Banks Version" },
520
    { RF4CE_ZRC20_ATTR_ACTION_CODES_SUPPORTED_RX,      "Action Codes Supported RX" },
521
    { RF4CE_ZRC20_ATTR_ACTION_CODES_SUPPORTED_TX,      "Action Codes Supported TX" },
522
    { RF4CE_ZRC20_ATTR_MAPPABLE_ACTIONS,               "Mappable Actions" },
523
    { RF4CE_ZRC20_ATTR_ACTION_MAPPINGS,                "Action Mappings" },
524
    { RF4CE_ZRC20_ATTR_HOME_AUTOMATION,                "Home Automation" },
525
    { RF4CE_ZRC20_ATTR_HOME_AUTOMATION_SUPPORTED,      "Home Automation Supported" },
526
    { 0, NULL }
527
};
528
529
5.49k
#define RF4CE_PROFILE_ATTR_STATUS_ATTRIBUTE_SUCCESSFULLY_READ_AND_INCLUDED 0x00
530
#define RF4CE_PROFILE_ATTR_STATUS_UNSUPPORTED_ATTRIBUTE                    0x01
531
#define RF4CE_PROFILE_ATTR_STATUS_ILLEGAL_REQUEST                          0x02
532
#define RF4CE_PROFILE_ATTR_STATUS_INVALID_ENTRY                            0x03
533
                                                                        /* 0x04 - 0xff Reserved error codes */
534
535
static const value_string hf_rf4ce_profile_attr_status_vals[] = {
536
    { RF4CE_PROFILE_ATTR_STATUS_ATTRIBUTE_SUCCESSFULLY_READ_AND_INCLUDED, "Attribute Successfully Read and Included" },
537
    { RF4CE_PROFILE_ATTR_STATUS_UNSUPPORTED_ATTRIBUTE,                    "Unsupported Attribute" },
538
    { RF4CE_PROFILE_ATTR_STATUS_ILLEGAL_REQUEST,                          "Illegal Request" },
539
    { RF4CE_PROFILE_ATTR_STATUS_INVALID_ENTRY,                            "Invalid Entry" },
540
    { 0, NULL }
541
};
542
543
/* RF4CE ZRC 2.0 Profile - Mappable Actions attribute */
544
static int hf_rf4ce_profile_zrc20_mappable_actions_action_dev_type;
545
static int hf_rf4ce_profile_zrc20_mappable_actions_action_bank;
546
static int hf_rf4ce_profile_zrc20_mappable_actions_action_code;
547
548
#define RF4CE_PROFILE_DEV_TYPE_RESERVED                         0x00
549
#define RF4CE_PROFILE_DEV_TYPE_REMOTE_CONTROL                   0x01
550
#define RF4CE_PROFILE_DEV_TYPE_TELEVISION                       0x02
551
#define RF4CE_PROFILE_DEV_TYPE_PROJECTOR                        0x03
552
#define RF4CE_PROFILE_DEV_TYPE_PLAYER                           0x04
553
#define RF4CE_PROFILE_DEV_TYPE_RECORDER                         0x05
554
#define RF4CE_PROFILE_DEV_TYPE_VIDEO_PLAYER_OR_RECORDER         0x06 /* (VCR, DVR, DVD, Blu-ray, portable) */
555
#define RF4CE_PROFILE_DEV_TYPE_AUDIO_PLAYER_OR_RECORDER         0x07 /* (CD, portable) */
556
#define RF4CE_PROFILE_DEV_TYPE_AUDIO_VIDEO_RECORDER             0x08
557
#define RF4CE_PROFILE_DEV_TYPE_SET_TOP_BOX                      0x09
558
#define RF4CE_PROFILE_DEV_TYPE_HOME_THEATER_SYSTEM              0x0a
559
#define RF4CE_PROFILE_DEV_TYPE_MEDIA_CENTER_OR_PC               0x0b
560
#define RF4CE_PROFILE_DEV_TYPE_GAME_CONSOLE                     0x0c
561
#define RF4CE_PROFILE_DEV_TYPE_SATELLITE_RADIO_RECEIVER         0x0d
562
#define RF4CE_PROFILE_DEV_TYPE_IR_EXTENDER                      0x0e
563
#define RF4CE_PROFILE_DEV_TYPE_MONITOR                          0x0f
564
                                                                /* 0x10 – 0xcf Reserved */
565
                                                                /* 0xd0 – 0xef Vendor-specific device */
566
                                                                /* 0xf0 – 0xfb Reserved */
567
#define RF4CE_PROFILE_DEV_TYPE_VENDOR_SPECIFIC_WILDCARD_DEV     0xfc
568
#define RF4CE_PROFILE_DEV_TYPE_NON_VENDOR_SPECIFIC_WILDCARD_DEV 0xfd
569
#define RF4CE_PROFILE_DEV_TYPE_GENERIC                          0xfe
570
#define RF4CE_PROFILE_DEV_TYPE_RESERVED_FOR_WILDCARDS           0xff
571
572
static const value_string rf4ce_profile_device_type_vals[] = {
573
    { RF4CE_PROFILE_DEV_TYPE_RESERVED,                         "Reserved" },
574
    { RF4CE_PROFILE_DEV_TYPE_REMOTE_CONTROL,                   "Remote Control" },
575
    { RF4CE_PROFILE_DEV_TYPE_TELEVISION,                       "Television" },
576
    { RF4CE_PROFILE_DEV_TYPE_PROJECTOR,                        "Projector" },
577
    { RF4CE_PROFILE_DEV_TYPE_PLAYER,                           "Player" },
578
    { RF4CE_PROFILE_DEV_TYPE_RECORDER,                         "Recorder" },
579
    { RF4CE_PROFILE_DEV_TYPE_VIDEO_PLAYER_OR_RECORDER,         "Video Player\\Recorder" },
580
    { RF4CE_PROFILE_DEV_TYPE_AUDIO_PLAYER_OR_RECORDER,         "Audio Player\\Recorder" },
581
    { RF4CE_PROFILE_DEV_TYPE_AUDIO_VIDEO_RECORDER,             "Audio Video Recorder" },
582
    { RF4CE_PROFILE_DEV_TYPE_SET_TOP_BOX,                      "Set Top Box" },
583
    { RF4CE_PROFILE_DEV_TYPE_HOME_THEATER_SYSTEM,              "Home Theater System" },
584
    { RF4CE_PROFILE_DEV_TYPE_MEDIA_CENTER_OR_PC,               "Media Center\\PC" },
585
    { RF4CE_PROFILE_DEV_TYPE_GAME_CONSOLE,                     "Game Console" },
586
    { RF4CE_PROFILE_DEV_TYPE_SATELLITE_RADIO_RECEIVER,         "Satellite Radio Receiver" },
587
    { RF4CE_PROFILE_DEV_TYPE_IR_EXTENDER,                      "IR Extender" },
588
    { RF4CE_PROFILE_DEV_TYPE_MONITOR,                          "Monitor" },
589
    { RF4CE_PROFILE_DEV_TYPE_VENDOR_SPECIFIC_WILDCARD_DEV,     "Vendor Specific Wildcard Device" },
590
    { RF4CE_PROFILE_DEV_TYPE_NON_VENDOR_SPECIFIC_WILDCARD_DEV, "Non-Vendor Specific Wildcard Device" },
591
    { RF4CE_PROFILE_DEV_TYPE_GENERIC,                          "Generic" },
592
    { RF4CE_PROFILE_DEV_TYPE_RESERVED_FOR_WILDCARDS,           "Reserved for Wildcards" },
593
    { 0, NULL }
594
};
595
596
/* RF4CE ZRC 2.0 Profile - Action Mappings attribute - Mapping Flags */
597
static int hf_rf4ce_profile_zrc20_action_mappings_mapping_flags;
598
static int hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_rf_specified;
599
static int hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_ir_specified;
600
static int hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_rf_descr_first;
601
static int hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_reserved;
602
static int hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_use_default;
603
static int hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_permanent;
604
605
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RF_SPECIFIED_MASK   0b00000001
606
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_IR_SPECIFIED_MASK   0b00000010
607
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RF_DESCR_FIRST_MASK 0b00000100
608
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RESERVED_MASK       0b00111000
609
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_USE_DEFAULT_MASK    0b01000000
610
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_PERMANENT_MASK      0b10000000
611
612
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_MASK                  \
613
14
    (RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RF_SPECIFIED_MASK        \
614
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_IR_SPECIFIED_MASK      \
615
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RF_DESCR_FIRST_MASK    \
616
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RESERVED_MASK          \
617
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_USE_DEFAULT_MASK       \
618
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_PERMANENT_MASK)
619
620
/* RF4CE ZRC 2.0 Profile - Action Mappings attribute - RF Descriptor - RF Config */
621
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf;
622
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_min_num_of_trans;
623
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_keep_trans_until_key_release;
624
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_short_rf_retry;
625
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_atomic_action;
626
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_reserved;
627
628
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_MIN_NUM_OF_TRANS_MASK             0b00001111
629
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_KEEP_TRANS_UNTIL_KEY_RELEASE_MASK 0b00010000
630
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_SHORT_RF_RETRY_MASK               0b00100000
631
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_ATOMIC_ACTION_MASK                0b01000000
632
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_RESERVED_MASK                     0b10000000
633
634
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_MASK                               \
635
14
    (RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_MIN_NUM_OF_TRANS_MASK                 \
636
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_KEEP_TRANS_UNTIL_KEY_RELEASE_MASK   \
637
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_SHORT_RF_RETRY_MASK                 \
638
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_ATOMIC_ACTION_MASK                  \
639
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_RESERVED_MASK)
640
641
/* RF4CE ZRC 2.0 Profile - Action Mappings attribute - RF Descriptor - RF4CE TX Options */
642
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts;
643
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_trans_mode;
644
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_dst_addr_mode;
645
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ack_mode;
646
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_sec_mode;
647
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_ag_mode;
648
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_norm_mode;
649
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_payload_mode;
650
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_reserved;
651
652
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_TRANS_MODE_MASK    0b00000001
653
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_DST_ADDR_MODE_MASK 0b00000010
654
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_ACK_MODE_MASK      0b00000100
655
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_SEC_MODE_MASK      0b00001000
656
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_CH_AG_MODE_MASK    0b00010000
657
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_CH_NORM_MODE_MASK  0b00100000
658
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_PAYLOAD_MODE_MASK  0b01000000
659
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_RESERVED_MASK      0b10000000
660
661
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_MASK               \
662
14
    (RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_TRANS_MODE_MASK       \
663
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_DST_ADDR_MODE_MASK  \
664
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_ACK_MODE_MASK       \
665
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_SEC_MODE_MASK       \
666
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_CH_AG_MODE_MASK     \
667
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_CH_NORM_MODE_MASK   \
668
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_PAYLOAD_MODE_MASK   \
669
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_RESERVED_MASK)
670
671
static const true_false_string rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_trans_mode_vals = {
672
    "Broadcast Transmission",
673
    "Unicast Transmission"
674
};
675
676
static const true_false_string rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_dst_addr_mode_vals = {
677
    "Use Destination IEEE Address",
678
    "Use Destination Network Address"
679
};
680
681
static const true_false_string rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ack_mode_vals = {
682
    "Acknowledged Transmission",
683
    "Unacknowledged Transmission"
684
};
685
686
static const true_false_string rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_sec_mode_vals = {
687
    "Transmit with Security",
688
    "Transmit without Security"
689
};
690
691
static const true_false_string rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_ag_mode_vals = {
692
    "Use Single Channel Operation",
693
    "Use Multiple Channel Operation"
694
};
695
696
static const true_false_string rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_norm_mode_vals = {
697
    "Specify Channel Designator",
698
    "Do not Specify Channel Designator"
699
};
700
701
static const true_false_string rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_payload_mode_vals = {
702
    "Data is Vendor-specific",
703
    "Data is not Vendor-specific"
704
};
705
706
/* RF4CE ZRC 2.0 Profile - Action Mappings attribute - RF Descriptor - Action Data Length */
707
static int hf_rf4ce_profile_zrc20_action_mappings_rf_descr_action_data_len;
708
709
/* RF4CE ZRC 2.0 Profile - Action Mappings attribute - IR Descriptor - IR Config */
710
static int hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf;
711
static int hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf_vendor_specific;
712
static int hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf_reserved;
713
714
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_VENDOR_SPECIFIC_MASK 0b00000001
715
28
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_RESERVED_MASK        0b11111110
716
717
#define RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_MASK               \
718
14
    (RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_VENDOR_SPECIFIC_MASK  \
719
14
     | RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_RESERVED_MASK)
720
721
/* RF4CE ZRC 2.0 Profile - Action Mappings attribute - IR Descriptor */
722
static int hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_vendor_id;
723
static int hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_code_len;
724
static int hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_code;
725
726
/* RF4CE ZRC 2.0 Profile - IRDB Vendor Support attribute - Vendor ID */
727
static int hf_rf4ce_profile_zrc20_irdb_vendor_support_vendor_id;
728
729
/* RF4CE Profile command - Check Validation */
730
1
#define RF4CE_PROFILE_CMD_CHECK_VALIDATION_SUB_TYPE_REQ 0x00
731
0
#define RF4CE_PROFILE_CMD_CHECK_VALIDATION_SUB_TYPE_RSP 0x01
732
                                                     /* 0x02 - 0xff - reserved */
733
734
static const value_string rf4ce_profile_cmd_check_validation_sub_type_vals[] = {
735
    { RF4CE_PROFILE_CMD_CHECK_VALIDATION_SUB_TYPE_REQ, "Request" },
736
    { RF4CE_PROFILE_CMD_CHECK_VALIDATION_SUB_TYPE_RSP, "Response" },
737
    { 0, NULL }
738
};
739
740
#define RF4CE_PROFILE_CMD_CHECK_VALIDATION_STATUS_SUCCESS 0x00
741
#define RF4CE_PROFILE_CMD_CHECK_VALIDATION_STATUS_PENDING 0x01
742
#define RF4CE_PROFILE_CMD_CHECK_VALIDATION_STATUS_TIMEOUT 0x02
743
#define RF4CE_PROFILE_CMD_CHECK_VALIDATION_STATUS_FAILURE 0x03
744
745
static const value_string rf4ce_profile_cmd_check_validation_status_vals[] = {
746
    { RF4CE_PROFILE_CMD_CHECK_VALIDATION_STATUS_SUCCESS, "Success" },
747
    { RF4CE_PROFILE_CMD_CHECK_VALIDATION_STATUS_PENDING, "Pending" },
748
    { RF4CE_PROFILE_CMD_CHECK_VALIDATION_STATUS_TIMEOUT, "Timeout" },
749
    { RF4CE_PROFILE_CMD_CHECK_VALIDATION_STATUS_FAILURE, "Failure" },
750
    { 0, NULL }
751
};
752
753
/* RF4CE Profile command - Client Notification */
754
1
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY                            0x00
755
2
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_POLL_NEGOTIATION                0x01
756
                                                                             /* 0x02 - 0x3f
757
                                                                                Reserved for Profile Client Notification Sub Types. */
758
1
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_ACTION_MAPPING_NEGOTIATION      0x40
759
1
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_HOME_AUTOMATION_PULL            0x41
760
1
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_SELECTIVE_ACTION_MAPPING_UPDATE 0x42
761
                                                                             /* 0x43 - 0x7f
762
                                                                                Reserved for profile-specific (non-Profile) Client Notification Sub Types. */
763
                                                                             /* 0x80 - 0x8f
764
                                                                                Reserved */
765
                                                                             /* 0xa0 - 0xff
766
                                                                                Reserved for vendor specific Client
767
                                                                                Notification Sub Types. The contents of
768
                                                                                this field shall be interpreted according to
769
                                                                                the vendor id of the Recipient. */
770
771
static const value_string rf4ce_profile_cmd_client_notification_sub_type_vals[] = {
772
    { RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY,                            "Identify" },
773
    { RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_POLL_NEGOTIATION,                "Request Poll Negotiation" },
774
    { RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_ACTION_MAPPING_NEGOTIATION,      "Request Action Mapping Negotiation" },
775
    { RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_HOME_AUTOMATION_PULL,            "Request Home Automation Pull" },
776
    { RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_SELECTIVE_ACTION_MAPPING_UPDATE, "Request Selective Action Mapping Update" },
777
    { 0, NULL }
778
};
779
780
14
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_STOP_ON_ACTION_FLAG 0b00000001
781
14
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_FLASH_LIGHT_FLAG    0b00000010
782
14
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_MAKE_SOUND_FLAG     0b00000100
783
14
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_VIBRATE_FLAG        0b00001000
784
14
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_RESERVED_FLAG       0b11110000
785
786
#define RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_MASK               \
787
    (RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_STOP_ON_ACTION_FLAG   \
788
     | RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_FLASH_LIGHT_FLAG    \
789
     | RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_MAKE_SOUND_FLAG     \
790
     | RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_VIBRATE_FLAG        \
791
     | RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_RESERVED_FLAG)
792
793
/* RF4CE Profile command - Key Exchange */
794
3
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CHALLENGE     0x00
795
2
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CHALLENGE_RSP 0x01
796
1
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_RSP           0x02
797
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CONFIRM       0x03
798
                                                           /* 0x04 - 0xff - Reserved */
799
800
static const value_string rf4ce_profile_cmd_key_exchange_sub_type_vals[] = {
801
    { RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CHALLENGE,     "Challenge" },
802
    { RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CHALLENGE_RSP, "Challenge Response" },
803
    { RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_RSP,           "Response" },
804
    { RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CONFIRM,       "Confirm" },
805
    { 0, NULL }
806
};
807
808
14
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_DEFAULT_SECRET_FLAG                   (0b0000000000000001)
809
14
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_INITIATOR_VENDOR_SPECIFIC_SECRET_FLAG (0b0000000000000010)
810
14
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_RESPONDER_VENDOR_SPECIFIC_SECRET_FLAG (0b0000000000000100)
811
14
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_RESERVED_FLAG                         (0b0000000011111000)
812
14
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_VENDOR_SPECIFIC_PARAMETER_FLAG        (0b1111111100000000)
813
814
#define RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_MASK                                   \
815
    (RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_DEFAULT_SECRET_FLAG                       \
816
     | RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_INITIATOR_VENDOR_SPECIFIC_SECRET_FLAG   \
817
     | RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_RESPONDER_VENDOR_SPECIFIC_SECRET_FLAG   \
818
     | RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_RESERVED_FLAG                           \
819
     | RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_VENDOR_SPECIFIC_PARAMETER_FLAG)
820
821
/* RF4CE - Vendor ID list */
822
#define RF4CE_VENDOR_ID_RESERVED          0x0000
823
#define RF4CE_VENDOR_ID_PANASONIC         0x0001
824
#define RF4CE_VENDOR_ID_SONY              0x0002
825
#define RF4CE_VENDOR_ID_SAMSUNG           0x0003
826
#define RF4CE_VENDOR_ID_PHILIPS           0x0004
827
#define RF4CE_VENDOR_ID_FREESCALE         0x0005
828
#define RF4CE_VENDOR_ID_OKI_SEMICONDUCTOR 0x0006
829
#define RF4CE_VENDOR_ID_TEXAS_INSTRUMENTS 0x0007
830
                                       /* 0x0008 - 0xfff0 Reserved */
831
#define RF4CE_VENDOR_ID_TEST_VENDOR_1     0xfff1
832
#define RF4CE_VENDOR_ID_TEST_VENDOR_2     0xfff2
833
#define RF4CE_VENDOR_ID_TEST_VENDOR_3     0xfff3
834
                                       /* 0xfff4 - 0xffff Reserved */
835
836
42
#define RF4CE_VENDOR_ID_MASK              0x0007
837
838
static const value_string rf4ce_vendor_id_vals[] = {
839
    { RF4CE_VENDOR_ID_RESERVED,          "Reserved" },
840
    { RF4CE_VENDOR_ID_PANASONIC,         "Panasonic" },
841
    { RF4CE_VENDOR_ID_SONY,              "Sony" },
842
    { RF4CE_VENDOR_ID_SAMSUNG,           "Samsung" },
843
    { RF4CE_VENDOR_ID_PHILIPS,           "Philips" },
844
    { RF4CE_VENDOR_ID_FREESCALE,         "Freescale" },
845
    { RF4CE_VENDOR_ID_OKI_SEMICONDUCTOR, "Oki Semiconductor" },
846
    { RF4CE_VENDOR_ID_TEXAS_INSTRUMENTS, "Texas Instruments" },
847
    { 0, NULL }
848
};
849
850
static int dissect_rf4ce_profile_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
851
852
/* RF4CE Profile common commands dissectors */
853
static void dissect_rf4ce_profile_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, uint8_t cmd_id, char *profile_str, bool is_cmd_frame);
854
855
static void dissect_rf4ce_profile_common_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, uint8_t cmd_id, bool is_zrc20);
856
857
static void dissect_rf4ce_profile_cmd_generic_resp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
858
static void dissect_rf4ce_profile_cmd_configuration_complete(tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
859
static void dissect_rf4ce_profile_cmd_heartbeat(tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
860
861
static bool dissect_rf4ce_profile_zrc20_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t attr_id, uint8_t attr_length);
862
static bool dissect_rf4ce_profile_gdp_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t attr_id);
863
static void dissect_rf4ce_profile_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t dissection_mask, bool is_zrc20);
864
static void dissect_rf4ce_profile_cmd_get_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20);
865
static void dissect_rf4ce_profile_cmd_get_attrs_resp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20);
866
static void dissect_rf4ce_profile_cmd_push_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20);
867
static void dissect_rf4ce_profile_cmd_set_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20);
868
static void dissect_rf4ce_profile_cmd_pull_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20);
869
static void dissect_rf4ce_profile_cmd_pull_attrs_resp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20);
870
static bool rf4ce_profile_is_gdp_attr_arrayed(uint8_t attr_id);
871
static bool rf4ce_profile_is_zrc20_attr_arrayed(uint8_t attr_id);
872
873
static void dissect_rf4ce_profile_cmd_check_validation(tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
874
static void dissect_rf4ce_profile_cmd_client_notification(tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
875
static void dissect_rf4ce_profile_cmd_key_exchange(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset);
876
877
/* RF4CE ZRC 1.0 profile commands dissectors */
878
static void dissect_rf4ce_profile_zrc10_cmd(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t cmd_id);
879
880
static void dissect_rf4ce_profile_zrc10_cmd_user_control_common(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool parse_payload);
881
882
static void dissect_rf4ce_profile_zrc10_cmd_discovery_req(tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
883
static void dissect_rf4ce_profile_zrc10_cmd_discovery_rsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
884
885
/* RF4CE ZRC 2.0 profile commands dissectors */
886
static void dissect_rf4ce_profile_zrc20_cmd(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t cmd_id);
887
static void dissect_rf4ce_profile_zrc20_action_data(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool dissect_action_control);
888
889
void proto_register_rf4ce_profile(void)
890
14
{
891
14
    static hf_register_info hf[] = {
892
14
        {&hf_rf4ce_profile_fcf,
893
14
         {"Frame Control Field", "rf4ce-profile.fcf",
894
14
          FT_UINT8, BASE_HEX,
895
14
          NULL, 0x0,
896
14
          NULL, HFILL}},
897
14
        {&hf_rf4ce_profile_fcf_cmd_id,
898
14
         {"Command ID", "rf4ce-profile.fcf.cmd_id",
899
14
          FT_UINT8, BASE_HEX,
900
14
          VALS(rf4ce_profile_fcf_cmd_id_vals), RF4CE_PROFILE_FCF_CMD_ID_MASK,
901
14
          NULL, HFILL}},
902
14
        {&hf_rf4ce_zrc20_fcf_cmd_id,
903
14
         {"Command ID", "rf4ce-profile.fcf.cmd_id",
904
14
          FT_UINT8, BASE_HEX,
905
14
          VALS(rf4ce_zrc20_fcf_cmd_id_vals), RF4CE_PROFILE_FCF_CMD_ID_MASK,
906
14
          NULL, HFILL}},
907
14
        {&hf_rf4ce_profile_fcf_reserved,
908
14
         {"Reserved", "rf4ce-profile.fcf.reserved",
909
14
          FT_UINT8, BASE_HEX,
910
14
          NULL, RF4CE_PROFILE_FCF_RESERVED_MASK,
911
14
          NULL, HFILL}},
912
14
        {&hf_rf4ce_profile_fcf_cmd_frame,
913
14
         {"Command Frame", "rf4ce-profile.fcf.cmd_frame",
914
14
          FT_UINT8, BASE_HEX,
915
14
          VALS(rf4ce_profile_fcf_cmd_frame_vals), RF4CE_PROFILE_FCF_CMD_FRAME_MASK,
916
14
          NULL, HFILL}},
917
14
        {&hf_rf4ce_profile_fcf_data_pending,
918
14
         {"Data Pending", "rf4ce-profile.fcf.data_pending",
919
14
          FT_BOOLEAN, 8,
920
14
          TFS(&tfs_yes_no), RF4CE_PROFILE_FCF_DATA_PENDING_MASK,
921
14
          NULL, HFILL}},
922
14
        {&hf_rf4ce_profile_cmd_generic_resp_status,
923
14
         {"Status", "rf4ce-profile.cmd.generic_resp.status",
924
14
          FT_UINT8, BASE_HEX,
925
14
          VALS(hf_rf4ce_profile_cmd_generic_resp_status_vals), 0x0,
926
14
          NULL, HFILL}},
927
14
        {&hf_rf4ce_profile_cmd_configuration_complete_status,
928
14
         {"Status", "rf4ce-profile.cmd.configuration_complete.status",
929
14
          FT_UINT8, BASE_HEX,
930
14
          VALS(hf_rf4ce_profile_cmd_configuration_complete_status_vals), 0x0,
931
14
          NULL, HFILL}},
932
14
        {&hf_rf4ce_profile_cmd_heartbeat_trigger,
933
14
         {"Trigger", "rf4ce-profile.cmd.heartbeat.trigger",
934
14
          FT_UINT8, BASE_HEX,
935
14
          VALS(hf_rf4ce_profile_cmd_heartbeat_trigger_vals), 0x0,
936
14
          NULL, HFILL}},
937
14
        {&hf_rf4ce_profile_gdp_attr_id,
938
14
         {"Attribute ID", "rf4ce-profile.gdp.attr.id",
939
14
          FT_UINT8, BASE_HEX,
940
14
          VALS(rf4ce_profile_gdp_attr_vals), 0x0,
941
14
          NULL, HFILL}},
942
14
        {&hf_rf4ce_profile_zrc20_attr_id,
943
14
         {"Attribute ID", "rf4ce-profile.zrc20.attr.id",
944
14
          FT_UINT8, BASE_HEX,
945
14
          VALS(rf4ce_profile_zrc20_attr_vals), 0x0,
946
14
          NULL, HFILL}},
947
14
        {&hf_rf4ce_profile_attr_entry_id,
948
14
         {"Entry Identifier", "rf4ce-profile.zrc20.attr.entry_identifier",
949
14
          FT_BYTES, SEP_COLON,
950
14
          NULL, 0x0,
951
14
          NULL, HFILL}},
952
14
        {&hf_rf4ce_profile_attr_status,
953
14
         {"Status", "rf4ce-profile.attr.status",
954
14
          FT_UINT8, BASE_HEX,
955
14
          VALS(hf_rf4ce_profile_attr_status_vals), 0x0,
956
14
          NULL, HFILL}},
957
14
        {&hf_rf4ce_profile_attr_length,
958
14
         {"Length", "rf4ce-profile.attr.length",
959
14
          FT_UINT8, BASE_DEC,
960
14
          NULL, 0x0,
961
14
          NULL, HFILL}},
962
14
        {&hf_rf4ce_profile_attr_value,
963
14
         {"Value", "rf4ce-profile.attr.value",
964
14
          FT_BYTES, SEP_COLON,
965
14
          NULL, 0x0,
966
14
          NULL, HFILL}},
967
14
        {&hf_rf4ce_profile_gdp_ident_cap,
968
14
         {"Identification Capabilities", "rf4ce-profile.attr.ident_cap",
969
14
          FT_UINT8, BASE_HEX,
970
14
          NULL, 0x0,
971
14
          NULL, HFILL}},
972
14
        {&hf_rf4ce_profile_gdp_ident_cap_reserved,
973
14
         {"Reserved", "rf4ce-profile.attr.ident_cap.reserved",
974
14
          FT_UINT8, BASE_HEX,
975
14
          NULL, RF4CE_PROFILE_GDP_IDENT_CAP_RESERVED_MASK,
976
14
          NULL, HFILL}},
977
14
        {&hf_rf4ce_profile_gdp_ident_cap_support_flash_light,
978
14
         {"Support Flash Light", "rf4ce-profile.attr.ident_cap.support_flash_light",
979
14
          FT_BOOLEAN, SEP_DOT,
980
14
          NULL, RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_FLASH_LIGHT_MASK,
981
14
          NULL, HFILL}},
982
14
        {&hf_rf4ce_profile_gdp_ident_cap_support_make_short_sound,
983
14
         {"Support Make Short Sound", "rf4ce-profile.attr.ident_cap.support_make_short_sound",
984
14
          FT_BOOLEAN, SEP_DOT,
985
14
          NULL, RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_MAKE_SHORT_SOUND_MASK,
986
14
          NULL, HFILL}},
987
14
        {&hf_rf4ce_profile_gdp_ident_cap_support_vibrate,
988
14
         {"Support Vibrate", "rf4ce-profile.attr.ident_cap.support_vibrate",
989
14
          FT_BOOLEAN, SEP_DOT,
990
14
          NULL, RF4CE_PROFILE_GDP_IDENT_CAP_SUPPORT_VIBRATE_MASK,
991
14
          NULL, HFILL}},
992
14
        {&hf_rf4ce_profile_gdp_ident_cap_reserved2,
993
14
         {"Reserved", "rf4ce-profile.attr.ident_cap.reserved2",
994
14
          FT_UINT8, BASE_HEX,
995
14
          NULL, RF4CE_PROFILE_GDP_IDENT_CAP_RESERVED2_MASK,
996
14
          NULL, HFILL}},
997
14
        {&hf_rf4ce_profile_gdp_poll_constraints_methods_num,
998
14
         {"Polling Methods Number", "rf4ce-profile.attr.poll_constraints.methods_num",
999
14
          FT_UINT8, BASE_DEC,
1000
14
          NULL, 0x0,
1001
14
          NULL, HFILL}},
1002
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_method_id,
1003
14
         {"Polling Method ID", "rf4ce-profile.attr.poll_constraints.polling_record.method_id",
1004
14
          FT_UINT8, BASE_HEX,
1005
14
          VALS(rf4ce_profile_gdp_poll_constraints_polling_rec_method_id_vals), 0x0,
1006
14
          NULL, HFILL}},
1007
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap,
1008
14
         {"Polling Trigger Capabilities", "rf4ce-profile.attr.poll_constraints.polling_record.polling_trig_cap",
1009
14
          FT_UINT16, BASE_HEX,
1010
14
          NULL, RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_MASK,
1011
14
          NULL, HFILL}},
1012
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_tbased,
1013
14
         {"Time based polling capable", "rf4ce-profile.attr.poll_constraints.polling_record.polling_trig_cap.tbased",
1014
14
          FT_BOOLEAN, 16,
1015
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_TBASED_MASK,
1016
14
          NULL, HFILL}},
1017
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_k_press,
1018
14
         {"Polling On Key Press Capable", "rf4ce-profile.attr.poll_constraints.polling_record.polling_trig_cap.on_k_press",
1019
14
          FT_BOOLEAN, 16,
1020
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_K_PRESS_MASK,
1021
14
          NULL, HFILL}},
1022
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_pick_up,
1023
14
         {"Polling On Pick Up Capable", "rf4ce-profile.attr.poll_constraints.polling_record.polling_trig_cap.on_pick_up",
1024
14
          FT_BOOLEAN, 16,
1025
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_PICK_UP_MASK,
1026
14
          NULL, HFILL}},
1027
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_reset,
1028
14
         {"Polling On Reset Capable", "rf4ce-profile.attr.poll_constraints.polling_record.polling_trig_cap.on_reset",
1029
14
          FT_BOOLEAN, 16,
1030
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_RESET_MASK,
1031
14
          NULL, HFILL}},
1032
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_micro_act,
1033
14
         {"Polling On Microphone Activity Capable", "rf4ce-profile.attr.poll_constraints.polling_record.polling_trig_cap.on_micro_act",
1034
14
          FT_BOOLEAN, 16,
1035
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_MICRO_ACT_MASK,
1036
14
          NULL, HFILL}},
1037
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_user_act,
1038
14
         {"Polling On Other User Activity Capable", "rf4ce-profile.attr.poll_constraints.polling_record.polling_trig_cap.on_user_act",
1039
14
          FT_BOOLEAN, 16,
1040
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_ON_USER_ACT_MASK,
1041
14
          NULL, HFILL}},
1042
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_reserved,
1043
14
         {"Reserved", "rf4ce-profile.attr.poll_constraints.polling_record.polling_trig_cap.reserved",
1044
14
          FT_UINT16, BASE_HEX,
1045
14
          NULL, RF4CE_PROFILE_GDP_POLL_CONSTRAINTS_POLLING_REC_POLLING_TRIG_CAP_RESERVED_MASK,
1046
14
          NULL, HFILL}},
1047
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_min_polling_key_press_cnt,
1048
14
         {"Minimum Polling Key Press Counter", "rf4ce-profile.attr.poll_constraints.polling_record.min_polling_key_press_cnt",
1049
14
          FT_UINT8, BASE_DEC,
1050
14
          NULL, 0x0,
1051
14
          NULL, HFILL}},
1052
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_max_polling_key_press_cnt,
1053
14
         {"Maximum Polling Key Press Counter", "rf4ce-profile.attr.poll_constraints.polling_record.max_polling_key_press_cnt",
1054
14
          FT_UINT8, BASE_DEC,
1055
14
          NULL, 0x0,
1056
14
          NULL, HFILL}},
1057
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_min_polling_time_interval,
1058
14
         {"Minimum Polling Time Interval", "rf4ce-profile.attr.poll_constraints.polling_record.min_polling_time_interval",
1059
14
          FT_UINT32, BASE_DEC,
1060
14
          NULL, 0x0,
1061
14
          NULL, HFILL}},
1062
14
        {&hf_rf4ce_profile_gdp_poll_constraints_polling_rec_max_polling_time_interval,
1063
14
         {"Maximum Polling Time Interval", "rf4ce-profile.attr.poll_constraints.polling_record.max_polling_time_interval",
1064
14
          FT_UINT32, BASE_DEC,
1065
14
          NULL, 0x0,
1066
14
          NULL, HFILL}},
1067
14
        {&hf_rf4ce_profile_gdp_poll_configuration_method_id,
1068
14
         {"Polling Method ID", "rf4ce-profile.attr.poll_configuration.method_id",
1069
14
          FT_UINT8, BASE_HEX,
1070
14
          VALS(rf4ce_profile_gdp_poll_constraints_polling_rec_method_id_vals), 0x0,
1071
14
          NULL, HFILL}},
1072
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf,
1073
14
         {"Polling Trigger Configuration", "rf4ce-profile.attr.poll_configuration.polling_trig_conf",
1074
14
          FT_UINT16, BASE_HEX,
1075
14
          NULL, 0x0,
1076
14
          NULL, HFILL}},
1077
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_tbased,
1078
14
         {"Time Based Polling", "rf4ce-profile.attr.poll_configuration.polling_trig_conf.tbased",
1079
14
          FT_BOOLEAN, 16,
1080
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_TBASED_MASK,
1081
14
          NULL, HFILL}},
1082
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_k_press,
1083
14
         {"Polling on Key Press", "rf4ce-profile.attr.poll_configuration.polling_trig_conf.on_k_press",
1084
14
          FT_BOOLEAN, 16,
1085
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_K_PRESS_MASK,
1086
14
          NULL, HFILL}},
1087
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_pick_up,
1088
14
         {"Polling on Pick up", "rf4ce-profile.attr.poll_configuration.polling_trig_conf.on_pick_up",
1089
14
          FT_BOOLEAN, 16,
1090
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_PICK_UP_MASK,
1091
14
          NULL, HFILL}},
1092
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_reset,
1093
14
         {"Polling on Reset", "rf4ce-profile.attr.poll_configuration.polling_trig_conf.on_reset",
1094
14
          FT_BOOLEAN, 16,
1095
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_RESET_MASK,
1096
14
          NULL, HFILL}},
1097
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_micro_act,
1098
14
         {"Polling on Microphone Activity", "rf4ce-profile.attr.poll_configuration.polling_trig_conf.on_micro_act",
1099
14
          FT_BOOLEAN, 16,
1100
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_MICRO_ACT_MASK,
1101
14
          NULL, HFILL}},
1102
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_user_act,
1103
14
         {"Polling on User Activity", "rf4ce-profile.attr.poll_configuration.polling_trig_conf.on_user_act",
1104
14
          FT_BOOLEAN, 16,
1105
14
          TFS(&tfs_enabled_disabled), RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_ON_USER_ACT_MASK,
1106
14
          NULL, HFILL}},
1107
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_reserved,
1108
14
         {"Reserved", "rf4ce-profile.attr.poll_configuration.polling_trig_conf.reserved",
1109
14
          FT_UINT16, BASE_HEX,
1110
14
          NULL, RF4CE_PROFILE_GDP_POLL_CONFIGURATION_POLLING_TRIG_CONF_RESERVED_MASK,
1111
14
          NULL, HFILL}},
1112
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_key_press_cnt,
1113
14
         {"Polling Key Press Counter", "rf4ce-profile.attr.poll_configuration.polling_key_press_cnt",
1114
14
          FT_UINT8, BASE_DEC,
1115
14
          NULL, 0x0,
1116
14
          NULL, HFILL}},
1117
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_time_interval,
1118
14
         {"Polling Time Interval", "rf4ce-profile.attr.poll_configuration.polling_time_interval",
1119
14
          FT_UINT32, BASE_DEC,
1120
14
          NULL, 0x0,
1121
14
          NULL, HFILL}},
1122
14
        {&hf_rf4ce_profile_gdp_poll_configuration_polling_timeout,
1123
14
         {"Polling Timeout", "rf4ce-profile.attr.poll_configuration.polling_timeout",
1124
14
          FT_UINT8, BASE_DEC,
1125
14
          NULL, 0x0,
1126
14
          NULL, HFILL}},
1127
14
        {&hf_rf4ce_profile_zrc20_mappable_actions_action_dev_type,
1128
14
         {"Action Device Type", "rf4ce-profile.attr.mappable_actions.action_dev_type",
1129
14
          FT_UINT8, BASE_HEX,
1130
14
          VALS(rf4ce_profile_device_type_vals), 0x0,
1131
14
          NULL, HFILL}},
1132
14
        {&hf_rf4ce_profile_zrc20_mappable_actions_action_bank,
1133
14
         {"Action Bank", "rf4ce-profile.attr.mappable_actions.action_bank",
1134
14
          FT_UINT8, BASE_HEX,
1135
14
          NULL, 0x0,
1136
14
          NULL, HFILL}},
1137
14
        {&hf_rf4ce_profile_zrc20_mappable_actions_action_code,
1138
14
         {"Action Code", "rf4ce-profile.attr.mappable_actions.action_code",
1139
14
          FT_UINT8, BASE_HEX,
1140
14
          NULL, 0x0,
1141
14
          NULL, HFILL}},
1142
14
        {&hf_rf4ce_profile_zrc20_action_mappings_mapping_flags,
1143
14
         {"Mapping Flags", "rf4ce-profile.attr.action_mappings.mapping_flags",
1144
14
          FT_UINT8, BASE_HEX,
1145
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_MASK,
1146
14
          NULL, HFILL}},
1147
14
        {&hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_rf_specified,
1148
14
         {"RF Specified", "rf4ce-profile.attr.action_mappings.mapping_flags.rf_specified",
1149
14
          FT_BOOLEAN, SEP_DOT,
1150
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RF_SPECIFIED_MASK,
1151
14
          NULL, HFILL}},
1152
14
        {&hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_ir_specified,
1153
14
         {"IR Specified", "rf4ce-profile.attr.action_mappings.mapping_flags.ir_specified",
1154
14
          FT_BOOLEAN, SEP_DOT,
1155
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_IR_SPECIFIED_MASK,
1156
14
          NULL, HFILL}},
1157
14
        {&hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_rf_descr_first,
1158
14
         {"RF Descriptor First", "rf4ce-profile.attr.action_mappings.mapping_flags.rf_descr_first",
1159
14
          FT_BOOLEAN, SEP_DOT,
1160
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RF_DESCR_FIRST_MASK,
1161
14
          NULL, HFILL}},
1162
14
        {&hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_reserved,
1163
14
         {"Reserved", "rf4ce-profile.attr.action_mappings.mapping_flags.reserved",
1164
14
          FT_UINT8, BASE_HEX,
1165
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RESERVED_MASK,
1166
14
          NULL, HFILL}},
1167
14
        {&hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_use_default,
1168
14
         {"Use Default", "rf4ce-profile.attr.action_mappings.mapping_flags.use_default",
1169
14
          FT_BOOLEAN, SEP_DOT,
1170
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_USE_DEFAULT_MASK,
1171
14
          NULL, HFILL}},
1172
14
        {&hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_permanent,
1173
14
         {"Permanent", "rf4ce-profile.attr.action_mappings.mapping_flags.permanent",
1174
14
          FT_BOOLEAN, SEP_DOT,
1175
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_PERMANENT_MASK,
1176
14
          NULL, HFILL}},
1177
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf,
1178
14
         {"RF Config", "rf4ce-profile.attr.action_mappings.rf_descr.rf_conf",
1179
14
          FT_UINT8, BASE_HEX,
1180
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_MASK,
1181
14
          NULL, HFILL}},
1182
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_min_num_of_trans,
1183
14
         {"Minimum Number of Transmissions", "rf4ce-profile.attr.action_mappings.rf_descr.rf_conf.min_num_of_trans",
1184
14
          FT_UINT8, BASE_HEX,
1185
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_MIN_NUM_OF_TRANS_MASK,
1186
14
          NULL, HFILL}},
1187
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_keep_trans_until_key_release,
1188
14
         {"Keep Transmitting Until Key Release", "rf4ce-profile.attr.action_mappings.rf_descr.rf_conf.keep_trans_until_key_release",
1189
14
          FT_BOOLEAN, SEP_DOT,
1190
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_KEEP_TRANS_UNTIL_KEY_RELEASE_MASK,
1191
14
          NULL, HFILL}},
1192
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_short_rf_retry,
1193
14
         {"Short RF Retry", "rf4ce-profile.attr.action_mappings.rf_descr.rf_conf.short_rf_retry",
1194
14
          FT_BOOLEAN, SEP_DOT,
1195
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_SHORT_RF_RETRY_MASK,
1196
14
          NULL, HFILL}},
1197
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_atomic_action,
1198
14
         {"Atomic Action", "rf4ce-profile.attr.action_mappings.rf_descr.rf_conf.atomic_action",
1199
14
          FT_BOOLEAN, SEP_DOT,
1200
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_ATOMIC_ACTION_MASK,
1201
14
          NULL, HFILL}},
1202
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_reserved,
1203
14
         {"Reserved", "rf4ce-profile.attr.action_mappings.rf_descr.rf_conf.reserved",
1204
14
          FT_UINT8, BASE_HEX,
1205
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_RF_CONF_RESERVED_MASK,
1206
14
          NULL, HFILL}},
1207
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts,
1208
14
         {"TX Options", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts",
1209
14
          FT_UINT8, BASE_HEX,
1210
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_MASK,
1211
14
          NULL, HFILL}},
1212
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_trans_mode,
1213
14
         {"Transmission Mode", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts.trans_mode",
1214
14
          FT_BOOLEAN, SEP_DOT,
1215
14
          TFS(&rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_trans_mode_vals), RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_TRANS_MODE_MASK,
1216
14
          NULL, HFILL}},
1217
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_dst_addr_mode,
1218
14
         {"Destination Addressing Mode", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts.dst_addr_mode",
1219
14
          FT_BOOLEAN, SEP_DOT,
1220
14
          TFS(&rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_dst_addr_mode_vals), RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_DST_ADDR_MODE_MASK,
1221
14
          NULL, HFILL}},
1222
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ack_mode,
1223
14
         {"Acknowledgement Mode", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts.ack_mode",
1224
14
          FT_BOOLEAN, SEP_DOT,
1225
14
          TFS(&rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ack_mode_vals), RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_ACK_MODE_MASK,
1226
14
          NULL, HFILL}},
1227
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_sec_mode,
1228
14
         {"Security Mode", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts.sec_mode",
1229
14
          FT_BOOLEAN, SEP_DOT,
1230
14
          TFS(&rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_sec_mode_vals), RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_SEC_MODE_MASK,
1231
14
          NULL, HFILL}},
1232
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_ag_mode,
1233
14
         {"Channel Agility Mode", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts.ch_ag_mode",
1234
14
          FT_BOOLEAN, SEP_DOT,
1235
14
          TFS(&rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_ag_mode_vals), RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_CH_AG_MODE_MASK,
1236
14
          NULL, HFILL}},
1237
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_norm_mode,
1238
14
         {"Channel Normalization Mode", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts.ch_norm_mode",
1239
14
          FT_BOOLEAN, SEP_DOT,
1240
14
          TFS(&rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_norm_mode_vals), RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_CH_NORM_MODE_MASK,
1241
14
          NULL, HFILL}},
1242
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_payload_mode,
1243
14
         {"Payload Mode", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts.payload_mode",
1244
14
          FT_BOOLEAN, SEP_DOT,
1245
14
          TFS(&rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_payload_mode_vals), RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_PAYLOAD_MODE_MASK,
1246
14
          NULL, HFILL}},
1247
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_reserved,
1248
14
         {"Reserved", "rf4ce-profile.attr.action_mappings.rf_descr.tx_opts.reserved",
1249
14
          FT_BOOLEAN, SEP_DOT,
1250
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_RF_DESCR_TX_OPTS_RESERVED_MASK,
1251
14
          NULL, HFILL}},
1252
14
        {&hf_rf4ce_profile_zrc20_action_mappings_rf_descr_action_data_len,
1253
14
         {"Action Data Length", "rf4ce-profile.attr.action_mappings.rf_descr.action_data_len",
1254
14
          FT_UINT8, BASE_DEC,
1255
14
          NULL, 0x0,
1256
14
          NULL, HFILL}},
1257
14
        {&hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf,
1258
14
         {"IR Config", "rf4ce-profile.attr.action_mappings.ir_descr.ir_conf",
1259
14
          FT_UINT8, BASE_HEX,
1260
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_MASK,
1261
14
          NULL, HFILL}},
1262
14
        {&hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf_vendor_specific,
1263
14
         {"Vendor Specific", "rf4ce-profile.attr.action_mappings.ir_descr.ir_conf.vendor_specific",
1264
14
          FT_BOOLEAN, SEP_DOT,
1265
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_VENDOR_SPECIFIC_MASK,
1266
14
          NULL, HFILL}},
1267
14
        {&hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf_reserved,
1268
14
         {"Reserved", "rf4ce-profile.attr.action_mappings.ir_descr.ir_conf.reserved",
1269
14
          FT_UINT8, BASE_HEX,
1270
14
          NULL, RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_RESERVED_MASK,
1271
14
          NULL, HFILL}},
1272
14
        {&hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_vendor_id,
1273
14
         {"IR Vendor ID", "rf4ce-profile.attr.action_mappings.ir_descr.ir_vendor_id",
1274
14
          FT_UINT16, BASE_HEX,
1275
14
          VALS(rf4ce_vendor_id_vals), RF4CE_VENDOR_ID_MASK,
1276
14
          NULL, HFILL}},
1277
14
        {&hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_code_len,
1278
14
         {"IR Code Length", "rf4ce-profile.attr.action_mappings.ir_descr.ir_code_len",
1279
14
          FT_UINT8, BASE_DEC,
1280
14
          NULL, 0x0,
1281
14
          NULL, HFILL}},
1282
14
        {&hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_code,
1283
14
         {"IR Code", "rf4ce-profile.attr.action_mappings.ir_descr.ir_code",
1284
14
          FT_BYTES, SEP_COLON,
1285
14
          NULL, 0x0,
1286
14
          NULL, HFILL}},
1287
14
        {&hf_rf4ce_profile_zrc20_irdb_vendor_support_vendor_id,
1288
14
         {"Vendor ID", "rf4ce-profile.attr.irdb_vendor_support.vendor_id",
1289
14
          FT_UINT16, BASE_HEX,
1290
14
          VALS(rf4ce_vendor_id_vals), RF4CE_VENDOR_ID_MASK,
1291
14
          NULL, HFILL}},
1292
14
        {&hf_rf4ce_profile_cmd_check_validation_sub_type,
1293
14
         {"Sub-type", "rf4ce-profile.cmd.check_validation.sub_type",
1294
14
          FT_UINT8, BASE_HEX,
1295
14
          VALS(rf4ce_profile_cmd_check_validation_sub_type_vals), 0x0,
1296
14
          NULL, HFILL}},
1297
14
        {&hf_rf4ce_profile_cmd_check_validation_control,
1298
14
         {"Validation Control", "rf4ce-profile.cmd.check_validation.validation_control",
1299
14
          FT_UINT8, BASE_HEX,
1300
14
          NULL, 0x0,
1301
14
          NULL, HFILL}},
1302
14
        {&hf_rf4ce_profile_cmd_check_validation_status,
1303
14
         {"Validation Status", "rf4ce-profile.cmd.check_validation.validation_status",
1304
14
          FT_UINT8, BASE_HEX,
1305
14
          VALS(rf4ce_profile_cmd_check_validation_status_vals), 0x0,
1306
14
          NULL, HFILL}},
1307
14
        {&hf_rf4ce_profile_cmd_client_notification_sub_type,
1308
14
         {"Sub-ype", "rf4ce-profile.cmd.client_notification.sub_type",
1309
14
          FT_UINT8, BASE_HEX,
1310
14
          VALS(rf4ce_profile_cmd_client_notification_sub_type_vals), 0x0,
1311
14
          NULL, HFILL}},
1312
14
        {&hf_rf4ce_profile_cmd_client_notification_identify_flags,
1313
14
         {"Identify Flags", "rf4ce-profile.cmd.client_notification.identify_flags",
1314
14
          FT_UINT8, BASE_HEX,
1315
14
          NULL, 0x0,
1316
14
          NULL, HFILL}},
1317
14
        {&hf_rf4ce_profile_cmd_client_notification_identify_flags_stop_on_action,
1318
14
         {"Stop on Action", "rf4ce-profile.cmd.client_notification.identify_flags.stop_on_action",
1319
14
          FT_UINT8, BASE_HEX,
1320
14
          NULL, RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_STOP_ON_ACTION_FLAG,
1321
14
          NULL, HFILL}},
1322
14
        {&hf_rf4ce_profile_cmd_client_notification_identify_flags_flash_light,
1323
14
         {"Flash Light", "rf4ce-profile.cmd.client_notification.identify_flags.flash_light",
1324
14
          FT_UINT8, BASE_HEX,
1325
14
          NULL, RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_FLASH_LIGHT_FLAG,
1326
14
          NULL, HFILL}},
1327
14
        {&hf_rf4ce_profile_cmd_client_notification_identify_flags_make_sound,
1328
14
         {"Make Sound", "rf4ce-profile.cmd.client_notification.identify_flags.make_sound",
1329
14
          FT_UINT8, BASE_HEX,
1330
14
          NULL, RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_MAKE_SOUND_FLAG,
1331
14
          NULL, HFILL}},
1332
14
        {&hf_rf4ce_profile_cmd_client_notification_identify_flags_vibrate,
1333
14
         {"Vibrate", "rf4ce-profile.cmd.client_notification.identify_flags.vibrate",
1334
14
          FT_UINT8, BASE_HEX,
1335
14
          NULL, RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_VIBRATE_FLAG,
1336
14
          NULL, HFILL}},
1337
14
        {&hf_rf4ce_profile_cmd_client_notification_identify_flags_reserved,
1338
14
         {"Reserved", "rf4ce-profile.cmd.client_notification.identify_flags.reserved",
1339
14
          FT_UINT8, BASE_HEX,
1340
14
          NULL, RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY_RESERVED_FLAG,
1341
14
          NULL, HFILL}},
1342
14
        {&hf_rf4ce_profile_cmd_client_notification_identify_time,
1343
14
         {"Identify Time", "rf4ce-profile.cmd.client_notification.identify_time",
1344
14
          FT_UINT16, BASE_DEC,
1345
14
          NULL, 0x0,
1346
14
          NULL, HFILL}},
1347
14
        {&hf_rf4ce_profile_cmd_key_exchange_sub_type,
1348
14
         {"Sub-type", "rf4ce-profile.cmd.key_exchange.sub_type",
1349
14
          FT_UINT8, BASE_HEX,
1350
14
          VALS(rf4ce_profile_cmd_key_exchange_sub_type_vals), 0x0,
1351
14
          NULL, HFILL}},
1352
14
        {&hf_rf4ce_profile_cmd_key_exchange_flags,
1353
14
         {"Key Exchange Flags", "rf4ce-profile.cmd.key_exchange.flags",
1354
14
          FT_UINT16, BASE_HEX,
1355
14
          NULL, 0x0,
1356
14
          NULL, HFILL}},
1357
14
        {&hf_rf4ce_profile_cmd_key_exchange_flags_default_secret,
1358
14
         {"Default Secret", "rf4ce-profile.cmd.key_exchange.flags.default_secret",
1359
14
          FT_UINT16, BASE_HEX,
1360
14
          NULL, RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_DEFAULT_SECRET_FLAG,
1361
14
          NULL, HFILL}},
1362
14
        {&hf_rf4ce_profile_cmd_key_exchange_flags_initiator_vendor_specific_secret,
1363
14
         {"Initiator Vendor Specific Secret", "rf4ce-profile.cmd.key_exchange.flags.initiator_vendor_specific_secret",
1364
14
          FT_UINT16, BASE_HEX,
1365
14
          NULL, RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_INITIATOR_VENDOR_SPECIFIC_SECRET_FLAG,
1366
14
          NULL, HFILL}},
1367
14
        {&hf_rf4ce_profile_cmd_key_exchange_flags_responder_vendor_specific_secret,
1368
14
         {"Responder Vendor Specific Secret", "rf4ce-profile.cmd.key_exchange.flags.responder_vendor_specific_secret",
1369
14
          FT_UINT16, BASE_HEX,
1370
14
          NULL, RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_RESPONDER_VENDOR_SPECIFIC_SECRET_FLAG,
1371
14
          NULL, HFILL}},
1372
14
        {&hf_rf4ce_profile_cmd_key_exchange_flags_reserved,
1373
14
         {"Reserved", "rf4ce-profile.cmd.key_exchange.flags.reserved",
1374
14
          FT_UINT16, BASE_HEX,
1375
14
          NULL, RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_RESERVED_FLAG,
1376
14
          NULL, HFILL}},
1377
14
        {&hf_rf4ce_profile_cmd_key_exchange_flags_vendor_specific_parameter,
1378
14
         {"Vendor Specific Parameter", "rf4ce-profile.cmd.key_exchange.flags.vendor_specific_parameter",
1379
14
          FT_UINT16, BASE_HEX,
1380
14
          NULL, RF4CE_PROFILE_CMD_KEY_EXCHANGE_FLAGS_VENDOR_SPECIFIC_PARAMETER_FLAG,
1381
14
          NULL, HFILL}},
1382
14
        {&hf_rf4ce_profile_cmd_key_exchange_rand_a,
1383
14
         {"Rand-A", "rf4ce-profile.cmd.key_exchange.rand_a",
1384
14
          FT_BYTES, SEP_COLON,
1385
14
          NULL, 0x00,
1386
14
          NULL, HFILL}},
1387
14
        {&hf_rf4ce_profile_cmd_key_exchange_rand_b,
1388
14
         {"Rand-B", "rf4ce-profile.cmd.key_exchange.rand_b",
1389
14
          FT_BYTES, SEP_COLON,
1390
14
          NULL, 0x00,
1391
14
          NULL, HFILL}},
1392
14
        {&hf_rf4ce_profile_cmd_key_exchange_tag_b,
1393
14
         {"TAG-B", "rf4ce-profile.cmd.key_exchange.tag_b",
1394
14
          FT_BYTES, SEP_COLON,
1395
14
          NULL, 0x00,
1396
14
          NULL, HFILL}},
1397
14
        {&hf_rf4ce_profile_cmd_key_exchange_tag_a,
1398
14
         {"TAG-A", "rf4ce-profile.cmd.key_exchange.tag_a",
1399
14
          FT_BYTES, SEP_COLON,
1400
14
          NULL, 0x00,
1401
14
          NULL, HFILL}},
1402
#if 0
1403
        {&hf_rf4ce_zrc20_cmd_actions,
1404
         {"Actions", "rf4ce-profile.zrc20.cmd.actions",
1405
          FT_BYTES, SEP_COLON,
1406
          NULL, 0x00,
1407
          NULL, HFILL}},
1408
#endif
1409
14
        {&hf_rf4ce_zrc20_cmd_actions_action_control,
1410
14
         {"Action Control", "rf4ce-profile.zrc20.cmd.actions.action_control",
1411
14
          FT_UINT8, BASE_HEX,
1412
14
          NULL, 0x00,
1413
14
          NULL, HFILL}},
1414
14
        {&hf_rf4ce_zrc20_cmd_actions_action_control_action_type,
1415
14
         {"Action Type", "rf4ce-profile.zrc20.cmd.actions.action_control.action_type",
1416
14
          FT_UINT8, BASE_HEX,
1417
14
          VALS(rf4ce_zrc20_cmd_actions_action_control_action_type_vals), RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_ACTION_TYPE_MASK,
1418
14
          NULL, HFILL}},
1419
14
        {&hf_rf4ce_zrc20_cmd_actions_action_control_reserved,
1420
14
         {"Reserved", "rf4ce-profile.zrc20.cmd.actions.action_control.reserved",
1421
14
          FT_UINT8, BASE_HEX,
1422
14
          NULL, RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_RESERVED,
1423
14
          NULL, HFILL}},
1424
14
        {&hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_gui,
1425
14
         {"GUI Modifier", "rf4ce-profile.zrc20.cmd.actions.action_control.modifier_bits.gui",
1426
14
          FT_BOOLEAN, 8,
1427
14
          TFS(&tfs_yes_no), RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_MODIFIER_BITS_GUI,
1428
14
          NULL, HFILL}},
1429
14
        {&hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_alt,
1430
14
         {"ALT Modifier", "rf4ce-profile.zrc20.cmd.actions.action_control.modifier_bits.alt",
1431
14
          FT_BOOLEAN, 8,
1432
14
          TFS(&tfs_yes_no), RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_MODIFIER_BITS_ALT,
1433
14
          NULL, HFILL}},
1434
14
        {&hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_shift,
1435
14
         {"SHIFT Modifier", "rf4ce-profile.zrc20.cmd.actions.action_control.modifier_bits.shift",
1436
14
          FT_BOOLEAN, 8,
1437
14
          TFS(&tfs_yes_no), RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_MODIFIER_BITS_SHIFT,
1438
14
          NULL, HFILL}},
1439
14
        {&hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_ctrl,
1440
14
         {"CTRL Modifier", "rf4ce-profile.zrc20.cmd.actions.action_control.modifier_bits.ctrl",
1441
14
          FT_BOOLEAN, 8,
1442
14
          TFS(&tfs_yes_no), RF4CE_ZRC20_CMD_ACTIONS_ACTION_CONTROL_MODIFIER_BITS_CTRL,
1443
14
          NULL, HFILL}},
1444
14
        {&hf_rf4ce_zrc20_cmd_actions_action_data_payload_length,
1445
14
         {"Payload Length", "rf4ce-profile.zrc20.cmd.actions.action_data.payload_length",
1446
14
          FT_UINT8, BASE_HEX,
1447
14
          NULL, 0x0,
1448
14
          NULL, HFILL}},
1449
14
        {&hf_rf4ce_zrc20_cmd_actions_action_data_action_bank,
1450
14
         {"Action Bank", "rf4ce-profile.zrc20.cmd.actions.action_data.action_bank",
1451
14
          FT_UINT8, BASE_HEX,
1452
14
          NULL, 0x0,
1453
14
          NULL, HFILL}},
1454
14
        {&hf_rf4ce_zrc20_cmd_actions_action_data_action_code,
1455
14
         {"Action Code", "rf4ce-profile.zrc20.cmd.actions.action_data.action_code",
1456
14
          FT_UINT8, BASE_HEX,
1457
14
          NULL, 0x0,
1458
14
          NULL, HFILL}},
1459
14
        {&hf_rf4ce_zrc20_cmd_actions_action_data_action_vendor,
1460
14
         {"Action Vendor", "rf4ce-profile.zrc20.cmd.actions.action_data.action_vendor",
1461
14
          FT_UINT16, BASE_HEX,
1462
14
          VALS(rf4ce_vendor_id_vals), RF4CE_VENDOR_ID_MASK,
1463
14
          NULL, HFILL}},
1464
14
        {&hf_rf4ce_zrc20_cmd_actions_action_data_action_payload,
1465
14
         {"Action Payload", "rf4ce-profile.zrc20.cmd.actions.action_data.action_payload",
1466
14
          FT_BYTES, SEP_COLON,
1467
14
          NULL, 0x0,
1468
14
          NULL, HFILL}},
1469
14
        {&hf_rf4ce_zrc10_fcf,
1470
14
         {"Frame Control Field", "rf4ce-profile.zrc10.fcf",
1471
14
          FT_UINT8, BASE_HEX,
1472
14
          NULL, 0x0,
1473
14
          NULL, HFILL}},
1474
14
        {&hf_rf4ce_zrc10_fcf_cmd_id,
1475
14
         {"Command ID", "rf4ce-profile.zrc10.fcf.cmd_id",
1476
14
          FT_UINT8, BASE_HEX,
1477
14
          VALS(rf4ce_zrc10_fcf_cmd_id_vals), RF4CE_ZRC10_FCF_CMD_ID_MASK,
1478
14
          NULL, HFILL}},
1479
14
        {&hf_rf4ce_zrc10_fcf_reserved,
1480
14
         {"Reserved", "rf4ce-profile.zrc10.fcf.reserved",
1481
14
          FT_UINT8, BASE_HEX,
1482
14
          NULL, RF4CE_ZRC10_FCF_RESERVED_MASK,
1483
14
          NULL, HFILL}},
1484
14
        {&hf_rf4ce_zrc10_cmd_common_rc_command_code,
1485
14
         {"RC Command Code", "rf4ce-profile.zrc10.cmd_common.rc_command_code",
1486
14
          FT_UINT8, BASE_HEX,
1487
14
          NULL, 0x0,
1488
14
          NULL, HFILL}},
1489
14
        {&hf_rf4ce_zrc10_cmd_common_rc_command_payload,
1490
14
         {"RC Command Payload", "rf4ce-profile.zrc10.cmd_common.rc_command_payload",
1491
14
          FT_BYTES, SEP_COLON,
1492
14
          NULL, 0x0,
1493
14
          NULL, HFILL}},
1494
14
        {&hf_rf4ce_zrc10_cmd_disc_reserved,
1495
14
         {"Reserved", "rf4ce-profile.zrc10.cmd.discovery.reserved",
1496
14
          FT_UINT8, BASE_HEX,
1497
14
          NULL, 0x0,
1498
14
          NULL, HFILL}},
1499
14
        {&hf_rf4ce_zrc10_cmd_disc_rsp_supported_commands,
1500
14
         {"Supported Commands", "rf4ce-profile.zrc10.cmd_disc_rsp.supported_commands",
1501
14
          FT_BYTES, SEP_COLON,
1502
14
          NULL, 0x0,
1503
14
          NULL, HFILL}},
1504
14
        {&hf_rf4ce_profile_unparsed_payload,
1505
14
         {"Unparsed Profile Payload", "rf4ce-profile.unparsed_payload",
1506
14
          FT_BYTES, SEP_COLON,
1507
14
          NULL, 0x0,
1508
14
          NULL, HFILL}},
1509
14
    };
1510
1511
    /* Setup protocol subtree array */
1512
14
    static int *ett[] = {
1513
14
        &ett_rf4ce_profile,
1514
14
        &ett_rf4ce_profile_cmd_frame,
1515
14
        &ett_rf4ce_profile_attrs,
1516
14
        &ett_rf4ce_profile_attrs_sub,
1517
14
        &ett_rf4ce_profile_zrc20_ident_cap,
1518
14
        &ett_rf4ce_profile_zrc20_mappable_actions_entry,
1519
14
        &ett_rf4ce_profile_zrc20_action_control,
1520
14
        &ett_rf4ce_profile_zrc20_action_mappings_flags,
1521
14
        &ett_rf4ce_profile_zrc20_action_mappings_rf_descr,
1522
14
        &ett_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf,
1523
14
        &ett_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts,
1524
14
        &ett_rf4ce_profile_zrc20_action_mappings_ir_descr,
1525
14
        &ett_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf,
1526
14
        &ett_rf4ce_profile_gdp_poll_constraints_polling_rec,
1527
14
        &ett_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap,
1528
14
        &ett_rf4ce_profile_gdp_poll_configuration_polling_trig_conf,
1529
14
        &ett_rf4ce_profile_action_records,
1530
14
        &ett_rf4ce_profile_action_records_sub,
1531
14
        &ett_rf4ce_profile_zrc10_supported_commands,
1532
14
        &ett_rf4ce_profile_zrc10_supported_commands_sub};
1533
1534
14
    proto_rf4ce_profile = proto_register_protocol("RF4CE Profile", "RF4CE Profile", "rf4ce_profile");
1535
14
    proto_register_field_array(proto_rf4ce_profile, hf, array_length(hf));
1536
14
    proto_register_subtree_array(ett, array_length(ett));
1537
1538
14
    rf4ce_profile_dissector_table = register_dissector_table("rf4ce.profile", "RF4CE Profile", proto_rf4ce_profile, FT_NONE, BASE_NONE);
1539
14
    rf4ce_profile_handle = register_dissector("rf4ce_profile", dissect_rf4ce_profile_common, proto_rf4ce_profile);
1540
14
}
1541
1542
void proto_reg_handoff_rf4ce_profile(void)
1543
14
{
1544
14
}
1545
1546
/* RF4CE Profile common dissector */
1547
static int dissect_rf4ce_profile_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1548
85
{
1549
85
    unsigned offset = 0;
1550
85
    proto_item *ti = proto_tree_add_item(tree, proto_rf4ce_profile, tvb, 0, -1, ENC_LITTLE_ENDIAN);
1551
85
    proto_tree *rf4ce_profile_tree = proto_item_add_subtree(ti, ett_rf4ce_profile);
1552
1553
85
    uint8_t fcf = tvb_get_uint8(tvb, offset);
1554
85
    uint8_t cmd_id = fcf & RF4CE_PROFILE_FCF_CMD_ID_MASK;
1555
85
    bool is_cmd_frame = fcf & RF4CE_PROFILE_FCF_CMD_FRAME_MASK;
1556
85
    bool is_gdp = !strncmp("GDP", (char *)data, 3);
1557
85
    bool is_zrc20 = !strncmp("ZRC 2.0", (char *)data, 7);
1558
85
    bool is_zrc10 = !strncmp("ZRC 1.0", (char *)data, 7);
1559
1560
85
    char protocol_str[14] = {0};
1561
1562
    /* Clear the info column */
1563
85
    col_clear(pinfo->cinfo, COL_INFO);
1564
1565
85
    if (is_gdp || (is_zrc20 && is_cmd_frame))
1566
75
    {
1567
75
        static int *const gdp_fcf_bits[] = {
1568
75
            &hf_rf4ce_profile_fcf_cmd_id,
1569
75
            &hf_rf4ce_profile_fcf_reserved,
1570
75
            &hf_rf4ce_profile_fcf_cmd_frame,
1571
75
            &hf_rf4ce_profile_fcf_data_pending,
1572
75
            NULL};
1573
1574
75
        proto_tree_add_bitmask(rf4ce_profile_tree, tvb, offset, hf_rf4ce_profile_fcf, ett_rf4ce_profile, gdp_fcf_bits, ENC_LITTLE_ENDIAN);
1575
75
        offset += 1;
1576
75
    }
1577
10
    else if (is_zrc20)
1578
1
    {
1579
1
        static int *const zrc20_fcf_bits[] = {
1580
1
            &hf_rf4ce_zrc20_fcf_cmd_id,
1581
1
            &hf_rf4ce_profile_fcf_reserved,
1582
1
            &hf_rf4ce_profile_fcf_cmd_frame,
1583
1
            &hf_rf4ce_profile_fcf_data_pending,
1584
1
            NULL};
1585
1586
1
        proto_tree_add_bitmask(rf4ce_profile_tree, tvb, offset, hf_rf4ce_profile_fcf, ett_rf4ce_profile, zrc20_fcf_bits, ENC_LITTLE_ENDIAN);
1587
1
        offset += 1;
1588
1
    }
1589
9
    else if (is_zrc10)
1590
9
    {
1591
9
        static int *const zrc10_fcf_bits[] = {
1592
9
            &hf_rf4ce_zrc10_fcf_cmd_id,
1593
9
            &hf_rf4ce_zrc10_fcf_reserved,
1594
9
            NULL};
1595
1596
9
        proto_tree_add_bitmask(rf4ce_profile_tree, tvb, offset, hf_rf4ce_zrc10_fcf, ett_rf4ce_profile, zrc10_fcf_bits, ENC_LITTLE_ENDIAN);
1597
9
        offset += 1;
1598
1599
9
        cmd_id = fcf & RF4CE_ZRC10_FCF_CMD_ID_MASK;
1600
9
    }
1601
1602
85
    snprintf(protocol_str, sizeof(protocol_str), "%s %s", "RF4CE", (char *)data);
1603
85
    col_add_str(pinfo->cinfo, COL_PROTOCOL, protocol_str);
1604
1605
85
    if (is_gdp || is_zrc20 || is_zrc10)
1606
85
    {
1607
85
        dissect_rf4ce_profile_cmd(tvb, pinfo, rf4ce_profile_tree, &offset, cmd_id, (char *)data, is_cmd_frame);
1608
85
    }
1609
1610
85
    if (offset < tvb_captured_length(tvb))
1611
10
    {
1612
10
        unsigned unparsed_length = tvb_captured_length(tvb) - offset;
1613
10
        proto_tree_add_item(rf4ce_profile_tree, hf_rf4ce_profile_unparsed_payload, tvb, offset, unparsed_length, ENC_NA);
1614
10
        offset += unparsed_length;
1615
10
    }
1616
1617
85
    return offset;
1618
85
}
1619
1620
static void dissect_rf4ce_profile_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, uint8_t cmd_id, char *profile_str, bool is_cmd_frame)
1621
85
{
1622
85
    proto_tree *profile_cmd_tree;
1623
85
    bool is_zrc10 = !strncmp("ZRC 1.0", profile_str, 7);
1624
85
    bool is_zrc20 = !strncmp("ZRC 2.0", profile_str, 7);
1625
1626
85
    profile_cmd_tree = proto_tree_add_subtree(tree, tvb, *offset, tvb_captured_length(tvb) - *offset, ett_rf4ce_profile_cmd_frame, NULL, "Profile Command Frame");
1627
1628
85
    if (is_cmd_frame)
1629
68
    {
1630
68
        col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(cmd_id, rf4ce_profile_fcf_cmd_id_vals, "Unknown Command"));
1631
68
        dissect_rf4ce_profile_common_cmd(tvb, pinfo, profile_cmd_tree, offset, cmd_id, is_zrc20);
1632
68
    }
1633
17
    else if (is_zrc10)
1634
3
    {
1635
3
        col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(cmd_id, rf4ce_zrc10_fcf_cmd_id_vals, "Unknown Command"));
1636
3
        dissect_rf4ce_profile_zrc10_cmd(tvb, profile_cmd_tree, offset, cmd_id);
1637
3
    }
1638
    /* cmd_frame bit MUST be zero for ZRC 2.0 profile */
1639
14
    else if (is_zrc20 || !is_cmd_frame)
1640
14
    {
1641
14
        col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(cmd_id, rf4ce_zrc20_fcf_cmd_id_vals, "Unknown Command"));
1642
14
        dissect_rf4ce_profile_zrc20_cmd(tvb, profile_cmd_tree, offset, cmd_id);
1643
14
    }
1644
85
}
1645
1646
static void dissect_rf4ce_profile_common_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset, uint8_t cmd_id, bool is_zrc20)
1647
68
{
1648
68
    switch (cmd_id)
1649
68
    {
1650
1
    case RF4CE_PROFILE_CMD_GENERIC_RESPONSE:
1651
1
        dissect_rf4ce_profile_cmd_generic_resp(tvb, tree, offset);
1652
1
        break;
1653
1654
0
    case RF4CE_PROFILE_CMD_CONFIGURATION_COMPLETE:
1655
0
        dissect_rf4ce_profile_cmd_configuration_complete(tvb, tree, offset);
1656
0
        break;
1657
1658
1
    case RF4CE_PROFILE_CMD_HEARTBEAT:
1659
1
        dissect_rf4ce_profile_cmd_heartbeat(tvb, tree, offset);
1660
1
        break;
1661
1662
10
    case RF4CE_PROFILE_CMD_GET_ATTRIBUTES:
1663
10
        dissect_rf4ce_profile_cmd_get_attrs(tvb, tree, offset, is_zrc20);
1664
10
        break;
1665
1666
4
    case RF4CE_PROFILE_CMD_GET_ATTRIBUTES_RESPONSE:
1667
4
        dissect_rf4ce_profile_cmd_get_attrs_resp(tvb, tree, offset, is_zrc20);
1668
4
        break;
1669
1670
1
    case RF4CE_PROFILE_CMD_PUSH_ATTRIBUTES:
1671
1
        dissect_rf4ce_profile_cmd_push_attrs(tvb, tree, offset, is_zrc20);
1672
1
        break;
1673
1674
18
    case RF4CE_PROFILE_CMD_SET_ATTRIBUTES:
1675
18
        dissect_rf4ce_profile_cmd_set_attrs(tvb, tree, offset, is_zrc20);
1676
18
        break;
1677
1678
11
    case RF4CE_PROFILE_CMD_PULL_ATTRIBUTES:
1679
11
        dissect_rf4ce_profile_cmd_pull_attrs(tvb, tree, offset, is_zrc20);
1680
11
        break;
1681
1682
17
    case RF4CE_PROFILE_CMD_PULL_ATTRIBUTES_RESPONSE:
1683
17
        dissect_rf4ce_profile_cmd_pull_attrs_resp(tvb, tree, offset, is_zrc20);
1684
17
        break;
1685
1686
1
    case RF4CE_PROFILE_CMD_CHECK_VALIDATION:
1687
1
        dissect_rf4ce_profile_cmd_check_validation(tvb, tree, offset);
1688
1
        break;
1689
1690
1
    case RF4CE_PROFILE_CMD_CLIENT_NOTIFICATION:
1691
1
        dissect_rf4ce_profile_cmd_client_notification(tvb, tree, offset);
1692
1
        break;
1693
1694
1
    case RF4CE_PROFILE_CMD_KEY_EXCHANGE:
1695
1
        dissect_rf4ce_profile_cmd_key_exchange(tvb, pinfo, tree, offset);
1696
1
        break;
1697
68
    }
1698
68
}
1699
1700
static void dissect_rf4ce_profile_cmd_generic_resp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1701
1
{
1702
1
    proto_tree_add_item(tree, hf_rf4ce_profile_cmd_generic_resp_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1703
1
    *offset += 1;
1704
1
}
1705
1706
static void dissect_rf4ce_profile_cmd_configuration_complete(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1707
0
{
1708
0
    proto_tree_add_item(tree, hf_rf4ce_profile_cmd_configuration_complete_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1709
0
    *offset += 1;
1710
0
}
1711
1712
static void dissect_rf4ce_profile_cmd_heartbeat(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
1713
1
{
1714
1
    proto_tree_add_item(tree, hf_rf4ce_profile_cmd_heartbeat_trigger, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1715
1
    *offset += 1;
1716
1
}
1717
1718
static bool dissect_rf4ce_profile_gdp_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t attr_id)
1719
36
{
1720
36
    bool is_parsed = true;
1721
1722
36
    if (attr_id == RF4CE_GDP_ATTR_IDENTIFICATION_CAPABILITIES)
1723
1
    {
1724
1
        static int *const ident_cap_bits[] = {
1725
1
            &hf_rf4ce_profile_gdp_ident_cap_reserved,
1726
1
            &hf_rf4ce_profile_gdp_ident_cap_support_flash_light,
1727
1
            &hf_rf4ce_profile_gdp_ident_cap_support_make_short_sound,
1728
1
            &hf_rf4ce_profile_gdp_ident_cap_support_vibrate,
1729
1
            &hf_rf4ce_profile_gdp_ident_cap_reserved2,
1730
1
            NULL};
1731
1732
1
        proto_tree_add_bitmask(tree, tvb, *offset, hf_rf4ce_profile_gdp_ident_cap, ett_rf4ce_profile_zrc20_ident_cap, ident_cap_bits, ENC_LITTLE_ENDIAN);
1733
1
        *offset += 1;
1734
1
    }
1735
35
    else if (attr_id == RF4CE_GDP_ATTR_POLL_CONSTRAINTS)
1736
0
    {
1737
0
        int methods_index;
1738
0
        uint8_t methods_num;
1739
1740
0
        static int *const polling_trig_cap_bits[] = {
1741
0
            &hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_tbased,
1742
0
            &hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_k_press,
1743
0
            &hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_pick_up,
1744
0
            &hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_reset,
1745
0
            &hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_micro_act,
1746
0
            &hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_on_user_act,
1747
0
            &hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap_reserved,
1748
0
            NULL};
1749
1750
0
        proto_tree_add_item(tree, hf_rf4ce_profile_gdp_poll_constraints_methods_num, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1751
0
        methods_num = tvb_get_uint8(tvb, *offset);
1752
0
        *offset += 1;
1753
1754
0
        for (methods_index = 1; methods_index <= methods_num; methods_index++)
1755
0
        {
1756
0
            char subtree_name[40];
1757
0
            proto_tree *record_subtree;
1758
1759
0
            snprintf(subtree_name, sizeof(subtree_name), "Polling Constraint Record %d:", methods_index);
1760
0
            record_subtree = proto_tree_add_subtree(tree, tvb, *offset, tvb_captured_length(tvb) - *offset, ett_rf4ce_profile_gdp_poll_constraints_polling_rec, NULL, subtree_name);
1761
1762
0
            proto_tree_add_item(record_subtree, hf_rf4ce_profile_gdp_poll_constraints_polling_rec_method_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1763
0
            *offset += 1;
1764
1765
0
            proto_tree_add_bitmask(record_subtree, tvb, *offset, hf_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap, ett_rf4ce_profile_gdp_poll_constraints_polling_rec_polling_trig_cap, polling_trig_cap_bits, ENC_LITTLE_ENDIAN);
1766
0
            *offset += 2;
1767
1768
0
            proto_tree_add_item(record_subtree, hf_rf4ce_profile_gdp_poll_constraints_polling_rec_min_polling_key_press_cnt, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1769
0
            *offset += 1;
1770
1771
0
            proto_tree_add_item(record_subtree, hf_rf4ce_profile_gdp_poll_constraints_polling_rec_max_polling_key_press_cnt, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1772
0
            *offset += 1;
1773
1774
0
            proto_tree_add_item(record_subtree, hf_rf4ce_profile_gdp_poll_constraints_polling_rec_min_polling_time_interval, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
1775
0
            *offset += 4;
1776
1777
0
            proto_tree_add_item(record_subtree, hf_rf4ce_profile_gdp_poll_constraints_polling_rec_max_polling_time_interval, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
1778
0
            *offset += 4;
1779
0
        }
1780
0
    }
1781
35
    else if (attr_id == RF4CE_GDP_ATTR_POLL_CONFIGURATION)
1782
0
    {
1783
0
        proto_tree_add_item(tree, hf_rf4ce_profile_gdp_poll_configuration_method_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1784
0
        *offset += 1;
1785
1786
0
        static int *const polling_trig_conf_bits[] = {
1787
0
            &hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_tbased,
1788
0
            &hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_k_press,
1789
0
            &hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_pick_up,
1790
0
            &hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_reset,
1791
0
            &hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_micro_act,
1792
0
            &hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_on_user_act,
1793
0
            &hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf_reserved,
1794
0
            NULL};
1795
1796
0
        proto_tree_add_bitmask_len(tree, tvb, *offset, 2, hf_rf4ce_profile_gdp_poll_configuration_polling_trig_conf, ett_rf4ce_profile_gdp_poll_configuration_polling_trig_conf, polling_trig_conf_bits, NULL, ENC_LITTLE_ENDIAN);
1797
0
        *offset += 2;
1798
1799
0
        proto_tree_add_item(tree, hf_rf4ce_profile_gdp_poll_configuration_polling_key_press_cnt, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1800
0
        *offset += 1;
1801
1802
0
        proto_tree_add_item(tree, hf_rf4ce_profile_gdp_poll_configuration_polling_time_interval, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
1803
0
        *offset += 4;
1804
1805
0
        proto_tree_add_item(tree, hf_rf4ce_profile_gdp_poll_configuration_polling_timeout, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1806
0
        *offset += 1;
1807
0
    }
1808
#if 0
1809
  else if (attr_id == RF4CE_GDP_ATTR_GDP_PROFILE_CAPABILITIES)
1810
  {
1811
    /* TODO: Implement RF4CE_GDP_ATTR_GDP_CAPABILITIES parsing */
1812
  }
1813
  else if (attr_id == RF4CE_GDP_ATTR_POWER_STATUS)
1814
  {
1815
    /* TODO: Implement RF4CE_GDP_ATTR_POWER_STATUS parsing */
1816
  }
1817
#endif
1818
35
    else
1819
35
    {
1820
35
        is_parsed = false;
1821
35
    }
1822
1823
36
    return is_parsed;
1824
36
}
1825
1826
static bool dissect_rf4ce_profile_zrc20_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t attr_id, uint8_t attr_length)
1827
32
{
1828
32
    bool is_parsed = true;
1829
1830
32
    if (attr_id == RF4CE_ZRC20_ATTR_MAPPABLE_ACTIONS)
1831
1
    {
1832
1
        proto_tree *entry_subtree;
1833
1
        char entry_subtree_name[11];
1834
1
        unsigned entries_num = attr_length / 3;
1835
1836
1
        for (unsigned i = 1; i <= entries_num; i++)
1837
0
        {
1838
0
            snprintf(entry_subtree_name, sizeof(entry_subtree_name), "Entry %d:", i);
1839
0
            entry_subtree = proto_tree_add_subtree(tree, tvb, *offset, tvb_captured_length(tvb) - *offset, ett_rf4ce_profile_zrc20_mappable_actions_entry, NULL, entry_subtree_name);
1840
1841
0
            proto_tree_add_item(entry_subtree, hf_rf4ce_profile_zrc20_mappable_actions_action_dev_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1842
0
            *offset += 1;
1843
1844
0
            proto_tree_add_item(entry_subtree, hf_rf4ce_profile_zrc20_mappable_actions_action_bank, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1845
0
            *offset += 1;
1846
1847
0
            proto_tree_add_item(entry_subtree, hf_rf4ce_profile_zrc20_mappable_actions_action_code, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1848
0
            *offset += 1;
1849
0
        }
1850
1
    }
1851
31
    else if (attr_id == RF4CE_ZRC20_ATTR_ACTION_MAPPINGS)
1852
0
    {
1853
0
        uint8_t action_mapping_flags = tvb_get_uint8(tvb, *offset);
1854
0
        bool rf_specified = (action_mapping_flags & RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_RF_SPECIFIED_MASK) != 0;
1855
0
        bool ir_specified = (action_mapping_flags & RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_IR_SPECIFIED_MASK) != 0;
1856
0
        bool use_default = (action_mapping_flags & RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_MAPPING_FLAGS_USE_DEFAULT_MASK) != 0;
1857
1858
0
        static int *const action_mapping_flags_bits[] = {
1859
0
            &hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_rf_specified,
1860
0
            &hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_ir_specified,
1861
0
            &hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_rf_descr_first,
1862
0
            &hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_reserved,
1863
0
            &hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_use_default,
1864
0
            &hf_rf4ce_profile_zrc20_action_mappings_mapping_flags_permanent,
1865
0
            NULL};
1866
1867
0
        proto_tree_add_bitmask(tree, tvb, *offset, hf_rf4ce_profile_zrc20_action_mappings_mapping_flags, ett_rf4ce_profile_zrc20_action_mappings_flags, action_mapping_flags_bits, ENC_LITTLE_ENDIAN);
1868
0
        *offset += 1;
1869
1870
0
        if (rf_specified && !use_default)
1871
0
        {
1872
0
            proto_tree *rf_desc_subtree = proto_tree_add_subtree(tree, tvb, *offset, tvb_captured_length(tvb) - *offset, ett_rf4ce_profile_zrc20_action_mappings_rf_descr, NULL, "RF Descriptor");
1873
0
            uint8_t action_data_len;
1874
1875
0
            static int *const rf_conf_bits[] = {
1876
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_min_num_of_trans,
1877
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_keep_trans_until_key_release,
1878
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_short_rf_retry,
1879
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_atomic_action,
1880
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf_reserved,
1881
0
                NULL};
1882
1883
0
            proto_tree_add_bitmask(rf_desc_subtree, tvb, *offset, hf_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf, ett_rf4ce_profile_zrc20_action_mappings_rf_descr_rf_conf, rf_conf_bits, ENC_LITTLE_ENDIAN);
1884
0
            *offset += 1;
1885
1886
0
            static int *const tx_opts_bits[] = {
1887
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_trans_mode,
1888
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_dst_addr_mode,
1889
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ack_mode,
1890
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_sec_mode,
1891
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_ag_mode,
1892
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_ch_norm_mode,
1893
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_payload_mode,
1894
0
                &hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts_reserved,
1895
0
                NULL};
1896
1897
0
            proto_tree_add_bitmask(rf_desc_subtree, tvb, *offset, hf_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts, ett_rf4ce_profile_zrc20_action_mappings_rf_descr_tx_opts, tx_opts_bits, ENC_LITTLE_ENDIAN);
1898
0
            *offset += 1;
1899
1900
0
            proto_tree_add_item(rf_desc_subtree, hf_rf4ce_profile_zrc20_action_mappings_rf_descr_action_data_len, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1901
0
            action_data_len = tvb_get_uint8(tvb, *offset);
1902
0
            *offset += 1;
1903
1904
0
            if (action_data_len > 0)
1905
0
            {
1906
0
                dissect_rf4ce_profile_zrc20_action_data(tvb, rf_desc_subtree, offset, false /* do not dissect the Action Control field */);
1907
0
            }
1908
0
        }
1909
1910
0
        if (ir_specified && !use_default)
1911
0
        {
1912
0
            proto_tree *ir_desc_subtree = proto_tree_add_subtree(tree, tvb, *offset, tvb_captured_length(tvb) - *offset, ett_rf4ce_profile_zrc20_action_mappings_ir_descr, NULL, "IR Descriptor");
1913
0
            uint8_t ir_config;
1914
0
            bool vendor_specific;
1915
0
            uint8_t ir_code_len;
1916
1917
0
            static int *const ir_conf_bits[] = {
1918
0
                &hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf_vendor_specific,
1919
0
                &hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf_reserved,
1920
0
                NULL};
1921
1922
0
            proto_tree_add_bitmask(ir_desc_subtree, tvb, *offset, hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf, ett_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_conf, ir_conf_bits, ENC_LITTLE_ENDIAN);
1923
0
            ir_config = tvb_get_uint8(tvb, *offset);
1924
0
            *offset += 1;
1925
1926
0
            vendor_specific = (ir_config & RF4CE_PROFILE_ZRC20_ACTION_MAPPINGS_IR_DESCR_IR_CONF_VENDOR_SPECIFIC_MASK) != 0;
1927
0
            if (vendor_specific)
1928
0
            {
1929
0
                proto_tree_add_item(ir_desc_subtree, hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_vendor_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1930
0
                *offset += 2;
1931
0
            }
1932
1933
0
            proto_tree_add_item(ir_desc_subtree, hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_code_len, tvb, *offset, 1, ENC_NA);
1934
0
            ir_code_len = tvb_get_uint8(tvb, *offset);
1935
0
            *offset += 1;
1936
1937
0
            if (ir_code_len > 0)
1938
0
            {
1939
0
                proto_tree_add_item(ir_desc_subtree, hf_rf4ce_profile_zrc20_action_mappings_ir_descr_ir_code, tvb, *offset, ir_code_len, ENC_NA);
1940
0
                *offset += ir_code_len;
1941
0
            }
1942
0
        }
1943
0
    }
1944
31
    else if (attr_id == RF4CE_ZRC20_ATTR_IRDB_VENDOR_SUPPORT)
1945
4
    {
1946
4
        int remaining_length = tvb_reported_length_remaining(tvb, *offset);
1947
53
        while (remaining_length > 0)
1948
49
        {
1949
49
            proto_tree_add_item(tree, hf_rf4ce_profile_zrc20_irdb_vendor_support_vendor_id, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1950
49
            *offset += 2;
1951
49
            remaining_length -= 2;
1952
49
        }
1953
4
    }
1954
27
    else
1955
27
    {
1956
27
        is_parsed = false;
1957
27
    }
1958
1959
32
    return is_parsed;
1960
32
}
1961
1962
static void dissect_rf4ce_profile_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t dissection_mask, bool is_zrc20)
1963
61
{
1964
61
    int attr_counter = 1;
1965
61
    uint8_t attr_id = 0xff;
1966
61
    uint8_t attr_status = RF4CE_PROFILE_ATTR_STATUS_ATTRIBUTE_SUCCESSFULLY_READ_AND_INCLUDED;
1967
61
    uint8_t attr_length = 0xff;
1968
61
    proto_tree *attrs_tree = proto_tree_add_subtree(tree, tvb, *offset, tvb_captured_length(tvb) - *offset, ett_rf4ce_profile_attrs, NULL, "Attributes List");
1969
61
    unsigned prev_offset = *offset;
1970
1971
1.42k
    while (tvb_captured_length(tvb) - *offset)
1972
1.35k
    {
1973
1.35k
        char attr_subtree_name[14];
1974
1.35k
        proto_tree *attrs_subtree;
1975
1976
1.35k
        snprintf(attr_subtree_name, sizeof(attr_subtree_name), "Attribute %d:", attr_counter);
1977
1.35k
        attr_counter++;
1978
1979
1.35k
        attrs_subtree = proto_tree_add_subtree(attrs_tree, tvb, *offset, tvb_captured_length(tvb) - *offset, ett_rf4ce_profile_attrs_sub, NULL, attr_subtree_name);
1980
1981
1.35k
        if (dissection_mask & RF4CE_PROFILE_ATTR_DISSECT_ATTR_ID_MASK)
1982
1.35k
        {
1983
1.35k
            int hf_temp = is_zrc20 ? hf_rf4ce_profile_zrc20_attr_id : hf_rf4ce_profile_gdp_attr_id;
1984
1985
1.35k
            proto_tree_add_item(attrs_subtree, hf_temp, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
1986
1.35k
            attr_id = tvb_get_uint8(tvb, *offset);
1987
1.35k
            *offset += 1;
1988
1.35k
        }
1989
1990
1.35k
        if (dissection_mask & RF4CE_PROFILE_ATTR_DISSECT_ENTRY_ID_MASK)
1991
1.35k
        {
1992
1.35k
            bool is_attr_arrayed =
1993
1.35k
                is_zrc20 ? rf4ce_profile_is_zrc20_attr_arrayed(attr_id) : rf4ce_profile_is_gdp_attr_arrayed(attr_id);
1994
1.35k
            if (is_attr_arrayed)
1995
98
            {
1996
98
                proto_tree_add_item(attrs_subtree, hf_rf4ce_profile_attr_entry_id, tvb, *offset, 2, ENC_NA);
1997
98
                *offset += 2;
1998
98
            }
1999
1.35k
        }
2000
2001
1.35k
        if (dissection_mask & RF4CE_PROFILE_ATTR_DISSECT_ATTR_STATUS_MASK)
2002
365
        {
2003
365
            proto_tree_add_item(attrs_subtree, hf_rf4ce_profile_attr_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2004
365
            attr_status = tvb_get_uint8(tvb, *offset);
2005
365
            *offset += 1;
2006
365
        }
2007
2008
1.35k
        if (attr_status == RF4CE_PROFILE_ATTR_STATUS_ATTRIBUTE_SUCCESSFULLY_READ_AND_INCLUDED && dissection_mask & RF4CE_PROFILE_ATTR_DISSECT_ATTR_LENGTH_MASK)
2009
246
        {
2010
246
            proto_tree_add_item(attrs_subtree, hf_rf4ce_profile_attr_length, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2011
246
            attr_length = tvb_get_uint8(tvb, *offset);
2012
246
            *offset += 1;
2013
246
        }
2014
2015
1.35k
        if (attr_status == RF4CE_PROFILE_ATTR_STATUS_ATTRIBUTE_SUCCESSFULLY_READ_AND_INCLUDED && dissection_mask & RF4CE_PROFILE_ATTR_DISSECT_ATTR_VALUE_MASK && attr_length != 0xff && attr_length != 0x00)
2016
68
        {
2017
68
            bool is_parsed;
2018
2019
68
            if (is_zrc20)
2020
32
            {
2021
32
                is_parsed = dissect_rf4ce_profile_zrc20_attrs(tvb, attrs_subtree, offset, attr_id, attr_length);
2022
32
            }
2023
36
            else
2024
36
            {
2025
36
                is_parsed = dissect_rf4ce_profile_gdp_attrs(tvb, attrs_subtree, offset, attr_id);
2026
36
            }
2027
2028
68
            if (!is_parsed)
2029
62
            {
2030
62
                proto_tree_add_item(attrs_subtree, hf_rf4ce_profile_attr_value, tvb, *offset, attr_length, ENC_NA);
2031
62
                *offset += attr_length;
2032
62
            }
2033
68
        }
2034
2035
1.35k
        if (dissection_mask == RF4CE_PROFILE_ATTR_DISSECT_NOT_SET || prev_offset == *offset)
2036
0
        {
2037
0
            attr_length = tvb_captured_length(tvb) - *offset;
2038
0
            proto_tree_add_item(attrs_subtree, hf_rf4ce_profile_attr_value, tvb, *offset, attr_length, ENC_NA);
2039
0
            *offset += attr_length;
2040
0
        }
2041
2042
1.35k
      prev_offset = *offset;
2043
1.35k
    }
2044
61
}
2045
2046
static void dissect_rf4ce_profile_cmd_get_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20)
2047
10
{
2048
10
    dissect_rf4ce_profile_attrs(tvb, tree, offset, RF4CE_PROFILE_ATTR_DISSECT_GET_ATTRS_MASK, is_zrc20);
2049
10
}
2050
2051
static void dissect_rf4ce_profile_cmd_get_attrs_resp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20)
2052
4
{
2053
4
    dissect_rf4ce_profile_attrs(tvb, tree, offset, RF4CE_PROFILE_ATTR_DISSECT_GET_ATTRS_RESP_MASK, is_zrc20);
2054
4
}
2055
2056
static void dissect_rf4ce_profile_cmd_push_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20)
2057
1
{
2058
1
    dissect_rf4ce_profile_attrs(tvb, tree, offset, RF4CE_PROFILE_ATTR_DISSECT_PUSH_ATTRS_MASK, is_zrc20);
2059
1
}
2060
2061
static void dissect_rf4ce_profile_cmd_set_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20)
2062
18
{
2063
18
    dissect_rf4ce_profile_attrs(tvb, tree, offset, RF4CE_PROFILE_ATTR_DISSECT_SET_ATTRS_MASK, is_zrc20);
2064
18
}
2065
2066
static void dissect_rf4ce_profile_cmd_pull_attrs(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20)
2067
11
{
2068
11
    dissect_rf4ce_profile_attrs(tvb, tree, offset, RF4CE_PROFILE_ATTR_DISSECT_PULL_ATTRS_MASK, is_zrc20);
2069
11
}
2070
2071
static void dissect_rf4ce_profile_cmd_pull_attrs_resp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool is_zrc20)
2072
17
{
2073
17
    dissect_rf4ce_profile_attrs(tvb, tree, offset, RF4CE_PROFILE_ATTR_DISSECT_PULL_ATTRS_RESP_MASK, is_zrc20);
2074
17
}
2075
2076
static bool rf4ce_profile_is_gdp_attr_arrayed(uint8_t attr_id)
2077
983
{
2078
    /* other values are scalar */
2079
983
    return ((attr_id >= RF4CE_GDP_ATTR_ARRAYED1_RESERVED_MIN && attr_id <= RF4CE_GDP_ATTR_ARRAYED1_RESERVED_MAX) || (attr_id >= RF4CE_GDP_ATTR_ARRAYED2_RESERVED_MIN && attr_id <= RF4CE_GDP_ATTR_ARRAYED2_RESERVED_MAX));
2080
983
}
2081
2082
static bool rf4ce_profile_is_zrc20_attr_arrayed(uint8_t attr_id)
2083
376
{
2084
    /* other values are scalar */
2085
376
    return (attr_id == RF4CE_ZRC20_ATTR_ACTION_CODES_SUPPORTED_RX || attr_id == RF4CE_ZRC20_ATTR_ACTION_CODES_SUPPORTED_TX || attr_id == RF4CE_ZRC20_ATTR_MAPPABLE_ACTIONS || attr_id == RF4CE_ZRC20_ATTR_ACTION_MAPPINGS || attr_id == RF4CE_ZRC20_ATTR_HOME_AUTOMATION || attr_id == RF4CE_ZRC20_ATTR_HOME_AUTOMATION_SUPPORTED || (attr_id >= RF4CE_ZRC20_ATTR_ARRAYED1_MIN && attr_id <= RF4CE_ZRC20_ATTR_ARRAYED2_MAX));
2086
376
}
2087
2088
static void dissect_rf4ce_profile_cmd_check_validation(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2089
1
{
2090
1
    uint8_t sub_type = tvb_get_uint8(tvb, *offset);
2091
1
    proto_tree_add_item(tree, hf_rf4ce_profile_cmd_check_validation_sub_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2092
1
    *offset += 1;
2093
2094
1
    if (sub_type == RF4CE_PROFILE_CMD_CHECK_VALIDATION_SUB_TYPE_REQ)
2095
1
    {
2096
1
        proto_tree_add_item(tree, hf_rf4ce_profile_cmd_check_validation_control, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2097
1
        *offset += 1;
2098
1
    }
2099
0
    else if (sub_type == RF4CE_PROFILE_CMD_CHECK_VALIDATION_SUB_TYPE_RSP)
2100
0
    {
2101
0
        proto_tree_add_item(tree, hf_rf4ce_profile_cmd_check_validation_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2102
0
        *offset += 1;
2103
0
    }
2104
1
}
2105
2106
static void dissect_rf4ce_profile_cmd_client_notification(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2107
1
{
2108
1
    uint8_t sub_type = tvb_get_uint8(tvb, *offset);
2109
1
    ;
2110
1
    proto_tree_add_item(tree, hf_rf4ce_profile_cmd_client_notification_sub_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2111
1
    *offset += 1;
2112
2113
1
    if (sub_type == RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_IDENTIFY)
2114
0
    {
2115
0
        static int *const identify_bits[] = {
2116
0
            &hf_rf4ce_profile_cmd_client_notification_identify_flags_stop_on_action,
2117
0
            &hf_rf4ce_profile_cmd_client_notification_identify_flags_flash_light,
2118
0
            &hf_rf4ce_profile_cmd_client_notification_identify_flags_make_sound,
2119
0
            &hf_rf4ce_profile_cmd_client_notification_identify_flags_vibrate,
2120
0
            &hf_rf4ce_profile_cmd_client_notification_identify_flags_reserved,
2121
0
            NULL};
2122
2123
0
        proto_tree_add_bitmask(tree, tvb, *offset, hf_rf4ce_profile_cmd_client_notification_identify_flags, ett_rf4ce_profile_cmd_frame, identify_bits, ENC_LITTLE_ENDIAN);
2124
0
        *offset += 1;
2125
2126
0
        proto_tree_add_item(tree, hf_rf4ce_profile_cmd_client_notification_identify_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2127
0
        *offset += 2;
2128
0
    }
2129
1
    else if (sub_type == RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_HOME_AUTOMATION_PULL)
2130
0
    {
2131
        /* TODO: implement payload parsing */
2132
0
    }
2133
1
    else if (sub_type == RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_SELECTIVE_ACTION_MAPPING_UPDATE)
2134
0
    {
2135
        /* TODO: implement payload parsing */
2136
0
    }
2137
1
    else if (sub_type == RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_POLL_NEGOTIATION || sub_type == RF4CE_PROFILE_CMD_CL_NOTIF_SUB_TYPE_REQ_ACTION_MAPPING_NEGOTIATION)
2138
0
    {
2139
        /* No payload */
2140
0
    }
2141
1
}
2142
2143
static void dissect_rf4ce_profile_cmd_key_exchange(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned *offset)
2144
1
{
2145
1
    uint8_t sub_type = tvb_get_uint8(tvb, *offset);
2146
2147
1
    proto_tree_add_item(tree, hf_rf4ce_profile_cmd_key_exchange_sub_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2148
1
    *offset += 1;
2149
2150
1
    if (sub_type == RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CHALLENGE || sub_type == RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CHALLENGE_RSP)
2151
1
    {
2152
1
        static int *const key_exchange_bits[] = {
2153
1
            &hf_rf4ce_profile_cmd_key_exchange_flags_default_secret,
2154
1
            &hf_rf4ce_profile_cmd_key_exchange_flags_initiator_vendor_specific_secret,
2155
1
            &hf_rf4ce_profile_cmd_key_exchange_flags_responder_vendor_specific_secret,
2156
1
            &hf_rf4ce_profile_cmd_key_exchange_flags_reserved,
2157
1
            &hf_rf4ce_profile_cmd_key_exchange_flags_vendor_specific_parameter,
2158
1
            NULL};
2159
2160
1
        proto_tree_add_bitmask(tree, tvb, *offset, hf_rf4ce_profile_cmd_key_exchange_flags, ett_rf4ce_profile_cmd_frame, key_exchange_bits, ENC_LITTLE_ENDIAN);
2161
1
        *offset += 2;
2162
1
    }
2163
2164
1
    if (sub_type == RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CHALLENGE)
2165
0
    {
2166
0
        uint8_t rand_a[RF4CE_PROFILE_CMD_KEY_EXCHANGE_RAND_A_LENGTH];
2167
0
        uint8_t target_addr[RF4CE_IEEE_ADDR_LEN];
2168
2169
0
        proto_tree_add_item(tree, hf_rf4ce_profile_cmd_key_exchange_rand_a, tvb, *offset, RF4CE_PROFILE_CMD_KEY_EXCHANGE_RAND_A_LENGTH, ENC_NA);
2170
0
        tvb_memcpy(tvb, (void *)rand_a, *offset, RF4CE_PROFILE_CMD_KEY_EXCHANGE_RAND_A_LENGTH);
2171
0
        *offset += RF4CE_PROFILE_CMD_KEY_EXCHANGE_RAND_A_LENGTH;
2172
2173
0
        if (!key_exchange_context_is_procedure_started())
2174
0
        {
2175
0
            if (rf4ce_addr_table_get_ieee_addr(target_addr, pinfo, true))
2176
0
            {
2177
0
                key_exchange_context_init();
2178
2179
0
                key_exchange_context_set_rand_a(rand_a);
2180
0
                key_exchange_context_set_mac_a(target_addr);
2181
2182
0
                key_exchange_context_start_procedure();
2183
0
            }
2184
0
        }
2185
0
    }
2186
2187
1
    if (sub_type == RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_CHALLENGE_RSP)
2188
1
    {
2189
1
        uint8_t rand_b[RF4CE_PROFILE_CMD_KEY_EXCHANGE_RAND_A_LENGTH];
2190
1
        uint32_t tag_b_pack;
2191
2192
1
        uint8_t controller_addr[RF4CE_IEEE_ADDR_LEN];
2193
2194
1
        proto_tree_add_item(tree, hf_rf4ce_profile_cmd_key_exchange_rand_b, tvb, *offset, RF4CE_PROFILE_CMD_KEY_EXCHANGE_RAND_B_LENGTH, ENC_NA);
2195
1
        tvb_memcpy(tvb, (void *)rand_b, *offset, RF4CE_PROFILE_CMD_KEY_EXCHANGE_RAND_A_LENGTH);
2196
1
        *offset += RF4CE_PROFILE_CMD_KEY_EXCHANGE_RAND_B_LENGTH;
2197
2198
1
        proto_tree_add_item(tree, hf_rf4ce_profile_cmd_key_exchange_tag_b, tvb, *offset, RF4CE_PROFILE_CMD_KEY_EXCHANGE_TAG_B_LENGTH, ENC_NA);
2199
1
        tag_b_pack = tvb_get_uint32(tvb, *offset, ENC_LITTLE_ENDIAN);
2200
1
        *offset += RF4CE_PROFILE_CMD_KEY_EXCHANGE_TAG_B_LENGTH;
2201
2202
1
        if (key_exchange_context_is_procedure_started())
2203
0
        {
2204
0
            if (rf4ce_addr_table_get_ieee_addr(controller_addr, pinfo, true))
2205
0
            {
2206
0
                key_exchange_context_set_rand_b(rand_b);
2207
0
                key_exchange_context_set_mac_b(controller_addr);
2208
2209
0
                key_exchange_calc_key(tag_b_pack);
2210
0
            }
2211
2212
0
            key_exchange_context_stop_procedure();
2213
0
        }
2214
1
    }
2215
2216
1
    if (sub_type == RF4CE_PROFILE_CMD_KEY_EXCHANGE_SUB_TYPE_RSP)
2217
0
    {
2218
0
        proto_tree_add_item(tree, hf_rf4ce_profile_cmd_key_exchange_tag_a, tvb, *offset, RF4CE_PROFILE_CMD_KEY_EXCHANGE_TAG_A_LENGTH, ENC_NA);
2219
0
        *offset += RF4CE_PROFILE_CMD_KEY_EXCHANGE_TAG_A_LENGTH;
2220
0
    }
2221
1
}
2222
2223
static void dissect_rf4ce_profile_zrc10_cmd(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t cmd_id)
2224
3
{
2225
3
    switch (cmd_id)
2226
3
    {
2227
1
    case RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_PRESSED:
2228
1
        dissect_rf4ce_profile_zrc10_cmd_user_control_common(tvb, tree, offset, true);
2229
1
        break;
2230
2231
0
    case RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_REPEATED:
2232
0
        dissect_rf4ce_profile_zrc10_cmd_user_control_common(tvb, tree, offset, true);
2233
0
        break;
2234
2235
0
    case RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_RELEASED:
2236
0
        dissect_rf4ce_profile_zrc10_cmd_user_control_common(tvb, tree, offset, false);
2237
0
        break;
2238
2239
1
    case RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_CMD_DISCOVERY_REQ:
2240
1
        dissect_rf4ce_profile_zrc10_cmd_discovery_req(tvb, tree, offset);
2241
1
        break;
2242
2243
0
    case RF4CE_ZRC10_FCF_CMD_ID_USER_CONTROL_CMD_DISCOVERY_RSP:
2244
0
        dissect_rf4ce_profile_zrc10_cmd_discovery_rsp(tvb, tree, offset);
2245
0
        break;
2246
3
    }
2247
3
}
2248
2249
static void dissect_rf4ce_profile_zrc10_cmd_user_control_common(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool parse_payload)
2250
1
{
2251
1
    proto_tree_add_item(tree, hf_rf4ce_zrc10_cmd_common_rc_command_code, tvb, *offset, 1, ENC_NA);
2252
1
    *offset += 1;
2253
2254
1
    if (parse_payload)
2255
1
    {
2256
1
        int remaining_length = tvb_reported_length_remaining(tvb, *offset);
2257
1
        if (remaining_length > 0)
2258
1
        {
2259
1
            proto_tree_add_item(tree, hf_rf4ce_zrc10_cmd_common_rc_command_payload, tvb, *offset, remaining_length, ENC_NA);
2260
1
            *offset += remaining_length;
2261
1
        }
2262
1
    }
2263
1
}
2264
2265
static void dissect_rf4ce_profile_zrc10_cmd_discovery_req(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2266
1
{
2267
1
    proto_tree_add_item(tree, hf_rf4ce_zrc10_cmd_disc_reserved, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2268
1
    *offset += 1;
2269
1
}
2270
2271
static void dissect_rf4ce_profile_zrc10_cmd_discovery_rsp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
2272
0
{
2273
0
  int remaining_length = tvb_reported_length_remaining(tvb, *offset);
2274
2275
0
  if (remaining_length > 0)
2276
0
  {
2277
0
    proto_tree_add_item(tree, hf_rf4ce_zrc10_cmd_disc_rsp_supported_commands, tvb, *offset, remaining_length, ENC_NA);
2278
0
    *offset += remaining_length;
2279
0
  }
2280
0
}
2281
2282
static void dissect_rf4ce_profile_zrc20_cmd(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, uint8_t cmd_id)
2283
14
{
2284
14
    if (cmd_id == RF4CE_ZRC20_CMD_ACTIONS)
2285
10
    {
2286
10
        int remaining_length = tvb_reported_length_remaining(tvb, *offset);
2287
10
        proto_tree *action_records_tree;
2288
2289
10
        if (remaining_length > 0)
2290
10
        {
2291
10
            action_records_tree = proto_tree_add_subtree(tree, tvb, *offset, remaining_length, ett_rf4ce_profile_action_records, NULL, "Action Records List");
2292
2293
76
            while (remaining_length > 0)
2294
66
            {
2295
66
                dissect_rf4ce_profile_zrc20_action_data(tvb, action_records_tree, offset, true /* dissect the Action Control field */);
2296
66
                remaining_length = tvb_reported_length_remaining(tvb, *offset);
2297
66
            }
2298
10
        }
2299
0
        else
2300
0
        {
2301
0
            proto_tree_add_subtree(tree, tvb, *offset, remaining_length, ett_rf4ce_profile_action_records, NULL, "Action Records List - empty");
2302
0
        }
2303
10
    }
2304
14
}
2305
2306
static void dissect_rf4ce_profile_zrc20_action_data(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool dissect_action_control)
2307
66
{
2308
66
    char record_tree_name[10];
2309
66
    proto_tree *record_tree;
2310
66
    uint8_t payload_length;
2311
66
    int remaining_length;
2312
66
    int attr_counter = 1;
2313
2314
66
    snprintf(record_tree_name, sizeof(record_tree_name), "Record %d:", attr_counter);
2315
66
    attr_counter++;
2316
2317
66
    record_tree = proto_tree_add_subtree(tree, tvb, *offset, tvb_reported_length_remaining(tvb, *offset), ett_rf4ce_profile_action_records_sub, NULL, record_tree_name);
2318
2319
66
    if (dissect_action_control)
2320
66
    {
2321
66
        static int *const action_control_bits[] = {
2322
66
            &hf_rf4ce_zrc20_cmd_actions_action_control_action_type,
2323
66
            &hf_rf4ce_zrc20_cmd_actions_action_control_reserved,
2324
66
            &hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_gui,
2325
66
            &hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_alt,
2326
66
            &hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_shift,
2327
66
            &hf_rf4ce_zrc20_cmd_actions_action_control_modifier_bits_ctrl,
2328
66
            NULL};
2329
2330
66
        proto_tree_add_bitmask(record_tree, tvb, *offset, hf_rf4ce_zrc20_cmd_actions_action_control, ett_rf4ce_profile_zrc20_action_control, action_control_bits, ENC_LITTLE_ENDIAN);
2331
66
        *offset += 1;
2332
66
    }
2333
2334
66
    proto_tree_add_item(record_tree, hf_rf4ce_zrc20_cmd_actions_action_data_payload_length, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2335
66
    payload_length = tvb_get_uint8(tvb, *offset);
2336
66
    *offset += 1;
2337
2338
66
    proto_tree_add_item(record_tree, hf_rf4ce_zrc20_cmd_actions_action_data_action_bank, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2339
66
    *offset += 1;
2340
2341
66
    proto_tree_add_item(record_tree, hf_rf4ce_zrc20_cmd_actions_action_data_action_code, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
2342
66
    *offset += 1;
2343
2344
    /* TODO: fix action_vendor parsing according to spec */
2345
66
    remaining_length = tvb_reported_length_remaining(tvb, *offset);
2346
66
    if (((payload_length > 0) && (remaining_length - payload_length == 3)) || ((payload_length == 0) && (remaining_length - payload_length == 2)))
2347
2
    {
2348
2
        proto_tree_add_item(record_tree, hf_rf4ce_zrc20_cmd_actions_action_data_action_vendor, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
2349
2
        *offset += 2;
2350
2
    }
2351
2352
66
    if (payload_length > 0)
2353
19
    {
2354
19
        proto_tree_add_item(record_tree, hf_rf4ce_zrc20_cmd_actions_action_data_action_payload, tvb, *offset, payload_length, ENC_NA);
2355
19
        *offset += payload_length;
2356
19
    }
2357
66
}