source: asp3_tinet_ecnl_rx/trunk/btstack/src/sdp.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: 4.0 KB
Line 
1/*
2 * Copyright (C) 2009-2012 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#ifndef __SDP_H
37#define __SDP_H
38
39#include <stdint.h>
40#include <btstack/linked_list.h>
41
42#include "btstack-config.h"
43
44#if defined __cplusplus
45extern "C" {
46#endif
47
48typedef enum {
49 SDP_Invalid = 0,
50 SDP_ErrorResponse = 1,
51 SDP_ServiceSearchRequest,
52 SDP_ServiceSearchResponse,
53 SDP_ServiceAttributeRequest,
54 SDP_ServiceAttributeResponse,
55 SDP_ServiceSearchAttributeRequest,
56 SDP_ServiceSearchAttributeResponse
57} SDP_PDU_ID_t;
58
59// service record
60// -- uses user_data field for actual
61typedef struct {
62 // linked list - assert: first field
63 linked_item_t item;
64
65 // client connection
66 void * connection;
67
68 // data is contained in same memory
69 uint32_t service_record_handle;
70 uint8_t service_record[1]; // waste 1 byte to allow compilation with older compilers
71} service_record_item_t;
72
73
74void sdp_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type,
75 uint16_t channel, uint8_t *packet, uint16_t size));
76
77
78//
79int sdp_handle_service_search_request(uint8_t * packet, uint16_t remote_mtu);
80int sdp_handle_service_attribute_request(uint8_t * packet, uint16_t remote_mtu);
81int sdp_handle_service_search_attribute_request(uint8_t * packet, uint16_t remote_mtu);
82
83#ifndef EMBEDDED
84// Register service record internally - this version creates a copy of the record
85// precondition: AttributeIDs are in ascending order => ServiceRecordHandle is first attribute if present
86// @returns ServiceRecordHandle or 0 if registration failed
87uint32_t sdp_register_service_internal(void *connection, uint8_t * service_record);
88#endif
89
90//
91
92/** Embedded API **/
93
94// Set up SDP.
95void sdp_init(void);
96
97#ifdef EMBEDDED
98// Register service record internally - this version doesn't copy the record therefore it must be forever accessible.
99// Preconditions:
100// - AttributeIDs are in ascending order;
101// - ServiceRecordHandle is first attribute and valid.
102// @returns ServiceRecordHandle or 0 if registration failed.
103uint32_t sdp_register_service_internal(void *connection, service_record_item_t * record_item);
104#endif
105
106// Unregister service record internally.
107void sdp_unregister_service_internal(void *connection, uint32_t service_record_handle);
108
109#if defined __cplusplus
110}
111#endif
112#endif // __SDP_H
Note: See TracBrowser for help on using the repository browser.