mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-26 00:40:38 +00:00
added doku
This commit is contained in:
parent
66fdc33878
commit
5eaeb7ae8d
30
src/pan.c
30
src/pan.c
@ -47,9 +47,11 @@
|
||||
|
||||
#include <btstack/sdp_util.h>
|
||||
|
||||
static uint16_t PANU_UUID = 0x1115;
|
||||
static uint16_t NAP_UUID = 0x1116;
|
||||
static uint16_t GN_UUID = 0x1117;
|
||||
typedef enum {
|
||||
PANU_UUID = 0x1115,
|
||||
NAP_UUID = 0x1116,
|
||||
GN_UUID = 0x1117
|
||||
} bnep_service_uuid_t;
|
||||
|
||||
static const char default_panu_service_name[] = "Personal Ad-hoc User Service";
|
||||
static const char default_panu_service_desc[] = "Personal Ad-hoc User Service";
|
||||
@ -60,8 +62,9 @@ static const char default_nap_service_desc[] = "Personal Ad-hoc Network Service
|
||||
static const char default_gn_service_name[] = "Group Ad-hoc Network Service";
|
||||
static const char default_gn_service_desc[] = "Personal Group Ad-hoc Network Service";
|
||||
|
||||
void pan_create_service(uint16_t service_uuid, uint8_t *service, const char *name, const char *descriptor,
|
||||
const char *IPv4Subnet, const char *IPv6Subnet, uint16_t net_access_type, uint32_t max_net_access_rate){
|
||||
void pan_create_service(bnep_service_uuid_t service_uuid, uint8_t *service, const char *name, const char *descriptor,
|
||||
security_description_t security_desc, net_access_type_t net_access_type, uint32_t max_net_access_rate,
|
||||
const char *IPv4Subnet, const char *IPv6Subnet){
|
||||
|
||||
uint8_t* attribute;
|
||||
de_create_sequence(service);
|
||||
@ -182,7 +185,7 @@ void pan_create_service(uint16_t service_uuid, uint8_t *service, const char *nam
|
||||
|
||||
// 0x030A "Security Description"
|
||||
de_add_number(service, DE_UINT, DE_SIZE_16, 0x030A);
|
||||
de_add_number(service, DE_UINT, DE_SIZE_16, 0x0000);
|
||||
de_add_number(service, DE_UINT, DE_SIZE_16, security_desc);
|
||||
|
||||
if (service_uuid == PANU_UUID) return;
|
||||
|
||||
@ -211,14 +214,17 @@ void pan_create_service(uint16_t service_uuid, uint8_t *service, const char *nam
|
||||
}
|
||||
|
||||
|
||||
void pan_create_nap_service(uint8_t *service, const char *name, const char *description, uint16_t net_access_type, uint32_t max_net_access_rate, const char *IPv4Subnet, const char *IPv6Subnet){
|
||||
pan_create_service(NAP_UUID, service, name, description, IPv4Subnet, IPv6Subnet, net_access_type, max_net_access_rate);
|
||||
void pan_create_nap_service(uint8_t *service, const char *name, const char *description, security_description_t security_desc,
|
||||
net_access_type_t net_access_type, uint32_t max_net_access_rate, const char *IPv4Subnet, const char *IPv6Subnet){
|
||||
|
||||
pan_create_service(NAP_UUID, service, name, description, security_desc, net_access_type, max_net_access_rate, IPv4Subnet, IPv6Subnet);
|
||||
}
|
||||
|
||||
void pan_create_gn_service(uint8_t *service, const char *name, const char *description, const char *IPv4Subnet, const char *IPv6Subnet){
|
||||
pan_create_service(GN_UUID, service, name, description, IPv4Subnet, IPv6Subnet, 0, 0);
|
||||
void pan_create_gn_service(uint8_t *service, const char *name, const char *description, security_description_t security_desc,
|
||||
const char *IPv4Subnet, const char *IPv6Subnet){
|
||||
pan_create_service(GN_UUID, service, name, description, security_desc, PAN_NET_ACCESS_TYPE_NONE, 0, IPv4Subnet, IPv6Subnet);
|
||||
}
|
||||
|
||||
void pan_create_panu_service(uint8_t *service, const char *name, const char *description){
|
||||
pan_create_service(PANU_UUID, service, name, description, NULL, NULL, 0, 0);
|
||||
void pan_create_panu_service(uint8_t *service, const char *name, const char *description, security_description_t security_desc){
|
||||
pan_create_service(PANU_UUID, service, name, description, security_desc, PAN_NET_ACCESS_TYPE_NONE, 0, NULL, NULL);
|
||||
}
|
||||
|
64
src/pan.h
64
src/pan.h
@ -51,13 +51,69 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void pan_create_panu_service(uint8_t *service, const char *name, const char *description);
|
||||
typedef enum {
|
||||
BNEP_SECURITY_NONE = 0x0000,
|
||||
BNEP_SECURITY_SERVICE_LEVEL_ENFORCED,
|
||||
BNEP_SECURITY_802_1X
|
||||
} security_description_t;
|
||||
|
||||
void pan_create_gn_service(uint8_t *service, const char *name, const char *description,
|
||||
typedef enum {
|
||||
PAN_NET_ACCESS_TYPE_PSTN = 0x0000,
|
||||
PAN_NET_ACCESS_TYPE_ISDN,
|
||||
PAN_NET_ACCESS_TYPE_DSL,
|
||||
PAN_NET_ACCESS_TYPE_CABLE_MODEM,
|
||||
PAN_NET_ACCESS_TYPE_10MB_ETHERNET,
|
||||
PAN_NET_ACCESS_TYPE_100MB_ETHERNET,
|
||||
PAN_NET_ACCESS_TYPE_4MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_16MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_100MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_FDDI,
|
||||
PAN_NET_ACCESS_TYPE_GSM,
|
||||
PAN_NET_ACCESS_TYPE_CDMA,
|
||||
PAN_NET_ACCESS_TYPE_GPRS,
|
||||
PAN_NET_ACCESS_TYPE_3G,
|
||||
PAN_NET_ACCESS_TYPE_CELULAR,
|
||||
PAN_NET_ACCESS_TYPE_OTHER = 0xFFFE,
|
||||
PAN_NET_ACCESS_TYPE_NONE
|
||||
} net_access_type_t;
|
||||
|
||||
/* Creates SDP record for PANU BNEP service in provided empty buffer.
|
||||
* @note Make sure the buffer is big enough.
|
||||
*
|
||||
* @param service is an empty buffer to store service record
|
||||
* @security_description
|
||||
* @param name if NULL, the default service name will be assigned
|
||||
* @param description if NULL, the default service description will be assigned
|
||||
*/
|
||||
void pan_create_panu_service(uint8_t *service, const char *name, const char *description, security_description_t security_desc);
|
||||
|
||||
/* Creates SDP record for GN BNEP service in provided empty buffer.
|
||||
* @note Make sure the buffer is big enough.
|
||||
*
|
||||
* @param service is an empty buffer to store service record
|
||||
* @security_description
|
||||
* @param name if NULL, the default service name will be assigned
|
||||
* @param description if NULL, the default service description will be assigned
|
||||
* @param IPv4Subnet is optional subnet definition, e.g. "10.0.0.0/8"
|
||||
* @param IPv6Subnet is optional subnet definition given in the standard IETF format wit hte absolute attribute IDs
|
||||
*/
|
||||
void pan_create_gn_service(uint8_t *service, const char *name, const char *description, security_description_t security_desc,
|
||||
const char *IPv4Subnet, const char *IPv6Subnet);
|
||||
|
||||
void pan_create_nap_service(uint8_t *service, const char *name, const char *description,
|
||||
uint16_t net_access_type, uint32_t max_net_access_rate, const char *IPv4Subnet, const char *IPv6Subnet);
|
||||
/* Creates SDP record for NAP BNEP service in provided empty buffer.
|
||||
* @note Make sure the buffer is big enough.
|
||||
*
|
||||
* @param service is an empty buffer to store service record
|
||||
* @param name if NULL, the default service name will be assigned
|
||||
* @security_description
|
||||
* @param description if NULL, the default service description will be assigned
|
||||
* @param net_access_type type of available network access
|
||||
* @param max_net_access_rate based on net_access_type measured in byte/s
|
||||
* @param IPv4Subnet is optional subnet definition, e.g. "10.0.0.0/8"
|
||||
* @param IPv6Subnet is optional subnet definition given in the standard IETF format wit hte absolute attribute IDs
|
||||
*/
|
||||
void pan_create_nap_service(uint8_t *service, const char *name, const char *description, security_description_t security_desc,
|
||||
net_access_type_t net_access_type, uint32_t max_net_access_rate, const char *IPv4Subnet, const char *IPv6Subnet);
|
||||
|
||||
|
||||
#if defined __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user