CVS commit: src/lib/libbluetooth
Module Name:src Committed By: rillig Date: Tue Jun 18 05:13:58 UTC 2024 Modified Files: src/lib/libbluetooth: bluetooth.c Log Message: libbluetooth: constify result of strchr lint warned: > call to 'strchr' effectively discards 'const' from argument [346] No binary change. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/bluetooth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bluetooth.c diff -u src/lib/libbluetooth/bluetooth.c:1.1 src/lib/libbluetooth/bluetooth.c:1.2 --- src/lib/libbluetooth/bluetooth.c:1.1 Mon Jun 19 15:44:36 2006 +++ src/lib/libbluetooth/bluetooth.c Tue Jun 18 05:13:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: bluetooth.c,v 1.1 2006/06/19 15:44:36 gdamore Exp $ */ +/* $NetBSD: bluetooth.c,v 1.2 2024/06/18 05:13:58 rillig Exp $ */ /* * bluetooth.c @@ -27,12 +27,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bluetooth.c,v 1.1 2006/06/19 15:44:36 gdamore Exp $ + * $Id: bluetooth.c,v 1.2 2024/06/18 05:13:58 rillig Exp $ * $FreeBSD: src/lib/libbluetooth/bluetooth.c,v 1.2 2004/03/05 08:10:17 markm Exp $ */ #include -__RCSID("$NetBSD: bluetooth.c,v 1.1 2006/06/19 15:44:36 gdamore Exp $"); +__RCSID("$NetBSD: bluetooth.c,v 1.2 2024/06/18 05:13:58 rillig Exp $"); #include #include @@ -291,7 +291,7 @@ int bt_aton(char const *str, bdaddr_t *ba) { int i, b; - char *end = NULL; + const char *end; memset(ba, 0, sizeof(*ba));
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: rillig Date: Tue Jun 18 05:13:58 UTC 2024 Modified Files: src/lib/libbluetooth: bluetooth.c Log Message: libbluetooth: constify result of strchr lint warned: > call to 'strchr' effectively discards 'const' from argument [346] No binary change. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/bluetooth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: christos Date: Thu Oct 3 17:10:16 UTC 2019 Modified Files: src/lib/libbluetooth: bt_dev.c Log Message: Use strlcpy to NUL terminate the name string here. The kernel already uses strlcpy() to set values in this field. We leave the kernel's strncmp() alone to maintain compatibility. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/bt_dev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: christos Date: Thu Oct 3 17:10:16 UTC 2019 Modified Files: src/lib/libbluetooth: bt_dev.c Log Message: Use strlcpy to NUL terminate the name string here. The kernel already uses strlcpy() to set values in this field. We leave the kernel's strncmp() alone to maintain compatibility. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/bt_dev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bt_dev.c diff -u src/lib/libbluetooth/bt_dev.c:1.3 src/lib/libbluetooth/bt_dev.c:1.4 --- src/lib/libbluetooth/bt_dev.c:1.3 Mon Nov 22 14:59:04 2010 +++ src/lib/libbluetooth/bt_dev.c Thu Oct 3 13:10:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: bt_dev.c,v 1.3 2010/11/22 19:59:04 plunky Exp $ */ +/* $NetBSD: bt_dev.c,v 1.4 2019/10/03 17:10:16 christos Exp $ */ /*- * Copyright (c) 2009 Iain Hibbert @@ -59,7 +59,7 @@ */ #include -__RCSID("$NetBSD: bt_dev.c,v 1.3 2010/11/22 19:59:04 plunky Exp $"); +__RCSID("$NetBSD: bt_dev.c,v 1.4 2019/10/03 17:10:16 christos Exp $"); #include #include @@ -92,7 +92,7 @@ bt_devaddr(const char *name, bdaddr_t *a return bt_devname(NULL, addr); memset(, 0, sizeof(btr)); - strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE); + strlcpy(btr.btr_name, name, HCI_DEVNAME_SIZE); s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); if (s == -1) @@ -781,7 +781,7 @@ bt__devinfo(int s, const char *name, str struct btreq btr; memset(, 0, sizeof(btr)); - strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE); + strlcpy(btr.btr_name, name, HCI_DEVNAME_SIZE); if (ioctl(s, SIOCGBTINFO, ) == -1) return -1;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Fri Jan 22 08:51:40 UTC 2016 Modified Files: src/lib/libbluetooth: bt_dev.3 Log Message: correct comment in literal section To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/bt_dev.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bt_dev.3 diff -u src/lib/libbluetooth/bt_dev.3:1.3 src/lib/libbluetooth/bt_dev.3:1.4 --- src/lib/libbluetooth/bt_dev.3:1.3 Tue Oct 25 09:33:55 2011 +++ src/lib/libbluetooth/bt_dev.3 Fri Jan 22 08:51:40 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: bt_dev.3,v 1.3 2011/10/25 09:33:55 plunky Exp $ +.\" $NetBSD: bt_dev.3,v 1.4 2016/01/22 08:51:40 plunky Exp $ .\" .\" Copyright (c) 2009 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -155,7 +155,7 @@ structure contains at least the followin /* flow control */ uint16_tcmd_free; /* available CMD packet buffers */ uint16_tacl_free; /* available ACL packet buffers */ -uint16_tsco_free; /* available ACL packet buffers */ +uint16_tsco_free; /* available SCO packet buffers */ /* statistics */ uint32_tcmd_sent;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Fri Jan 22 08:51:40 UTC 2016 Modified Files: src/lib/libbluetooth: bt_dev.3 Log Message: correct comment in literal section To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/bt_dev.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Nov 28 07:47:30 UTC 2015 Modified Files: src/lib/libbluetooth: bluetooth.3 Log Message: fix spelling Multiplexor->Multiplexer To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libbluetooth/bluetooth.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Nov 28 07:47:30 UTC 2015 Modified Files: src/lib/libbluetooth: bluetooth.3 Log Message: fix spelling Multiplexor->Multiplexer To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libbluetooth/bluetooth.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bluetooth.3 diff -u src/lib/libbluetooth/bluetooth.3:1.7 src/lib/libbluetooth/bluetooth.3:1.8 --- src/lib/libbluetooth/bluetooth.3:1.7 Tue Mar 18 18:20:37 2014 +++ src/lib/libbluetooth/bluetooth.3 Sat Nov 28 07:47:30 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: bluetooth.3,v 1.7 2014/03/18 18:20:37 riastradh Exp $ +.\" $NetBSD: bluetooth.3,v 1.8 2015/11/28 07:47:30 plunky Exp $ .\" .\" Copyright (c) 2003 Maksim Yevmenkin.\" All rights reserved. @@ -134,7 +134,7 @@ and .Fn bt_getprotobynumber functions each return a pointer to an object with the .Vt protoent -structure describing a Bluetooth Protocol Service Multiplexor referenced +structure describing a Bluetooth Protocol Service Multiplexer referenced by name or number, respectively. .Pp The @@ -143,13 +143,13 @@ argument passed to .Fn bt_getprotobyname should point to a .Dv NUL Ns -terminated -Bluetooth Protocol Service Multiplexor name. +Bluetooth Protocol Service Multiplexer name. The .Fa proto argument passed to .Fn bt_getprotobynumber should have numeric value of the desired Bluetooth Protocol Service -Multiplexor. +Multiplexer. .Pp The structure returned contains the information obtained from a line in .Pa /etc/bluetooth/protocols
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Tue Mar 31 09:26:45 UTC 2015 Modified Files: src/lib/libbluetooth: sdp_data.3 Log Message: fix typo: sdp_seq_seq-sdp_set_seq To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/lib/libbluetooth/sdp_data.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Tue Mar 31 09:26:45 UTC 2015 Modified Files: src/lib/libbluetooth: sdp_data.3 Log Message: fix typo: sdp_seq_seq-sdp_set_seq To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/lib/libbluetooth/sdp_data.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_data.3 diff -u src/lib/libbluetooth/sdp_data.3:1.8 src/lib/libbluetooth/sdp_data.3:1.9 --- src/lib/libbluetooth/sdp_data.3:1.8 Thu Mar 15 19:04:46 2012 +++ src/lib/libbluetooth/sdp_data.3 Tue Mar 31 09:26:45 2015 @@ -1,4 +1,4 @@ -.\ $NetBSD: sdp_data.3,v 1.8 2012/03/15 19:04:46 njoly Exp $ +.\ $NetBSD: sdp_data.3,v 1.9 2015/03/31 09:26:45 plunky Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -375,7 +375,7 @@ But, because the value of is unknown, the overall length of the ProtocolDataList may vary depending if 8, 16 or 32 bits were needed to represent the original buffer size. -.Fn sdp_seq_seq +.Fn sdp_set_seq will only modify the content, not the size of the header. .Sh SEE ALSO .Xr sdpquery 1 ,
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: joerg Date: Thu Mar 22 23:46:49 UTC 2012 Modified Files: src/lib/libbluetooth: sdp_data.c Log Message: Use __printflike. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_data.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_data.c diff -u src/lib/libbluetooth/sdp_data.c:1.3 src/lib/libbluetooth/sdp_data.c:1.4 --- src/lib/libbluetooth/sdp_data.c:1.3 Thu Sep 15 17:51:57 2011 +++ src/lib/libbluetooth/sdp_data.c Thu Mar 22 23:46:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_data.c,v 1.3 2011/09/15 17:51:57 plunky Exp $ */ +/* $NetBSD: sdp_data.c,v 1.4 2012/03/22 23:46:49 joerg Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_data.c,v 1.3 2011/09/15 17:51:57 plunky Exp $); +__RCSID($NetBSD: sdp_data.c,v 1.4 2012/03/22 23:46:49 joerg Exp $); #include sdp.h #include stdarg.h @@ -325,7 +325,7 @@ sdp_data_valid(const sdp_data_t *data) * * print out a SDP data element list in human readable format */ -static void +static __printflike(3, 4) void _sdp_put(int indent, const char *type, const char *fmt, ...) { va_list ap;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: joerg Date: Thu Mar 22 23:46:49 UTC 2012 Modified Files: src/lib/libbluetooth: sdp_data.c Log Message: Use __printflike. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_data.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Tue Oct 25 09:33:55 UTC 2011 Modified Files: src/lib/libbluetooth: bluetooth.3 bt_dev.3 Log Message: remove trailing comma in NAME section To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libbluetooth/bluetooth.3 cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/bt_dev.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bluetooth.3 diff -u src/lib/libbluetooth/bluetooth.3:1.4 src/lib/libbluetooth/bluetooth.3:1.5 --- src/lib/libbluetooth/bluetooth.3:1.4 Mon Aug 3 15:59:42 2009 +++ src/lib/libbluetooth/bluetooth.3 Tue Oct 25 09:33:55 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: bluetooth.3,v 1.4 2009/08/03 15:59:42 plunky Exp $ +.\ $NetBSD: bluetooth.3,v 1.5 2011/10/25 09:33:55 plunky Exp $ .\ .\ Copyright (c) 2003 Maksim Yevmenkin m_evmen...@yahoo.com .\ All rights reserved. @@ -26,7 +26,7 @@ .\ .\ $FreeBSD: src/lib/libbluetooth/bluetooth.3,v 1.7 2005/01/21 10:26:11 ru Exp $ .\ -.Dd August 3, 2009 +.Dd October 25, 2011 .Dt BLUETOOTH 3 .Os .Sh NAME @@ -41,7 +41,7 @@ .Nm bt_setprotoent , .Nm bt_endprotoent , .Nm bt_aton , -.Nm bt_ntoa , +.Nm bt_ntoa .Nd Bluetooth host lookup routines .Sh LIBRARY .Lb libbluetooth Index: src/lib/libbluetooth/bt_dev.3 diff -u src/lib/libbluetooth/bt_dev.3:1.2 src/lib/libbluetooth/bt_dev.3:1.3 --- src/lib/libbluetooth/bt_dev.3:1.2 Mon Aug 3 22:13:47 2009 +++ src/lib/libbluetooth/bt_dev.3 Tue Oct 25 09:33:55 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: bt_dev.3,v 1.2 2009/08/03 22:13:47 wiz Exp $ +.\ $NetBSD: bt_dev.3,v 1.3 2011/10/25 09:33:55 plunky Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -24,7 +24,7 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd August 3, 2009 +.Dd October 25, 2011 .Dt BT_DEV 3 .Os .Sh NAME @@ -43,7 +43,7 @@ .Nm bt_devfilter_evt_set , .Nm bt_devfilter_evt_clr , .Nm bt_devfilter_evt_tst , -.Nm bt_devinquiry , +.Nm bt_devinquiry .Nd Bluetooth device access routines .Sh LIBRARY .Lb libbluetooth
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Tue Oct 25 09:33:55 UTC 2011 Modified Files: src/lib/libbluetooth: bluetooth.3 bt_dev.3 Log Message: remove trailing comma in NAME section To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libbluetooth/bluetooth.3 cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/bt_dev.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Thu Sep 15 17:51:57 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_data.c Log Message: when printing URLs, don't use VIS_HTTPSTYLE as it doesn't really do what I expected. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_data.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_data.c diff -u src/lib/libbluetooth/sdp_data.c:1.2 src/lib/libbluetooth/sdp_data.c:1.3 --- src/lib/libbluetooth/sdp_data.c:1.2 Thu Jul 7 10:44:50 2011 +++ src/lib/libbluetooth/sdp_data.c Thu Sep 15 17:51:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_data.c,v 1.2 2011/07/07 10:44:50 plunky Exp $ */ +/* $NetBSD: sdp_data.c,v 1.3 2011/09/15 17:51:57 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_data.c,v 1.2 2011/07/07 10:44:50 plunky Exp $); +__RCSID($NetBSD: sdp_data.c,v 1.3 2011/09/15 17:51:57 plunky Exp $); #include sdp.h #include stdarg.h @@ -345,10 +345,10 @@ } static void -_sdp_putstr(int indent, int style, const char *type, -const uint8_t *str, size_t len) +_sdp_putstr(int indent, const char *type, const uint8_t *str, size_t len) { char buf[50], *dst = buf; + int style; indent = printf(%*s%s(%zu), indent, , type, len); indent = 18 - indent; @@ -357,7 +357,7 @@ printf(%*s, indent, ); - style |= VIS_NL; + style = VIS_CSTYLE | VIS_NL; buf[0] = '\0'; while (len 0 (dst + 5) (buf + sizeof(buf))) { @@ -540,7 +540,7 @@ if (next + len end) return false; - _sdp_putstr(indent, VIS_CSTYLE, str8, next, len); + _sdp_putstr(indent, str8, next, len); next += len; break; @@ -554,7 +554,7 @@ if (next + len end) return false; - _sdp_putstr(indent, VIS_HTTPSTYLE, url8, next, len); + _sdp_putstr(indent, url8, next, len); next += len; break; @@ -568,7 +568,7 @@ if (next + len end) return false; - _sdp_putstr(indent, VIS_CSTYLE, str16, next, len); + _sdp_putstr(indent, str16, next, len); next += len; break; @@ -582,7 +582,7 @@ if (next + len end) return false; - _sdp_putstr(indent, VIS_HTTPSTYLE, url16, next, len); + _sdp_putstr(indent, url16, next, len); next += len; break; @@ -596,7 +596,7 @@ if (next + len end) return false; - _sdp_putstr(indent, VIS_CSTYLE, str32, next, len); + _sdp_putstr(indent, str32, next, len); next += len; break; @@ -610,7 +610,7 @@ if (next + len end) return false; - _sdp_putstr(indent, VIS_HTTPSTYLE, url32, next, len); + _sdp_putstr(indent, url32, next, len); next += len; break;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Thu Sep 15 17:51:57 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_data.c Log Message: when printing URLs, don't use VIS_HTTPSTYLE as it doesn't really do what I expected. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_data.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Thu Jul 7 10:44:51 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_data.c Log Message: ensure that the buffer is nul-terminated, otherwise printing an empty string will show junk.. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/sdp_data.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_data.c diff -u src/lib/libbluetooth/sdp_data.c:1.1 src/lib/libbluetooth/sdp_data.c:1.2 --- src/lib/libbluetooth/sdp_data.c:1.1 Tue May 12 10:05:06 2009 +++ src/lib/libbluetooth/sdp_data.c Thu Jul 7 10:44:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_data.c,v 1.1 2009/05/12 10:05:06 plunky Exp $ */ +/* $NetBSD: sdp_data.c,v 1.2 2011/07/07 10:44:50 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_data.c,v 1.1 2009/05/12 10:05:06 plunky Exp $); +__RCSID($NetBSD: sdp_data.c,v 1.2 2011/07/07 10:44:50 plunky Exp $); #include sdp.h #include stdarg.h @@ -358,6 +358,7 @@ printf(%*s, indent, ); style |= VIS_NL; + buf[0] = '\0'; while (len 0 (dst + 5) (buf + sizeof(buf))) { dst = vis(dst, str[0], style, (len 0 ? str[1] : 0));
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Thu Jul 7 10:44:51 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_data.c Log Message: ensure that the buffer is nul-terminated, otherwise printing an empty string will show junk.. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/sdp_data.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Apr 16 07:19:37 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_put.c Log Message: when placing an attribute/value pair, validate that the value given is a single data element To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libbluetooth/sdp_put.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_put.c diff -u src/lib/libbluetooth/sdp_put.c:1.5 src/lib/libbluetooth/sdp_put.c:1.6 --- src/lib/libbluetooth/sdp_put.c:1.5 Tue Apr 5 18:19:04 2011 +++ src/lib/libbluetooth/sdp_put.c Sat Apr 16 07:19:36 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_put.c,v 1.5 2011/04/05 18:19:04 plunky Exp $ */ +/* $NetBSD: sdp_put.c,v 1.6 2011/04/16 07:19:36 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_put.c,v 1.5 2011/04/05 18:19:04 plunky Exp $); +__RCSID($NetBSD: sdp_put.c,v 1.6 2011/04/16 07:19:36 plunky Exp $); #include bluetooth.h #include limits.h @@ -65,6 +65,7 @@ sdp_data_t d = *data; if (!sdp_put_uint16(d, attr) + || sdp_data_size(value) != (value-end - value-next) || !sdp_put_data(d, value)) return false;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Tue Apr 5 18:19:04 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_put.c sdp_set.c Log Message: Don't add the passed in 'len' value while testing if the data space is large enough, to handle the edge case where len is large (up to SSIZE_MAX may be valid on some machines) causing pointers to wrap around and the fail condition to be missed. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libbluetooth/sdp_put.c cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_put.c diff -u src/lib/libbluetooth/sdp_put.c:1.4 src/lib/libbluetooth/sdp_put.c:1.5 --- src/lib/libbluetooth/sdp_put.c:1.4 Mon Apr 4 19:51:33 2011 +++ src/lib/libbluetooth/sdp_put.c Tue Apr 5 18:19:04 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_put.c,v 1.4 2011/04/04 19:51:33 plunky Exp $ */ +/* $NetBSD: sdp_put.c,v 1.5 2011/04/05 18:19:04 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_put.c,v 1.4 2011/04/04 19:51:33 plunky Exp $); +__RCSID($NetBSD: sdp_put.c,v 1.5 2011/04/05 18:19:04 plunky Exp $); #include bluetooth.h #include limits.h @@ -51,7 +51,7 @@ len = value-end - value-next; - if (data-next + len data-end) + if (len data-end - data-next) return false; memcpy(data-next, value-next, (size_t)len); @@ -304,21 +304,21 @@ return false; if ((size_t)len UINT16_MAX) { - if (p + 5 + len data-end) + if (len data-end - 5 - p) return false; p[0] = type | SDP_DATA_EXT32; be32enc(p + 1, (uint32_t)len); p += 5; } else if ((size_t)len UINT8_MAX) { - if (p + 3 + len data-end) + if (len data-end - 3 - p) return false; p[0] = type | SDP_DATA_EXT16; be16enc(p + 1, (uint16_t)len); p += 3; } else { - if (p + 2 + len data-end) + if (len data-end - 2 - p) return false; p[0] = type | SDP_DATA_EXT8; Index: src/lib/libbluetooth/sdp_set.c diff -u src/lib/libbluetooth/sdp_set.c:1.2 src/lib/libbluetooth/sdp_set.c:1.3 --- src/lib/libbluetooth/sdp_set.c:1.2 Thu May 14 19:12:45 2009 +++ src/lib/libbluetooth/sdp_set.c Tue Apr 5 18:19:04 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_set.c,v 1.2 2009/05/14 19:12:45 plunky Exp $ */ +/* $NetBSD: sdp_set.c,v 1.3 2011/04/05 18:19:04 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_set.c,v 1.2 2009/05/14 19:12:45 plunky Exp $); +__RCSID($NetBSD: sdp_set.c,v 1.3 2011/04/05 18:19:04 plunky Exp $); #include bluetooth.h #include limits.h @@ -187,7 +187,7 @@ return false; len = data-end - p - 1; - } else if (p + 1 + len data-end) + } else if (len data-end - 1 - p) return false; if (len UINT8_MAX) @@ -202,7 +202,7 @@ return false; len = data-end - p - 2; - } else if (p + 2 + len data-end) + } else if (len data-end - 2 - p) return false; if (len UINT16_MAX) @@ -217,7 +217,7 @@ return false; len = data-end - p - 4; - } else if (p + 4 + len data-end) + } else if (len data-end - 4 - p) return false; if ((size_t)len UINT32_MAX)
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Tue Apr 5 18:58:43 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_set.c Log Message: inc pointer, so we store the value in the correct place To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_set.c diff -u src/lib/libbluetooth/sdp_set.c:1.3 src/lib/libbluetooth/sdp_set.c:1.4 --- src/lib/libbluetooth/sdp_set.c:1.3 Tue Apr 5 18:19:04 2011 +++ src/lib/libbluetooth/sdp_set.c Tue Apr 5 18:58:43 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_set.c,v 1.3 2011/04/05 18:19:04 plunky Exp $ */ +/* $NetBSD: sdp_set.c,v 1.4 2011/04/05 18:58:43 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_set.c,v 1.3 2011/04/05 18:19:04 plunky Exp $); +__RCSID($NetBSD: sdp_set.c,v 1.4 2011/04/05 18:58:43 plunky Exp $); #include bluetooth.h #include limits.h @@ -48,7 +48,7 @@ uint8_t *p = data-next; if (p + 2 data-end - || *p != SDP_DATA_BOOL) + || *p++ != SDP_DATA_BOOL) return false; *p = (value ? 0x01 : 0x00);
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Tue Apr 5 18:19:04 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_put.c sdp_set.c Log Message: Don't add the passed in 'len' value while testing if the data space is large enough, to handle the edge case where len is large (up to SSIZE_MAX may be valid on some machines) causing pointers to wrap around and the fail condition to be missed. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libbluetooth/sdp_put.c cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Tue Apr 5 18:58:43 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_set.c Log Message: inc pointer, so we store the value in the correct place To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/lib/libbluetooth
On Mon, 04 Apr 2011, Iain Hibbert wrote: Modified Files: src/lib/libbluetooth: sdp_get.c Log Message: handle overflowed values correctly, also put a compile time guard to warn if INTMAX won't fit in INT64 (all our ports currently have INTMAX = INT64) The actual code tests #if INTMAX_MAX INT64_MAX which is the reverse of what the commit log says, and it's guaranteed by the C99 standard to never be true. (intmax_t is guaranteed to be at least 64 bits, and is guarantted to be the largest integral type.) --apb (Alan Barrett)
Re: CVS commit: src/lib/libbluetooth
On Mon, 4 Apr 2011, Alan Barrett wrote: On Mon, 04 Apr 2011, Iain Hibbert wrote: Modified Files: src/lib/libbluetooth: sdp_get.c Log Message: handle overflowed values correctly, also put a compile time guard to warn if INTMAX won't fit in INT64 (all our ports currently have INTMAX = INT64) The actual code tests #if INTMAX_MAX INT64_MAX which is the reverse of what the commit log says, and it's guaranteed by the C99 standard to never be true. (intmax_t is guaranteed to be at least 64 bits, and is guarantted to be the largest integral type.) Sorry, the code test was correct though I did not see the bit about 64-bit being minimum spec for intmax types (section 7.18.2.5), so the guard is redundant and I will remove it iain
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Mon Apr 4 16:19:25 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_get.c Log Message: handle overflowed values correctly, also put a compile time guard to warn if INTMAX won't fit in INT64 (all our ports currently have INTMAX = INT64) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/sdp_get.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_get.c diff -u src/lib/libbluetooth/sdp_get.c:1.1 src/lib/libbluetooth/sdp_get.c:1.2 --- src/lib/libbluetooth/sdp_get.c:1.1 Tue May 12 10:05:06 2009 +++ src/lib/libbluetooth/sdp_get.c Mon Apr 4 16:19:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_get.c,v 1.1 2009/05/12 10:05:06 plunky Exp $ */ +/* $NetBSD: sdp_get.c,v 1.2 2011/04/04 16:19:25 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,11 +30,15 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_get.c,v 1.1 2009/05/12 10:05:06 plunky Exp $); +__RCSID($NetBSD: sdp_get.c,v 1.2 2011/04/04 16:19:25 plunky Exp $); #include sdp.h #include limits.h +#if INTMAX_MAX INT64_MAX +#warning INTMAX type is not large enough to hold INT64 values +#endif + /** * sdp_get_(data, value) * @@ -188,9 +192,6 @@ return false; v = be64dec(p); - if (v UINTMAX_MAX) - return false; - p += 8; break; @@ -200,7 +201,7 @@ x = be64dec(p); v = be64dec(p + 8); - if (x != 0 || v UINTMAX_MAX) + if (x != 0) return false; p += 16; @@ -254,9 +255,6 @@ return false; v = (int64_t)be64dec(p); - if (v INTMAX_MAX || v INTMAX_MIN) - return false; - p += 8; break; @@ -267,10 +265,10 @@ x = (int64_t)be64dec(p); v = (int64_t)be64dec(p + 8); if (x == 0) { - if (v INTMAX_MAX) + if (v 0) return false; } else if (x == -1) { - if (v INTMAX_MIN) + if (v = 0) return false; } else { return false;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Mon Apr 4 18:29:48 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_get.c Log Message: remove compile time guard from previous commit, it is not needed (C99 guarantees [u]intmax types are at least 64-bits) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_get.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_get.c diff -u src/lib/libbluetooth/sdp_get.c:1.2 src/lib/libbluetooth/sdp_get.c:1.3 --- src/lib/libbluetooth/sdp_get.c:1.2 Mon Apr 4 16:19:25 2011 +++ src/lib/libbluetooth/sdp_get.c Mon Apr 4 18:29:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_get.c,v 1.2 2011/04/04 16:19:25 plunky Exp $ */ +/* $NetBSD: sdp_get.c,v 1.3 2011/04/04 18:29:47 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,15 +30,11 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_get.c,v 1.2 2011/04/04 16:19:25 plunky Exp $); +__RCSID($NetBSD: sdp_get.c,v 1.3 2011/04/04 18:29:47 plunky Exp $); #include sdp.h #include limits.h -#if INTMAX_MAX INT64_MAX -#warning INTMAX type is not large enough to hold INT64 values -#endif - /** * sdp_get_(data, value) *
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Mon Apr 4 19:51:33 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_put.c Log Message: correct inverted logic (if sdp_put_data fails, sdp_put_attr should fail) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_put.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_put.c diff -u src/lib/libbluetooth/sdp_put.c:1.3 src/lib/libbluetooth/sdp_put.c:1.4 --- src/lib/libbluetooth/sdp_put.c:1.3 Sat Nov 13 19:43:56 2010 +++ src/lib/libbluetooth/sdp_put.c Mon Apr 4 19:51:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_put.c,v 1.3 2010/11/13 19:43:56 plunky Exp $ */ +/* $NetBSD: sdp_put.c,v 1.4 2011/04/04 19:51:33 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_put.c,v 1.3 2010/11/13 19:43:56 plunky Exp $); +__RCSID($NetBSD: sdp_put.c,v 1.4 2011/04/04 19:51:33 plunky Exp $); #include bluetooth.h #include limits.h @@ -65,7 +65,7 @@ sdp_data_t d = *data; if (!sdp_put_uint16(d, attr) - || sdp_put_data(d, value)) + || !sdp_put_data(d, value)) return false; *data = d;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Mon Apr 4 16:19:25 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_get.c Log Message: handle overflowed values correctly, also put a compile time guard to warn if INTMAX won't fit in INT64 (all our ports currently have INTMAX = INT64) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/sdp_get.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Mon Apr 4 18:29:48 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_get.c Log Message: remove compile time guard from previous commit, it is not needed (C99 guarantees [u]intmax types are at least 64-bits) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_get.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Mon Apr 4 19:51:33 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_put.c Log Message: correct inverted logic (if sdp_put_data fails, sdp_put_attr should fail) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_put.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Jan 15 11:51:26 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_data.3 Log Message: add sdp_put_[u]int64() .Fn prototypes to list To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libbluetooth/sdp_data.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_data.3 diff -u src/lib/libbluetooth/sdp_data.3:1.6 src/lib/libbluetooth/sdp_data.3:1.7 --- src/lib/libbluetooth/sdp_data.3:1.6 Thu Dec 16 10:08:27 2010 +++ src/lib/libbluetooth/sdp_data.3 Sat Jan 15 11:51:25 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: sdp_data.3,v 1.6 2010/12/16 10:08:27 wiz Exp $ +.\ $NetBSD: sdp_data.3,v 1.7 2011/01/15 11:51:25 plunky Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -27,7 +27,7 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd December 16, 2010 +.Dd January 15, 2011 .Dt SDP_DATA 3 .Os .Sh NAME @@ -123,6 +123,8 @@ .Ft bool .Fn sdp_put_uint32 sdp_data_t *data uint32_t value .Ft bool +.Fn sdp_put_uint64 sdp_data_t *data uint64_t value +.Ft bool .Fn sdp_put_int sdp_data_t *data intmax_t value .Ft bool .Fn sdp_put_int8 sdp_data_t *data int8_t value @@ -131,6 +133,8 @@ .Ft bool .Fn sdp_put_int32 sdp_data_t *data int32_t value .Ft bool +.Fn sdp_put_int64 sdp_data_t *data int64_t value +.Ft bool .Fn sdp_put_seq sdp_data_t *data ssize_t length .Ft bool .Fn sdp_put_alt sdp_data_t *data ssize_t length
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Jan 15 11:51:26 UTC 2011 Modified Files: src/lib/libbluetooth: sdp_data.3 Log Message: add sdp_put_[u]int64() .Fn prototypes to list To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libbluetooth/sdp_data.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Thu Dec 16 08:44:23 UTC 2010 Modified Files: src/lib/libbluetooth: sdp_data.3 Log Message: remove unnecessary step in example code (sdp_service_attribute() did that already) while here, start new paragraph for next example To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_data.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_data.3 diff -u src/lib/libbluetooth/sdp_data.3:1.3 src/lib/libbluetooth/sdp_data.3:1.4 --- src/lib/libbluetooth/sdp_data.3:1.3 Thu May 21 09:23:50 2009 +++ src/lib/libbluetooth/sdp_data.3 Thu Dec 16 08:44:23 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: sdp_data.3,v 1.3 2009/05/21 09:23:50 wiz Exp $ +.\ $NetBSD: sdp_data.3,v 1.4 2010/12/16 08:44:23 plunky Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -309,10 +309,6 @@ /* rsp contains remote response */ - /* discard sequence header */ - if (!sdp_get_seq(\*[Am]rsp, \*[Am]rsp)) - err(EXIT_FAILURE, response is not a sequence); - while (sdp_get_attr(\*[Am]rsp, \*[Am]attr, \*[Am]val)) { switch(attr) { case SDP_ATTR_SERVICE_RECORD_HANDLE: @@ -330,8 +326,8 @@ break; } } - .Ed +.Pp The following code creates a ProtocolDataList attribute value for a service using the L2CAP and RFCOMM protocols and illustrates how to construct sequences of known and unknown length.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Thu Dec 16 08:45:32 UTC 2010 Modified Files: src/lib/libbluetooth: sdp_data.3 Log Message: bump date for previous To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libbluetooth/sdp_data.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_data.3 diff -u src/lib/libbluetooth/sdp_data.3:1.4 src/lib/libbluetooth/sdp_data.3:1.5 --- src/lib/libbluetooth/sdp_data.3:1.4 Thu Dec 16 08:44:23 2010 +++ src/lib/libbluetooth/sdp_data.3 Thu Dec 16 08:45:32 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: sdp_data.3,v 1.4 2010/12/16 08:44:23 plunky Exp $ +.\ $NetBSD: sdp_data.3,v 1.5 2010/12/16 08:45:32 plunky Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -27,7 +27,7 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd May 7, 2009 +.Dd Dec 16, 2010 .Dt SDP_DATA 3 .Os .Sh NAME
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: wiz Date: Thu Dec 16 10:08:27 UTC 2010 Modified Files: src/lib/libbluetooth: sdp_data.3 Log Message: Use full month name in dates. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libbluetooth/sdp_data.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_data.3 diff -u src/lib/libbluetooth/sdp_data.3:1.5 src/lib/libbluetooth/sdp_data.3:1.6 --- src/lib/libbluetooth/sdp_data.3:1.5 Thu Dec 16 08:45:32 2010 +++ src/lib/libbluetooth/sdp_data.3 Thu Dec 16 10:08:27 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: sdp_data.3,v 1.5 2010/12/16 08:45:32 plunky Exp $ +.\ $NetBSD: sdp_data.3,v 1.6 2010/12/16 10:08:27 wiz Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -27,7 +27,7 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd Dec 16, 2010 +.Dd December 16, 2010 .Dt SDP_DATA 3 .Os .Sh NAME
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Mon Nov 22 19:59:04 UTC 2010 Modified Files: src/lib/libbluetooth: bt_dev.c Log Message: use cached values directly rather than querying device for features and buffer_size To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/bt_dev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bt_dev.c diff -u src/lib/libbluetooth/bt_dev.c:1.2 src/lib/libbluetooth/bt_dev.c:1.3 --- src/lib/libbluetooth/bt_dev.c:1.2 Sat Nov 13 19:43:56 2010 +++ src/lib/libbluetooth/bt_dev.c Mon Nov 22 19:59:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bt_dev.c,v 1.2 2010/11/13 19:43:56 plunky Exp $ */ +/* $NetBSD: bt_dev.c,v 1.3 2010/11/22 19:59:04 plunky Exp $ */ /*- * Copyright (c) 2009 Iain Hibbert @@ -59,7 +59,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: bt_dev.c,v 1.2 2010/11/13 19:43:56 plunky Exp $); +__RCSID($NetBSD: bt_dev.c,v 1.3 2010/11/22 19:59:04 plunky Exp $); #include sys/event.h #include sys/ioctl.h @@ -773,17 +773,12 @@ /* * Internal version of bt_devinfo. Fill in the devinfo structure - * with the socket handle provided. If the device is present and - * active, the socket will be left connected to the device. + * with the socket handle provided. */ static int bt__devinfo(int s, const char *name, struct bt_devinfo *info) { - struct sockaddr_bt sa; - struct bt_devreq req; struct btreq btr; - hci_read_buffer_size_rp bp; - hci_read_local_features_rp fp; memset(btr, 0, sizeof(btr)); strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE); @@ -801,10 +796,17 @@ info-cmd_free = btr.btr_num_cmd; info-sco_free = btr.btr_num_sco; info-acl_free = btr.btr_num_acl; + info-sco_pkts = btr.btr_max_sco; + info-acl_pkts = btr.btr_max_acl; info-link_policy_info = btr.btr_link_policy; info-packet_type_info = btr.btr_packet_type; + if (ioctl(s, SIOCGBTFEAT, btr) == -1) + return -1; + + memcpy(info-features, btr.btr_features0, HCI_FEATURES_SIZE); + if (ioctl(s, SIOCGBTSTATS, btr) == -1) return -1; @@ -817,40 +819,6 @@ info-bytes_recv = btr.btr_stats.byte_rx; info-bytes_sent = btr.btr_stats.byte_tx; - /* can only get the rest from enabled devices */ - if ((info-enabled) == 0) - return 0; - - memset(sa, 0, sizeof(sa)); - sa.bt_len = sizeof(sa); - sa.bt_family = AF_BLUETOOTH; - bdaddr_copy(sa.bt_bdaddr, info-bdaddr); - - if (bind(s, (struct sockaddr *)sa, sizeof(sa)) == -1 - || connect(s, (struct sockaddr *)sa, sizeof(sa)) == -1) - return -1; - - memset(req, 0, sizeof(req)); - req.opcode = HCI_CMD_READ_BUFFER_SIZE; - req.rparam = bp; - req.rlen = sizeof(bp); - - if (bt_devreq(s, req, 5) == -1) - return -1; - - info-acl_pkts = bp.max_acl_size; - info-sco_pkts = bp.max_sco_size; - - memset(req, 0, sizeof(req)); - req.opcode = HCI_CMD_READ_LOCAL_FEATURES; - req.rparam = fp; - req.rlen = sizeof(fp); - - if (bt_devreq(s, req, 5) == -1) - return -1; - - memcpy(info-features, fp.features, HCI_FEATURES_SIZE); - return 0; } @@ -878,6 +846,7 @@ { struct btreq btr; struct bt_devinfo info; + struct sockaddr_bt sa; int count, fd, rv, s; s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI); @@ -905,6 +874,20 @@ return -1; } + if (info.enabled) { + memset(sa, 0, sizeof(sa)); + sa.bt_len = sizeof(sa); + sa.bt_family = AF_BLUETOOTH; + bdaddr_copy(sa.bt_bdaddr, info.bdaddr); + + if (bind(fd, (struct sockaddr *)sa, sizeof(sa)) == -1 + || connect(fd, (struct sockaddr *)sa, sizeof(sa)) == -1) { +close(fd); +close(s); +return -1; + } + } + rv = (*cb)(fd, info, arg); close(fd); if (rv != 0)
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Mon Nov 22 19:59:04 UTC 2010 Modified Files: src/lib/libbluetooth: bt_dev.c Log Message: use cached values directly rather than querying device for features and buffer_size To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/bt_dev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Nov 20 12:12:21 UTC 2010 Modified Files: src/lib/libbluetooth: sdp_service.c Log Message: use atomic ops wisely To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_service.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_service.c diff -u src/lib/libbluetooth/sdp_service.c:1.3 src/lib/libbluetooth/sdp_service.c:1.4 --- src/lib/libbluetooth/sdp_service.c:1.3 Sat Nov 13 19:43:56 2010 +++ src/lib/libbluetooth/sdp_service.c Sat Nov 20 12:12:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_service.c,v 1.3 2010/11/13 19:43:56 plunky Exp $ */ +/* $NetBSD: sdp_service.c,v 1.4 2010/11/20 12:12:21 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,9 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_service.c,v 1.3 2010/11/13 19:43:56 plunky Exp $); +__RCSID($NetBSD: sdp_service.c,v 1.4 2010/11/20 12:12:21 plunky Exp $); + +#include sys/atomic.h #include errno.h #include limits.h @@ -43,6 +45,7 @@ /* * If AttributeIDList is given as NULL, request all attributes. + * (this is actually const data but we can't declare it const) */ static uint8_t ail_default[] = { 0x0a, 0x00, 0x00, 0xff, 0xff }; @@ -56,13 +59,11 @@ sdp_response_max(void) { static size_t max = UINT16_MAX; - static bool check = true; + static unsigned int check = 1; char *env, *ep; unsigned long v; - while (check) { - check = false; /* only check env once */ - + while (atomic_swap_uint(check, 0)) { /* only check env once */ env = getenv(SDP_RESPONSE_MAX); if (env == NULL) break;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Nov 20 12:12:21 UTC 2010 Modified Files: src/lib/libbluetooth: sdp_service.c Log Message: use atomic ops wisely To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/sdp_service.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Nov 13 19:43:56 UTC 2010 Modified Files: src/lib/libbluetooth: bt_dev.c sdp_put.c sdp_service.c sdp_session.c Log Message: quell some lint warnings To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/bt_dev.c cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_put.c \ src/lib/libbluetooth/sdp_service.c src/lib/libbluetooth/sdp_session.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bt_dev.c diff -u src/lib/libbluetooth/bt_dev.c:1.1 src/lib/libbluetooth/bt_dev.c:1.2 --- src/lib/libbluetooth/bt_dev.c:1.1 Mon Aug 3 15:59:42 2009 +++ src/lib/libbluetooth/bt_dev.c Sat Nov 13 19:43:56 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bt_dev.c,v 1.1 2009/08/03 15:59:42 plunky Exp $ */ +/* $NetBSD: bt_dev.c,v 1.2 2010/11/13 19:43:56 plunky Exp $ */ /*- * Copyright (c) 2009 Iain Hibbert @@ -59,7 +59,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: bt_dev.c,v 1.1 2009/08/03 15:59:42 plunky Exp $); +__RCSID($NetBSD: bt_dev.c,v 1.2 2010/11/13 19:43:56 plunky Exp $); #include sys/event.h #include sys/ioctl.h @@ -515,6 +515,7 @@ * Internal function used by bt_devinquiry to find the first * active device. */ +/* ARGSUSED */ static int bt__devany_cb(int s, const struct bt_devinfo *info, void *arg) { Index: src/lib/libbluetooth/sdp_put.c diff -u src/lib/libbluetooth/sdp_put.c:1.2 src/lib/libbluetooth/sdp_put.c:1.3 --- src/lib/libbluetooth/sdp_put.c:1.2 Thu May 14 19:12:45 2009 +++ src/lib/libbluetooth/sdp_put.c Sat Nov 13 19:43:56 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_put.c,v 1.2 2009/05/14 19:12:45 plunky Exp $ */ +/* $NetBSD: sdp_put.c,v 1.3 2010/11/13 19:43:56 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_put.c,v 1.2 2009/05/14 19:12:45 plunky Exp $); +__RCSID($NetBSD: sdp_put.c,v 1.3 2010/11/13 19:43:56 plunky Exp $); #include bluetooth.h #include limits.h @@ -354,7 +354,7 @@ if (!_sdp_put_ext(SDP_DATA_STR, data, len)) return false; - memcpy(data-next, str, len); + memcpy(data-next, str, (size_t)len); data-next += len; return true; } @@ -369,7 +369,7 @@ if (!_sdp_put_ext(SDP_DATA_URL, data, len)) return false; - memcpy(data-next, url, len); + memcpy(data-next, url, (size_t)len); data-next += len; return true; } Index: src/lib/libbluetooth/sdp_service.c diff -u src/lib/libbluetooth/sdp_service.c:1.2 src/lib/libbluetooth/sdp_service.c:1.3 --- src/lib/libbluetooth/sdp_service.c:1.2 Thu May 14 19:12:45 2009 +++ src/lib/libbluetooth/sdp_service.c Sat Nov 13 19:43:56 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_service.c,v 1.2 2009/05/14 19:12:45 plunky Exp $ */ +/* $NetBSD: sdp_service.c,v 1.3 2010/11/13 19:43:56 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_service.c,v 1.2 2009/05/14 19:12:45 plunky Exp $); +__RCSID($NetBSD: sdp_service.c,v 1.3 2010/11/13 19:43:56 plunky Exp $); #include errno.h #include limits.h @@ -193,7 +193,7 @@ || ptr + ptr[0] + 1 != end) break; - memcpy(ss-cs, ptr, ptr[0] + 1); + memcpy(ss-cs, ptr, (size_t)(ptr[0] + 1)); /* * Complete? @@ -312,7 +312,7 @@ || ptr + ptr[0] + 1 != end) break; - memcpy(ss-cs, ptr, ptr[0] + 1); + memcpy(ss-cs, ptr, (size_t)(ptr[0] + 1)); /* * Complete? @@ -448,7 +448,7 @@ || ptr + ptr[0] + 1 != end) break; - memcpy(ss-cs, ptr, ptr[0] + 1); + memcpy(ss-cs, ptr, (size_t)(ptr[0] + 1)); /* * Complete? Index: src/lib/libbluetooth/sdp_session.c diff -u src/lib/libbluetooth/sdp_session.c:1.2 src/lib/libbluetooth/sdp_session.c:1.3 --- src/lib/libbluetooth/sdp_session.c:1.2 Thu May 14 19:12:45 2009 +++ src/lib/libbluetooth/sdp_session.c Sat Nov 13 19:43:56 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_session.c,v 1.2 2009/05/14 19:12:45 plunky Exp $ */ +/* $NetBSD: sdp_session.c,v 1.3 2010/11/13 19:43:56 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_session.c,v 1.2 2009/05/14 19:12:45 plunky Exp $); +__RCSID($NetBSD: sdp_session.c,v 1.3 2010/11/13 19:43:56 plunky Exp $); #include sys/socket.h #include sys/un.h @@ -87,7 +87,7 @@ if (getsockopt(ss-s, BTPROTO_L2CAP, SO_L2CAP_IMTU, ss-imtu, len) == -1) goto fail; - ss-ibuf = malloc(ss-imtu); + ss-ibuf = malloc((size_t)(ss-imtu)); if (ss-ibuf == NULL) goto fail; @@ -127,7 +127,7 @@ ss-imtu = L2CAP_MTU_DEFAULT; - ss-ibuf = malloc(ss-imtu); + ss-ibuf = malloc((size_t)(ss-imtu)); if (ss-ibuf == NULL) goto fail;
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Sat Nov 13 19:43:56 UTC 2010 Modified Files: src/lib/libbluetooth: bt_dev.c sdp_put.c sdp_service.c sdp_session.c Log Message: quell some lint warnings To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/bt_dev.c cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp_put.c \ src/lib/libbluetooth/sdp_service.c src/lib/libbluetooth/sdp_session.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: wiz Date: Mon Aug 3 22:13:47 UTC 2009 Modified Files: src/lib/libbluetooth: bt_dev.3 Log Message: Formatting nits. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/bt_dev.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/bt_dev.3 diff -u src/lib/libbluetooth/bt_dev.3:1.1 src/lib/libbluetooth/bt_dev.3:1.2 --- src/lib/libbluetooth/bt_dev.3:1.1 Mon Aug 3 15:59:42 2009 +++ src/lib/libbluetooth/bt_dev.3 Mon Aug 3 22:13:47 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: bt_dev.3,v 1.1 2009/08/03 15:59:42 plunky Exp $ +.\ $NetBSD: bt_dev.3,v 1.2 2009/08/03 22:13:47 wiz Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -28,8 +28,8 @@ .Dt BT_DEV 3 .Os .Sh NAME -.Nm bt_devaddr, -.Nm bt_devname, +.Nm bt_devaddr , +.Nm bt_devname , .Nm bt_devenum , .Nm bt_devinfo , .Nm bt_devopen , @@ -317,7 +317,9 @@ .It Fn bt_devinquiry name timeout max_rsp iip Perform a Bluetooth Inquiry using the device .Fa name , -or the first available device if NULL is passed. +or the first available device if +.Dv NULL +is passed. The inquiry length will be .Fa timeout seconds, and the number of responses @@ -344,7 +346,7 @@ .Xr free 3 . .El .Sh RETURN VALUES -These Bluetooth device access routines return -1 on failure, and +These Bluetooth device access routines return \-1 on failure, and .Va errno will be set to indicate the error. .Sh ERRORS
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Wed May 20 17:22:56 UTC 2009 Modified Files: src/lib/libbluetooth: sdp.3 sdp_data.3 Log Message: adjust markup language according to mdoc(7) .Fafor function arguments (instead of Ar) .Vafor variable names (errno) .Ftfor structure type To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libbluetooth/sdp.3 cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/sdp_data.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp.3 diff -u src/lib/libbluetooth/sdp.3:1.2 src/lib/libbluetooth/sdp.3:1.3 --- src/lib/libbluetooth/sdp.3:1.2 Tue May 12 10:32:45 2009 +++ src/lib/libbluetooth/sdp.3 Wed May 20 17:22:56 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: sdp.3,v 1.2 2009/05/12 10:32:45 wiz Exp $ +.\ $NetBSD: sdp.3,v 1.3 2009/05/20 17:22:56 plunky Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -118,7 +118,7 @@ .Bl -tag -width .It Fn sdp_open laddr raddr Open a SDP session to a remote Bluetooth device. -.Ar laddr +.Fa laddr refers to the local bluetooth device address and may be .Dv NULL in which case it will default to @@ -126,7 +126,7 @@ .It Fn sdp_open_local control Open a SDP session to a server using a local socket. The -.Ar control +.Fa control socket path may be given as .Dv NULL in which case the default control path @@ -137,55 +137,55 @@ .It Fn sdp_service_search ss ssp handlep num Perform a complete ServiceSearch transaction on the SDP session. At most -.Ar num +.Fa num service record handles matching the ServiceSearchPattern -.Ar ssp +.Fa ssp will be returned in the array pointed to by -.Ar handlep . +.Fa handlep . .It Fn sdp_service_attribute ss handle ail response Perform a complete ServiceAttribute transaction on the SDP session. The ServiceRecord with ServiceRecordHandle -.Ar handle +.Fa handle will be parsed using the AttributeIDList -.Ar ail . +.Fa ail . If the transaction succeeds, the -.Ar response +.Fa response data buffer will contain a validated data element list of attribute ID/value pairs from the selected record. .It Fn sdp_service_search_attribute ss ssp ail response Perform a complete ServiceSearchAttribute transaction on the SDP session. All ServiceRecords matching the ServiceSearchPattern -.Ar ssp +.Fa ssp will be parsed using the AttributeIDList -.Ar ail . +.Fa ail . If the transaction succeeds, the -.Ar response +.Fa response data buffer will contain a valid data element list of sequences, where each sequence is the attribute ID/value list from a matched record. .It Fn sdp_record_insert ss bdaddr handlep record Insert a ServiceRecord -.Ar record . +.Fa record . If -.Ar bdaddr +.Fa bdaddr is given, the service record will be restricted to clients connecting through the Bluetooth controller with that BD_ADDR. When the -.Ar handlep +.Fa handlep pointer is non NULL, the resulting ServiceRecordHandle will be written to the address given. The record will be valid while the session is active and will be purged when the session is closed. .It Fn sdp_record_update ss handle record Update a ServiceRecord that is owned by this session. -.Ar handle +.Fa handle is the identifier returned by the .Fn sdp_record_insert call, and -.Ar record +.Fa record is the updated ServiceRecord as described above. .It Fn sdp_record_remove ss handle Remove a ServiceRecord owned by this session. -.Ar handle +.Fa handle is the identifier returned by the .Fn sdp_record_insert call. @@ -214,7 +214,7 @@ For service lookup and record manipulation routines, a boolean value is returned indicating success or failure. On failure, -.Ar errno +.Va errno will be set to indicate the error. .Sh FILES .Pa /var/run/sdp @@ -229,7 +229,7 @@ A response from the remote server was not understood. .It Bq Er ENOATTR The record -.Ar handle +.Fa handle did not exist on the server. .El .Sh SEE ALSO Index: src/lib/libbluetooth/sdp_data.3 diff -u src/lib/libbluetooth/sdp_data.3:1.1 src/lib/libbluetooth/sdp_data.3:1.2 --- src/lib/libbluetooth/sdp_data.3:1.1 Tue May 12 10:05:06 2009 +++ src/lib/libbluetooth/sdp_data.3 Wed May 20 17:22:56 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: sdp_data.3,v 1.1 2009/05/12 10:05:06 plunky Exp $ +.\ $NetBSD: sdp_data.3,v 1.2 2009/05/20 17:22:56 plunky Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -166,9 +166,9 @@ .Ed .Pp Where -.Ar next +.Fa next points to the next available byte, and -.Ar end +.Fa end points to the first address past end of the data area, such that .Qq end = next + length . .Pp @@ -215,7 +215,7 @@ If the UUID matches, the function will return .Dv true and the -.Ar next +.Fa next field of the SDP data buffer will be advanced to the next element. Otherwise .Dv false @@ -225,16 +225,16 @@ element of the given type. If the type matches, the function will
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: plunky Date: Thu May 14 19:12:45 UTC 2009 Modified Files: src/lib/libbluetooth: sdp_compat.c sdp_put.c sdp_service.c sdp_session.c sdp_set.c Log Message: fix some signed vs unsigned comparison issues To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/sdp_compat.c \ src/lib/libbluetooth/sdp_put.c src/lib/libbluetooth/sdp_service.c \ src/lib/libbluetooth/sdp_session.c src/lib/libbluetooth/sdp_set.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp_compat.c diff -u src/lib/libbluetooth/sdp_compat.c:1.1 src/lib/libbluetooth/sdp_compat.c:1.2 --- src/lib/libbluetooth/sdp_compat.c:1.1 Tue May 12 10:05:06 2009 +++ src/lib/libbluetooth/sdp_compat.c Thu May 14 19:12:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_compat.c,v 1.1 2009/05/12 10:05:06 plunky Exp $ */ +/* $NetBSD: sdp_compat.c,v 1.2 2009/05/14 19:12:45 plunky Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -77,7 +77,7 @@ #define SDP_COMPAT #include sys/cdefs.h -__RCSID($NetBSD: sdp_compat.c,v 1.1 2009/05/12 10:05:06 plunky Exp $); +__RCSID($NetBSD: sdp_compat.c,v 1.2 2009/05/14 19:12:45 plunky Exp $); #include errno.h #include sdp.h @@ -170,7 +170,7 @@ struct sdp_compat *sc = xss; sdp_data_t seq, ssp, ail, rsp, value; uint16_t attr; - int i; + size_t i; bool rv; if (sc == NULL) @@ -224,7 +224,7 @@ while (vlen 0 sdp_get_attr(seq, attr, value)) { vp-attr = attr; if (vp-value != NULL) { -if (value.end - value.next vp-vlen) { +if (value.end - value.next (ssize_t)vp-vlen) { vp-flags = SDP_ATTR_TRUNCATED; } else { vp-flags = SDP_ATTR_OK; Index: src/lib/libbluetooth/sdp_put.c diff -u src/lib/libbluetooth/sdp_put.c:1.1 src/lib/libbluetooth/sdp_put.c:1.2 --- src/lib/libbluetooth/sdp_put.c:1.1 Tue May 12 10:05:06 2009 +++ src/lib/libbluetooth/sdp_put.c Thu May 14 19:12:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_put.c,v 1.1 2009/05/12 10:05:06 plunky Exp $ */ +/* $NetBSD: sdp_put.c,v 1.2 2009/05/14 19:12:45 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_put.c,v 1.1 2009/05/12 10:05:06 plunky Exp $); +__RCSID($NetBSD: sdp_put.c,v 1.2 2009/05/14 19:12:45 plunky Exp $); #include bluetooth.h #include limits.h @@ -300,17 +300,17 @@ len -= 2; } - if (len UINT32_MAX) + if ((size_t)len UINT32_MAX) return false; - if (len UINT16_MAX) { + if ((size_t)len UINT16_MAX) { if (p + 5 + len data-end) return false; p[0] = type | SDP_DATA_EXT32; be32enc(p + 1, (uint32_t)len); p += 5; - } else if (len UINT8_MAX) { + } else if ((size_t)len UINT8_MAX) { if (p + 3 + len data-end) return false; Index: src/lib/libbluetooth/sdp_service.c diff -u src/lib/libbluetooth/sdp_service.c:1.1 src/lib/libbluetooth/sdp_service.c:1.2 --- src/lib/libbluetooth/sdp_service.c:1.1 Tue May 12 10:05:06 2009 +++ src/lib/libbluetooth/sdp_service.c Thu May 14 19:12:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_service.c,v 1.1 2009/05/12 10:05:06 plunky Exp $ */ +/* $NetBSD: sdp_service.c,v 1.2 2009/05/14 19:12:45 plunky Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: sdp_service.c,v 1.1 2009/05/12 10:05:06 plunky Exp $); +__RCSID($NetBSD: sdp_service.c,v 1.2 2009/05/14 19:12:45 plunky Exp $); #include errno.h #include limits.h @@ -236,7 +236,7 @@ /* * setup AttributeIDList */ - len = (ail == NULL ? sizeof(ail_default) : (ail-end - ail-next)); + len = (ail == NULL ? (ssize_t)sizeof(ail_default) : (ail-end - ail-next)); if (len 0 || len UINT16_MAX) { errno = EINVAL; return false; @@ -320,7 +320,7 @@ if (ss-cs[0] == 0) { rsp-next = rbuf; rsp-end = rbuf + rlen; - if (sdp_data_size(rsp) != rlen + if (sdp_data_size(rsp) != (ssize_t)rlen || !sdp_data_valid(rsp) || !sdp_get_seq(rsp, rsp)) break; @@ -372,7 +372,7 @@ /* * setup AttributeIDList */ - len = (ail == NULL ? sizeof(ail_default) : (ail-end - ail-next)); + len = (ail == NULL ? (ssize_t)sizeof(ail_default) : (ail-end - ail-next)); if (len 0 || len UINT16_MAX) { errno = EINVAL; return false; @@ -456,7 +456,7 @@ if (ss-cs[0] == 0) { rsp-next = rbuf; rsp-end = rbuf + rlen; - if (sdp_data_size(rsp) != rlen + if (sdp_data_size(rsp) != (ssize_t)rlen || !sdp_data_valid(rsp) || !sdp_get_seq(rsp, rsp)) break; Index: src/lib/libbluetooth/sdp_session.c diff -u src/lib/libbluetooth/sdp_session.c:1.1 src/lib/libbluetooth/sdp_session.c:1.2 --- src/lib/libbluetooth/sdp_session.c:1.1 Tue May 12 10:05:06 2009 +++ src/lib/libbluetooth/sdp_session.c Thu May 14 19:12:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sdp_session.c,v 1.1 2009/05/12 10:05:06 plunky Exp $ */ +/* $NetBSD:
CVS commit: src/lib/libbluetooth
Module Name:src Committed By: wiz Date: Tue May 12 10:32:46 UTC 2009 Modified Files: src/lib/libbluetooth: sdp.3 Log Message: New sentence, new line. Sort sections. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libbluetooth/sdp.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libbluetooth/sdp.3 diff -u src/lib/libbluetooth/sdp.3:1.1 src/lib/libbluetooth/sdp.3:1.2 --- src/lib/libbluetooth/sdp.3:1.1 Tue May 12 10:05:06 2009 +++ src/lib/libbluetooth/sdp.3 Tue May 12 10:32:45 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: sdp.3,v 1.1 2009/05/12 10:05:06 plunky Exp $ +.\ $NetBSD: sdp.3,v 1.2 2009/05/12 10:32:45 wiz Exp $ .\ .\ Copyright (c) 2009 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -82,7 +82,8 @@ .Xr sdp_data 3 library functions. .Pp -The ServiceSearchPattern is a list of UUID data elements. The list must +The ServiceSearchPattern is a list of UUID data elements. +The list must contain at least one UUID and the maximum number of UUIDs is 12. A service record will be matched when all the UUIDs from the ServiceSearchPattern are contained in the record. @@ -215,6 +216,8 @@ On failure, .Ar errno will be set to indicate the error. +.Sh FILES +.Pa /var/run/sdp .Sh ERRORS In addition to errors returned by the standard C library IO functions, the following errors may be detected by @@ -229,8 +232,6 @@ .Ar handle did not exist on the server. .El -.Sh FILES -.Pa /var/run/sdp .Sh SEE ALSO .Xr sdpquery 1 , .Xr bluetooth 3 ,