Initialize Tizen 2.3
[framework/connectivity/bluez.git] / wearable / lib / mgmt.h
1 /*
2  *  BlueZ - Bluetooth protocol stack for Linux
3  *
4  *  Copyright (C) 2010  Nokia Corporation
5  *  Copyright (C) 2010  Marcel Holtmann <marcel@holtmann.org>
6  *
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 #ifndef __packed
25 #define __packed __attribute__((packed))
26 #endif
27
28 #define MGMT_INDEX_NONE                 0xFFFF
29
30 #define MGMT_STATUS_SUCCESS             0x00
31 #define MGMT_STATUS_UNKNOWN_COMMAND     0x01
32 #define MGMT_STATUS_NOT_CONNECTED       0x02
33 #define MGMT_STATUS_FAILED              0x03
34 #define MGMT_STATUS_CONNECT_FAILED      0x04
35 #define MGMT_STATUS_AUTH_FAILED         0x05
36 #define MGMT_STATUS_NOT_PAIRED          0x06
37 #define MGMT_STATUS_NO_RESOURCES        0x07
38 #define MGMT_STATUS_TIMEOUT             0x08
39 #define MGMT_STATUS_ALREADY_CONNECTED   0x09
40 #define MGMT_STATUS_BUSY                0x0a
41 #define MGMT_STATUS_REJECTED            0x0b
42 #define MGMT_STATUS_NOT_SUPPORTED       0x0c
43 #define MGMT_STATUS_INVALID_PARAMS      0x0d
44 #define MGMT_STATUS_DISCONNECTED        0x0e
45 #define MGMT_STATUS_NOT_POWERED         0x0f
46 #define MGMT_STATUS_CANCELLED           0x10
47 #define MGMT_STATUS_INVALID_INDEX       0x11
48
49 struct mgmt_hdr {
50         uint16_t opcode;
51         uint16_t index;
52         uint16_t len;
53 } __packed;
54 #define MGMT_HDR_SIZE   6
55
56 struct mgmt_addr_info {
57         bdaddr_t bdaddr;
58         uint8_t type;
59 } __packed;
60
61 #define MGMT_OP_READ_VERSION            0x0001
62 struct mgmt_rp_read_version {
63         uint8_t version;
64         uint16_t revision;
65 } __packed;
66
67 #define MGMT_OP_READ_COMMANDS           0x0002
68 struct mgmt_rp_read_commands {
69         uint16_t num_commands;
70         uint16_t num_events;
71         uint16_t opcodes[0];
72 } __packed;
73
74 #define MGMT_OP_READ_INDEX_LIST         0x0003
75 struct mgmt_rp_read_index_list {
76         uint16_t num_controllers;
77         uint16_t index[0];
78 } __packed;
79
80 /* Reserve one extra byte for names in management messages so that they
81  * are always guaranteed to be nul-terminated */
82 #define MGMT_MAX_NAME_LENGTH            (HCI_MAX_NAME_LENGTH + 1)
83 #define MGMT_MAX_SHORT_NAME_LENGTH      (10 + 1)
84
85 #ifdef __TIZEN_PATCH__
86 #define MGMT_MAX_ADVERTISING_LENGTH             31
87 #endif
88
89 #define MGMT_SETTING_POWERED            0x00000001
90 #define MGMT_SETTING_CONNECTABLE        0x00000002
91 #define MGMT_SETTING_FAST_CONNECTABLE   0x00000004
92 #define MGMT_SETTING_DISCOVERABLE       0x00000008
93 #define MGMT_SETTING_PAIRABLE           0x00000010
94 #define MGMT_SETTING_LINK_SECURITY      0x00000020
95 #define MGMT_SETTING_SSP                0x00000040
96 #define MGMT_SETTING_BREDR              0x00000080
97 #define MGMT_SETTING_HS                 0x00000100
98 #define MGMT_SETTING_LE                 0x00000200
99 #ifdef __TIZEN_PATCH__
100 #define MGMT_SETTING_ADVERTISING        0x00000400
101 #endif
102
103 #define MGMT_OP_READ_INFO               0x0004
104 struct mgmt_rp_read_info {
105         bdaddr_t bdaddr;
106         uint8_t version;
107         uint16_t manufacturer;
108         uint32_t supported_settings;
109         uint32_t current_settings;
110         uint8_t dev_class[3];
111         uint8_t name[MGMT_MAX_NAME_LENGTH];
112         uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
113 } __packed;
114
115 struct mgmt_mode {
116         uint8_t val;
117 } __packed;
118
119 #define MGMT_OP_SET_POWERED             0x0005
120
121 #define MGMT_OP_SET_DISCOVERABLE        0x0006
122 struct mgmt_cp_set_discoverable {
123         uint8_t val;
124         uint16_t timeout;
125 } __packed;
126
127 #define MGMT_OP_SET_CONNECTABLE         0x0007
128
129 #define MGMT_OP_SET_FAST_CONNECTABLE    0x0008
130
131 #define MGMT_OP_SET_PAIRABLE            0x0009
132
133 #define MGMT_OP_SET_LINK_SECURITY       0x000A
134
135 #define MGMT_OP_SET_SSP                 0x000B
136
137 #define MGMT_OP_SET_HS                  0x000C
138
139 #define MGMT_OP_SET_LE                  0x000D
140
141 #define MGMT_OP_SET_DEV_CLASS           0x000E
142 struct mgmt_cp_set_dev_class {
143         uint8_t major;
144         uint8_t minor;
145 } __packed;
146
147 #define MGMT_OP_SET_LOCAL_NAME          0x000F
148 struct mgmt_cp_set_local_name {
149         uint8_t name[MGMT_MAX_NAME_LENGTH];
150         uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
151 } __packed;
152
153 #define MGMT_OP_ADD_UUID                0x0010
154 struct mgmt_cp_add_uuid {
155         uint8_t uuid[16];
156         uint8_t svc_hint;
157 } __packed;
158
159 #define MGMT_OP_REMOVE_UUID             0x0011
160 struct mgmt_cp_remove_uuid {
161         uint8_t uuid[16];
162 } __packed;
163
164 struct mgmt_link_key_info {
165         struct mgmt_addr_info addr;
166         uint8_t type;
167         uint8_t val[16];
168         uint8_t pin_len;
169 } __packed;
170
171 #define MGMT_OP_LOAD_LINK_KEYS          0x0012
172 struct mgmt_cp_load_link_keys {
173         uint8_t debug_keys;
174         uint16_t key_count;
175         struct mgmt_link_key_info keys[0];
176 } __packed;
177
178 struct mgmt_ltk_info {
179         struct mgmt_addr_info addr;
180         uint8_t authenticated;
181         uint8_t master;
182         uint8_t enc_size;
183         uint16_t ediv;
184         uint8_t rand[8];
185         uint8_t val[16];
186 } __packed;
187
188 #define MGMT_OP_LOAD_LONG_TERM_KEYS     0x0013
189 struct mgmt_cp_load_long_term_keys {
190         uint16_t key_count;
191         struct mgmt_ltk_info keys[0];
192 } __packed;
193
194 #define MGMT_OP_DISCONNECT              0x0014
195 struct mgmt_cp_disconnect {
196         struct mgmt_addr_info addr;
197 } __packed;
198 struct mgmt_rp_disconnect {
199         struct mgmt_addr_info addr;
200 } __packed;
201
202 #define MGMT_OP_GET_CONNECTIONS         0x0015
203 struct mgmt_rp_get_connections {
204         uint16_t conn_count;
205         struct mgmt_addr_info addr[0];
206 } __packed;
207
208 #define MGMT_OP_PIN_CODE_REPLY          0x0016
209 struct mgmt_cp_pin_code_reply {
210         struct mgmt_addr_info addr;
211         uint8_t pin_len;
212         uint8_t pin_code[16];
213 } __packed;
214
215 #define MGMT_OP_PIN_CODE_NEG_REPLY      0x0017
216 struct mgmt_cp_pin_code_neg_reply {
217         struct mgmt_addr_info addr;
218 } __packed;
219
220 #define MGMT_OP_SET_IO_CAPABILITY       0x0018
221 struct mgmt_cp_set_io_capability {
222         uint8_t io_capability;
223 } __packed;
224
225 #define MGMT_OP_PAIR_DEVICE             0x0019
226 struct mgmt_cp_pair_device {
227         struct mgmt_addr_info addr;
228         uint8_t io_cap;
229 } __packed;
230 struct mgmt_rp_pair_device {
231         struct mgmt_addr_info addr;
232 } __packed;
233
234 #define MGMT_OP_CANCEL_PAIR_DEVICE      0x001A
235
236 #define MGMT_OP_UNPAIR_DEVICE           0x001B
237 struct mgmt_cp_unpair_device {
238         struct mgmt_addr_info addr;
239         uint8_t disconnect;
240 } __packed;
241 struct mgmt_rp_unpair_device {
242         struct mgmt_addr_info addr;
243 } __packed;
244
245 #define MGMT_OP_USER_CONFIRM_REPLY      0x001C
246 struct mgmt_cp_user_confirm_reply {
247         struct mgmt_addr_info addr;
248 } __packed;
249 struct mgmt_rp_user_confirm_reply {
250         struct mgmt_addr_info addr;
251 } __packed;
252
253 #define MGMT_OP_USER_CONFIRM_NEG_REPLY  0x001D
254
255 #define MGMT_OP_USER_PASSKEY_REPLY      0x001E
256 struct mgmt_cp_user_passkey_reply {
257         struct mgmt_addr_info addr;
258         uint32_t passkey;
259 } __packed;
260 struct mgmt_rp_user_passkey_reply {
261         struct mgmt_addr_info addr;
262 } __packed;
263
264 #define MGMT_OP_USER_PASSKEY_NEG_REPLY  0x001F
265 struct mgmt_cp_user_passkey_neg_reply {
266         struct mgmt_addr_info addr;
267 } __packed;
268
269 #define MGMT_OP_READ_LOCAL_OOB_DATA     0x0020
270 struct mgmt_rp_read_local_oob_data {
271         uint8_t hash[16];
272         uint8_t randomizer[16];
273 } __packed;
274
275 #define MGMT_OP_ADD_REMOTE_OOB_DATA     0x0021
276 struct mgmt_cp_add_remote_oob_data {
277         struct mgmt_addr_info addr;
278         uint8_t hash[16];
279         uint8_t randomizer[16];
280 } __packed;
281
282 #define MGMT_OP_REMOVE_REMOTE_OOB_DATA  0x0022
283 struct mgmt_cp_remove_remote_oob_data {
284         struct mgmt_addr_info addr;
285 } __packed;
286
287 #define MGMT_OP_START_DISCOVERY         0x0023
288 struct mgmt_cp_start_discovery {
289         uint8_t type;
290 } __packed;
291
292 #define MGMT_OP_STOP_DISCOVERY          0x0024
293 struct mgmt_cp_stop_discovery {
294         uint8_t type;
295 } __packed;
296
297 #define MGMT_OP_CONFIRM_NAME            0x0025
298 struct mgmt_cp_confirm_name {
299         struct mgmt_addr_info addr;
300         uint8_t name_known;
301 } __packed;
302 struct mgmt_rp_confirm_name {
303         struct mgmt_addr_info addr;
304 } __packed;
305
306 #define MGMT_OP_BLOCK_DEVICE            0x0026
307 struct mgmt_cp_block_device {
308         struct mgmt_addr_info addr;
309 } __packed;
310
311 #define MGMT_OP_UNBLOCK_DEVICE          0x0027
312 struct mgmt_cp_unblock_device {
313         struct mgmt_addr_info addr;
314 } __packed;
315
316 #define MGMT_OP_SET_DEVICE_ID           0x0028
317 struct mgmt_cp_set_device_id {
318         uint16_t source;
319         uint16_t vendor;
320         uint16_t product;
321         uint16_t version;
322 } __packed;
323
324 #ifdef __TIZEN_PATCH__
325 #define MGMT_OP_SET_ADVERTISING         0x0029
326
327 #define MGMT_OP_SET_BREDR               0x002A
328
329 #define MGMT_OP_SET_STATIC_ADDRESS      0x002B
330 struct mgmt_cp_set_static_address {
331         bdaddr_t bdaddr;
332 } __packed;
333
334 #define MGMT_OP_SET_SCAN_PARAMS         0x002C
335 struct mgmt_cp_set_scan_params {
336         uint16_t interval;
337         uint16_t window;
338 } __packed;
339
340 #define MGMT_OP_SET_ADVERTISING_PARAMS          0x002D
341 struct mgmt_cp_set_advertising_params {
342         uint16_t interval_min;
343         uint16_t interval_max;
344         uint8_t filter_policy;
345 } __packed;
346
347 #define MGMT_OP_SET_ADVERTISING_DATA            0x002E
348 struct mgmt_cp_set_advertising_data {
349         uint8_t data[MGMT_MAX_ADVERTISING_LENGTH - 3];  /* Except flag */
350 } __packed;
351
352 #define MGMT_OP_SET_SCAN_RSP_DATA       0x002F
353 struct mgmt_cp_set_scan_rsp_data {
354         uint8_t data[MGMT_MAX_ADVERTISING_LENGTH];
355 } __packed;
356
357 #define MGMT_OP_ADD_DEV_WHITE_LIST      0x0030
358 struct mgmt_cp_add_dev_white_list {
359         uint8_t bdaddr_type;
360         bdaddr_t bdaddr;
361 } __packed;
362
363 #define MGMT_OP_REMOVE_DEV_WHITE_LIST   0x0031
364 struct mgmt_cp_remove_dev_white_list {
365         uint8_t bdaddr_type;
366         bdaddr_t bdaddr;
367 } __packed;
368
369 #define MGMT_OP_CLEAR_DEV_WHITE_LIST    0x0032
370
371 struct mgmt_irk_info {
372         struct mgmt_addr_info addr;
373         uint8_t master;
374         uint8_t val[16];
375 } __packed;
376
377 #define MGMT_OP_RESOLVE_RPA             0x0033
378 #define MGMT_RESOLVE_RPA_SIZE           6
379 struct mgmt_cp_resolve_rpa {
380         bdaddr_t bdaddr;
381 } __packed;
382
383 #define MGMT_OP_LOAD_REMOTE_IRKS                0x0034
384 struct mgmt_cp_load_remote_irks {
385         uint16_t        key_count;
386         struct mgmt_irk_info keys[0];
387 } __packed;
388 #define MGMT_LOAD_REMOTE_IRKS_SIZE      2
389
390 #endif
391
392 #define MGMT_EV_CMD_COMPLETE            0x0001
393 struct mgmt_ev_cmd_complete {
394         uint16_t opcode;
395         uint8_t status;
396         uint8_t data[0];
397 } __packed;
398
399 #define MGMT_EV_CMD_STATUS              0x0002
400 struct mgmt_ev_cmd_status {
401         uint16_t opcode;
402         uint8_t status;
403 } __packed;
404
405 #define MGMT_EV_CONTROLLER_ERROR        0x0003
406 struct mgmt_ev_controller_error {
407         uint8_t error_code;
408 } __packed;
409
410 #define MGMT_EV_INDEX_ADDED             0x0004
411
412 #define MGMT_EV_INDEX_REMOVED           0x0005
413
414 #define MGMT_EV_NEW_SETTINGS            0x0006
415
416 #define MGMT_EV_CLASS_OF_DEV_CHANGED    0x0007
417 struct mgmt_ev_class_of_dev_changed {
418         uint8_t class_of_dev[3];
419 } __packed;
420
421 #define MGMT_EV_LOCAL_NAME_CHANGED      0x0008
422 struct mgmt_ev_local_name_changed {
423         uint8_t name[MGMT_MAX_NAME_LENGTH];
424         uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
425 } __packed;
426
427 #define MGMT_EV_NEW_LINK_KEY            0x0009
428 struct mgmt_ev_new_link_key {
429         uint8_t store_hint;
430         struct mgmt_link_key_info key;
431 } __packed;
432
433 #define MGMT_EV_NEW_LONG_TERM_KEY       0x000A
434 struct mgmt_ev_new_long_term_key {
435         uint8_t store_hint;
436         struct mgmt_ltk_info key;
437 } __packed;
438
439 #define MGMT_EV_DEVICE_CONNECTED        0x000B
440 struct mgmt_ev_device_connected {
441         struct mgmt_addr_info addr;
442         uint32_t flags;
443         uint16_t eir_len;
444         uint8_t eir[0];
445 } __packed;
446
447 #define MGMT_DEV_DISCONN_UNKNOWN        0x00
448 #define MGMT_DEV_DISCONN_TIMEOUT        0x01
449 #define MGMT_DEV_DISCONN_LOCAL_HOST     0x02
450 #define MGMT_DEV_DISCONN_REMOTE         0x03
451
452 #define MGMT_EV_DEVICE_DISCONNECTED     0x000C
453 struct mgmt_ev_device_disconnected {
454         struct mgmt_addr_info addr;
455         uint8_t reason;
456 } __packed;
457
458 #define MGMT_EV_CONNECT_FAILED          0x000D
459 struct mgmt_ev_connect_failed {
460         struct mgmt_addr_info addr;
461         uint8_t status;
462 } __packed;
463
464 #define MGMT_EV_PIN_CODE_REQUEST        0x000E
465 struct mgmt_ev_pin_code_request {
466         struct mgmt_addr_info addr;
467         uint8_t secure;
468 } __packed;
469
470 #define MGMT_EV_USER_CONFIRM_REQUEST    0x000F
471 struct mgmt_ev_user_confirm_request {
472         struct mgmt_addr_info addr;
473         uint8_t confirm_hint;
474         uint32_t value;
475 } __packed;
476
477 #define MGMT_EV_USER_PASSKEY_REQUEST    0x0010
478 struct mgmt_ev_user_passkey_request {
479         struct mgmt_addr_info addr;
480 } __packed;
481
482 #define MGMT_EV_AUTH_FAILED             0x0011
483 struct mgmt_ev_auth_failed {
484         struct mgmt_addr_info addr;
485         uint8_t status;
486 } __packed;
487
488 #define MGMT_DEV_FOUND_CONFIRM_NAME     0x01
489 #define MGMT_DEV_FOUND_LEGACY_PAIRING   0x02
490
491 #define MGMT_EV_DEVICE_FOUND            0x0012
492 struct mgmt_ev_device_found {
493         struct mgmt_addr_info addr;
494         int8_t rssi;
495         uint32_t flags;
496         uint16_t eir_len;
497         uint8_t eir[0];
498 } __packed;
499
500 #define MGMT_EV_DISCOVERING             0x0013
501 struct mgmt_ev_discovering {
502         uint8_t type;
503         uint8_t discovering;
504 } __packed;
505
506 #define MGMT_EV_DEVICE_BLOCKED          0x0014
507 struct mgmt_ev_device_blocked {
508         struct mgmt_addr_info addr;
509 } __packed;
510
511 #define MGMT_EV_DEVICE_UNBLOCKED        0x0015
512 struct mgmt_ev_device_unblocked {
513         struct mgmt_addr_info addr;
514 } __packed;
515
516 #define MGMT_EV_DEVICE_UNPAIRED         0x0016
517 struct mgmt_ev_device_unpaired {
518         struct mgmt_addr_info addr;
519 } __packed;
520
521 #define MGMT_EV_PASSKEY_NOTIFY         0x0017
522 struct mgmt_ev_passkey_notify {
523         struct mgmt_addr_info addr;
524         uint32_t passkey;
525         uint8_t entered;
526 } __packed;
527
528 #ifdef __TIZEN_PATCH__
529 #define MGMT_EV_DEVICE_NAME_UPDATE              0x0018
530 struct mgmt_ev_device_name_update {
531         struct mgmt_addr_info addr;
532         uint16_t eir_len;
533         uint8_t eir[0];
534 } __packed;
535
536 #define MGMT_EV_NEW_REMOTE_IRK          0x0019
537 struct mgmt_ev_new_remote_irk {
538         uint8_t store_hint;
539         struct mgmt_irk_info key;
540 } __packed;
541
542 #define MGMT_EV_NEW_RPA         0x0020
543 struct mgmt_ev_new_rpa {
544         struct mgmt_addr_info rp_addr;
545 } __packed;
546
547 #define MGMT_EV_HARDWARE_ERROR 0x0022
548 struct mgmt_ev_hardware_error{
549         uint8_t error_code;
550 } __packed;
551
552 #define MGMT_TX_TIMEOUT_ERROR 0x0023
553 #endif
554
555 static const char *mgmt_op[] = {
556         "<0x0000>",
557         "Read Version",
558         "Read Commands",
559         "Read Index List",
560         "Read Controller Info",
561         "Set Powered",
562         "Set Discoverable",
563         "Set Connectable",
564         "Set Fast Connectable",         /* 0x0008 */
565         "Set Pairable",
566         "Set Link Security",
567         "Set Secure Simple Pairing",
568         "Set High Speed",
569         "Set Low Energy",
570         "Set Dev Class",
571         "Set Local Name",
572         "Add UUID",                     /* 0x0010 */
573         "Remove UUID",
574         "Load Link Keys",
575         "Load Long Term Keys",
576         "Disconnect",
577         "Get Connections",
578         "PIN Code Reply",
579         "PIN Code Neg Reply",
580         "Set IO Capability",            /* 0x0018 */
581         "Pair Device",
582         "Cancel Pair Device",
583         "Unpair Device",
584         "User Confirm Reply",
585         "User Confirm Neg Reply",
586         "User Passkey Reply",
587         "User Passkey Neg Reply",
588         "Read Local OOB Data",          /* 0x0020 */
589         "Add Remote OOB Data",
590         "Remove Remove OOB Data",
591         "Start Discovery",
592         "Stop Discovery",
593         "Confirm Name",
594         "Block Device",
595         "Unblock Device",
596         "Set Device ID",
597 #ifdef __TIZEN_PATCH__
598         "Set Advertising",
599         "Set BR/EDR",
600         "Set Static Address",
601         "Set Scan Parameters",
602         "Set Advertising Parameters",
603         "Set Advertising Data",
604         "Set Scan Response Data",
605         "Add Device White List",        /* 0x0030 */
606         "Remove Device White List",
607         "Clear Device White List",
608         "Resolve Random Public Address",
609         "Load Remote Irks",
610 #endif
611 };
612
613 static const char *mgmt_ev[] = {
614         "<0x0000>",
615         "Command Complete",
616         "Command Status",
617         "Controller Error",
618         "Index Added",
619         "Index Removed",
620         "New Settings",
621         "Class of Device Changed",
622         "Local Name Changed",           /* 0x0008 */
623         "New Link Key",
624         "New Long Term Key",
625         "Device Connected",
626         "Device Disconnected",
627         "Connect Failed",
628         "PIN Code Request",
629         "User Confirm Request",
630         "User Passkey Request",         /* 0x0010 */
631         "Authentication Failed",
632         "Device Found",
633         "Discovering",
634         "Device Blocked",
635         "Device Unblocked",
636         "Device Unpaired",
637         "Passkey Notify",
638 #ifdef __TIZEN_PATCH__
639         "Device Name Update",
640         "New Remote IRK",       /* 0x0019 */
641         "New RPA",              /* 0x0020 */
642         "New Remote Identity Address",
643         "Hardware Error",
644         "Tx TimeOut Error",
645 #endif
646 };
647
648 static const char *mgmt_status[] = {
649         "Success",
650         "Unknown Command",
651         "Not Connected",
652         "Failed",
653         "Connect Failed",
654         "Authentication Failed",
655         "Not Paired",
656         "No Resources",
657         "Timeout",
658         "Already Connected",
659         "Busy",
660         "Rejected",
661         "Not Supported",
662         "Invalid Parameters",
663         "Disconnected",
664         "Not Powered",
665         "Cancelled",
666         "Invalid Index",
667 #ifdef __TIZEN_PATCH__
668         "New Identity Resolving Key",
669         "New Random Public Address",
670 #endif /* __TIZEN_PATCH__ */
671 };
672
673 #ifndef NELEM
674 #define NELEM(x) (sizeof(x) / sizeof((x)[0]))
675 #endif
676
677 static inline const char *mgmt_opstr(uint16_t op)
678 {
679         if (op >= NELEM(mgmt_op))
680                 return "<unknown opcode>";
681         return mgmt_op[op];
682 }
683
684 static inline const char *mgmt_evstr(uint16_t ev)
685 {
686         if (ev >= NELEM(mgmt_ev))
687                 return "<unknown event>";
688         return mgmt_ev[ev];
689 }
690
691 static inline const char *mgmt_errstr(uint8_t status)
692 {
693         if (status >= NELEM(mgmt_status))
694                 return "<unknown status>";
695         return mgmt_status[status];
696 }