xref: /btstack/src/classic/pan.h (revision 3deb3ec68039c68a16974dffc53343233662f909)
1*3deb3ec6SMatthias Ringwald /*
2*3deb3ec6SMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
3*3deb3ec6SMatthias Ringwald  *
4*3deb3ec6SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*3deb3ec6SMatthias Ringwald  * modification, are permitted provided that the following conditions
6*3deb3ec6SMatthias Ringwald  * are met:
7*3deb3ec6SMatthias Ringwald  *
8*3deb3ec6SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*3deb3ec6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*3deb3ec6SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*3deb3ec6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*3deb3ec6SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*3deb3ec6SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*3deb3ec6SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*3deb3ec6SMatthias Ringwald  *    from this software without specific prior written permission.
16*3deb3ec6SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*3deb3ec6SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18*3deb3ec6SMatthias Ringwald  *    monetary gain.
19*3deb3ec6SMatthias Ringwald  *
20*3deb3ec6SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*3deb3ec6SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*3deb3ec6SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*3deb3ec6SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24*3deb3ec6SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*3deb3ec6SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*3deb3ec6SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*3deb3ec6SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*3deb3ec6SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*3deb3ec6SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*3deb3ec6SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*3deb3ec6SMatthias Ringwald  * SUCH DAMAGE.
32*3deb3ec6SMatthias Ringwald  *
33*3deb3ec6SMatthias Ringwald  * Please inquire about commercial licensing options at
34*3deb3ec6SMatthias Ringwald  * [email protected]
35*3deb3ec6SMatthias Ringwald  *
36*3deb3ec6SMatthias Ringwald  */
37*3deb3ec6SMatthias Ringwald 
38*3deb3ec6SMatthias Ringwald /*
39*3deb3ec6SMatthias Ringwald  *  pan.h
40*3deb3ec6SMatthias Ringwald  *
41*3deb3ec6SMatthias Ringwald  *  Created by Milanka Ringwald on 10/16/14.
42*3deb3ec6SMatthias Ringwald  */
43*3deb3ec6SMatthias Ringwald 
44*3deb3ec6SMatthias Ringwald #ifndef __PAN_H
45*3deb3ec6SMatthias Ringwald #define __PAN_H
46*3deb3ec6SMatthias Ringwald 
47*3deb3ec6SMatthias Ringwald #include <stdint.h>
48*3deb3ec6SMatthias Ringwald 
49*3deb3ec6SMatthias Ringwald #include "btstack-config.h"
50*3deb3ec6SMatthias Ringwald 
51*3deb3ec6SMatthias Ringwald #if defined __cplusplus
52*3deb3ec6SMatthias Ringwald extern "C" {
53*3deb3ec6SMatthias Ringwald #endif
54*3deb3ec6SMatthias Ringwald 
55*3deb3ec6SMatthias Ringwald typedef enum {
56*3deb3ec6SMatthias Ringwald 	PANU_UUID = 0x1115,
57*3deb3ec6SMatthias Ringwald 	NAP_UUID = 0x1116,
58*3deb3ec6SMatthias Ringwald 	GN_UUID = 0x1117
59*3deb3ec6SMatthias Ringwald } bnep_service_uuid_t;
60*3deb3ec6SMatthias Ringwald 
61*3deb3ec6SMatthias Ringwald typedef enum {
62*3deb3ec6SMatthias Ringwald 	BNEP_SECURITY_NONE = 0x0000,
63*3deb3ec6SMatthias Ringwald 	BNEP_SECURITY_SERVICE_LEVEL_ENFORCED,
64*3deb3ec6SMatthias Ringwald 	BNEP_SECURITY_802_1X
65*3deb3ec6SMatthias Ringwald } security_description_t;
66*3deb3ec6SMatthias Ringwald 
67*3deb3ec6SMatthias Ringwald typedef enum {
68*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_PSTN = 0x0000,
69*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_ISDN,
70*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_DSL,
71*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_CABLE_MODEM,
72*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_10MB_ETHERNET,
73*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_100MB_ETHERNET,
74*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_4MB_TOKEN_RING,
75*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_16MB_TOKEN_RING,
76*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_100MB_TOKEN_RING,
77*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_FDDI,
78*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_GSM,
79*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_CDMA,
80*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_GPRS,
81*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_3G,
82*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_CELULAR,
83*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_OTHER = 0xFFFE,
84*3deb3ec6SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_NONE
85*3deb3ec6SMatthias Ringwald } net_access_type_t;
86*3deb3ec6SMatthias Ringwald 
87*3deb3ec6SMatthias Ringwald /* API_START */
88*3deb3ec6SMatthias Ringwald 
89*3deb3ec6SMatthias Ringwald /**
90*3deb3ec6SMatthias Ringwald  * @brief Creates SDP record for PANU BNEP service in provided empty buffer.
91*3deb3ec6SMatthias Ringwald  * @note Make sure the buffer is big enough.
92*3deb3ec6SMatthias Ringwald  *
93*3deb3ec6SMatthias Ringwald  * @param service is an empty buffer to store service record
94*3deb3ec6SMatthias Ringwald  * @param network_packet_types array of types terminated by a 0x0000 entry
95*3deb3ec6SMatthias Ringwald  * @param name if NULL, the default service name will be assigned
96*3deb3ec6SMatthias Ringwald  * @param description if NULL, the default service description will be assigned
97*3deb3ec6SMatthias Ringwald  * @param security_desc
98*3deb3ec6SMatthias Ringwald  */
99*3deb3ec6SMatthias Ringwald void pan_create_panu_service(uint8_t *service, uint16_t * network_packet_types, const char *name,
100*3deb3ec6SMatthias Ringwald 	const char *description, security_description_t security_desc);
101*3deb3ec6SMatthias Ringwald 
102*3deb3ec6SMatthias Ringwald /**
103*3deb3ec6SMatthias Ringwald  * @brief Creates SDP record for GN BNEP service in provided empty buffer.
104*3deb3ec6SMatthias Ringwald  * @note Make sure the buffer is big enough.
105*3deb3ec6SMatthias Ringwald  *
106*3deb3ec6SMatthias Ringwald  * @param service is an empty buffer to store service record
107*3deb3ec6SMatthias Ringwald  * @param network_packet_types array of types terminated by a 0x0000 entry
108*3deb3ec6SMatthias Ringwald  * @param name if NULL, the default service name will be assigned
109*3deb3ec6SMatthias Ringwald  * @param description if NULL, the default service description will be assigned
110*3deb3ec6SMatthias Ringwald  * @param security_desc
111*3deb3ec6SMatthias Ringwald  * @param IPv4Subnet is optional subnet definition, e.g. "10.0.0.0/8"
112*3deb3ec6SMatthias Ringwald  * @param IPv6Subnet is optional subnet definition given in the standard IETF format with the absolute attribute IDs
113*3deb3ec6SMatthias Ringwald  */
114*3deb3ec6SMatthias Ringwald void pan_create_gn_service(uint8_t *service, uint16_t * network_packet_types, const char *name,
115*3deb3ec6SMatthias Ringwald 	const char *description, security_description_t security_desc, const char *IPv4Subnet,
116*3deb3ec6SMatthias Ringwald 	const char *IPv6Subnet);
117*3deb3ec6SMatthias Ringwald 
118*3deb3ec6SMatthias Ringwald /**
119*3deb3ec6SMatthias Ringwald  * @brief Creates SDP record for NAP BNEP service in provided empty buffer.
120*3deb3ec6SMatthias Ringwald  * @note Make sure the buffer is big enough.
121*3deb3ec6SMatthias Ringwald  *
122*3deb3ec6SMatthias Ringwald  * @param service is an empty buffer to store service record
123*3deb3ec6SMatthias Ringwald  * @param name if NULL, the default service name will be assigned
124*3deb3ec6SMatthias Ringwald  * @param network_packet_types array of types terminated by a 0x0000 entry
125*3deb3ec6SMatthias Ringwald  * @param description if NULL, the default service description will be assigned
126*3deb3ec6SMatthias Ringwald  * @param security_desc
127*3deb3ec6SMatthias Ringwald  * @param net_access_type type of available network access
128*3deb3ec6SMatthias Ringwald  * @param max_net_access_rate based on net_access_type measured in byte/s
129*3deb3ec6SMatthias Ringwald  * @param IPv4Subnet is optional subnet definition, e.g. "10.0.0.0/8"
130*3deb3ec6SMatthias Ringwald  * @param IPv6Subnet is optional subnet definition given in the standard IETF format with the absolute attribute IDs
131*3deb3ec6SMatthias Ringwald  */
132*3deb3ec6SMatthias Ringwald void pan_create_nap_service(uint8_t *service, uint16_t * network_packet_types, const char *name,
133*3deb3ec6SMatthias Ringwald 	const char *description, security_description_t security_desc, net_access_type_t net_access_type,
134*3deb3ec6SMatthias Ringwald 	uint32_t max_net_access_rate, const char *IPv4Subnet, const char *IPv6Subnet);
135*3deb3ec6SMatthias Ringwald 
136*3deb3ec6SMatthias Ringwald /* API_END */
137*3deb3ec6SMatthias Ringwald 
138*3deb3ec6SMatthias Ringwald #if defined __cplusplus
139*3deb3ec6SMatthias Ringwald }
140*3deb3ec6SMatthias Ringwald #endif
141*3deb3ec6SMatthias Ringwald #endif // __PAN_H
142