diff options
Diffstat (limited to 'static/freebsd/man4/ng_btsocket.4 3.html')
| -rw-r--r-- | static/freebsd/man4/ng_btsocket.4 3.html | 313 |
1 files changed, 313 insertions, 0 deletions
diff --git a/static/freebsd/man4/ng_btsocket.4 3.html b/static/freebsd/man4/ng_btsocket.4 3.html new file mode 100644 index 00000000..cdc90d68 --- /dev/null +++ b/static/freebsd/man4/ng_btsocket.4 3.html @@ -0,0 +1,313 @@ +<table class="head"> + <tr> + <td class="head-ltitle">NG_BTSOCKET(4)</td> + <td class="head-vol">Device Drivers Manual</td> + <td class="head-rtitle">NG_BTSOCKET(4)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<p class="Pp"><code class="Nm">ng_btsocket</code> — + <span class="Nd">Bluetooth sockets layer</span></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<p class="Pp"><code class="In">#include + <<a class="In">sys/types.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/socket.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/bitstring.h</a>></code> + <br/> + <code class="In">#include + <<a class="In">netgraph/bluetooth/include/ng_hci.h</a>></code> + <br/> + <code class="In">#include + <<a class="In">netgraph/bluetooth/include/ng_l2cap.h</a>></code> + <br/> + <code class="In">#include + <<a class="In">netgraph/bluetooth/include/ng_btsocket.h</a>></code></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<p class="Pp">The <code class="Nm">ng_btsocket</code> module implements three + Netgraph node types. Each type in its turn implements one protocol within + <code class="Dv">PF_BLUETOOTH</code> domain.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="BLUETOOTH_PROTO_HCI_protocol"><a class="permalink" href="#BLUETOOTH_PROTO_HCI_protocol"><code class="Dv">BLUETOOTH_PROTO_HCI + protocol</code></a></h1> +<section class="Ss"> +<h2 class="Ss" id="SOCK_RAW_HCI_sockets"><a class="permalink" href="#SOCK_RAW_HCI_sockets"><code class="Dv">SOCK_RAW + HCI sockets</code></a></h2> +<p class="Pp">Implemented by <code class="Nm">btsock_hci_raw</code> Netgraph + type. Raw HCI sockets allow sending of raw HCI command datagrams only to + correspondents named in <a class="Xr">send(2)</a> calls. Raw HCI datagrams + (HCI commands, events and data) are generally received with + <a class="Xr">recvfrom(2)</a>, which returns the next datagram with its + return address. Raw HCI sockets can also be used to control HCI nodes.</p> +<p class="Pp">The Bluetooth raw HCI socket address is defined as follows:</p> +<div class="Bd Pp Bd-indent Li"> +<pre>/* 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[32]; /* address (size == NG_NODESIZ ) */ +};</pre> +</div> +<p class="Pp">Raw HCI sockets support a number of <a class="Xr">ioctl(2)</a> + requests such as:</p> +<dl class="Bl-tag"> + <dt id="SIOC_HCI_RAW_NODE_GET_STATE"><a class="permalink" href="#SIOC_HCI_RAW_NODE_GET_STATE"><code class="Dv">SIOC_HCI_RAW_NODE_GET_STATE</code></a></dt> + <dd>Returns current state for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_INIT"><a class="permalink" href="#SIOC_HCI_RAW_NODE_INIT"><code class="Dv">SIOC_HCI_RAW_NODE_INIT</code></a></dt> + <dd>Turn on “inited” bit for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_GET_DEBUG"><a class="permalink" href="#SIOC_HCI_RAW_NODE_GET_DEBUG"><code class="Dv">SIOC_HCI_RAW_NODE_GET_DEBUG</code></a></dt> + <dd>Returns current debug level for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_SET_DEBUG"><a class="permalink" href="#SIOC_HCI_RAW_NODE_SET_DEBUG"><code class="Dv">SIOC_HCI_RAW_NODE_SET_DEBUG</code></a></dt> + <dd>Sets current debug level for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_GET_BUFFER"><a class="permalink" href="#SIOC_HCI_RAW_NODE_GET_BUFFER"><code class="Dv">SIOC_HCI_RAW_NODE_GET_BUFFER</code></a></dt> + <dd>Returns current state of data buffers for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_GET_BDADDR"><a class="permalink" href="#SIOC_HCI_RAW_NODE_GET_BDADDR"><code class="Dv">SIOC_HCI_RAW_NODE_GET_BDADDR</code></a></dt> + <dd>Returns BD_ADDR for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_GET_FEATURES"><a class="permalink" href="#SIOC_HCI_RAW_NODE_GET_FEATURES"><code class="Dv">SIOC_HCI_RAW_NODE_GET_FEATURES</code></a></dt> + <dd>Returns the list of features supported by hardware for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_GET_STAT"><a class="permalink" href="#SIOC_HCI_RAW_NODE_GET_STAT"><code class="Dv">SIOC_HCI_RAW_NODE_GET_STAT</code></a></dt> + <dd>Returns various statistic counters for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_RESET_STAT"><a class="permalink" href="#SIOC_HCI_RAW_NODE_RESET_STAT"><code class="Dv">SIOC_HCI_RAW_NODE_RESET_STAT</code></a></dt> + <dd>Resets all statistic counters for the HCI node to zero.</dd> + <dt id="SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE"><a class="permalink" href="#SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE"><code class="Dv">SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE</code></a></dt> + <dd>Remove all neighbor cache entries for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE"><a class="permalink" href="#SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE"><code class="Dv">SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE</code></a></dt> + <dd>Returns content of the neighbor cache for the HCI node.</dd> + <dt id="SIOC_HCI_RAW_NODE_GET_CON_LIST"><a class="permalink" href="#SIOC_HCI_RAW_NODE_GET_CON_LIST"><code class="Dv">SIOC_HCI_RAW_NODE_GET_CON_LIST</code></a></dt> + <dd>Returns list of active baseband connections (i.e., ACL and SCO links) for + the HCI node.</dd> + <dt>SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK</dt> + <dd>Returns current link policy settings mask for the HCI node.</dd> + <dt>SIOC_HCI_RAW_NODE_SET_LINK_POLICY_MASK</dt> + <dd>Sets current link policy settings mask for the HCI node.</dd> + <dt>SIOC_HCI_RAW_NODE_GET_PACKET_MASK</dt> + <dd>Returns current packet mask for the HCI node.</dd> + <dt>SIOC_HCI_RAW_NODE_SET_PACKET_MASK</dt> + <dd>Sets current packet mask for the HCI node.</dd> + <dt>SIOC_HCI_RAW_NODE_GET_ROLE_SWITCH</dt> + <dd>Returns current value of the role switch parameter for the HCI node.</dd> + <dt>SIOC_HCI_RAW_NODE_SET_ROLE_SWITCH</dt> + <dd>Sets new value of the role switch parameter for the HCI node.</dd> +</dl> +<p class="Pp">The + <var class="Va">net.bluetooth.hci.sockets.raw.ioctl_timeout</var> variable, + that can be examined and set via <a class="Xr">sysctl(8)</a>, controls the + control request timeout (in seconds) for raw HCI sockets.</p> +<p class="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:</p> +<div class="Bd Pp Bd-indent Li"> +<pre>/* + * 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)); +};</pre> +</div> +<p class="Pp">The <code class="Dv">SO_HCI_RAW_FILTER</code> option defined at + <code class="Dv">SOL_HCI_RAW</code> level can be used to obtain via + <a class="Xr">getsockopt(2)</a> or change via + <a class="Xr">setsockopt(2)</a> raw HCI socket's filter.</p> +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="BLUETOOTH_PROTO_L2CAP_protocol"><a class="permalink" href="#BLUETOOTH_PROTO_L2CAP_protocol"><code class="Dv">BLUETOOTH_PROTO_L2CAP + protocol</code></a></h1> +<p class="Pp">The Bluetooth L2CAP socket address is defined as follows:</p> +<div class="Bd Pp Bd-indent Li"> +<pre>/* Bluetooth version of struct sockaddr for L2CAP sockets */ +struct sockaddr_l2cap { + u_char l2cap_len; /* total length */ + u_char l2cap_family; /* address family */ + uint16_t l2cap_psm; /* Protocol/Service Multiplexor */ + bdaddr_t l2cap_bdaddr; /* address */ +};</pre> +</div> +<section class="Ss"> +<h2 class="Ss" id="SOCK_RAW_L2CAP_sockets"><a class="permalink" href="#SOCK_RAW_L2CAP_sockets"><code class="Dv">SOCK_RAW + L2CAP sockets</code></a></h2> +<p class="Pp">Implemented by <code class="Nm">btsock_l2c_raw</code> 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 <code class="Dv">ECHO_REQUEST</code> and <code class="Dv">GET_INFO</code> + request.</p> +<p class="Pp">Raw L2CAP sockets support number of <a class="Xr">ioctl(2)</a> + requests such as:</p> +<dl class="Bl-tag"> + <dt id="SIOC_L2CAP_NODE_GET_FLAGS"><a class="permalink" href="#SIOC_L2CAP_NODE_GET_FLAGS"><code class="Dv">SIOC_L2CAP_NODE_GET_FLAGS</code></a></dt> + <dd>Returns current state for the L2CAP node.</dd> + <dt id="SIOC_L2CAP_NODE_GET_DEBUG"><a class="permalink" href="#SIOC_L2CAP_NODE_GET_DEBUG"><code class="Dv">SIOC_L2CAP_NODE_GET_DEBUG</code></a></dt> + <dd>Returns current debug level for the L2CAP node.</dd> + <dt id="SIOC_L2CAP_NODE_SET_DEBUG"><a class="permalink" href="#SIOC_L2CAP_NODE_SET_DEBUG"><code class="Dv">SIOC_L2CAP_NODE_SET_DEBUG</code></a></dt> + <dd>Sets current debug level for the L2CAP node.</dd> + <dt id="SIOC_L2CAP_NODE_GET_CON_LIST"><a class="permalink" href="#SIOC_L2CAP_NODE_GET_CON_LIST"><code class="Dv">SIOC_L2CAP_NODE_GET_CON_LIST</code></a></dt> + <dd>Returns list of active baseband connections (i.e., ACL links) for the + L2CAP node.</dd> + <dt id="SIOC_L2CAP_NODE_GET_CHAN_LIST"><a class="permalink" href="#SIOC_L2CAP_NODE_GET_CHAN_LIST"><code class="Dv">SIOC_L2CAP_NODE_GET_CHAN_LIST</code></a></dt> + <dd>Returns list of active channels for the L2CAP node.</dd> + <dt id="SIOC_L2CAP_NODE_GET_AUTO_DISCON_TIMO"><a class="permalink" href="#SIOC_L2CAP_NODE_GET_AUTO_DISCON_TIMO"><code class="Dv">SIOC_L2CAP_NODE_GET_AUTO_DISCON_TIMO</code></a></dt> + <dd>Returns current value of the auto disconnect timeout for the L2CAP + node.</dd> + <dt id="SIOC_L2CAP_NODE_SET_AUTO_DISCON_TIMO"><a class="permalink" href="#SIOC_L2CAP_NODE_SET_AUTO_DISCON_TIMO"><code class="Dv">SIOC_L2CAP_NODE_SET_AUTO_DISCON_TIMO</code></a></dt> + <dd>Sets current value of the auto disconnect timeout for the L2CAP node.</dd> + <dt id="SIOC_L2CAP_L2CA_PING"><a class="permalink" href="#SIOC_L2CAP_L2CA_PING"><code class="Dv">SIOC_L2CAP_L2CA_PING</code></a></dt> + <dd>Issues L2CAP <code class="Dv">ECHO_REQUEST</code>.</dd> + <dt id="SIOC_L2CAP_L2CA_GET_INFO"><a class="permalink" href="#SIOC_L2CAP_L2CA_GET_INFO"><code class="Dv">SIOC_L2CAP_L2CA_GET_INFO</code></a></dt> + <dd>Issues L2CAP <code class="Dv">GET_INFO</code> request.</dd> +</dl> +<p class="Pp">The + <var class="Va">net.bluetooth.l2cap.sockets.raw.ioctl_timeout</var> + variable, that can be examined and set via <a class="Xr">sysctl(8)</a>, + controls the control request timeout (in seconds) for raw L2CAP sockets.</p> +</section> +<section class="Ss"> +<h2 class="Ss" id="SOCK_SEQPACKET_L2CAP_sockets"><a class="permalink" href="#SOCK_SEQPACKET_L2CAP_sockets"><code class="Dv">SOCK_SEQPACKET + L2CAP sockets</code></a></h2> +<p class="Pp">Implemented by <code class="Nm">btsock_l2c</code> Netgraph type. + L2CAP sockets are either “active” or “passive”. + Active sockets initiate connections to passive sockets. By default, L2CAP + sockets are created active; to create a passive socket, the + <a class="Xr">listen(2)</a> system call must be used after binding the + socket with the <a class="Xr">bind(2)</a> system call. Only passive sockets + may use the <a class="Xr">accept(2)</a> call to accept incoming connections. + Only active sockets may use the <a class="Xr">connect(2)</a> call to + initiate connections.</p> +<p class="Pp">L2CAP sockets support “wildcard addressing”. In this + case, socket must be bound to <code class="Dv">NG_HCI_BDADDR_ANY</code> + address. Note that PSM (Protocol/Service Multiplexor) field is always + required. Once a connection has been established, the socket's address is + fixed by the peer entity's location. The address assigned to the socket is + the address associated with the Bluetooth device through which packets are + being transmitted and received, and PSM (Protocol/Service Multiplexor).</p> +<p class="Pp">L2CAP sockets support number of options defined at + <code class="Dv">SOL_L2CAP</code> level which can be set with + <a class="Xr">setsockopt(2)</a> and tested with + <a class="Xr">getsockopt(2)</a>:</p> +<dl class="Bl-tag"> + <dt id="SO_L2CAP_IMTU"><a class="permalink" href="#SO_L2CAP_IMTU"><code class="Dv">SO_L2CAP_IMTU</code></a></dt> + <dd>Get (set) maximum payload size the local socket is capable of + accepting.</dd> + <dt id="SO_L2CAP_OMTU"><a class="permalink" href="#SO_L2CAP_OMTU"><code class="Dv">SO_L2CAP_OMTU</code></a></dt> + <dd>Get maximum payload size the remote socket is capable of accepting.</dd> + <dt id="SO_L2CAP_IFLOW"><a class="permalink" href="#SO_L2CAP_IFLOW"><code class="Dv">SO_L2CAP_IFLOW</code></a></dt> + <dd>Get incoming flow specification for the socket. + <div class="Bf Em">Not implemented.</div> + </dd> + <dt id="SO_L2CAP_OFLOW"><a class="permalink" href="#SO_L2CAP_OFLOW"><code class="Dv">SO_L2CAP_OFLOW</code></a></dt> + <dd>Get (set) outgoing flow specification for the socket. + <div class="Bf Em">Not implemented.</div> + </dd> + <dt id="SO_L2CAP_FLUSH"><a class="permalink" href="#SO_L2CAP_FLUSH"><code class="Dv">SO_L2CAP_FLUSH</code></a></dt> + <dd>Get (set) value of the flush timeout. + <div class="Bf Em">Not implemented.</div> + </dd> +</dl> +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="BLUETOOTH_PROTO_RFCOMM_protocol"><a class="permalink" href="#BLUETOOTH_PROTO_RFCOMM_protocol"><code class="Dv">BLUETOOTH_PROTO_RFCOMM + protocol</code></a></h1> +<p class="Pp">The Bluetooth RFCOMM socket address is defined as follows:</p> +<div class="Bd Pp Bd-indent Li"> +<pre>/* Bluetooth version of struct sockaddr for RFCOMM sockets */ +struct sockaddr_rfcomm { + u_char rfcomm_len; /* total length */ + u_char rfcomm_family; /* address family */ + bdaddr_t rfcomm_bdaddr; /* address */ + uint8_t rfcomm_channel; /* channel */ +};</pre> +</div> +<section class="Ss"> +<h2 class="Ss" id="SOCK_STREAM_RFCOMM_sockets"><a class="permalink" href="#SOCK_STREAM_RFCOMM_sockets"><code class="Dv">SOCK_STREAM + RFCOMM sockets</code></a></h2> +<p class="Pp">Note that RFCOMM sockets do not have associated Netgraph node + type. RFCOMM sockets are implemented as additional layer on top of L2CAP + sockets. RFCOMM sockets are either “active” or + “passive”. Active sockets initiate connections to passive + sockets. By default, RFCOMM sockets are created active; to create a passive + socket, the <a class="Xr">listen(2)</a> system call must be used after + binding the socket with the <a class="Xr">bind(2)</a> system call. Only + passive sockets may use the <a class="Xr">accept(2)</a> call to accept + incoming connections. Only active sockets may use the + <a class="Xr">connect(2)</a> call to initiate connections.</p> +<p class="Pp">RFCOMM sockets support “wildcard addressing”. In + this case, socket must be bound to <code class="Dv">NG_HCI_BDADDR_ANY</code> + address. Note that RFCOMM channel field is always required. Once a + connection has been established, the socket's address is fixed by the peer + entity's location. The address assigned to the socket is the address + associated with the Bluetooth device through which packets are being + transmitted and received, and RFCOMM channel.</p> +<p class="Pp">The following options, which can be tested with + <a class="Xr">getsockopt(2)</a> call, are defined at + <code class="Dv">SOL_RFCOMM</code> level for RFCOMM sockets:</p> +<dl class="Bl-tag"> + <dt id="SO_RFCOMM_MTU"><a class="permalink" href="#SO_RFCOMM_MTU"><code class="Dv">SO_RFCOMM_MTU</code></a></dt> + <dd>Returns the maximum transfer unit size (in bytes) for the underlying + RFCOMM channel. Note that application still can write/read bigger chunks + to/from the socket.</dd> + <dt id="SO_RFCOMM_FC_INFO"><a class="permalink" href="#SO_RFCOMM_FC_INFO"><code class="Dv">SO_RFCOMM_FC_INFO</code></a></dt> + <dd>Return the flow control information for the underlying RFCOMM + channel.</dd> +</dl> +<p class="Pp">The + <var class="Va">net.bluetooth.rfcomm.sockets.stream.timeout</var> variable, + that can be examined and set via <a class="Xr">sysctl(8)</a>, controls the + connection timeout (in seconds) for RFCOMM sockets.</p> +</section> +</section> +<section class="Sh"> +<h1 class="Sh" id="HOOKS"><a class="permalink" href="#HOOKS">HOOKS</a></h1> +<p class="Pp">These node types support hooks with arbitrary names (as long as + they are unique) and always accept hook connection requests.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="NETGRAPH_CONTROL_MESSAGES"><a class="permalink" href="#NETGRAPH_CONTROL_MESSAGES">NETGRAPH + CONTROL MESSAGES</a></h1> +<p class="Pp">These node types support the generic control messages.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SHUTDOWN"><a class="permalink" href="#SHUTDOWN">SHUTDOWN</a></h1> +<p class="Pp">These nodes are persistent and cannot be shut down.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<p class="Pp"><a class="Xr">btsockstat(1)</a>, <a class="Xr">socket(2)</a>, + <a class="Xr">netgraph(4)</a>, <a class="Xr">ng_bluetooth(4)</a>, + <a class="Xr">ng_hci(4)</a>, <a class="Xr">ng_l2cap(4)</a>, + <a class="Xr">ngctl(8)</a>, <a class="Xr">sysctl(8)</a></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<p class="Pp">The <code class="Nm">ng_btsocket</code> module was implemented in + <span class="Ux">FreeBSD 5.0</span>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<p class="Pp"><span class="An">Maksim Yevmenkin</span> + <<a class="Mt" href="mailto:m_evmenkin@yahoo.com">m_evmenkin@yahoo.com</a>></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1> +<p class="Pp">Most likely. Please report if found.</p> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">November 13, 2012</td> + <td class="foot-os">FreeBSD 15.0</td> + </tr> +</table> |
