Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: wakaama/liblwm2m.h
- Revision:
- 14:ec9e195830ff
- Parent:
- 13:4e6f1ebf886c
- Child:
- 16:31c387e94b6d
--- a/wakaama/liblwm2m.h Wed May 03 11:13:02 2017 +0000 +++ b/wakaama/liblwm2m.h Sat May 06 11:21:27 2017 +0000 @@ -84,10 +84,11 @@ #ifndef LWM2M_EMBEDDED_MODE /** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided * by your system, set this to 0 and include <sys/time.h> in cc.h */ +//typedef long time_t struct timeval { - long tv_sec; /* seconds */ - long tv_usec; /* and microseconds */ + time_t tv_sec; /* seconds */ + time_t tv_usec; /* and microseconds */ }; struct timezone{ @@ -146,6 +147,7 @@ // communication layer #ifdef LWM2M_CLIENT_MODE + // Returns a session handle that MUST uniquely identify a peer. // secObjInstID: ID of the Securty Object instance to open a connection to // userData: parameter to lwm2m_init() @@ -160,7 +162,7 @@ // sessionH: session handle identifying the peer (opaque to the core) // buffer, length: data to send // userData: parameter to lwm2m_init() -uint8_t lwm2m_buffer_send(void * sessionH, uint8_t * buffer, size_t length, void * userData); +coap_status_t lwm2m_buffer_send(void * sessionH, uint8_t * buffer, size_t length, void * userData); // Compare two session handles // Returns true if the two sessions identify the same peer. false otherwise. // userData: parameter to lwm2m_init() @@ -520,6 +522,32 @@ uint16_t lastmid; // mid of the last message received }; +/* + * LWM2M Servers + * + * Since LWM2M Server Object instances are not accessible to LWM2M servers, + * there is no need to store them as lwm2m_objects_t + */ + +typedef enum +{ + SEC_NONE = 0, + SEC_PRE_SHARED_KEY, + SEC_RAW_PUBLIC_KEY, + SEC_CERTIFICATE +} lwm2m_security_mode_t; + +typedef struct +{ + lwm2m_security_mode_t mode; + size_t publicKeyLength; + uint8_t * publicKey; + size_t privateKeyLength; + uint8_t * privateKey; +} lwm2m_security_t; + + + typedef struct _lwm2m_server_ { struct _lwm2m_server_ * next; // matches lwm2m_list_t::next @@ -533,6 +561,8 @@ char * location; bool dirty; lwm2m_block1_data_t * block1Data; // buffer to handle block1 data, should be replace by a list to support several block1 transfer by server. + lwm2m_security_t security; + char * sms; } lwm2m_server_t; @@ -733,6 +763,9 @@ void * userData; } lwm2m_context_t; +#ifdef MBED_OS_EXAMPLE_WAKAAMA +int lwm2m_add_server(lwm2m_context_t * contextP, uint16_t shortID, uint32_t lifetime, char * sms, lwm2m_binding_t binding, void * sessionH, lwm2m_security_t * securityP); +#endif // initialize a liblwm2m context. lwm2m_context_t * lwm2m_init(void * userData);