net: lwm2m: Remove unneeded function pointer parameter
lwm2m_udp_receive() is only called with same function pointer, so there no need to carry that in the parameter. Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This commit is contained in:
parent
4e97607c27
commit
b9028bb722
5 changed files with 10 additions and 18 deletions
|
@ -642,7 +642,7 @@ static int socket_recv_message(struct lwm2m_ctx *client_ctx)
|
|||
}
|
||||
|
||||
in_buf[len] = 0U;
|
||||
lwm2m_udp_receive(client_ctx, in_buf, len, &from_addr, handle_request);
|
||||
lwm2m_udp_receive(client_ctx, in_buf, len, &from_addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ sys_slist_t *lwm2m_engine_obj_list(void);
|
|||
|
||||
sys_slist_t *lwm2m_engine_obj_inst_list(void);
|
||||
|
||||
static int handle_request(struct coap_packet *request, struct lwm2m_message *msg);
|
||||
#if defined(CONFIG_LWM2M_COAP_BLOCK_TRANSFER)
|
||||
struct coap_block_context *lwm2m_output_block_context(void);
|
||||
#endif
|
||||
|
@ -2193,7 +2194,7 @@ static int lwm2m_exec_handler(struct lwm2m_message *msg)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
int handle_request(struct coap_packet *request, struct lwm2m_message *msg)
|
||||
static int handle_request(struct coap_packet *request, struct lwm2m_message *msg)
|
||||
{
|
||||
int r;
|
||||
uint8_t code;
|
||||
|
@ -2557,7 +2558,7 @@ static int lwm2m_response_promote_to_con(struct lwm2m_message *msg)
|
|||
}
|
||||
|
||||
void lwm2m_udp_receive(struct lwm2m_ctx *client_ctx, uint8_t *buf, uint16_t buf_len,
|
||||
struct sockaddr *from_addr, udp_request_handler_cb_t udp_request_handler)
|
||||
struct sockaddr *from_addr)
|
||||
{
|
||||
struct lwm2m_message *msg = NULL;
|
||||
struct coap_pending *pending;
|
||||
|
@ -2684,12 +2685,7 @@ void lwm2m_udp_receive(struct lwm2m_ctx *client_ctx, uint8_t *buf, uint16_t buf_
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If no normal response handler is found, then this is
|
||||
* a new request coming from the server. Let's look
|
||||
* at registered objects to find a handler.
|
||||
*/
|
||||
if (udp_request_handler && coap_header_get_type(&response) == COAP_TYPE_CON) {
|
||||
if (coap_header_get_type(&response) == COAP_TYPE_CON) {
|
||||
msg = lwm2m_get_message(client_ctx);
|
||||
if (!msg) {
|
||||
LOG_ERR("Unable to get a lwm2m message!");
|
||||
|
@ -2707,7 +2703,7 @@ void lwm2m_udp_receive(struct lwm2m_ctx *client_ctx, uint8_t *buf, uint16_t buf_
|
|||
|
||||
lwm2m_registry_lock();
|
||||
/* process the response to this request */
|
||||
r = udp_request_handler(&response, msg);
|
||||
r = handle_request(&response, msg);
|
||||
lwm2m_registry_unlock();
|
||||
if (r < 0) {
|
||||
return;
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
#define NUM_OUTPUT_BLOCK_CONTEXT CONFIG_LWM2M_NUM_OUTPUT_BLOCK_CONTEXT
|
||||
#endif
|
||||
|
||||
/* Establish a request handler callback type */
|
||||
typedef int (*udp_request_handler_cb_t)(struct coap_packet *request, struct lwm2m_message *msg);
|
||||
/* LwM2M message functions */
|
||||
struct lwm2m_message *lwm2m_get_message(struct lwm2m_ctx *client_ctx);
|
||||
struct lwm2m_message *find_msg(struct coap_pending *pending, struct coap_reply *reply);
|
||||
|
@ -49,10 +47,8 @@ void lm2m_message_clear_allocations(struct lwm2m_message *msg);
|
|||
int lwm2m_init_message(struct lwm2m_message *msg);
|
||||
int lwm2m_send_message_async(struct lwm2m_message *msg);
|
||||
|
||||
int handle_request(struct coap_packet *request, struct lwm2m_message *msg);
|
||||
|
||||
void lwm2m_udp_receive(struct lwm2m_ctx *client_ctx, uint8_t *buf, uint16_t buf_len,
|
||||
struct sockaddr *from_addr, udp_request_handler_cb_t udp_request_handler);
|
||||
struct sockaddr *from_addr);
|
||||
|
||||
int generate_notify_message(struct lwm2m_ctx *ctx, struct observe_node *obs, void *user_data);
|
||||
/* Notification and Send operation */
|
||||
|
|
|
@ -24,8 +24,8 @@ DEFINE_FAKE_VALUE_FUNC(int, generate_notify_message, struct lwm2m_ctx *, struct
|
|||
DEFINE_FAKE_VALUE_FUNC(int64_t, engine_observe_shedule_next_event, struct observe_node *, uint16_t,
|
||||
const int64_t);
|
||||
DEFINE_FAKE_VALUE_FUNC(int, handle_request, struct coap_packet *, struct lwm2m_message *);
|
||||
DEFINE_FAKE_VOID_FUNC(lwm2m_udp_receive, struct lwm2m_ctx *, uint8_t *, uint16_t, struct sockaddr *,
|
||||
udp_request_handler_cb_t);
|
||||
DEFINE_FAKE_VOID_FUNC(lwm2m_udp_receive, struct lwm2m_ctx *, uint8_t *, uint16_t,
|
||||
struct sockaddr *);
|
||||
DEFINE_FAKE_VALUE_FUNC(bool, lwm2m_rd_client_is_registred, struct lwm2m_ctx *);
|
||||
DEFINE_FAKE_VOID_FUNC(lwm2m_engine_context_close, struct lwm2m_ctx *);
|
||||
DEFINE_FAKE_VALUE_FUNC(int, lwm2m_get_res_buf, const struct lwm2m_obj_path *, void **, uint16_t *,
|
||||
|
|
|
@ -39,7 +39,7 @@ DECLARE_FAKE_VALUE_FUNC(int64_t, engine_observe_shedule_next_event, struct obser
|
|||
const int64_t);
|
||||
DECLARE_FAKE_VALUE_FUNC(int, handle_request, struct coap_packet *, struct lwm2m_message *);
|
||||
DECLARE_FAKE_VOID_FUNC(lwm2m_udp_receive, struct lwm2m_ctx *, uint8_t *, uint16_t,
|
||||
struct sockaddr *, udp_request_handler_cb_t);
|
||||
struct sockaddr *);
|
||||
DECLARE_FAKE_VALUE_FUNC(bool, lwm2m_rd_client_is_registred, struct lwm2m_ctx *);
|
||||
DECLARE_FAKE_VOID_FUNC(lwm2m_engine_context_close, struct lwm2m_ctx *);
|
||||
DECLARE_FAKE_VALUE_FUNC(int, lwm2m_get_res_buf, const struct lwm2m_obj_path *, void **, uint16_t *,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue