diff options
author | julian <julian@FreeBSD.org> | 2002-11-20 23:01:59 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-11-20 23:01:59 +0000 |
commit | d72cb748a8219735d80767b8847995b1ff103f9a (patch) | |
tree | c38e3c48c390af16003a1f451848e93558978422 /share | |
parent | 97980d0d57dd5c2944c5f3306726610a3a1b6e51 (diff) | |
download | FreeBSD-src-d72cb748a8219735d80767b8847995b1ff103f9a.zip FreeBSD-src-d72cb748a8219735d80767b8847995b1ff103f9a.tar.gz |
The second try a committing the bluetooth code
Has been seen to work on several cards and communicating with
several mobile phones to use them as modems etc.
We are still talking with 3com to try get them to allow us to include
the firmware for their pccard in the driver but the driver is here..
In the mean time
it can be downloaded from the 3com website and loaded using the utility
bt3cfw(8) (supplied) (instructions in the man page)
Not yet linked to the build
Submitted by: Maksim Yevmenkin <myevmenk@exodus.net>
Approved by: re
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man4/ng_bluetooth.4 | 109 | ||||
-rw-r--r-- | share/man/man4/ng_bt3c.4 | 136 | ||||
-rw-r--r-- | share/man/man4/ng_btsocket.4 | 255 | ||||
-rw-r--r-- | share/man/man4/ng_h4.4 | 121 | ||||
-rw-r--r-- | share/man/man4/ng_hci.4 | 342 | ||||
-rw-r--r-- | share/man/man4/ng_l2cap.4 | 341 | ||||
-rw-r--r-- | share/man/man4/ng_ubt.4 | 102 |
7 files changed, 1406 insertions, 0 deletions
diff --git a/share/man/man4/ng_bluetooth.4 b/share/man/man4/ng_bluetooth.4 new file mode 100644 index 0000000..4022786 --- /dev/null +++ b/share/man/man4/ng_bluetooth.4 @@ -0,0 +1,109 @@ +.\" ng_bluetooth.4 +.\" +.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id: ng_bluetooth.4,v 1.2 2002/11/12 22:14:10 max Exp $ +.\" $FreeBSD$ +.Dd November 9, 2002 +.Dt NG_BLUETOOTH 4 +.Os +.Sh NAME +.Nm bluetooth +.Nd placeholder for global Bluetooth variables +.Sh SYNOPSIS +.In sys/types.h +.In ng_bluetooth.h +.Sh DESCRIPTION +The +.Nm +module is a placeholder for global Bluetooth variables. All Bluetooth +variables can be examined and changed via +.Xr sysctl 8 . +.Sh BLUETOOTH VARIABLES +Below is the description of default variables. Each Bluetooth module +might add its own variables to the tree. +.Bl -tag -width foobar +.It net.bluetooth.version +A read only integer variable that shows the current version of the +Bluetooth stack. +.It net.bluetooth.hci.command_timeout +A read-write interger variable that controls the Host Controller Interface +(HCI) command timeout (in seconds), i.e. how long the HCI layer will wait +for the +.Dv Command_Complete +or +.Dv Command_Status +event from a Bluetooth device. +.It net.bluetooth.hci.connection_timeout +A read-write integer variable that controls the HCI connection timeout, i.e. +how long the HCI layer will wait for the +.Dv Connection_Complete +event. Normaly this should not be required as Bluetooth devices have +connection timeout of their own and will send event back. This timeout +is required to ensure that no connection will stall in case when the HCI +transport layer is broken. Be careful when changing this variable. +Make sure you understand what you are doing. +.It net.bluetooth.hci.watchdog_timeout +A read-write integer variable that controls the HCI connection watchdog +timeout in seconds), i.e. how long the HCI layer should wait before +disconnecting an inactive baseband connection. +.Em This has not been implemented yet . +.It net.bluetooth.hci.max_neighbor_age +A read-write integer variable that controls time-to-live (in seconds) for +entries in the HCI neighbor cache. Every time a Bluetooth device performs +an +.Dv Inquiry +operation, the results will be put in cache. Later when a Bluetooth device +establishes a baseband connection, it will try to find the matching entry in +the cache and use it. This might speed up establishment of the baseband +connection. +.It net.bluetooth.l2cap.rtx_timeout +A read-write integer variable that controls the Link Layer Control and +Adaptation Protocol (L2CAP) Retransmission Timeout (RTX) (in seconds). +Every time the L2CAP layer submits a control command, the RTX timeout is set. +The value of the RTX timeout should be greater or equal to the value of +the HCI connection timeout. Be careful when changing this variable. Make +sure you understand what you are doing. +.It net.bluetooth.l2cap.ertx_timeout +A read-write integer variable that controls the L2CAP Extended Retransmission +Timeout (ERTX) (in seconds). In some cases remote peer may respond with +.Dv PENDING +status to the L2CAP control command. In this case the L2CAP command timeout +is reset to the ERTX timeout value. The value of the ERTX timeout should be +greater or equal to the value of the RTX timeout. Be careful when changing +this variable. Make sure you understand what you are doing. +.El +.Sh SEE ALSO +.Xr sysctl 8 , +.Xr ng_hci 4 , +.Xr ng_l2cap 4 , +.Xr ng_btsocket 4 +.Sh HISTORY +The +.Nm +module was implemented in +.Fx 5.0 . +.Sh AUTHORS +.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com diff --git a/share/man/man4/ng_bt3c.4 b/share/man/man4/ng_bt3c.4 new file mode 100644 index 0000000..f651ea9 --- /dev/null +++ b/share/man/man4/ng_bt3c.4 @@ -0,0 +1,136 @@ +.\" ng_bt3c.4 +.\" +.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id: ng_bt3c.4,v 1.3 2002/11/12 17:03:58 max Exp $ +.\" $FreeBSD$ +.Dd June 14, 2002 +.Dt NG_BT3C 4 +.Os +.Sh NAME +.Nm BTCCC +.Nd Netgraph node type that is also a 3Com Bluetooth PC card driver +.Sh SYNOPSIS +.In sys/types.h +.In ng_bt3c.h +.Sh DESCRIPTION +The +.Nm BTCCC +node type is both a persistent Netgraph node type and a driver for +3Com Bluetooth PC card (3CRWB6096-HP). It implements a Bluetooth HCI +UART transport layer as per chapter H4 of the Bluetooth Specification +Book v1.1. A new node is created when the card is plugged. +.Pp +In order to use the card one +.Em MUST +download firmware first. Due to copyright issues I will no longer +provide firmware with the driver. The firmware can be obtained +from the Windows driver package that can be downloaded from the 3COM web +site at no charge. The firmware name is BT3CPCC.BIN. To load firmware +info the card use +.Xr bt3cfw 8 . +I'm using original firmware that came with the card on CD-ROM. +.Bd -literal -offset indent +MD5 (BT3CPCC.BIN) = 36170fda56ea9fdbf1702c966f8a97f1 +.Ed +.Pp +For OLDCARD systems the entry in +.Xr pccard.conf 5 +might look like this +.Bd -literal -offset indent +# 3Com 3CRWB60-A Bluetooth PC Card +card "3COM" "3CRWB60-A" "Bluetooth PC Card" + config auto "btccc" ? + insert /usr/sbin/bt3cfw -n $device -f /etc/BT3CPCC.bin +.Ed +.Pp +Do not forget to load module and SIGHUP +.Xr pccardd 8 . +.Pp +The node has a single hook called +.Dv hook . +Incoming bytes received on the device are re-assembled into HCI frames +(according to the length). Full HCI frames are sent out on the hook. HCI +frames received on +.Dv hook +are transmitted out. No modification to the data is performed in +either direction. +.Sh HOOKS +This node type supports the following hooks: +.Pp +.Bl -tag -width foobar +.It Dv hook +single HCI frame contained in single +.Dv mbuf +structure. +.El +.Sh CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width foo +.It Dv NGM_BT3C_NODE_GET_STATE +Returns current receiving state for the node. +.It Dv NGM_BT3C_NODE_GET_DEBUG +Returns an integer containing the current debug level for the node. +.It Dv NGM_BT3C_NODE_SET_DEBUG +This command takes an integer argument and sets current debug level +for the node. +.It Dv NGM_BT3C_NODE_GET_QLEN +This command takes a parameter that specifies queue number and returns +current length of the queue for the node. +.It Dv NGM_BT3C_NODE_SET_QLEN +This command takes two parameters that specify queue number and and +maximum length of the queue and sets maximum length of the queue for +the node. +.It Dv NGM_BT3C_NODE_GET_STAT +Returns various statistic information for the node, such as: number of +bytes (frames) sent, number of bytes (frames) received and number of +input (output) errors. +.It Dv NGM_BT3C_NODE_RESET_STAT +Reset all statistic counters to zero. +.It Dv NGM_BT3C_NODE_DOWNLOAD_FIRMWARE +Download card firmware. +.El +.Sh SHUTDOWN +This node shuts down when the corresponding card is un-plugged. +.Sh BUGS +The driver is based on information obrained from Jose Orlando Pereira +<jop@di.uminho.pt> and disassembled W2K driver. +.Sh SEE ALSO +.Xr cardbus 4 , +.Xr pccbb 4 , +.Xr pcic 4 , +.Xr pccardc 8 , +.Xr pccardd 8 , +.Xr pccard.conf 5 , +.Xr netgraph 4 , +.Xr ngctl 8 , +.Xr bt3cfw 8 +.Sh HISTORY +The +.Nm BTCCC +node type was implemented in +.Fx 5.0 . +.Sh AUTHORS +.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com diff --git a/share/man/man4/ng_btsocket.4 b/share/man/man4/ng_btsocket.4 new file mode 100644 index 0000000..bb2b360 --- /dev/null +++ b/share/man/man4/ng_btsocket.4 @@ -0,0 +1,255 @@ +.\" ng_btsocket.4 +.\" +.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id: ng_btsocket.4,v 1.4 2002/11/12 22:31:39 max Exp $ +.\" $FreeBSD$ +.Dd July 8, 2002 +.Dt NG_BTSOCKET 4 +.Os +.Sh NAME +.Nm btsocket +.Nd Bluetooth sockets layer +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In bitstring.h +.In netgraph.h +.In ng_hci.h +.In ng_l2cap.h +.In ng_btsocket.h +.Sh DESCRIPTION +The +.Nm +module implements three Netgraph node types. Each type in its turn implements +one protocol within +.Dv PF_BLUETOOTH +domain. +.Pp +.Sh BLUETOOTH_PROTO_HCI protocol +.Ss SOCK_RAW HCI sockets +Implemented by +.Cm btsock_hci_raw +Netgraph type. Raw HCI sockets allow sending of raw HCI command datagrams +only to correspondents named in +.Xr send 2 +calls. Raw HCI datagrams (HCI commands, events and data) are generally +received with +.Xr recvfrom 2 , +which returns the next datagram with its return address. Also raw HCI +sockets can be used to control HCI nodes. +.Pp +The Bluetooth raw HCI socket address is defined as follows: +.Bd -literal -offset indent +/* Bluetooth version of struct sockaddr for raw HCI sockets */ +struct sockaddr_hci { + u_char hci_len; /* total length */ + u_char hci_family; /* address family */ + char hci_node[16]; /* HCI node name */ +}; +.Ed +.Pp +Raw HCI sockets support number of +.Xr ioctl 2 +requests such as: +.Bl -tag -width foo +.It Dv SIOC_HCI_RAW_NODE_GET_STATE +Returns current state for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_INIT +Turn on +.Dq inited +bit for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_GET_DEBUG +Returns current debug level for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_SET_DEBUG +Sets current debug level for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_GET_BUFFER +Returns current state of data buffers for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_GET_BDADDR +Returns BD_ADDR for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_GET_FEATURES +Returns the list of features supported by hardware for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_GET_STAT +Returns various statistic counters for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_RESET_STAT +Resets all statistic counters for the HCI node to zero. +.It Dv SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE +Remove all neighbor cache entries for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE +Returns content of the neighbor cache for the HCI node. +.It Dv SIOC_HCI_RAW_NODE_GET_CON_LIST +Returns list of active baseband connections (i.e. ACL and SCO links) for +the HCI node. +.It SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK +Returns current link policy settings mask for the HCI node. +.It SIOC_HCI_RAW_NODE_SET_LINK_POLICY_MASK +Sets current link policy settings mask for the HCI node. +.It SIOC_HCI_RAW_NODE_GET_PACKET_MASK +Returns current packet mask for the HCI node. +.It SIOC_HCI_RAW_NODE_SET_PACKET_MASK +Sets current packet mask for the HCI node. +.El +.Pp +Raw HCI sockets support filters. The application can filter certain +HCI datagram types. For HCI event datagrams the application can set +additional filter. The raw HCI socket filter defined as follows: +.Bd -literal -offset indent +/* + * Raw HCI socket filter. + * + * For packet mask use (1 << (HCI packet indicator - 1)) + * For event mask use (1 << (Event - 1)) + */ + +struct ng_btsocket_hci_raw_filter { + bitstr_t bit_decl(packet_mask, 32); + bitstr_t bit_decl(event_mask, (NG_HCI_EVENT_MASK_SIZE * 8)); +}; +.Ed +.Pp +The +.Dv SO_HCI_RAW_FILTER +option defined at +.Dv SOL_HCI_RAW +level can be used to obtain via +.Xr getsockopt 2 +or change via +.Xr setsockopt 2 +raw HCI socket's filter. +.Pp +.Sh BLUETOOTH_PROTO_L2CAP protocol +The Bluetooth L2CAP socket address is defined as follows: +.Bd -literal -offset indent +/* Bluetooth version of struct sockaddr for L2CAP sockets */ +struct sockaddr_l2cap { + u_char l2cap_len; /* total length */ + u_char l2cap_family; /* address family */ + u_int16_t l2cap_psm; /* Protocol/Service Multiplexor */ + bdaddr_t l2cap_bdaddr; /* address */ +}; +.Ed +.Pp +.Ss SOCK_RAW L2CAP sockets +Implemented by +.Cm btsock_l2c_raw +Netgraph type. +Raw L2CAP sockets do not provide access to raw L2CAP datagrams. These +sockets used to control L2CAP nodes and to issue special L2CAP requests +such as ECHO_REQUEST and GET_INFO request. +.Pp +Raw L2CAP sockets support number of +.Xr ioctl 2 +requests such as: +.Bl -tag -width foo +.It Dv SIOC_L2CAP_NODE_GET_FLAGS +Returns current state for the L2CAP node. +.It Dv SIOC_L2CAP_NODE_GET_DEBUG +Returns current debug level for the L2CAP node. +.It Dv SIOC_L2CAP_NODE_SET_DEBUG +Sets current debug level for the L2CAP node. +.It Dv SIOC_L2CAP_NODE_GET_CON_LIST +Returns list of active baseband connections (i.e. ACL links) for the L2CAP +node. +.It Dv SIOC_L2CAP_NODE_GET_CHAN_LIST +Returns list of active channels for the L2CAP node. +.It Dv SIOC_L2CAP_L2CA_PING +Issues L2CAP ECHO_REQUEST. +.It Dv SIOC_L2CAP_L2CA_GET_INFO +Issues L2CAP GET_INFO request. +.El +.Pp +.Ss SOCK_SEQPACKET L2CAP sockets +Implemented by +.Cm btsock_l2c +Netgraph type. +L2CAP sockets are either +.Dq active +or +.Dq passive . +Active sockets initiate connections to passive sockets. By default L2CAP +sockets are created active; to create a passive socket the +.Xr listen 2 +system call must be used after binding the socket with the +.Xr bind 2 +system call. Only passive sockets may use the +.Xr accept 2 +call to accept incoming connections. Only active sockets may use the +.Xr connect 2 +call to initiate connections. +.Pp +L2CAP sockets supports +.Dq wildcard addressing . +In this case socket must be bound to +.Dv NG_HCI_BDADDR_ANY +address. Note that PSM (Protocol/Service Multiplexor) filed is always +required. Once a connection has been established the socket's address is +fixed by the peer entity's location. The address assigned the socket is +the address associated with the Bluetooth device through which packets are +being transmitted and received, and PSM (Protocol/Service Multiplexor). +.Pp +L2CAP sockets support number of options defined at +.Dv SOL_L2CAP +level which can be set with +.Xr setsockopt 2 +and tested with +.Xr getsockopt 2 : +.Bl -tag -width foo +.It Dv SO_L2CAP_IMTU +Get (set) maximum payload size the local socket is capable of accepting. +.It Dv SO_L2CAP_OMTU +Get maximum payload size the remote socket is capable of accepting. +.It Dv SO_L2CAP_IFLOW +Get incoming flow specification for the socket. +.Em Not implemented . +.It Dv SO_L2CAP_OFLOW +Get (set) outgoing flow specification for the socket. +.Em Not implemented . +.It Dv SO_L2CAP_FLUSH +Get (set) value of the flush timeout. +.Em Not implemeted . +.El +.Sh HOOKS +This node type supports hooks with arbitrary names (as long as they are +unique) and always accepts hook connection requests. +.Sh NETGRAPH CONTROL MESSAGES +This node type supports the generic control messages. +.Sh SHUTDOWN +These nodes are persistent and cannot be shut down. +.Sh BUGS +Most likely. Please report if found. +.Sh SEE ALSO +.Xr socket 2 , +.Xr netgraph 4 , +.Xr ngctl 8 , +.Xr ng_hci 4 , +.Xr ng_l2cap 4 , +.Xr btsockstat 1 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 5.0 . +.Sh AUTHORS +.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com diff --git a/share/man/man4/ng_h4.4 b/share/man/man4/ng_h4.4 new file mode 100644 index 0000000..bc76e1c --- /dev/null +++ b/share/man/man4/ng_h4.4 @@ -0,0 +1,121 @@ +.\" ng_h4.4 +.\" +.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id: ng_h4.4,v 1.3 2002/11/12 17:10:13 max Exp $ +.\" $FreeBSD$ +.Dd June 14, 2002 +.Dt NG_H4 4 +.Os +.Sh NAME +.Nm h4 +.Nd Netgraph node type that is also a H4 line discipline +.Sh SYNOPSIS +.In sys/types.h +.In sys/ttycom.h +.In netgraph/ng_message.h +.In netgraph/ng_h4.h +.Sh DESCRIPTION +The +.Nm +node type is both a persistent Netgraph node type and a H4 line +discipline. It implements a Bluetooth HCI UART transport layer as +per chapter H4 of the Bluetooth Specification Book v1.1. A new +node is created when the corresponding line discipline, +.Dv H4DISC , +is registered on a tty device (see +.Xr tty 4 ) . +.Pp +The node has a single hook called +.Dv hook . +Incoming bytes received on the tty device are re-assembled into +HCI frames (according to the length). Full HCI frames are sent out on +the hook. HCI frames received on +.Dv hook +are transmitted out on the tty device. +No modification to the data is performed in either direction. +While the line discipline is installed on a tty, the normal +read and write operations are unavailable, returning +.Er EIO . +.Pp +Information about the node is available via the netgraph +.Xr ioctl 2 +command +.Dv NGIOCGINFO . +This command returns a +.Dv "struct nodeinfo" +similar to the +.Dv NGM_NODEINFO +netgraph control message. +.Sh HOOKS +This node type supports the following hooks: +.Pp +.Bl -tag -width foobar +.It Dv hook +single HCI frame contained in single +.Dv mbuf +structure. +.El +.Sh CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width foo +.It Dv NGM_H4_NODE_RESET +Reset the node. +.It Dv NGM_H4_NODE_GET_STATE +Returns current receiving state for the node. +.It Dv NGM_H4_NODE_GET_DEBUG +Returns an integer containing the current debug level for the node. +.It Dv NGM_H4_NODE_SET_DEBUG +This command takes an integer argument and sets current debug level +for the node. +.It Dv NGM_H4_NODE_GET_QLEN +Returns current length of outgoing queue for the node. +.It Dv NGM_H4_NODE_SET_QLEN +This command takes an integer argument and sets maximum length of +outgoing queue for the node. +.It Dv NGM_H4_NODE_GET_STAT +Returns various statistic information for the node, such as: number of +bytes (frames) sent, number of bytes (frames) received and number of +input (output) errors. +.It Dv NGM_H4_NODE_RESET_STAT +Reset all statistic counters to zero. +.El +.Sh SHUTDOWN +This node shuts down when the corresponding device is closed +(or the line discipline is uninstalled on the device). +.Sh BUGS +This node still uses spltty() to lock tty layer. This is wrong. +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr netgraph 4 , +.Xr tty 4 , +.Xr ngctl 8 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 5.0 . +.Sh AUTHORS +.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com diff --git a/share/man/man4/ng_hci.4 b/share/man/man4/ng_hci.4 new file mode 100644 index 0000000..36272e0 --- /dev/null +++ b/share/man/man4/ng_hci.4 @@ -0,0 +1,342 @@ +.\" ng_hci.4 +.\" +.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id: ng_hci.4,v 1.8 2002/11/12 22:35:39 max Exp $ +.\" $FreeBSD$ +.Dd June 25, 2002 +.Dt NG_HCI 4 +.Os +.Sh NAME +.Nm hci +.Nd Netgraph node type that is also a Bluetooth Host Controller Interface +(HCI) layer +.Sh SYNOPSIS +.In sys/types.h +.In netgraph/ng_message.h +.In netgraph/netgraph.h +.In netgraph/ng_hci.h +.Sh DESCRIPTION +The +.Nm +node type is a Netgraph node type that implements Bluetooth Host Controller +Interface (HCI) layer as per chapter H1 of the Bluetooth Specification Book +v1.1. +.Sh INTRODUCTION TO BLUETOOTH +Bluetooth is a short-range radio link intended to replace the cable(s) +connecting portable and/or fixed electronic devices. Bluetooth operates +in the unlicensed ISM band at 2.4 GHz. The Bluetooth protocol uses a +combination of circuit and packet switching. Bluetooth can support an +asynchronous data channel, up to three simultaneous synchronous voice +channels, or a channel which simultaneously supports asynchronous data +and synchronous voice. Each voice channel supports a 64 kb/s synchronous +(voice) channel in each direction. The asynchronous channel can support +maximal 723.2 kb/s asymmetric (and still up to 57.6 kb/s in the return +direction), or 433.9 kb/s symmetric. +.Pp +The Bluetooth system provides a point-to-point connection (only two +Bluetooth units involved), or a point-to-multipoint connection. In the +point-to-multipoint connection, the channel is shared among several +Bluetooth units. Two or more units sharing the same channel form a +.Em piconet . +One Bluetooth unit acts as the master of the piconet, whereas the other +unit(s) acts as slave(s). Up to seven slaves can be active in the piconet. +In addition, many more slaves can remain locked to the master in a so-called +parked state. These parked slaves cannot be active on the channel, but remain +synchronized to the master. Both for active and parked slaves, the channel +access is controlled by the master. +.Pp +Multiple piconets with overlapping coverage areas form a +.Em scatternet . +Each piconet can only have a single master. However, slaves can participate +in different piconets on a time-division multiplex basis. In addition, a +master in one piconet can be a slave in another piconet. The piconets shall +not be frequency-synchronized. Each piconet has its own hopping channel. +.Ss Time slots +The channel is divided into time slots, each 625 usec in length. The time +slots are numbered according to the Bluetooth clock of the piconet master. +The slot numbering ranges from 0 to 2^27 -1 and is cyclic with a cycle length +of 2^27. In the time slots, master and slave can transmit packets. +.Ss SCO link +The SCO link is a symmetric, point-to-point link between the master and a +specific slave. The SCO link reserves slots and can therefore be considered +as a circuit-switched connection between the master and the slave. The SCO +link typically supports time-bounded information like voice. The master can +support up to three SCO links to the same slave or to different slaves. A +slave can support up to three SCO links from the same master, or two SCO +links if the links originate from different masters. SCO packets are never +retransmitted. +.Ss ACL link +In the slots not reserved for SCO links, the master can exchange packets +with any slave on a per-slot basis. The ACL link provides a packet-switched +connection between the master and all active slaves participating in the +piconet. Both asynchronous and isochronous services are supported. Between +a master and a slave only a single ACL link can exist. For most ACL packets, +packet retransmission is applied to assure data integrity. +.Sh HOST CONTROLLER INTERFACE (HCI) +The HCI provides a command interface to the baseband controller and link +manager, and access to hardware status and control registers. This interface +provides a uniform method of accessing the Bluetooth baseband capabilities. +.Pp +The HCI layer on the Host exchanges data and commands with the HCI firmware +on the Bluetooth hardware. The Host Controller Transport Layer (i.e. physical +bus) driver provides both HCI layers with the ability to exchange information +with each other. +.Pp +The Host will receive asynchronous notifications of HCI events independent +of which Host Controller Transport Layer is used. HCI events are used for +notifying the Host when something occurs. When the Host discovers that an +event has occurred it will then parse the received event packet to determine +which event occurred. +The next sections specify the HCI packet formats. +.Ss HCI command packet +.Bd -literal -offset indent +#define NG_HCI_CMD_PKT 0x01 +typedef struct { + u_int8_t type; /* MUST be 0x1 */ + u_int16_t opcode; /* OpCode */ + u_int8_t length; /* parameter(s) length in bytes */ +} __attribute__ ((packed)) ng_hci_cmd_pkt_t; +.Ed +.Pp +The HCI command packet is used to send commands to the Host Controller +from the Host. When the Host Controller completes most of the commands, +a Command Complete event is sent to the Host. Some commands do not receive +a Command Complete event when they have been completed. Instead, when the +Host Controller receives one of these commands the Host Controller sends +a Command Status event back to the Host when it has begun to execute the +command. Later on, when the actions associated with the command have finished, +an event that is associated with the sent command will be sent by the Host +Controller to the Host. +.Ss HCI event packet +.Bd -literal -offset indent +#define NG_HCI_EVENT_PKT 0x04 +typedef struct { + u_int8_t type; /* MUST be 0x4 */ + u_int8_t event; /* event */ + u_int8_t length; /* parameter(s) length in bytes */ +} __attribute__ ((packed)) ng_hci_event_pkt_t; +.Ed +.Pp +The HCI event packet is used by the Host Controller to notify the Host +when events occur. +.Ss HCI ACL data packet +.Bd -literal -offset indent +#define NG_HCI_ACL_DATA_PKT 0x02 +typedef struct { + u_int8_t type; /* MUST be 0x2 */ + u_int16_t con_handle; /* connection handle + PB + BC flags */ + u_int16_t length; /* payload length in bytes */ +} __attribute__ ((packed)) ng_hci_acldata_pkt_t; +.Ed +.Pp +HCI ACL data packets are used to exchange ACL data between the Host and +Host Controller. +.Ss HCI SCO data packet +.Bd -literal -offset indent +#define NG_HCI_SCO_DATA_PKT 0x03 +typedef struct { + u_int8_t type; /* MUST be 0x3 */ + u_int16_t con_handle; /* connection handle + reserved bits */ + u_int8_t length; /* payload length in bytes */ +} __attribute__ ((packed)) ng_hci_scodata_pkt_t; +.Ed +.Pp +HCI SCO data packets are used to exchange SCO data between the Host and +Host Controller. +.Sh HCI INITIALIZATION +On initialization, HCI control application must issue the following HCI +commands (in any order). +.Bl -tag -width foobar +.It Dv Read_BD_ADDR +To obtain BD_ADDR of the Bluetooth unit. +.It Dv Read_Local_Supported_Features +To obtain the list of features supported by Bluetooth unit. +.It Dv Read_Buffer_Size +To determine the maximum size of HCI ACL and SCO HCI data packets (excluding +header) that can be sent from the Host to the Host Controller. There are also +two additional return parameters that specify the total number of HCI ACL and +SCO data packets that the Host Controller can have waiting for transmission in +its buffers. +.El +.Pp +As soon as HCI initialization has been successfuly performed, HCI control +application must turn on +.Dq inited +bit for the node. Once HCI node has been initialized all upsteam hooks +will receive a +.Dv NGM_HCI_NODE_UP +Netgraph message defined as follows. +.Bd -literal -offset indent +#define NGM_HCI_NODE_UP 112 /* HCI -> Upper */ +typedef struct { + u_int16_t pkt_size; /* max. ACL/SCO packet size (w/o hdr) */ + u_int16_t num_pkts; /* ACL/SCO packet queue size */ + u_int16_t reserved; /* place holder */ + bdaddr_t bdaddr; /* bdaddr */ +} ng_hci_node_up_ep; +.Ed +.Sh HCI FLOW CONTROL +HCI layer performs flow control on baseband connection basis (i.e. ACL and +SCO link). Each baseband connection has +.Em connection handle +and queue of outgoing data packets. Upper layers protocols are allowed to +send up to ( +.Dv num_pkts - +.Dv pending ) +packets at one time. HCI layer will send +.Dv NGM_HCI_SYNC_CON_QUEUE +Netgraph messages to inform upper layers about current queue state for each +connection handle. The +.Dv NGM_HCI_SYNC_CON_QUEUE +Netgraph message is defined as follows. +.Bd -literal -offset indent +#define NGM_HCI_SYNC_CON_QUEUE 113 /* HCI -> Upper */ +typedef struct { + u_int16_t con_handle; /* connection handle */ + u_int16_t completed; /* number of completed packets */ +} ng_hci_sync_con_queue_ep; +.Ed +.Sh HOOKS +This node type supports the following hooks: +.Pp +.Bl -tag -width foobar +.It Dv drv +Bluetooth Host Controller Transport Layer hook. Single HCI packet contained in +single +.Dv mbuf +structure. +.It Dv acl +Upper layer protocol/node is connected to the hook. Single HCI ACL +data packet contained in single +.Dv mbuf +structure. +.It Dv sco +Upper layer protocol/node is connected to the hook. Single HCI SCO +data packet contained in single +.Dv mbuf +structure. +.It Dv raw +Raw hook. Every HCI frame (including HCI command frame) that goes in +or out will be delivired to the hook. Usually Bluetooth raw HCI sockets +layer is connected to the hook. Single HCI frame contained in single +. Dv mbuf +structure. +.El +.Sh BLUETOOTH UPPER LAYER PROTOCOLS INTERFACE (LP CONTROL MESSAGES) +.Bl -tag -width foo +.It Dv NGM_HCI_LP_CON_REQ +Requests the lower protocol to create a connection. If a physical link +to the remote device does not exist, this message must be sent to the lower +protocol (baseband) to establish the physical connection. +.It Dv NGM_HCI_LP_DISCON_REQ +Requests the lower protocol (baseband) to terminate a connection. +.It Dv NGM_HCI_LP_CON_CFM +Confirms success or failure of the +.Dv +NGM_HCI_LP_CON_REQ request to establish a lower layer (baseband) connection. +This includes passing the authentication challenge if authentication is +required to establish the physical link. +.It Dv NGM_HCI_LP_CON_IND +Indicates the lower protocol (baseband) has successfully established +incoming connection. +.It Dv NGM_HCI_LP_CON_RSP +A response accepting or rejecting the previous connection indication request. +.It Dv NGM_HCI_LP_DISCON_IND +Indicates the lower protocol (baseband) has terminated connection. This +could be a response to +.Dv NGM_HCI_LP_DISCON_REQ +or a timeout event. +.It Dv NGM_HCI_LP_QOS_REQ +Requests the lower protocol (baseband) to accommodate a particular QoS +parameter set. +.It Dv NGM_HCI_LP_QOS_CFM +Confirms success or failure of the request for a given quality of service. +.It Dv NGM_HCI_LP_QOS_IND +Indicates the lower protocol (baseband) has detected a violation of the QoS +agreement. +.El +.Sh NETGRAPH CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width foo +.It Dv NGM_HCI_NODE_GET_STATE +Returns current state for the node. +.It Dv NGM_HCI_NODE_INIT +Turn on +.Dq inited +bit for the node. +.It Dv NGM_HCI_NODE_GET_DEBUG +Returns an integer containing the current debug level for the node. +.It Dv NGM_HCI_NODE_SET_DEBUG +This command takes an integer argument and sets current debug level +for the node. +.It Dv NGM_HCI_NODE_GET_BUFFER +Returns current state of data buffers. +.It Dv NGM_HCI_NODE_GET_BDADDR +Returns BD_ADDR as cached in the node. +.It Dv NGM_HCI_NODE_GET_FEATURES +Returns the list of features supported by hardware (as cached by the node). +.It Dv NGM_HCI_NODE_GET_NEIGHBOR_CACHE +Returns content of the neighbor cache. +.It Dv NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE +Remove all neighbor cache entries. +.It Dv NGM_HCI_NODE_GET_CON_LIST +Returns list of active baseband connections (i.e. ACL and SCO links). +.It Dv NGM_HCI_NODE_GET_STAT +Returns various statistic counters. +.It Dv NGM_HCI_NODE_RESET_STAT +Resets all statistic counters to zero. +.It NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK +Sets current link policy settings mask. After the new ACL connection is +created the HCI node will try set link policy for the ACL connection. By +default every supported Link Manager (LM) mode will be enabled. User can +override this by setting link policy settings mask which specifies LM +modes to be enabled. +.It NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK +Returns current link policy settings mask. +.It NGM_HCI_NODE_SET_PACKET_MASK +Sets current packet mask. When new baseband (ACL or SCO) connection is +created the HCI node will specify every packet type supported by the device. +User can override this by setting packet mask which specifies packet types +to be used for new baseband connections. +.It NGM_HCI_NODE_GET_PACKET_MASK +Returns current packet mask. +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a NGM_SHUTDOWN control message, or +when all hooks have been disconnected. +.Sh BUGS +Most likely. Please report if found. +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ngctl 8 , +.Xr hccontrol 8 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 5.0 . +.Sh AUTHORS +.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com diff --git a/share/man/man4/ng_l2cap.4 b/share/man/man4/ng_l2cap.4 new file mode 100644 index 0000000..38f4bc8 --- /dev/null +++ b/share/man/man4/ng_l2cap.4 @@ -0,0 +1,341 @@ +.\" ng_l2cap.4 +.\" +.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id: ng_l2cap.4,v 1.4 2002/11/12 17:16:19 max Exp $ +.\" $FreeBSD$ +.Dd July 4, 2002 +.Dt NG_L2CAP 4 +.Os +.Sh NAME +.Nm l2cap +.Nd Netgraph node type that implements Bluetooth Logical Link Control and +Adaptation Protocol (L2CAP) +.Sh SYNOPSIS +.In sys/types.h +.In netgraph/ng_message.h +.In netgraph/netgraph.h +.In netgraph/ng_hci.h +.In netgraph/ng_l2cap.h +.Sh DESCRIPTION +The +.Nm +node type is a Netgraph node type that implements Bluetooth Logical Link +Control and Adaptation Protocol as per chapter D of the Bluetooth Specification +Book v1.1. +.Pp +L2CAP provides connection-oriented and connectionless data services to upper +layer protocols with protocol multiplexing capability, segmentation and +reassembly operation, and group abstractions. L2CAP permits higher level +protocols and applications to transmit and receive L2CAP data packets up to +64 kilobytes in length. +.Ss L2CAP assumptions +.Bl -enum -offset indent +.It +The ACL link between two units is set up. The Baseband provides orderly +delivery of data packets, although there might be individual packet corruption +and duplicates. No more than 1 ACL link exists between any two devices. +.It +The Baseband always provides the impression of full-duplex communication +channels. This does not imply that all L2CAP communications are bi-directional. +Multicasts and unidirectional traffic (e.g., video) do not require duplex +channels. +.It +L2CAP provides a reliable channel using the mechanisms available at the +Baseband layer. The Baseband always performs data integrity checks when +requested and resends data until it has been successfully acknowledged or +a timeout occurs. Because acknowledgements may be lost, timeouts may +occur even after the data has been successfully sent. +.El +.Sh L2CAP GENERAL OPERATION +The Logical Link Control and Adaptation Protocol (L2CAP) is based around the +concept of +.Em channels . +Each channel is bound to a single protocol in a many-to-one fashion. Multiple +channels can be bound to the same protocol, but a channel cannot be bound to +multiple protocols. Each L2CAP packet received on a channel is directed to +the appropriate higher level protocol. +.Pp +Each one of the end-points of an L2CAP channel is referred to by a channel +identifier. Channel identifiers (CIDs) are local names representing a logical +channel end-point on the device. Identifiers from 0x0001 to 0x003F are reserved +for specific L2CAP functions. The null identifier (0x0000) is defined as an +illegal identifier and must never be used as a destination end-point. +All L2CAP signalling commands are sent to CID 0x0001. CID 0x0002 is reserved +for group-oriented channel. The same CID must not be reused as a local L2CAP +channel endpoint for multiple simultaneous L2CAP channels between a local +device and some remote device. +.Pp +CID assignment is relative to a particular device and a device can assign CIDs +independently from other devices. Thus, even if the same CID value has been +assigned to (remote) channel endpoints by several remote devices connected +to a single local device, the local device can still uniquely associate each +remote CID with a different device. +.Ss Channel operational states +.Bl -tag -width foobar +.It Dv NG_L2CAP_CLOSED +In this state, there is no channel associated with this CID. This is the only +state when a link level connection (Baseband) may not exist. Link disconnection +forces all other states into the NG_L2CAP_CLOSED state. +.It Dv NG_L2CAP_W4_L2CAP_CON_RSP +In this state, the CID represents a local end-point and an L2CAP Connect +Request message has been sent referencing this endpoint and it is now waiting +for the corresponding L2CAP Connect Response message. +.It Dv NG_L2CAP_W4_L2CA_CON_RSP +In this state, the remote end-point exists and an L2CAP Connect Request has +been received by the local L2CAP entity. An L2CA Connect Indication has been +sent to the upper layer and the part of the local L2CAP entity processing the +received L2CAP Connect Request waits for the corresponding response. The +response may require a security check to be performed. +.It Dv NG_L2CAP_CONFIG +In this state, the connection has been established but both sides are still +negotiating the channel parameters. The Configuration state may also be +entered when the channel parameters are being renegotiated. Prior to entering +the NG_L2CAP_CONFIG state, all outgoing data traffic is suspended since +the traffic parameters of the data traffic are to be renegotiated. Incoming +data traffic is accepted until the remote channel endpoint has entered +the NG_L2CAP_CONFIG state. In the NG_L2CAP_CONFIG state, both sides will issue +L2CAP Configuration Request messages if only defaults are being used, a null +message will be sent. If a large amount of parameters need to be negotiated, +multiple messages will be sent to avoid any MTU limitations and negotiate +incrementally. Moving from the NG_L2CAP_CONFIG state to the NG_L2CAP_OPEN state +requires both sides to be ready. An L2CAP entity is ready when it has received +a positive response to its final request and it has positively responded to +the final request from the remote device. +.It Dv NG_L2CAP_OPEN +In this state, the connection has been established and configured, and data +flow may proceed. +.It Dv NG_L2CAP_W4_L2CAP_DISCON_RSP +In this state, the connection is shutting down and an L2CAP Disconnect Request +message has been sent. This state is now waiting for the corresponding response. +.It Dv NG_L2CAP_W4_L2CA_DISCON_RSP +In this state, the connection on the remote endpoint is shutting down and an +L2CAP Disconnect Request message has been received. An L2CA Disconnect +Indication has been sent to the upper layer to notify the owner of the CID +that the remote endpoint is being closed. This state is now waiting for the +corresponding response from the upper layer before responding to the remote +endpoint. +.El +.Ss Protocol Multiplexing +L2CAP supports protocol multiplexing because the Baseband Protocol does not +support any +.Dq type +field identifying the higher layer protocol being multiplexed above it. +L2CAP is able to distinguish between upper layer protocols such as the Service +Discovery Protocol, RFCOMM and Telephony Control. +.Ss Segmentation and Reassembly +The data packets defined by the Baseband Protocol are limited in size. Large +L2CAP packets must be segmented into multiple smaller Baseband packets prior +to their transmission over the air. Similarly, multiple received Baseband +packets may be reassembled into a single larger L2CAP packet. +.Ss Quality of Service +The L2CAP connection establishment process allows the exchange of information +regarding the quality of service (QoS) expected between two Bluetooth units. +.Ss Groups +The Baseband Protocol supports the concept of a piconet, a group of devices +synchronously hopping together using the same clock. The L2CAP group +abstraction permits implementations to efficiently map protocol groups on to +piconets. +.Pp +The following features are outside the scope of L2CAP responsibilities: +.Bl -dash -offset indent +.It +L2CAP does not transport audio designated for SCO links. +.It +L2CAP does not enforce a reliable channel or ensure data integrity, +that is, L2CAP performs no retransmissions or checksum calculations. +.It +L2CAP does not support a reliable multicast channel. +.It +L2CAP does not support the concept of a global group name. +.El +.Sh HOOKS +This node type supports the following hooks: +.Pp +.Bl -tag -width foobar +.It Dv hci +Bluetooth Host Controller Interface downstream hook. +.It Dv l2c +Upper layer protocol upstream hook. Usually Bluetooth L2CAP sockets layer +is connected to the hook. +.It Dv ctl +Control hook. Usually Bluetooth raw L2CAP sockets layer is connected +to the hook. +.El +.Sh INTERFACE TO THE UPPER LAYER PROTOCOLS (L2CA CONTROL MESSAGES) +Bluetooth specification says that L2CA request must block until response +is ready. L2CAP node uses +.Dq token +field from Netgraph message header to match L2CA request and response. The +upper layer protocol must populate +.Dq token . +L2CAP node will queue request and start processing. Later, when response is +ready or timeout has occur L2CAP node will create new Netgraph message, set +.Dq token +and +.Dv NFG_RESP +flag and send message to the upper layer. Note that L2CA indication messages +will not populate +.Dq token +and will not set +.Dv NGF_RESP +flag. There is no reason for this, because they are just notifications and do +not require acknowledgment. +.Pp +.Bl -tag -width foo +.It Dv NGM_L2CAP_L2CA_CON +Requests the creation of a channel representing a logical connection to a +physical address. Input parameters are the target protocol (PSM) and remote +device's 48-bit address (BD_ADDR). Output parameters are the local CID (LCID) +allocated by the local L2CAP entity, and Result of the request. If Result +indicates a pending notification, the Status value may contain more information +of what processing is delaying the establishment of the connection. +.It Dv NGM_L2CAP_L2CA_CON_IND +This message includes the parameters for the address of the remote device that +issued the connection request, the local CID representing the channel being +requested, the Identifier contained in the request, and the PSM value the +request is targeting. +.It Dv NGM_L2CAP_L2CA_CON_RSP +Issues a response to a connection request event indication. Input parameters +are the remote device's 48-bit address, Identifier sent in the request, local +CID, the Response code, and the Status attached to the Response code. The +output parameter is the Result of the service request. This primitive must be +called no more than once after receiving the indication. +.It Dv NGM_L2CAP_L2CA_CFG +Requests the initial configuration (or reconfiguration) of a channel to a new +set of channel parameters. Input parameters are the local CID endpoint, new +incoming receivable MTU (InMTU), new outgoing flow spec-ification, and flush +and link timeouts. Output parameters are the Result, accepted incoming MTU +(InMTU), the remote side's flow requests, and flush and link timeouts. +.It Dv NGM_L2CAP_L2CA_CFG_IND +This message includes the parameters indicating the local CID of the channel +the request has been sent to, the outgoing MTU size (maximum packet that can +be sent across the channel) and the flowspec describing the characteristics of +the incoming data. All other channel parameters are set to their default values if not provided by the remote device. +.It Dv NGM_L2CAP_L2CA_CFG_RSP +Issues a response to a configuration request event indication. Input parameters +include the local CID of the endpoint being configured, outgoing transmit MTU +(which may be equal or less to the OutMTU parameter in the configuration +indication event) and the accepted flowspec for incoming traffic. The output +parameter is the Result value. +.It Dv NGM_L2CAP_L2CA_QOS_IND +This message includes the parameter indicating the address of the remote +Bluetooth device where the QoS contract has been violated. +.It Dv NGM_L2CAP_L2CA_DISCON +Requests the disconnection of the channel. Input parameter is the CID +representing the local channel endpoint. Output parameter is Result. Result +is zero if a L2CAP Disconnect Response is received, otherwise a non-zero value +is returned. Once disconnection has been requested, no process will be able to +successfully read or write from the CID. +.It Dv NGM_L2CAP_L2CA_DISCON_IND +This message includes the parameter indicating the local CID the request has +been sent to. +.It Dv NGM_L2CAP_L2CA_WRITE +Response to transfer of data request. Actual data must be received from +appropriate upstream hook and must be prepended with header defined as follows. +.Pp +.Bd -literal -offset indent +/* L2CA data packet header */ +typedef struct { + u_int32_t token; /* token to use in L2CAP_L2CA_WRITE */ + u_int16_t length; /* length of the data */ + u_int16_t lcid; /* local channel ID */ +} __attribute__ ((packed)) ng_l2cap_l2ca_hdr_t; +.Ed +.Pp +The output parameters are Result and Length of data written. +.It Dv NGM_L2CAP_L2CA_GRP_CREATE +Requests the creation of a CID to represent a logical connection to multiple +devices. Input parameter is the PSM value that the outgoing connectionless +traffic is labelled with, and the filter used for incoming traffic. Output +parameter is the CID representing the local endpoint. On creation, the group +is empty but incoming traffic destined for the PSM value is readable. +.Em This request has not been implemented . +.It Dv NGM_L2CAP_L2CA_GRP_CLOSE +The use of this message closes down a Group. +.Em This request has not been implemented . +.It Dv NGM_L2CAP_L2CA_GRP_ADD_MEMBER +Requests the addition of a member to a group. The input parameter includes the +CID representing the group and the BD_ADDR of the group member to be added. +The output parameter Result confirms the success or failure of the request. +.Em This request has not been implemented . +.It Dv NGM_L2CAP_L2CA_GRP_REM_MEMBER +Requests the removal of a member from a group. The input parameters include +the CID representing the group and BD_ADDR of the group member to be removed. +The output parameter Result confirms the success or failure of the request. +.Em This request has not been implemented . +.It Dv NGM_L2CAP_L2CA_GRP_MEMBERSHIP +Requests a report of the members of a group. The input parameter CID represents +the group being queried. The output parameter Result confirms the success or +failure of the operation. If the Result is successful, BD_ADDR_Lst is a list +of the Bluetooth addresses of the N members of the group. +.Em This request has not been implemented . +.It Dv NGM_L2CAP_L2CA_PING +Initiates a L2CA Echo Request message and the reception of the corresponding +L2CAP Echo Response message. The input parameters are remote Bluetooth device +BD_ADDR, Echo Data and Length of the echo data. The output parameters are +Result, Echo Data and Length of the echo data. +.It Dv NGM_L2CAP_L2CA_GET_INFO +Initiates a L2CA Information Request message and the reception of the +corresponding L2CAP Info Response message. The input parameters are remote +Bluetooth device BD_ADDR and Information Type. The output parameters are +Result, Information Data and Size of the information data. +.It Dv NGM_L2CAP_L2CA_ENABLE_CLT +Request to disable (enable) the reception of connectionless packets. The input +parameter is the PSM value indicating service that should be blocked +(unblocked) and Enable flag. +.El +.Sh NETGRAPH CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width foo +.It Dv NGM_L2CAP_NODE_GET_FLAGS +Returns current state for the node. +.It Dv NGM_L2CAP_NODE_GET_DEBUG +Returns an integer containing the current debug level for the node. +.It Dv NGM_L2CAP_NODE_SET_DEBUG +This command takes an integer argument and sets current debug level +for the node. +.It Dv NGM_L2CAP_NODE_GET_CON_LIST +Returns list of active baseband connections (i.e. ACL links). +.It Dv NGM_L2CAP_NODE_GET_CHAN_LIST +Returns list of active L2CAP channels. +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a NGM_SHUTDOWN control message, or +when all hooks have been disconnected. +.Sh BUGS +Most likely. Please report if found. +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ngctl 8 , +.Xr l2control 8 , +.Xr l2ping 8 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 5.0 . +.Sh AUTHORS +.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com diff --git a/share/man/man4/ng_ubt.4 b/share/man/man4/ng_ubt.4 new file mode 100644 index 0000000..648d27b --- /dev/null +++ b/share/man/man4/ng_ubt.4 @@ -0,0 +1,102 @@ +.\" ng_ubt.4 +.\" +.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id: ng_ubt.4,v 1.2 2002/11/12 17:20:16 max Exp $ +.\" $FreeBSD$ +.Dd June 14, 2002 +.Dt NG_UBT 4 +.Os +.Sh NAME +.Nm ubt +.Nd Netgraph node type that is also a driver for Bluetooth USB devices +.Sh SYNOPSIS +.In sys/types.h +.In ng_ubt.h +.Sh DESCRIPTION +The +.Nm +node type is both a persistent Netgraph node type and a driver for +Bluetooth USB devices. It implements a Bluetooth USB transport layer +as per chapter H2 of the Bluetooth Specification Book v1.1. A new +node is created when supported USB device is plugged. +.Pp +The node has a single hook called +.Dv hook . +Incoming bytes received on the device are re-assembled into HCI frames +(according to the length). Full HCI frames are sent out on the hook. The node +will add HCI frame indicator if device did not send it. HCI frames received +on +.Dv hook +are transmitted out. The node will drop HCI frame indicator unless device +requires it to be present. +.Sh HOOKS +This node type supports the following hooks: +.Pp +.Bl -tag -width foobar +.It Dv hook +single HCI frame contained in single +.Dv mbuf +structure. +.El +.Sh CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width foo +.It Dv NGM_UBT_NODE_GET_DEBUG +Returns an integer containing the current debug level for the node. +.It Dv NGM_UBT_NODE_SET_DEBUG +This command takes an integer argument and sets current debug level +for the node. +.It Dv NGM_UBT_NODE_GET_QLEN +This command takes a parameter that specifies queue number and returns +current maximal length of the queue for the node. +.It Dv NGM_UBT_NODE_SET_QLEN +This command takes two parameters that specify queue number and maximum +length of the queue and sets maximal length of the queue for the node. +.It Dv NGM_UBT_NODE_GET_STAT +Returns various statistic information for the node, such as: number of +bytes (frames) sent, number of bytes (frames) received and number of +input (output) errors. +.It Dv NGM_UBT_NODE_RESET_STAT +Reset all statistic counters to zero. +.El +.Sh SHUTDOWN +This node shuts down when the corresponding USB device is un-plugged. +.Sh BUGS +Isochronous USB transfers are probably broken. It means that USB device +probably will not be able to transfer SCO data (voice). Driver does not +support firmware upgrade procedure. USB interrupt transfers are +implemented as bulk-in transfers (not really a bug). +.Sh SEE ALSO +.Xr usb 4 , +.Xr netgraph 4 , +.Xr ngctl 8 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 5.0 . +.Sh AUTHORS +.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com |