3
* BlueZ - Bluetooth protocol stack for Linux
5
* Copyright (C) 2014 Google Inc.
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
13
* This library 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 GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
#include "src/shared/att-types.h"
31
struct bt_att *bt_att_new(int fd, bool ext_signed);
33
struct bt_att *bt_att_ref(struct bt_att *att);
34
void bt_att_unref(struct bt_att *att);
36
bool bt_att_set_close_on_unref(struct bt_att *att, bool do_close);
38
int bt_att_get_fd(struct bt_att *att);
40
typedef void (*bt_att_response_func_t)(uint8_t opcode, const void *pdu,
41
uint16_t length, void *user_data);
42
typedef void (*bt_att_notify_func_t)(uint8_t opcode, const void *pdu,
43
uint16_t length, void *user_data);
44
typedef void (*bt_att_destroy_func_t)(void *user_data);
45
typedef void (*bt_att_debug_func_t)(const char *str, void *user_data);
46
typedef void (*bt_att_timeout_func_t)(unsigned int id, uint8_t opcode,
48
typedef void (*bt_att_disconnect_func_t)(int err, void *user_data);
49
typedef bool (*bt_att_counter_func_t)(uint32_t *sign_cnt, void *user_data);
51
bool bt_att_set_debug(struct bt_att *att, bt_att_debug_func_t callback,
52
void *user_data, bt_att_destroy_func_t destroy);
54
uint16_t bt_att_get_mtu(struct bt_att *att);
55
bool bt_att_set_mtu(struct bt_att *att, uint16_t mtu);
57
bool bt_att_set_timeout_cb(struct bt_att *att, bt_att_timeout_func_t callback,
59
bt_att_destroy_func_t destroy);
61
unsigned int bt_att_send(struct bt_att *att, uint8_t opcode,
62
const void *pdu, uint16_t length,
63
bt_att_response_func_t callback,
65
bt_att_destroy_func_t destroy);
66
bool bt_att_cancel(struct bt_att *att, unsigned int id);
67
bool bt_att_cancel_all(struct bt_att *att);
69
unsigned int bt_att_send_error_rsp(struct bt_att *att, uint8_t opcode,
70
uint16_t handle, int error);
72
unsigned int bt_att_register(struct bt_att *att, uint8_t opcode,
73
bt_att_notify_func_t callback,
75
bt_att_destroy_func_t destroy);
76
bool bt_att_unregister(struct bt_att *att, unsigned int id);
78
unsigned int bt_att_register_disconnect(struct bt_att *att,
79
bt_att_disconnect_func_t callback,
81
bt_att_destroy_func_t destroy);
82
bool bt_att_unregister_disconnect(struct bt_att *att, unsigned int id);
84
bool bt_att_unregister_all(struct bt_att *att);
86
int bt_att_get_security(struct bt_att *att);
87
bool bt_att_set_security(struct bt_att *att, int level);
89
bool bt_att_set_local_key(struct bt_att *att, uint8_t sign_key[16],
90
bt_att_counter_func_t func, void *user_data);
91
bool bt_att_set_remote_key(struct bt_att *att, uint8_t sign_key[16],
92
bt_att_counter_func_t func, void *user_data);
93
bool bt_att_has_crypto(struct bt_att *att);