source: asp3_tinet_ecnl_arm/trunk/btstack/src/sdp_parser.h@ 352

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

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 3.7 KB
Line 
1/*
2 * Copyright (C) 2009-2013 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 * 4. Any redistribution, use, or modification is done solely for
17 * personal benefit and not for any commercial purpose or for
18 * monetary gain.
19 *
20 * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * Please inquire about commercial licensing options at btstack@ringwald.ch
34 *
35 */
36
37/*
38 * sdp_parser.h
39 */
40
41#ifndef __SDP_PARSER_H
42#define __SDP_PARSER_H
43
44#include "btstack-config.h"
45
46#include <stdint.h>
47#include <stdio.h>
48#include <stdlib.h>
49#include <string.h>
50
51#include <btstack/sdp_util.h>
52#include <btstack/utils.h>
53
54#if defined __cplusplus
55extern "C" {
56#endif
57
58/* SDP Parser */
59
60// Data Element stream parser helper
61typedef struct de_state {
62 uint8_t in_state_GET_DE_HEADER_LENGTH ;
63 uint32_t addon_header_bytes;
64 uint32_t de_size;
65 uint32_t de_offset;
66} de_state_t;
67void de_state_init(de_state_t * state);
68int de_state_size(uint8_t eventByte, de_state_t *de_state);
69
70// SDP Parser
71// Basic SDP Query event type
72typedef struct sdp_query_event {
73 uint8_t type;
74} sdp_query_event_t;
75
76// SDP Query event to indicate that query/parser is complete.
77typedef struct sdp_query_complete_event {
78 uint8_t type;
79 uint8_t status; // 0 == OK
80} sdp_query_complete_event_t;
81
82// SDP Parser event to deliver an attribute value byte by byte
83typedef struct sdp_query_attribute_value_event {
84 uint8_t type;
85 int record_id;
86 uint16_t attribute_id;
87 uint32_t attribute_length;
88 int data_offset;
89 uint8_t data;
90} sdp_query_attribute_value_event_t;
91
92
93#ifdef HAVE_SDP_EXTRA_QUERIES
94typedef struct sdp_query_service_record_handle_event {
95 uint8_t type;
96 uint16_t total_count;
97 uint16_t current_count;
98 uint32_t record_handle;
99} sdp_query_service_record_handle_event_t;
100#endif
101
102void sdp_parser_init(void);
103void sdp_parser_handle_chunk(uint8_t * data, uint16_t size);
104
105#ifdef HAVE_SDP_EXTRA_QUERIES
106void sdp_parser_init_service_attribute_search(void);
107void sdp_parser_init_service_search(void);
108void sdp_parser_handle_service_search(uint8_t * data, uint16_t total_count, uint16_t record_handle_count);
109#endif
110
111void sdp_parser_handle_done(uint8_t status);
112
113// Registers a callback to receive attribute value data and parse complete event.
114void sdp_parser_register_callback(void (*sdp_callback)(sdp_query_event_t * event));
115
116
117#if defined __cplusplus
118}
119#endif
120
121#endif // __SDP_PARSER_H
Note: See TracBrowser for help on using the repository browser.