xref: /dflybsd-src/sys/netgraph7/bluetooth/include/ng_btsocket_hci_raw.h (revision e85b99abf6da4a83a7dc495b0ef37ce19864149f)
1b06ebda0SMatthew Dillon /*
2b06ebda0SMatthew Dillon  * ng_btsocket_hci_raw.h
3b06ebda0SMatthew Dillon  */
4b06ebda0SMatthew Dillon 
5b06ebda0SMatthew Dillon /*-
6b06ebda0SMatthew Dillon  * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7b06ebda0SMatthew Dillon  * All rights reserved.
8b06ebda0SMatthew Dillon  *
9b06ebda0SMatthew Dillon  * Redistribution and use in source and binary forms, with or without
10b06ebda0SMatthew Dillon  * modification, are permitted provided that the following conditions
11b06ebda0SMatthew Dillon  * are met:
12b06ebda0SMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
13b06ebda0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
14b06ebda0SMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
15b06ebda0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer in the
16b06ebda0SMatthew Dillon  *    documentation and/or other materials provided with the distribution.
17b06ebda0SMatthew Dillon  *
18b06ebda0SMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19b06ebda0SMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20b06ebda0SMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21b06ebda0SMatthew Dillon  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22b06ebda0SMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23b06ebda0SMatthew Dillon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24b06ebda0SMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25b06ebda0SMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26b06ebda0SMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27b06ebda0SMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28b06ebda0SMatthew Dillon  * SUCH DAMAGE.
29b06ebda0SMatthew Dillon  *
30b06ebda0SMatthew Dillon  * $Id: ng_btsocket_hci_raw.h,v 1.3 2003/03/25 23:53:32 max Exp $
31b06ebda0SMatthew Dillon  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h,v 1.7 2006/07/21 17:11:13 rwatson Exp $
32b06ebda0SMatthew Dillon  */
33b06ebda0SMatthew Dillon 
34b06ebda0SMatthew Dillon #ifndef _NETGRAPH_BTSOCKET_HCI_RAW_H_
35b06ebda0SMatthew Dillon #define _NETGRAPH_BTSOCKET_HCI_RAW_H_
36b06ebda0SMatthew Dillon 
37b06ebda0SMatthew Dillon #define NG_BTSOCKET_HCI_RAW_SENDSPACE	(4 * 1024)
38b06ebda0SMatthew Dillon #define NG_BTSOCKET_HCI_RAW_RECVSPACE	(4 * 1024)
39b06ebda0SMatthew Dillon 
40b06ebda0SMatthew Dillon /*
41b06ebda0SMatthew Dillon  * Bluetooth raw HCI socket PCB
42b06ebda0SMatthew Dillon  */
43b06ebda0SMatthew Dillon 
44b06ebda0SMatthew Dillon struct ng_btsocket_hci_raw_pcb {
45b06ebda0SMatthew Dillon 	struct socket				*so;     /* socket */
46b06ebda0SMatthew Dillon 	u_int32_t				 flags;  /* flags */
47b06ebda0SMatthew Dillon #define NG_BTSOCKET_HCI_RAW_DIRECTION	(1 << 0)
48b06ebda0SMatthew Dillon #define NG_BTSOCKET_HCI_RAW_PRIVILEGED	(1 << 1)
49b06ebda0SMatthew Dillon 	struct sockaddr_hci			 addr;   /* local address */
50b06ebda0SMatthew Dillon 	struct ng_btsocket_hci_raw_filter	 filter; /* filter */
51b06ebda0SMatthew Dillon 	u_int32_t				 token;  /* message token */
52b06ebda0SMatthew Dillon 	struct ng_mesg				*msg;    /* message */
53b06ebda0SMatthew Dillon 	LIST_ENTRY(ng_btsocket_hci_raw_pcb)	 next;   /* link to next */
54*e85b99abSSascha Wildner 	struct lock				 pcb_lock; /* pcb lock */
55b06ebda0SMatthew Dillon };
56b06ebda0SMatthew Dillon typedef struct ng_btsocket_hci_raw_pcb		ng_btsocket_hci_raw_pcb_t;
57b06ebda0SMatthew Dillon typedef struct ng_btsocket_hci_raw_pcb *	ng_btsocket_hci_raw_pcb_p;
58b06ebda0SMatthew Dillon 
59b06ebda0SMatthew Dillon #define	so2hci_raw_pcb(so) \
60b06ebda0SMatthew Dillon 	((struct ng_btsocket_hci_raw_pcb *)((so)->so_pcb))
61b06ebda0SMatthew Dillon 
62b06ebda0SMatthew Dillon /*
63b06ebda0SMatthew Dillon  * Bluetooth raw HCI socket methods
64b06ebda0SMatthew Dillon  */
65b06ebda0SMatthew Dillon 
66b06ebda0SMatthew Dillon #ifdef _KERNEL
67b06ebda0SMatthew Dillon 
68b06ebda0SMatthew Dillon void ng_btsocket_hci_raw_init       (void);
69*e85b99abSSascha Wildner void ng_btsocket_hci_raw_abort      (netmsg_t msg);
70*e85b99abSSascha Wildner #if 0 /* XXX */
71b06ebda0SMatthew Dillon void ng_btsocket_hci_raw_close      (struct socket *);
72*e85b99abSSascha Wildner #endif
73*e85b99abSSascha Wildner void ng_btsocket_hci_raw_attach     (netmsg_t msg);
74*e85b99abSSascha Wildner void ng_btsocket_hci_raw_bind       (netmsg_t msg);
75*e85b99abSSascha Wildner void ng_btsocket_hci_raw_connect    (netmsg_t msg);
76*e85b99abSSascha Wildner void ng_btsocket_hci_raw_control    (netmsg_t msg);
77*e85b99abSSascha Wildner void ng_btsocket_hci_raw_ctloutput  (netmsg_t msg);
78*e85b99abSSascha Wildner void ng_btsocket_hci_raw_detach     (netmsg_t msg);
79*e85b99abSSascha Wildner void ng_btsocket_hci_raw_disconnect (netmsg_t msg);
80*e85b99abSSascha Wildner void ng_btsocket_hci_raw_peeraddr   (netmsg_t msg);
81*e85b99abSSascha Wildner void ng_btsocket_hci_raw_send       (netmsg_t msg);
82*e85b99abSSascha Wildner void ng_btsocket_hci_raw_sockaddr   (netmsg_t msg);
83b06ebda0SMatthew Dillon 
84b06ebda0SMatthew Dillon #endif /* _KERNEL */
85b06ebda0SMatthew Dillon 
86b06ebda0SMatthew Dillon #endif /* ndef _NETGRAPH_BTSOCKET_HCI_RAW_H_ */
87b06ebda0SMatthew Dillon 
88