Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
object_security.h File Reference
#include "liblwm2m.h"
Include dependency graph for object_security.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

lwm2m_object_t * get_security_object (int serverId, const char *serverUri, char *bsPskId, char *psk, uint16_t pskLen, bool isBootstrap)
 Create the security object and return a pointer to it. More...
 
void clean_security_object (lwm2m_object_t *objectP)
 Free and clean up the security object. More...
 
const char * security_get_server_uri (lwm2m_object_t *objectP, uint16_t secObjInstID)
 Get the server URI from security object. More...
 
int32_t security_get_mode (lwm2m_object_t *objectP, uint16_t secObjInstID)
 Get the security mode from security object. More...
 
const char * security_get_public_id (lwm2m_object_t *objectP, uint16_t secObjInstID, size_t *idLen)
 Get the public id from security object. More...
 
const char * security_get_secret_key (lwm2m_object_t *objectP, uint16_t secObjInstID, size_t *keyLen)
 Get the secret key from security object. More...
 
void security_display_object (lwm2m_object_t *objectP)
 Print the security object to output, for debugging. More...
 
void security_copy_object (lwm2m_object_t *objectDest, lwm2m_object_t *objectSrc)
 Create a copy of the security object source into the destination, with freshly allocated internal data. More...
 

Function Documentation

◆ clean_security_object()

void clean_security_object ( lwm2m_object_t *  objectP)

Free and clean up the security object.

Parameters
objectPPointer to security object

◆ get_security_object()

lwm2m_object_t* get_security_object ( int  serverId,
const char *  serverUri,
char *  bsPskId,
char *  psk,
uint16_t  pskLen,
bool  isBootstrap 
)

Create the security object and return a pointer to it.

Parameters
serverIdUnique server ID
serverUriURI of the server
bsPskIdID of the psk
pskPre shared Key
pskLenLength of preshared key
isBootstraptrue if bootstrapping
Returns
Pointer to created security object, or NULL if error

◆ security_copy_object()

void security_copy_object ( lwm2m_object_t *  objectDest,
lwm2m_object_t *  objectSrc 
)

Create a copy of the security object source into the destination, with freshly allocated internal data.

Parameters
objectDestPointer to the object to write to.
objectSrcPointer to the object to copy from.

◆ security_display_object()

void security_display_object ( lwm2m_object_t *  objectP)

Print the security object to output, for debugging.

Parameters
objectPPointer to security object

◆ security_get_mode()

int32_t security_get_mode ( lwm2m_object_t *  objectP,
uint16_t  secObjInstID 
)

Get the security mode from security object.

Parameters
objectPPointer to security object
secObjInstIDSecurity object ID
Returns
Security mode identifier, or -1 on failure (See LWM2M_SECURITY_MODE_* definitions)

◆ security_get_public_id()

const char* security_get_public_id ( lwm2m_object_t *  objectP,
uint16_t  secObjInstID,
size_t *  idLen 
)

Get the public id from security object.

Parameters
objectPPointer to security object
secObjInstIDSecurity object ID
[out]idLenPointer to output the length of the id to.
Returns
const secret key pointer, with length stored in *keyLen

◆ security_get_secret_key()

const char* security_get_secret_key ( lwm2m_object_t *  objectP,
uint16_t  secObjInstID,
size_t *  keyLen 
)

Get the secret key from security object.

Parameters
objectPPointer to security object
secObjInstIDSecurity object ID
[out]keyLenPointer to output the length of the key to.
Returns
const secret key pointer, with length stored in *keyLen

◆ security_get_server_uri()

const char* security_get_server_uri ( lwm2m_object_t *  objectP,
uint16_t  secObjInstID 
)

Get the server URI from security object.

Parameters
objectPPointer to security object
secObjInstIDSecurity object ID
Returns
pointer reference to server URI which must not be modified