pub unsafe extern "C" fn protocomm_add_endpoint(
    pc: *mut protocomm_t,
    ep_name: *const c_char,
    h: protocomm_req_handler_t,
    priv_data: *mut c_void
) -> esp_err_t
Expand description

@brief Add endpoint request handler for a protocomm instance

This API will bind an endpoint handler function to the specified endpoint name, along with any private data that needs to be pass to the handler at the time of call.

@note

  • An endpoint must be bound to a valid protocomm instance, created using protocomm_new().
  • This function internally calls the registered add_endpoint() function of the selected transport which is a member of the protocomm_t instance structure.

@param[in] pc Pointer to the protocomm instance @param[in] ep_name Endpoint identifier(name) string @param[in] h Endpoint handler function @param[in] priv_data Pointer to private data to be passed as a parameter to the handler function on call. Pass NULL if not needed.

@return

  • ESP_OK : Success
  • ESP_FAIL : Error adding endpoint / Endpoint with this name already exists
  • ESP_ERR_NO_MEM : Error allocating endpoint resource
  • ESP_ERR_INVALID_ARG : Null instance/name/handler arguments