anjay
|
Go to the source code of this file.
Data Structures | |
struct | anjay_server_instance_t |
Functions | |
int | anjay_server_object_add_instance (anjay_t *anjay, const anjay_server_instance_t *instance, anjay_iid_t *inout_iid) |
void | anjay_server_object_purge (anjay_t *anjay) |
AVS_LIST[const anjay_ssid_t] | anjay_server_get_ssids (anjay_t *anjay) |
avs_error_t | anjay_server_object_persist (anjay_t *anjay, avs_stream_t *out_stream) |
avs_error_t | anjay_server_object_restore (anjay_t *anjay, avs_stream_t *in_stream) |
bool | anjay_server_object_is_modified (anjay_t *anjay) |
int | anjay_server_object_install (anjay_t *anjay) |
int | anjay_server_object_set_lifetime (anjay_t *anjay, anjay_iid_t iid, int32_t lifetime) |
AVS_LIST[ const anjay_ssid_t] anjay_server_get_ssids | ( | anjay_t * | anjay | ) |
Retrieves a list of SSIDs currently present in the Server object. The SSIDs are NOT guaranteed to be returned in any particular order. Returned list may not be freed nor modified.
Attempting to call this function if anjay_server_object_install has not been previously successfully called on the same Anjay instance yields undefined behavior.
The returned list pointer shall be considered invalidated by any call to anjay_sched_run, anjay_serve, anjay_server_object_add_instance, anjay_server_object_purge, anjay_server_object_restore, or, if called from within some callback handler, on return from that handler.
If a transaction on the Server object is currently ongoing (e.g., during Bootstrap), last known state from before the transaction will be returned.
NOTE: If Anjay is compiled with thread safety enabled, the list that is returned is normally accessed with the Anjay mutex locked. You will need to ensure thread safety yourself if using this function. It is recommended to only call it from callback functions called from within Anjay, or in scheduler jobs.
anjay | Anjay instance with Server Object installed. |
int anjay_server_object_add_instance | ( | anjay_t * | anjay, |
const anjay_server_instance_t * | instance, | ||
anjay_iid_t * | inout_iid | ||
) |
Adds new Instance of Server 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 Server Instance Id.
Note: instance
may be safely freed by the user code after this function finishes (internally a deep copy of anjay_server_instance_t is performed).
anjay | Anjay instance with Server Object installed to operate on. |
instance | Server Instance to insert. |
inout_iid | Server Instance id to use or ANJAY_ID_INVALID . |
int anjay_server_object_install | ( | anjay_t * | anjay | ) |
Installs the Server Object in an Anjay instance.
The Server module does not require explicit cleanup; all resources will be automatically freed up during the call to anjay_delete.
anjay | Anjay instance for which the Server Object is installed. |
bool anjay_server_object_is_modified | ( | anjay_t * | anjay | ) |
Checks whether the Server Object from Anjay instance has been modified since last successful call to anjay_server_object_persist or anjay_server_object_restore.
avs_error_t anjay_server_object_persist | ( | anjay_t * | anjay, |
avs_stream_t * | out_stream | ||
) |
Dumps Server Object Instances into the out_stream
.
anjay | Anjay instance with Server Object installed. |
out_stream | Stream to write to. |
void anjay_server_object_purge | ( | anjay_t * | anjay | ) |
Removes all instances of Server Object leaving it in an empty state.
anjay | Anjay instance with Server Object installed to purge. |
avs_error_t anjay_server_object_restore | ( | anjay_t * | anjay, |
avs_stream_t * | in_stream | ||
) |
Attempts to restore Server Object Instances from specified in_stream
.
Note: if restore fails, then Server Object will be left untouched, on success though all Instances stored within the Object will be purged.
anjay | Anjay instance with Server Object installed. |
in_stream | Stream to read from. |
int anjay_server_object_set_lifetime | ( | anjay_t * | anjay, |
anjay_iid_t | iid, | ||
int32_t | lifetime | ||
) |
Sets the Lifetime value for the specified Server Instance ID.
NOTE: Calling this function MAY trigger sending LwM2M Update message to an associated LwM2M Server.
anjay | Anjay instance for which the Server Object is installed. |
iid | Server Object Instance for which the Lifetime shall be altered. |
lifetime | New value of the Lifetime Resource. MUST BE strictly positive. |