1/*
2 * Copyright 2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
5#ifndef _CONNECTION_INTERFACE_H
6#define _CONNECTION_INTERFACE_H
7
8#include <net_buffer.h>
9
10#include <bluetooth/bluetooth.h>
11#include <bluetooth/HCI/btHCI.h>
12
13#include <btCoreData.h>
14
15extern mutex sConnectionListLock;
16extern DoublyLinkedList<HciConnection> sConnectionList;
17
18HciConnection* ConnectionByHandle(uint16 handle, hci_id hid);
19HciConnection* ConnectionByDestination(const bdaddr_t& destination,
20	hci_id hid);
21
22
23HciConnection* AddConnection(uint16 handle, int type, const bdaddr_t& dst,
24	hci_id hid);
25status_t RemoveConnection(const bdaddr_t& destination, hci_id hid);
26status_t RemoveConnection(uint16 handle, hci_id hid);
27
28hci_id RouteConnection(const bdaddr_t& destination);
29
30uint8 allocate_command_ident(HciConnection* conn, void* pointer);
31void* lookup_command_ident(HciConnection* conn, uint8 ident);
32void free_command_ident(HciConnection* conn, uint8 ident);
33
34#endif // _CONNECTION_INTERFACE_H
35