The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netbt/bt_proto.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: bt_proto.c,v 1.10 2008/04/24 11:38:37 ad Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 2005 Iain Hibbert.
    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 #include <sys/cdefs.h>
   34 __KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.10 2008/04/24 11:38:37 ad Exp $");
   35 
   36 #include <sys/param.h>
   37 #include <sys/domain.h>
   38 #include <sys/kernel.h>
   39 #include <sys/protosw.h>
   40 #include <sys/socket.h>
   41 #include <sys/systm.h>
   42 
   43 #include <net/route.h>
   44 
   45 #include <netbt/bluetooth.h>
   46 #include <netbt/hci.h>
   47 #include <netbt/l2cap.h>
   48 #include <netbt/rfcomm.h>
   49 #include <netbt/sco.h>
   50 
   51 DOMAIN_DEFINE(btdomain);        /* forward declare and add to link set */
   52 
   53 static void     bt_init(void);
   54 
   55 PR_WRAP_CTLOUTPUT(hci_ctloutput)
   56 PR_WRAP_CTLOUTPUT(sco_ctloutput)
   57 PR_WRAP_CTLOUTPUT(l2cap_ctloutput)
   58 PR_WRAP_CTLOUTPUT(rfcomm_ctloutput)
   59 
   60 #define hci_ctloutput           hci_ctloutput_wrapper
   61 #define sco_ctloutput           sco_ctloutput_wrapper
   62 #define l2cap_ctloutput         l2cap_ctloutput_wrapper
   63 #define rfcomm_ctloutput        rfcomm_ctloutput_wrapper
   64 
   65 PR_WRAP_USRREQ(hci_usrreq)
   66 PR_WRAP_USRREQ(sco_usrreq)
   67 PR_WRAP_USRREQ(l2cap_usrreq)
   68 PR_WRAP_USRREQ(rfcomm_usrreq)
   69 
   70 #define hci_usrreq              hci_usrreq_wrapper
   71 #define sco_usrreq              sco_usrreq_wrapper
   72 #define l2cap_usrreq            l2cap_usrreq_wrapper
   73 #define rfcomm_usrreq           rfcomm_usrreq_wrapper
   74 
   75 const struct protosw btsw[] = {
   76         { /* raw HCI commands */
   77                 .pr_type = SOCK_RAW,
   78                 .pr_domain = &btdomain,
   79                 .pr_protocol = BTPROTO_HCI,
   80                 .pr_flags = (PR_ADDR | PR_ATOMIC),
   81                 .pr_ctloutput = hci_ctloutput,
   82                 .pr_usrreq = hci_usrreq,
   83         },
   84         { /* HCI SCO data (audio) */
   85                 .pr_type = SOCK_SEQPACKET,
   86                 .pr_domain = &btdomain,
   87                 .pr_protocol = BTPROTO_SCO,
   88                 .pr_flags = (PR_CONNREQUIRED | PR_ATOMIC | PR_LISTEN),
   89                 .pr_ctloutput = sco_ctloutput,
   90                 .pr_usrreq = sco_usrreq,
   91         },
   92         { /* L2CAP Connection Oriented */
   93                 .pr_type = SOCK_SEQPACKET,
   94                 .pr_domain = &btdomain,
   95                 .pr_protocol = BTPROTO_L2CAP,
   96                 .pr_flags = (PR_CONNREQUIRED | PR_ATOMIC | PR_LISTEN),
   97                 .pr_ctloutput = l2cap_ctloutput,
   98                 .pr_usrreq = l2cap_usrreq,
   99         },
  100         { /* RFCOMM */
  101                 .pr_type = SOCK_STREAM,
  102                 .pr_domain = &btdomain,
  103                 .pr_protocol = BTPROTO_RFCOMM,
  104                 .pr_flags = (PR_CONNREQUIRED | PR_LISTEN | PR_WANTRCVD),
  105                 .pr_ctloutput = rfcomm_ctloutput,
  106                 .pr_usrreq = rfcomm_usrreq,
  107         },
  108 };
  109 
  110 struct domain btdomain = {
  111         .dom_family = AF_BLUETOOTH,
  112         .dom_name = "bluetooth",
  113         .dom_init = bt_init,
  114         .dom_protosw = btsw,
  115         .dom_protoswNPROTOSW = &btsw[__arraycount(btsw)],
  116 };
  117 
  118 kmutex_t *bt_lock;
  119 
  120 static void
  121 bt_init(void)
  122 {
  123 
  124         bt_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
  125 }

Cache object: 27e72000d17b2aed54303a1c0cd354d8


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.