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