Deleted Added
full compact
sdp.3 (131504) sdp.3 (131637)
1.\" Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 9 unchanged lines hidden (view full) ---

18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $Id: sdp.3,v 1.1 2003/09/07 20:34:19 max Exp $
1.\" Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 9 unchanged lines hidden (view full) ---

18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $Id: sdp.3,v 1.1 2003/09/07 20:34:19 max Exp $
26.\" $FreeBSD: head/lib/libsdp/sdp.3 131504 2004-07-02 23:52:20Z ru $
26.\" $FreeBSD: head/lib/libsdp/sdp.3 131637 2004-07-05 17:38:08Z ru $
27.\"
28.Dd September 7, 2003
29.Dt SDP 3
30.Os
31.Sh NAME
32.Nm SDP_GET8 ,
33.Nm SDP_GET16 ,
34.Nm SDP_GET32 ,
35.Nm SDP_GET64 ,
27.\"
28.Dd September 7, 2003
29.Dt SDP 3
30.Os
31.Sh NAME
32.Nm SDP_GET8 ,
33.Nm SDP_GET16 ,
34.Nm SDP_GET32 ,
35.Nm SDP_GET64 ,
36.Nm SDP_GET128
37.Nd get SDP integer
38.Pp
36.Nm SDP_GET128 ,
39.Nm SDP_PUT8 ,
40.Nm SDP_PUT16 ,
41.Nm SDP_PUT32 ,
42.Nm SDP_PUT64 ,
37.Nm SDP_PUT8 ,
38.Nm SDP_PUT16 ,
39.Nm SDP_PUT32 ,
40.Nm SDP_PUT64 ,
43.Nm SDP_PUT128
44.Nd put SPD integer
45.Pp
41.Nm SDP_PUT128 ,
46.Nm sdp_open ,
47.Nm sdp_open_local ,
42.Nm sdp_open ,
43.Nm sdp_open_local ,
48.Nm sdp_close
49.Nm sdp_error
50.Nd control SDP session
51.Pp
52.Nm sdp_search
53.Nd perform SDP query
54.Pp
44.Nm sdp_close ,
45.Nm sdp_error ,
46.Nm sdp_search ,
55.Nm sdp_attr2desc ,
56.Nm sdp_uuid2desc
47.Nm sdp_attr2desc ,
48.Nm sdp_uuid2desc
57.Nd convert numeric SDP attribute/UUID value into human readable description
49.Nd Bluetooth SDP routines
58.Sh LIBRARY
59.Lb libsdp
60.Sh SYNOPSIS
61.In bluetooth.h
62.In sdp.h
63.Fn SDP_GET8 "b" "cp"
64.Fn SDP_GET16 "s" "cp"
65.Fn SDP_GET32 "l" "cp"
66.Fn SDP_GET64 "l" "cp"
67.Fn SDP_GET128 "l" "cp"
68.Fn SDP_PUT8 "b" "cp"
69.Fn SDP_PUT16 "s" "cp"
70.Fn SDP_PUT32 "l" "cp"
71.Fn SDP_PUT64 "l" "cp"
72.Fn SDP_PUT128 "l" "cp"
50.Sh LIBRARY
51.Lb libsdp
52.Sh SYNOPSIS
53.In bluetooth.h
54.In sdp.h
55.Fn SDP_GET8 "b" "cp"
56.Fn SDP_GET16 "s" "cp"
57.Fn SDP_GET32 "l" "cp"
58.Fn SDP_GET64 "l" "cp"
59.Fn SDP_GET128 "l" "cp"
60.Fn SDP_PUT8 "b" "cp"
61.Fn SDP_PUT16 "s" "cp"
62.Fn SDP_PUT32 "l" "cp"
63.Fn SDP_PUT64 "l" "cp"
64.Fn SDP_PUT128 "l" "cp"
73.Ft void *
65.Ft "void *"
74.Fn sdp_open "bdaddr_t const *l" "bdaddr_t const *r"
66.Fn sdp_open "bdaddr_t const *l" "bdaddr_t const *r"
75.Ft void *
67.Ft "void *"
76.Fn sdp_open_local "char const *control"
77.Ft int32_t
78.Fn sdp_close "void *xs"
79.Ft int32_t
80.Fn sdp_error "void *xs"
81.Ft int32_t
68.Fn sdp_open_local "char const *control"
69.Ft int32_t
70.Fn sdp_close "void *xs"
71.Ft int32_t
72.Fn sdp_error "void *xs"
73.Ft int32_t
82.Fn sdp_search "void *xs" "uint32_t plen" "uint16_t const *pp" "uint32_t alen" "uint32_t const *ap" "uint32_t vlen" "sdp_attr_t *vp"
83.Ft char const * const
74.Fo sdp_search
75.Fa "void *xs" "uint32_t plen" "uint16_t const *pp" "uint32_t alen"
76.Fa "uint32_t const *ap" "uint32_t vlen" "sdp_attr_t *vp"
77.Fc
78.Ft "char const * const"
84.Fn sdp_attr2desc "uint16_t attr"
79.Fn sdp_attr2desc "uint16_t attr"
85.Ft char const * const
80.Ft "char const * const"
86.Fn sdp_uuid2desc "uint16_t uuid"
87.Ft int32_t
81.Fn sdp_uuid2desc "uint16_t uuid"
82.Ft int32_t
88.Fn sdp_register_service "void *xss" "uint16_t uuid" "bdaddr_p const bdaddr" "uint8_t const *data" "uint32_t datalen" "uint32_t *handle"
83.Fo sdp_register_service
84.Fa "void *xss" "uint16_t uuid" "bdaddr_p const bdaddr" "uint8_t const *data"
85.Fa "uint32_t datalen" "uint32_t *handle"
86.Fc
89.Ft int32_t
90.Fn sdp_unregister_service "void *xss" "uint32_t handle"
91.Ft int32_t
87.Ft int32_t
88.Fn sdp_unregister_service "void *xss" "uint32_t handle"
89.Ft int32_t
92.Fn sdp_change_service "void *xss" "uint32_t handle" "uint8_t const *data" "uint32_t datalen"
90.Fo sdp_change_service
91.Fa "void *xss" "uint32_t handle" "uint8_t const *data" "uint32_t datalen"
92.Fc
93.Sh DESCRIPTION
94The
95.Fn SDP_GET8 ,
96.Fn SDP_GET16 ,
97.Fn SDP_GET32 ,
98.Fn SDP_GET64
99and
100.Fn SDP_GET128
101macros are used to get byte, short, long, long long and 128-bit integer
102from the buffer pointed by
93.Sh DESCRIPTION
94The
95.Fn SDP_GET8 ,
96.Fn SDP_GET16 ,
97.Fn SDP_GET32 ,
98.Fn SDP_GET64
99and
100.Fn SDP_GET128
101macros are used to get byte, short, long, long long and 128-bit integer
102from the buffer pointed by
103.Vt cp
103.Fa cp
104pointer.
105The pointer is automatically advanced.
106.Pp
107The
108.Fn SDP_PUT8 ,
109.Fn SDP_PUT16 ,
110.Fn SDP_PUT32 ,
111.Fn SDP_PUT64
112and
113.Fn SDP_PUT128
114macros are used to put byte, short, long, long long and 128-bit integer
115into the buffer pointed by
104pointer.
105The pointer is automatically advanced.
106.Pp
107The
108.Fn SDP_PUT8 ,
109.Fn SDP_PUT16 ,
110.Fn SDP_PUT32 ,
111.Fn SDP_PUT64
112and
113.Fn SDP_PUT128
114macros are used to put byte, short, long, long long and 128-bit integer
115into the buffer pointed by
116.Vt cp
116.Fa cp
117pointer.
118The pointer is automatically advanced.
119.Pp
117pointer.
118The pointer is automatically advanced.
119.Pp
120The
120.Fn sdp_open
121and
122.Fn sdp_open_local
123functions each return a pointer to an opaque object describing SDP session.
124The
121.Fn sdp_open
122and
123.Fn sdp_open_local
124functions each return a pointer to an opaque object describing SDP session.
125The
125.Vt l
126.Fa l
126argument passed to
127.Fn sdp_open
128function should point to a source BD_ADDR.
129If source BD_ADDR is
130.Dv NULL
131then source address
132.Dv NG_HCI_BDADDR_ANY
133is used.
134The
127argument passed to
128.Fn sdp_open
129function should point to a source BD_ADDR.
130If source BD_ADDR is
131.Dv NULL
132then source address
133.Dv NG_HCI_BDADDR_ANY
134is used.
135The
135.Vt r
136.Fa r
136argument passed to
137.Fn sdp_open
137argument passed to
138.Fn sdp_open
138function should point to a non
139.Dv NULL
139function should point to a
140.Pf non- Dv NULL
140remote BD_ADDR.
141remote BD_ADDR.
141Remote BD_ADDR can not be
142Remote BD_ADDR cannot be
142.Dv NG_HCI_BDADDR_ANY .
143The
144.Fn sdp_open_local
145function takes path to the control socket and opens a connection to a local
146SDP server.
147If path to the control socket is
148.Dv NULL
149then default
150.Pa /var/run/sdp
151path will be used.
152.Pp
153The
154.Fn sdp_close
155function terminates active SDP session and deletes SDP session object.
156The
143.Dv NG_HCI_BDADDR_ANY .
144The
145.Fn sdp_open_local
146function takes path to the control socket and opens a connection to a local
147SDP server.
148If path to the control socket is
149.Dv NULL
150then default
151.Pa /var/run/sdp
152path will be used.
153.Pp
154The
155.Fn sdp_close
156function terminates active SDP session and deletes SDP session object.
157The
157.Vt xs
158.Fa xs
158parameter should point to a valid SDP session object created with
159.Fn sdp_open
160or
161.Fn sdp_open_local .
162.Pp
163The
164.Fn sdp_error
165function returns last error that is stored inside SDP session object.
166The
159parameter should point to a valid SDP session object created with
160.Fn sdp_open
161or
162.Fn sdp_open_local .
163.Pp
164The
165.Fn sdp_error
166function returns last error that is stored inside SDP session object.
167The
167.Vt xs
168.Fa xs
168parameter should point to a valid SDP session object created with
169.Fn sdp_open
170or
171.Fn sdp_open_local .
172The error value returned can be converted to a human readable message by
173calling
174.Xr strerror 3
175function.
176.Pp
177The
178.Fn sdp_search
179function is used to perform SDP Service Search Attribute Request.
180The
169parameter should point to a valid SDP session object created with
170.Fn sdp_open
171or
172.Fn sdp_open_local .
173The error value returned can be converted to a human readable message by
174calling
175.Xr strerror 3
176function.
177.Pp
178The
179.Fn sdp_search
180function is used to perform SDP Service Search Attribute Request.
181The
181.Vt xs
182.Fa xs
182parameter should point to a valid SDP session object created with
183.Fn sdp_open
184or
185.Fn sdp_open_local .
186The
183parameter should point to a valid SDP session object created with
184.Fn sdp_open
185or
186.Fn sdp_open_local .
187The
187.Vt pp
188.Fa pp
188parameter is a Service Search Pattern - an array of one or more Service
189Class IDs.
190The maximum number of Service Class IDs in the array is 12.
191The
189parameter is a Service Search Pattern - an array of one or more Service
190Class IDs.
191The maximum number of Service Class IDs in the array is 12.
192The
192.Vt plen
193.Fa plen
193parameter is the length of the Service Search pattern.
194The
194parameter is the length of the Service Search pattern.
195The
195.Vt ap
196parameter is a Attribute ID Range List - an array of one or more SDP Attribute
196.Fa ap
197parameter is an Attribute ID Range List - an array of one or more SDP Attribute
197ID Range.
198Each attribute ID Range is encoded as a 32-bit unsigned integer data
199element, where the high order 16 bits are interpreted as the beginning
200attribute ID of the range and the low order 16 bits are interpreted as the
201ending attribute ID of the range.
202The attribute IDs contained in the Attribute ID Ranges List must be listed in
203ascending order without duplication of any attribute ID values.
204Note that all attributes may be requested by specifying a range of
2050x0000-0xFFFF.
206The
198ID Range.
199Each attribute ID Range is encoded as a 32-bit unsigned integer data
200element, where the high order 16 bits are interpreted as the beginning
201attribute ID of the range and the low order 16 bits are interpreted as the
202ending attribute ID of the range.
203The attribute IDs contained in the Attribute ID Ranges List must be listed in
204ascending order without duplication of any attribute ID values.
205Note that all attributes may be requested by specifying a range of
2060x0000-0xFFFF.
207The
207.Vt alen
208.Fa alen
208parameter is the length of the Attribute ID Ranges List.
209The
210.Fn SDP_ATTR_RANGE "lo" "hi"
211macro can be used to prepare Attribute ID Range.
212The
209parameter is the length of the Attribute ID Ranges List.
210The
211.Fn SDP_ATTR_RANGE "lo" "hi"
212macro can be used to prepare Attribute ID Range.
213The
213.Vt vp
214.Fa vp
214parameter should be an array of
215.Vt sdp_attr_t
216structures.
217Each
218.Vt sdp_attr_t
219structure describes single SDP attribute and defined as follows:
220.Bd -literal -offset indent
221struct sdp_attr {

--- 9 unchanged lines hidden (view full) ---

231typedef struct sdp_attr * sdp_attr_p;
232.Ed
233.Pp
234The caller of the
235.Fn sdp_search
236function is expected to prepare the array of
237.Vt sdp_attr
238structures and for each element of the array both
215parameter should be an array of
216.Vt sdp_attr_t
217structures.
218Each
219.Vt sdp_attr_t
220structure describes single SDP attribute and defined as follows:
221.Bd -literal -offset indent
222struct sdp_attr {

--- 9 unchanged lines hidden (view full) ---

232typedef struct sdp_attr * sdp_attr_p;
233.Ed
234.Pp
235The caller of the
236.Fn sdp_search
237function is expected to prepare the array of
238.Vt sdp_attr
239structures and for each element of the array both
239.Vt vlen
240.Va vlen
240and
241and
241.Vt value
242.Va value
242must be set.
243The
244.Fn sdp_search
245function will fill each
246.Vt sdp_attr_t
247structure with attribute and value, i.e., it will set
243must be set.
244The
245.Fn sdp_search
246function will fill each
247.Vt sdp_attr_t
248structure with attribute and value, i.e., it will set
248.Vt flags ,
249.Vt attr
249.Va flags ,
250.Va attr
250and
251and
251.Vt vlen
252.Va vlen
252fields.
253The actual value of the attribute will be copied into
253fields.
254The actual value of the attribute will be copied into
254.Vt value
255.Va value
255buffer.
256Note: attributes are returned in the order they appear in the Service Search
257Attribute Response.
258SDP server could return several attributes for the same record.
259In this case the order of the attributes will be: all attributes for the first
260records, then all attributes for the secord record etc.
261.Pp
262The
263.Fn sdp_attr2desc
264and
265.Fn sdp_uuid2desc
266functions each take a numeric attribute ID/UUID value and convert it to a
267human readable description.
268.Pp
269The
270.Fn sdp_register_service
256buffer.
257Note: attributes are returned in the order they appear in the Service Search
258Attribute Response.
259SDP server could return several attributes for the same record.
260In this case the order of the attributes will be: all attributes for the first
261records, then all attributes for the secord record etc.
262.Pp
263The
264.Fn sdp_attr2desc
265and
266.Fn sdp_uuid2desc
267functions each take a numeric attribute ID/UUID value and convert it to a
268human readable description.
269.Pp
270The
271.Fn sdp_register_service
272function
271is used to register service with the local SDP server.
272The
273is used to register service with the local SDP server.
274The
273.Vt xss
275.Fa xss
274parameter should point to a valid SDP session object obtained from
275.Fn sdp_open_local .
276The
276parameter should point to a valid SDP session object obtained from
277.Fn sdp_open_local .
278The
277.Vt uuid
279.Fa uuid
278parameter is a SDP Service Class ID for the service to be registered.
279The
280parameter is a SDP Service Class ID for the service to be registered.
281The
280.Vt bdaddr
282.Fa bdaddr
281parameter should point to a valid BD_ADDR.
282The service will be only advertised if request was received by the local device
283with
283parameter should point to a valid BD_ADDR.
284The service will be only advertised if request was received by the local device
285with
284.Vt bdaddr .
286.Fa bdaddr .
285If
287If
286.Vt bdaddr
288.Fa bdaddr
287is set to
288.Dv NG_HCI_BDADDR_ANY
289then the service will be advertised to any remote devices that queries for it.
290The
289is set to
290.Dv NG_HCI_BDADDR_ANY
291then the service will be advertised to any remote devices that queries for it.
292The
291.Vt data
293.Fa data
292and
294and
293.Vt datalen
295.Fa datalen
294parameters specify data and size of the data for the service.
295Upon successful return
296.Fn sdp_register_service
297will populate
296parameters specify data and size of the data for the service.
297Upon successful return
298.Fn sdp_register_service
299will populate
298.Vt handle
300.Fa handle
299with the SDP record handle.
300This parameter is optional and can be set to
301.Dv NULL .
302.Pp
303The
304.Fn sdp_unregister_service
301with the SDP record handle.
302This parameter is optional and can be set to
303.Dv NULL .
304.Pp
305The
306.Fn sdp_unregister_service
307function
305is used to unregister service with the local SDP server.
306The
308is used to unregister service with the local SDP server.
309The
307.Vt xss
310.Fa xss
308parameter should point to a valid SDP session object obtained from
309.Fn sdp_open_local .
310The
311parameter should point to a valid SDP session object obtained from
312.Fn sdp_open_local .
313The
311.Vt handle
314.Fa handle
312parameter should contain a valid SDP record handle of the service to be
313unregistered.
314.Pp
315The
316.Fn sdp_change_service
317function is used to change data associated with the existing service on
318the local SDP server.
319The
315parameter should contain a valid SDP record handle of the service to be
316unregistered.
317.Pp
318The
319.Fn sdp_change_service
320function is used to change data associated with the existing service on
321the local SDP server.
322The
320.Vt xss
323.Fa xss
321parameter should point to a valid SDP session object obtained from
322.Fn sdp_open_local .
323The
324parameter should point to a valid SDP session object obtained from
325.Fn sdp_open_local .
326The
324.Vt handle
327.Fa handle
325parameter should contain a valid SDP record handle of the service to be changed.
326The
328parameter should contain a valid SDP record handle of the service to be changed.
329The
327.Vt data
330.Fa data
328and
331and
329.Vt datalen
332.Fa datalen
330parameters specify data and size of the data for the service.
331.Sh CAVEAT
332When registering services with the local SDP server the application must
333keep the SDP session open.
334If SDP session is closed then the local SDP server will remove all services
335that were registered over the session.
336The application is allowed to change or unregister service if it was registered
337over the same session.

--- 63 unchanged lines hidden ---
333parameters specify data and size of the data for the service.
334.Sh CAVEAT
335When registering services with the local SDP server the application must
336keep the SDP session open.
337If SDP session is closed then the local SDP server will remove all services
338that were registered over the session.
339The application is allowed to change or unregister service if it was registered
340over the same session.

--- 63 unchanged lines hidden ---