ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers baidu_ca_coap_ep.h Source File

baidu_ca_coap_ep.h

00001 // Copyright 2017 Baidu Inc. All Rights Reserved.
00002 // Author: Su Hao (suhao@baidu.com)
00003 //
00004 // Description: The CoAP endpoint definitions.
00005 
00006 #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H
00007 #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H
00008 
00009 #include "baidu_ca_internal.h"
00010 
00011 #define LIFETIME_MAX_LEN    (10)
00012 
00013 /**
00014  * Endpoint registration parameters
00015  */
00016 typedef struct _baidu_ca_coap_endpoint_s {
00017     char*          name_ptr;           // Endpoint name
00018     bca_size_t     name_len;
00019 
00020     char*          type_ptr;           // Endpoint type
00021     bca_size_t     type_len;
00022 
00023     char*          lifetime_ptr;       // Endpoint lifetime in seconds. eg. "1200" = 1200 seconds
00024     bca_size_t     lifetime_len;
00025 
00026     bca_addr_t*    address; // Endpoint address to be accessed by the server, optional, default NULL
00027 } bca_coap_ep_t, *bca_coap_ep_ptr;
00028 
00029 /*
00030  * Create the endpoint.
00031  *
00032  * @Param hdlr, in, the global context for baidu ca
00033  * @Param name, in, the endpoint name
00034  * @Param type, in, the endpoint type
00035  * @Param lifetime, in, the lifetime of the endpoint
00036  * @Param addr, in, the endpoint address to be accessed by the server, optional, default NULL
00037  * @Return bca_coap_ep_ptr, the endpoint context pointer
00038  */
00039 BCA_INT bca_coap_ep_ptr bca_coap_ep_create(const char* name,
00040                                            const char* type,
00041                                            bca_u32_t lifetime,
00042                                            const bca_addr_t* addr);
00043 
00044 
00045 /*
00046  * Destroy the endpoint that created by ${link bca_coap_ep_create}.
00047  *
00048  * @Param hdlr, in, the global context for baidu ca
00049  * @Param ptr, in, the endpoint context pointer
00050  * @Return bca_status_t, the operation result
00051  */
00052 BCA_INT bca_status_t bca_coap_ep_destroy(bca_coap_ep_ptr ptr);
00053 
00054 #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H