Function esp_idf_svc::sys::protocomm_req_handle

source ·
pub unsafe extern "C" fn protocomm_req_handle(
    pc: *mut protocomm,
    ep_name: *const i8,
    session_id: u32,
    inbuf: *const u8,
    inlen: isize,
    outbuf: *mut *mut u8,
    outlen: *mut isize,
) -> i32
Expand description

@brief Calls the registered handler of an endpoint session for processing incoming data and generating the response

@note

  • An endpoint must be bound to a valid protocomm instance, created using protocomm_new().
  • Resulting output buffer must be deallocated by the caller.

@param[in] pc Pointer to the protocomm instance @param[in] ep_name Endpoint identifier(name) string @param[in] session_id Unique ID for a communication session @param[in] inbuf Input buffer contains input request data which is to be processed by the registered handler @param[in] inlen Length of the input buffer @param[out] outbuf Pointer to internally allocated output buffer, where the resulting response data output from the registered handler is to be stored @param[out] outlen Buffer length of the allocated output buffer

@return

  • ESP_OK : Request handled successfully
  • ESP_FAIL : Internal error in execution of registered handler
  • ESP_ERR_NO_MEM : Error allocating internal resource
  • ESP_ERR_NOT_FOUND : Endpoint with specified name doesn’t exist
  • ESP_ERR_INVALID_ARG : Null instance/name arguments