Lines Matching refs:client_ctx
446 void lwm2m_engine_context_close(struct lwm2m_ctx *client_ctx) in lwm2m_engine_context_close() argument
453 lwm2m_client_lock(client_ctx); in lwm2m_engine_context_close()
456 while (!sys_slist_is_empty(&client_ctx->observer)) { in lwm2m_engine_context_close()
457 obs_node = sys_slist_get_not_empty(&client_ctx->observer); in lwm2m_engine_context_close()
459 remove_observer_from_list(client_ctx, NULL, obs); in lwm2m_engine_context_close()
463 if (msg->ctx == client_ctx) { in lwm2m_engine_context_close()
468 coap_pendings_clear(client_ctx->pendings, ARRAY_SIZE(client_ctx->pendings)); in lwm2m_engine_context_close()
469 coap_replies_clear(client_ctx->replies, ARRAY_SIZE(client_ctx->replies)); in lwm2m_engine_context_close()
471 client_ctx->connection_suspended = false; in lwm2m_engine_context_close()
473 client_ctx->buffer_client_messages = true; in lwm2m_engine_context_close()
475 lwm2m_client_unlock(client_ctx); in lwm2m_engine_context_close()
478 void lwm2m_engine_context_init(struct lwm2m_ctx *client_ctx) in lwm2m_engine_context_init() argument
480 sys_slist_init(&client_ctx->pending_sends); in lwm2m_engine_context_init()
481 sys_slist_init(&client_ctx->observer); in lwm2m_engine_context_init()
482 client_ctx->connection_suspended = false; in lwm2m_engine_context_init()
484 client_ctx->buffer_client_messages = true; in lwm2m_engine_context_init()
485 sys_slist_init(&client_ctx->queued_messages); in lwm2m_engine_context_init()
487 k_mutex_init(&client_ctx->lock); in lwm2m_engine_context_init()
543 struct lwm2m_message *lwm2m_get_message(struct lwm2m_ctx *client_ctx) in lwm2m_get_message() argument
552 messages[i].ctx = client_ctx; in lwm2m_get_message()
778 int lwm2m_send_empty_ack(struct lwm2m_ctx *client_ctx, uint16_t mid) in lwm2m_send_empty_ack() argument
783 msg = lwm2m_get_message(client_ctx); in lwm2m_send_empty_ack()
798 ret = zsock_send(client_ctx->sock_fd, msg->cpkt.data, msg->cpkt.offset, 0); in lwm2m_send_empty_ack()
810 void lwm2m_acknowledge(struct lwm2m_ctx *client_ctx) in lwm2m_acknowledge() argument
814 if (client_ctx == NULL || client_ctx->processed_req == NULL) { in lwm2m_acknowledge()
818 request = (struct lwm2m_message *)client_ctx->processed_req; in lwm2m_acknowledge()
824 if (lwm2m_send_empty_ack(client_ctx, request->mid) < 0) { in lwm2m_acknowledge()
2735 void lwm2m_udp_receive(struct lwm2m_ctx *client_ctx, uint8_t *buf, uint16_t buf_len, in lwm2m_udp_receive() argument
2758 lwm2m_client_lock(client_ctx); in lwm2m_udp_receive()
2760 pending = coap_pending_received(&response, client_ctx->pendings, in lwm2m_udp_receive()
2761 ARRAY_SIZE(client_ctx->pendings)); in lwm2m_udp_receive()
2788 reply = coap_response_received(&response, from_addr, client_ctx->replies, in lwm2m_udp_receive()
2789 ARRAY_SIZE(client_ctx->replies)); in lwm2m_udp_receive()
2794 r = lwm2m_send_empty_ack(client_ctx, coap_header_get_id(&response)); in lwm2m_udp_receive()
2868 lwm2m_client_unlock(client_ctx); in lwm2m_udp_receive()
2882 msg = lwm2m_get_message(client_ctx); in lwm2m_udp_receive()
2895 client_ctx->processed_req = msg; in lwm2m_udp_receive()
2914 client_ctx->processed_req = NULL; in lwm2m_udp_receive()
2923 lwm2m_client_unlock(client_ctx); in lwm2m_udp_receive()
2930 struct lwm2m_ctx *client_ctx = msg->ctx; in notify_message_timeout_cb() local
2933 obs = engine_observe_node_discover(&client_ctx->observer, &prev_node, NULL, in notify_message_timeout_cb()
2938 if (client_ctx->observe_cb) { in notify_message_timeout_cb()
2939 client_ctx->observe_cb(LWM2M_OBSERVE_EVENT_NOTIFY_TIMEOUT, in notify_message_timeout_cb()
2943 lwm2m_rd_client_timeout(client_ctx); in notify_message_timeout_cb()
3293 int lwm2m_parse_peerinfo(char *url, struct lwm2m_ctx *client_ctx, bool is_firmware_uri) in lwm2m_parse_peerinfo() argument
3321 client_ctx->use_dtls = false; in lwm2m_parse_peerinfo()
3324 client_ctx->use_dtls = true; in lwm2m_parse_peerinfo()
3331 if (is_firmware_uri && client_ctx->use_dtls) { in lwm2m_parse_peerinfo()
3351 (void)memset(&client_ctx->remote_addr, 0, sizeof(client_ctx->remote_addr)); in lwm2m_parse_peerinfo()
3354 client_ctx->remote_addr.sa_family = AF_INET6; in lwm2m_parse_peerinfo()
3356 &((struct sockaddr_in6 *)&client_ctx->remote_addr)->sin6_addr); in lwm2m_parse_peerinfo()
3359 client_ctx->remote_addr.sa_family = AF_INET; in lwm2m_parse_peerinfo()
3361 &((struct sockaddr_in *)&client_ctx->remote_addr)->sin_addr); in lwm2m_parse_peerinfo()
3384 memcpy(&client_ctx->remote_addr, res->ai_addr, sizeof(client_ctx->remote_addr)); in lwm2m_parse_peerinfo()
3385 client_ctx->remote_addr.sa_family = res->ai_family; in lwm2m_parse_peerinfo()
3389 client_ctx->desthostname = url + off; in lwm2m_parse_peerinfo()
3390 client_ctx->desthostnamelen = len; in lwm2m_parse_peerinfo()
3399 if (client_ctx->remote_addr.sa_family == AF_INET6) { in lwm2m_parse_peerinfo()
3400 net_sin6(&client_ctx->remote_addr)->sin6_port = htons(parser.port); in lwm2m_parse_peerinfo()
3401 } else if (client_ctx->remote_addr.sa_family == AF_INET) { in lwm2m_parse_peerinfo()
3402 net_sin(&client_ctx->remote_addr)->sin_port = htons(parser.port); in lwm2m_parse_peerinfo()