Function anjay_execute_get_next_arg

Function Documentation

int anjay_execute_get_next_arg(anjay_execute_ctx_t *ctx, int *out_arg, bool *out_has_value)

Reads next argument from execute request content.

Returns ANJAY_ERR_BAD_REQUEST to indicate the message is malformed and user should forward this code as the return value of anjay_dm_resource_execute_t . Arguments are parsed sequentially so not necessarily the first call of this function will return an error. In case of an error all data read up to the point when an error occurs should be considered invalid.

User not interested in argument value (or interested in ignoring the value after reading some part of it), can safely call this function to skip tail of the value and get next argument or an EOF information.

Parameters:
  • ctx – Execute context

  • out_arg – Obtained argument id

  • out_has_value – true if argument has a value, false otherwise

Returns:

0 on success, ANJAY_ERR_BAD_REQUEST in case of malformed message, ANJAY_EXECUTE_GET_ARG_END in case of end of message (in which case out_arg is set to -1, and out_has_value to false)