1 /* $OpenBSD: sco.h,v 1.2 2007/06/01 02:46:12 uwe Exp $ */
2 /* $NetBSD: sco.h,v 1.2 2006/07/26 10:20:56 tron Exp $ */
3
4 /*-
5 * Copyright (c) 2006 Itronix Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of Itronix Inc. may not be used to endorse
17 * or promote products derived from this software without specific
18 * prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef _NETBT_SCO_H_
34 #define _NETBT_SCO_H_
35
36 #define SO_SCO_MTU 1
37 #define SO_SCO_HANDLE 2
38
39 #ifdef _KERNEL
40 /*
41 * SCO protocol control block
42 */
43 struct sco_pcb {
44 struct hci_link *sp_link; /* SCO link */
45 unsigned int sp_flags; /* flags */
46 bdaddr_t sp_laddr; /* local address */
47 bdaddr_t sp_raddr; /* remote address */
48 unsigned int sp_mtu; /* link MTU */
49 int sp_pending; /* number of packets pending */
50
51 const struct btproto *sp_proto; /* upper layer protocol */
52 void *sp_upper; /* upper layer argument */
53
54 LIST_ENTRY(sco_pcb) sp_next;
55 };
56
57 LIST_HEAD(sco_pcb_list, sco_pcb);
58 extern struct sco_pcb_list sco_pcb;
59
60 /* sp_flags */
61 #define SP_LISTENING (1<<0) /* is listening pcb */
62
63 /* sco_socket.c */
64 struct socket;
65 extern int sco_sendspace;
66 extern int sco_recvspace;
67 int sco_usrreq(struct socket *, int, struct mbuf *,
68 struct mbuf *, struct mbuf *);
69 int sco_ctloutput(int, struct socket *, int, int, struct mbuf **);
70
71 /* sco_upper.c */
72 int sco_attach(struct sco_pcb **, const struct btproto *, void *);
73 int sco_bind(struct sco_pcb *, struct sockaddr_bt *);
74 int sco_sockaddr(struct sco_pcb *, struct sockaddr_bt *);
75 int sco_connect(struct sco_pcb *, struct sockaddr_bt *);
76 int sco_peeraddr(struct sco_pcb *, struct sockaddr_bt *);
77 int sco_disconnect(struct sco_pcb *, int);
78 int sco_detach(struct sco_pcb **);
79 int sco_listen(struct sco_pcb *);
80 int sco_send(struct sco_pcb *, struct mbuf *);
81 int sco_setopt(struct sco_pcb *, int, void *);
82 int sco_getopt(struct sco_pcb *, int, void *);
83
84 #endif /* _KERNEL */
85
86 #endif /* _NETBT_SCO_H_ */