Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / monitor / packet.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2011-2014  Intel Corporation
6  *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
7  *
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public
11  *  License as published by the Free Software Foundation; either
12  *  version 2.1 of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 #include <stdint.h>
26 #include <stdbool.h>
27 #include <sys/time.h>
28 #include <sys/socket.h>
29
30 #define PACKET_FILTER_SHOW_INDEX        (1 << 0)
31 #define PACKET_FILTER_SHOW_DATE         (1 << 1)
32 #define PACKET_FILTER_SHOW_TIME         (1 << 2)
33 #define PACKET_FILTER_SHOW_TIME_OFFSET  (1 << 3)
34 #define PACKET_FILTER_SHOW_ACL_DATA     (1 << 4)
35 #define PACKET_FILTER_SHOW_SCO_DATA     (1 << 5)
36
37 void packet_set_filter(unsigned long filter);
38 void packet_add_filter(unsigned long filter);
39 void packet_del_filter(unsigned long filter);
40
41 void packet_set_priority(const char *priority);
42 void packet_select_index(uint16_t index);
43
44 void packet_hexdump(const unsigned char *buf, uint16_t len);
45 void packet_print_error(const char *label, uint8_t error);
46 void packet_print_version(const char *label, uint8_t version,
47                                 const char *sublabel, uint16_t subversion);
48 void packet_print_company(const char *label, uint16_t company);
49 void packet_print_addr(const char *label, const void *data, bool random);
50 void packet_print_ad(const void *data, uint8_t size);
51 void packet_print_features_lmp(const uint8_t *features, uint8_t page);
52 void packet_print_features_ll(const uint8_t *features);
53 void packet_print_channel_map_lmp(const uint8_t *map);
54 void packet_print_channel_map_ll(const uint8_t *map);
55 void packet_print_io_capability(uint8_t capability);
56 void packet_print_io_authentication(uint8_t authentication);
57
58 void packet_control(struct timeval *tv, struct ucred *cred,
59                                         uint16_t index, uint16_t opcode,
60                                         const void *data, uint16_t size);
61 void packet_monitor(struct timeval *tv, struct ucred *cred,
62                                         uint16_t index, uint16_t opcode,
63                                         const void *data, uint16_t size);
64 void packet_simulator(struct timeval *tv, uint16_t frequency,
65                                         const void *data, uint16_t size);
66
67 void packet_new_index(struct timeval *tv, uint16_t index, const char *label,
68                                 uint8_t type, uint8_t bus, const char *name);
69 void packet_del_index(struct timeval *tv, uint16_t index, const char *label);
70 void packet_open_index(struct timeval *tv, uint16_t index, const char *label);
71 void packet_close_index(struct timeval *tv, uint16_t index, const char *label);
72 void packet_index_info(struct timeval *tv, uint16_t index, const char *label,
73                                                         uint16_t manufacturer);
74 void packet_vendor_diag(struct timeval *tv, uint16_t index,
75                                         uint16_t manufacturer,
76                                         const void *data, uint16_t size);
77 void packet_system_note(struct timeval *tv, struct ucred *cred,
78                                         uint16_t index, const void *message);
79 void packet_user_logging(struct timeval *tv, struct ucred *cred,
80                                         uint16_t index, uint8_t priority,
81                                         const char *ident, const char *message);
82
83 void packet_hci_command(struct timeval *tv, struct ucred *cred, uint16_t index,
84                                         const void *data, uint16_t size);
85 void packet_hci_event(struct timeval *tv, struct ucred *cred, uint16_t index,
86                                         const void *data, uint16_t size);
87 void packet_hci_acldata(struct timeval *tv, struct ucred *cred, uint16_t index,
88                                 bool in, const void *data, uint16_t size);
89 void packet_hci_scodata(struct timeval *tv, struct ucred *cred, uint16_t index,
90                                 bool in, const void *data, uint16_t size);
91
92 void packet_todo(void);