Function anjay_security_object_add_instance

Function Documentation

int anjay_security_object_add_instance(anjay_t *anjay, const anjay_security_instance_t *instance, anjay_iid_t *inout_iid)

Adds new Instance of Security Object and returns newly created Instance id via inout_iid .

Note: if *inout_iid is set to ANJAY_ID_INVALID then the Instance id is generated automatically, otherwise value of *inout_iid is used as a new Security Instance Id.

Note: instance may be safely freed by the user code after this function finishes (internally a deep copy of anjay_security_instance_t is performed).

Warning: calling this function during active communication with Bootstrap Server may yield undefined behavior and unexpected failures may occur.

Parameters:
  • anjay – Anjay instance with Security Object installed to operate on.

  • instance – Security Instance to insert.

  • inout_iid – Security Instance id to use or ANJAY_ID_INVALID .

Returns:

0 on success, negative value in case of an error or if the instance of specified id already exists.