source: asp3_tinet_ecnl_rx/trunk/btstack/include/btstack/sdp_util.h@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 5.8 KB
Line 
1/*
2 * Copyright (C) 2010 by Matthias Ringwald
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 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the copyright holders nor the names of
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
21 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 */
31
32/*
33 * sdp_util.h
34 */
35
36#ifndef __SDP_UTIL_H
37#define __SDP_UTIL_H
38
39#include <stdint.h>
40
41#if defined __cplusplus
42extern "C" {
43#endif
44
45typedef enum {
46 DE_NIL = 0,
47 DE_UINT,
48 DE_INT,
49 DE_UUID,
50 DE_STRING,
51 DE_BOOL,
52 DE_DES,
53 DE_DEA,
54 DE_URL
55} de_type_t;
56
57typedef enum {
58 DE_SIZE_8 = 0,
59 DE_SIZE_16,
60 DE_SIZE_32,
61 DE_SIZE_64,
62 DE_SIZE_128,
63 DE_SIZE_VAR_8,
64 DE_SIZE_VAR_16,
65 DE_SIZE_VAR_32
66} de_size_t;
67
68// UNIVERSAL ATTRIBUTE DEFINITIONS
69#define SDP_ServiceRecordHandle 0x0000
70#define SDP_ServiceClassIDList 0x0001
71#define SDP_ServiceRecordState 0x0002
72#define SDP_ServiceID 0x0003
73#define SDP_ProtocolDescriptorList 0x0004
74#define SDP_BrowseGroupList 0x0005
75#define SDP_LanguageBaseAttributeIDList 0x0006
76#define SDP_ServiceInfoTimeToLive 0x0007
77#define SDP_ServiceAvailability 0x0008
78#define SDP_BluetoothProfileDescriptorList 0x0009
79#define SDP_DocumentationURL 0x000a
80#define SDP_ClientExecutableURL 0x000b
81#define SDP_IconURL 0x000c
82#define SDP_AdditionalProtocolDescriptorList 0x000d
83#define SDP_SupportedFormatsList 0x0303
84
85// SERVICE CLASSES
86#define SDP_OBEXObjectPush 0x1105
87#define SDP_OBEXFileTransfer 0x1106
88#define SDP_PublicBrowseGroup 0x1002
89
90// PROTOCOLS
91#define SDP_SDPProtocol 0x0001
92#define SDP_UDPProtocol 0x0002
93#define SDP_RFCOMMProtocol 0x0003
94#define SDP_OBEXProtocol 0x0008
95#define SDP_L2CAPProtocol 0x0100
96#define SDP_BNEPProtocol 0x000f
97
98// OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList
99#define SDP_Offest_ServiceName 0x0000
100#define SDP_Offest_ServiceDescription 0x0001
101#define SDP_Offest_ProviderName 0x0002
102
103// OBEX
104#define SDP_vCard_2_1 0x01
105#define SDP_vCard_3_0 0x02
106#define SDP_vCal_1_0 0x03
107#define SDP_iCal_2_0 0x04
108#define SDP_vNote 0x05
109#define SDP_vMessage 0x06
110#define SDP_OBEXFileTypeAny 0xFF
111
112// MARK: DateElement
113void de_dump_data_element(uint8_t * record);
114int de_get_len(uint8_t *header);
115de_size_t de_get_size_type(uint8_t *header);
116de_type_t de_get_element_type(uint8_t *header);
117int de_get_header_size(uint8_t * header);
118void de_create_sequence(uint8_t *header);
119void de_store_descriptor_with_len(uint8_t * header, de_type_t type, de_size_t size, uint32_t len);
120uint8_t * de_push_sequence(uint8_t *header);
121void de_pop_sequence(uint8_t * parent, uint8_t * child);
122void de_add_number(uint8_t *seq, de_type_t type, de_size_t size, uint32_t value);
123void de_add_data( uint8_t *seq, de_type_t type, uint16_t size, uint8_t *data);
124int de_element_get_uint16(uint8_t * element, uint16_t * value);
125
126int de_get_data_size(uint8_t * header);
127void de_add_uuid128(uint8_t * seq, uint8_t * uuid);
128uint32_t de_get_uuid32(uint8_t * element);
129int de_get_normalized_uuid(uint8_t *uuid128, uint8_t *element);
130
131// MARK: DES iterator
132typedef struct {
133 uint8_t * element;
134 uint16_t pos;
135 uint16_t length;
136} des_iterator_t;
137
138int des_iterator_init(des_iterator_t * it, uint8_t * element);
139int des_iterator_has_more(des_iterator_t * it);
140de_type_t des_iterator_get_type (des_iterator_t * it);
141uint16_t des_iterator_get_size (des_iterator_t * it);
142uint8_t * des_iterator_get_element(des_iterator_t * it);
143void des_iterator_next(des_iterator_t * it);
144
145// MARK: SDP
146uint16_t sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint8_t *buffer);
147uint8_t * sdp_get_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID);
148uint8_t sdp_set_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID, uint32_t value);
149int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceSearchPattern);
150int spd_get_filtered_size(uint8_t *record, uint8_t *attributeIDList);
151int sdp_filter_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint16_t *usedBytes, uint8_t *buffer);
152
153void sdp_create_spp_service(uint8_t *service, int service_id, const char *name);
154void sdp_normalize_uuid(uint8_t *uuid, uint32_t shortUUID);
155int sdp_has_blueooth_base_uuid(uint8_t * uuid128);
156
157#if defined __cplusplus
158}
159#endif
160
161#endif // __SDP_UTIL_H
Note: See TracBrowser for help on using the repository browser.