.\" $NetBSD: sdpd.8,v 1.12 2017/12/21 08:59:58 plunky Exp $
.\"
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
.\" Copyright (c) 2004 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.
.\"
.\" $FreeBSD: src/usr.sbin/bluetooth/sdpd/sdpd.8,v 1.5 2005/12/06 17:56:36 emax Exp $
.\"
.Dd May 7, 2009
.Dt SDPD 8
.Os
.Sh NAME
.Nm sdpd
.Nd Bluetooth Service Discovery Protocol daemon
.Sh SYNOPSIS
.Nm
.Op Fl dh
.Op Fl c Ar path
.Op Fl G Ar group
.Op Fl g Ar group
.Op Fl u Ar user
.Sh DESCRIPTION
The
.Nm
daemon keeps a database of Bluetooth Service Records registered on
the host and responds to Service Discovery inquiries from remote
Bluetooth devices.
.Pp
In order to discover services, remote Bluetooth devices send Service
Search and Service Attribute or Service Search Attribute requests over
Bluetooth L2CAP connections on the SDP PSM (0x0001).
The
.Nm
daemon will try to find matching Service Records in its Service Database
and will return the requested record extracts for the remote device to
interpret.
The remote device will then make a separate connection in order to
access the service.
.Pp
Bluetooth applications, running on the host, are able to insert, remove
and update Service Records with the
.Nm
daemon via the control socket.
It is possible to query entire contents of the Service Database locally with
.Xr sdpquery 1
using the
.Fl l
option.
.Pp
The command line options are as follows:
.Bl -tag -width ".Fl g Ar group"
.It Fl c Ar path
Specify path to the control socket.
The default path is
.Pa /var/run/sdp .
.It Fl d
Do not detach from the controlling terminal.
.It Fl G Ar group
Grant permission to members of the
.Ar group
to modify the
.Nm
Service Database.
.It Fl g Ar group
Specifies the group the
.Nm
should run as after it initializes.
The value specified may be either a group name or a numeric group ID.
This only works if
.Nm
was started as root.
The default group name is
.Dq Li _sdpd .
.It Fl h
Display usage message and exit.
.It Fl u Ar user
Specifies the user the
.Nm
should run as after it initializes.
The value specified may be either a user name or a numeric user ID.
This only works if
.Nm
was started as root.
The default user name is
.Dq Li _sdpd .
.El
.Sh FILES
.Bl -tag -width ".Pa /var/run/sdp" -compact
.It Pa /var/run/sdp
.El
.Sh SEE ALSO
.Xr sdpquery 1 ,
.Xr sdp 3
.Pp
The
.Qq Service Discovery Protocol
section of the Bluetooth Core specifications, available at
.Lk http://www.bluetooth.com/
.Sh HISTORY
The original
.Nm
daemon first appeared in
.Fx 5.3
and was imported into
.Nx 4.0
by
.An Iain Hibbert
under the sponsorship of
.An Itronix, Inc.
This version was rewritten by
.An Iain Hibbert
for
.Nx 6.0
in order to allow Bluetooth applications to fully specify
service records.
.Sh AUTHORS
.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.An Iain Hibbert
.Sh CAVEATS
The
.Nm
daemon
will listen for incoming L2CAP connections on a wildcard BD_ADDR.
.Pp
In case of multiple Bluetooth controllers connected to the same host
it is possible to limit visibility of Service Records according to
the controller the connection is made through.
.Pp
Requests to insert, remove or update service records can only be made
via the control socket.
The
.Nm
daemon will check the peer's credentials and will only accept the request
when the peer is the superuser, of if the peer is a member of the group
specified with the
.Fl G
option.
.Pp
The
.Nm
daemon does not check for duplicated Service Records and only
performs minimal validation of the record data sent in the Insert/Update
Record requests.
It is assumed that application must obtain all required resources such
as RFCOMM channels etc., before registering the service.
.Sh BUGS
.Nm
only ever generates 16-bit sequence headers, so if a response was
to grow over
.Dv UINT16_MAX ,
the sequence header will be wrong.
.Pp
There is no way for clients to discover the maximum packet size that
.Nm
will accept on the local socket.
Currently this is
.Dv SDP_LOCAL_MTU
as defined in
.In bluetooth/sdp.h .