1 /* $OpenBSD: bt_proto.c,v 1.4 2007/06/24 20:55:27 uwe Exp $ */
2 /*
3 * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 #include <sys/param.h>
19 #include <sys/domain.h>
20 #include <sys/protosw.h>
21 #include <sys/socket.h>
22 #include <sys/timeout.h>
23
24 #include <netbt/bluetooth.h>
25 #include <netbt/bt_var.h>
26 #include <netbt/hci.h>
27 #include <netbt/l2cap.h>
28 #include <netbt/rfcomm.h>
29 #include <netbt/sco.h>
30
31 struct domain btdomain;
32
33 struct protosw btsw[] = {
34 { SOCK_RAW, &btdomain, BTPROTO_HCI,
35 PR_ATOMIC | PR_ADDR,
36 NULL/*input*/, NULL/*output*/, NULL/*ctlinput*/,
37 hci_ctloutput, hci_usrreq, NULL/*init*/,
38 NULL/*fasttimo*/, NULL/*slowtimo*/, NULL/*drain*/,
39 NULL/*sysctl*/
40 },
41 { SOCK_SEQPACKET, &btdomain, BTPROTO_SCO,
42 PR_ATOMIC | PR_CONNREQUIRED,
43 NULL/*input*/, NULL/*output*/, NULL/*ctlinput*/,
44 sco_ctloutput, sco_usrreq, NULL/*init*/,
45 NULL/*fasttimo*/, NULL/*slowtimo*/, NULL/*drain*/,
46 NULL/*sysctl*/
47 },
48 { SOCK_SEQPACKET, &btdomain, BTPROTO_L2CAP,
49 PR_ATOMIC | PR_CONNREQUIRED,
50 NULL/*input*/, NULL/*output*/, NULL/*ctlinput*/,
51 l2cap_ctloutput, l2cap_usrreq, l2cap_init,
52 NULL/*fasttimo*/, NULL/*slowtimo*/, NULL/*drain*/,
53 NULL/*sysctl*/
54 },
55 { SOCK_STREAM, &btdomain, BTPROTO_RFCOMM,
56 PR_CONNREQUIRED | PR_WANTRCVD,
57 NULL/*input*/, NULL/*output*/, NULL/*ctlinput*/,
58 rfcomm_ctloutput, rfcomm_usrreq, rfcomm_init,
59 NULL/*fasttimo*/, NULL/*slowtimo*/, NULL/*drain*/,
60 NULL/*sysctl*/
61 }
62 };
63
64 struct domain btdomain = {
65 AF_BLUETOOTH, "bluetooth",
66 NULL/*init*/, NULL/*externalize*/, NULL/*dispose*/,
67 btsw, &btsw[sizeof(btsw) / sizeof(btsw[0])], NULL,
68 NULL/*rtattach*/, 32, sizeof(struct sockaddr_bt),
69 NULL/*ifattach*/, NULL/*ifdetach*/
70 };