1*dfbf818aSplunky /* $NetBSD: sdp_match.c,v 1.1 2009/05/12 10:05:06 plunky Exp $ */
2*dfbf818aSplunky
3*dfbf818aSplunky /*-
4*dfbf818aSplunky * Copyright (c) 2009 The NetBSD Foundation, Inc.
5*dfbf818aSplunky * All rights reserved.
6*dfbf818aSplunky *
7*dfbf818aSplunky * This code is derived from software contributed to The NetBSD Foundation
8*dfbf818aSplunky * by Iain Hibbert.
9*dfbf818aSplunky *
10*dfbf818aSplunky * Redistribution and use in source and binary forms, with or without
11*dfbf818aSplunky * modification, are permitted provided that the following conditions
12*dfbf818aSplunky * are met:
13*dfbf818aSplunky * 1. Redistributions of source code must retain the above copyright
14*dfbf818aSplunky * notice, this list of conditions and the following disclaimer.
15*dfbf818aSplunky * 2. Redistributions in binary form must reproduce the above copyright
16*dfbf818aSplunky * notice, this list of conditions and the following disclaimer in the
17*dfbf818aSplunky * documentation and/or other materials provided with the distribution.
18*dfbf818aSplunky *
19*dfbf818aSplunky * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*dfbf818aSplunky * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*dfbf818aSplunky * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*dfbf818aSplunky * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*dfbf818aSplunky * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*dfbf818aSplunky * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*dfbf818aSplunky * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*dfbf818aSplunky * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*dfbf818aSplunky * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*dfbf818aSplunky * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*dfbf818aSplunky * POSSIBILITY OF SUCH DAMAGE.
30*dfbf818aSplunky */
31*dfbf818aSplunky
32*dfbf818aSplunky #include <sys/cdefs.h>
33*dfbf818aSplunky __RCSID("$NetBSD: sdp_match.c,v 1.1 2009/05/12 10:05:06 plunky Exp $");
34*dfbf818aSplunky
35*dfbf818aSplunky #include <limits.h>
36*dfbf818aSplunky #include <sdp.h>
37*dfbf818aSplunky
38*dfbf818aSplunky /******************************************************************************
39*dfbf818aSplunky * sdp_match_xxxx(data, value)
40*dfbf818aSplunky *
41*dfbf818aSplunky * examine SDP data element. Advance pointer and return true if it
42*dfbf818aSplunky * matches the supplied type value
43*dfbf818aSplunky */
44*dfbf818aSplunky
45*dfbf818aSplunky bool
sdp_match_uuid16(sdp_data_t * data,uint16_t uuid)46*dfbf818aSplunky sdp_match_uuid16(sdp_data_t *data, uint16_t uuid)
47*dfbf818aSplunky {
48*dfbf818aSplunky sdp_data_t d = *data;
49*dfbf818aSplunky uuid_t u1, u2;
50*dfbf818aSplunky
51*dfbf818aSplunky u1 = BLUETOOTH_BASE_UUID;
52*dfbf818aSplunky u1.time_low = uuid;
53*dfbf818aSplunky
54*dfbf818aSplunky if (!sdp_get_uuid(&d, &u2)
55*dfbf818aSplunky || !uuid_equal(&u1, &u2, NULL))
56*dfbf818aSplunky return false;
57*dfbf818aSplunky
58*dfbf818aSplunky *data = d;
59*dfbf818aSplunky return true;
60*dfbf818aSplunky }
61