/Zephyr-latest/subsys/net/lib/mqtt/ |
D | mqtt.c | 21 static void client_reset(struct mqtt_client *client) in client_reset() argument 23 MQTT_STATE_INIT(client); in client_reset() 25 client->internal.last_activity = 0U; in client_reset() 26 client->internal.rx_buf_datalen = 0U; in client_reset() 27 client->internal.remaining_payload = 0U; in client_reset() 31 static void tx_buf_init(struct mqtt_client *client, struct buf_ctx *buf) in tx_buf_init() argument 33 memset(client->tx_buf, 0, client->tx_buf_size); in tx_buf_init() 34 buf->cur = client->tx_buf; in tx_buf_init() 35 buf->end = client->tx_buf + client->tx_buf_size; in tx_buf_init() 38 void event_notify(struct mqtt_client *client, const struct mqtt_evt *evt) in event_notify() argument [all …]
|
D | mqtt_transport.h | 22 typedef int (*transport_connect_handler_t)(struct mqtt_client *client); 25 typedef int (*transport_write_handler_t)(struct mqtt_client *client, 29 typedef int (*transport_write_msg_handler_t)(struct mqtt_client *client, 33 typedef int (*transport_read_handler_t)(struct mqtt_client *client, uint8_t *data, 37 typedef int (*transport_disconnect_handler_t)(struct mqtt_client *client); 73 int mqtt_transport_connect(struct mqtt_client *client); 83 int mqtt_transport_write(struct mqtt_client *client, const uint8_t *data, 94 int mqtt_transport_write_msg(struct mqtt_client *client, 107 int mqtt_transport_read(struct mqtt_client *client, uint8_t *data, uint32_t buflen, 116 int mqtt_transport_disconnect(struct mqtt_client *client); [all …]
|
D | mqtt_transport_websocket.c | 24 int mqtt_client_websocket_connect(struct mqtt_client *client) in mqtt_client_websocket_connect() argument 33 if (client->transport.type == MQTT_TRANSPORT_NON_SECURE_WEBSOCKET) { in mqtt_client_websocket_connect() 34 ret = mqtt_client_tcp_connect(client); in mqtt_client_websocket_connect() 39 transport_sock = client->transport.tcp.sock; in mqtt_client_websocket_connect() 42 else if (client->transport.type == MQTT_TRANSPORT_SECURE_WEBSOCKET) { in mqtt_client_websocket_connect() 43 ret = mqtt_client_tls_connect(client); in mqtt_client_websocket_connect() 48 transport_sock = client->transport.tls.sock; in mqtt_client_websocket_connect() 55 if (client->transport.websocket.config.url == NULL) { in mqtt_client_websocket_connect() 56 client->transport.websocket.config.url = "/mqtt"; in mqtt_client_websocket_connect() 59 if (client->transport.websocket.config.host == NULL) { in mqtt_client_websocket_connect() [all …]
|
D | mqtt_rx.c | 19 static int mqtt_handle_packet(struct mqtt_client *client, in mqtt_handle_packet() argument 33 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_CONNACK!", client); in mqtt_handle_packet() 36 err_code = connect_ack_decode(client, buf, &evt.param.connack); in mqtt_handle_packet() 38 NET_DBG("[CID %p]: return_code: %d", client, in mqtt_handle_packet() 44 MQTT_SET_STATE(client, MQTT_STATE_CONNECTED); in mqtt_handle_packet() 57 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_PUBLISH", client); in mqtt_handle_packet() 64 client->internal.remaining_payload = in mqtt_handle_packet() 75 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_PUBACK!", client); in mqtt_handle_packet() 83 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_PUBREC!", client); in mqtt_handle_packet() 91 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_PUBREL!", client); in mqtt_handle_packet() [all …]
|
D | mqtt_transport.c | 61 int mqtt_transport_connect(struct mqtt_client *client) in mqtt_transport_connect() argument 63 return transport_fn[client->transport.type].connect(client); in mqtt_transport_connect() 66 int mqtt_transport_write(struct mqtt_client *client, const uint8_t *data, in mqtt_transport_write() argument 69 return transport_fn[client->transport.type].write(client, data, in mqtt_transport_write() 73 int mqtt_transport_write_msg(struct mqtt_client *client, in mqtt_transport_write_msg() argument 76 return transport_fn[client->transport.type].write_msg(client, message); in mqtt_transport_write_msg() 79 int mqtt_transport_read(struct mqtt_client *client, uint8_t *data, uint32_t buflen, in mqtt_transport_read() argument 82 return transport_fn[client->transport.type].read(client, data, buflen, in mqtt_transport_read() 86 int mqtt_transport_disconnect(struct mqtt_client *client) in mqtt_transport_disconnect() argument 88 return transport_fn[client->transport.type].disconnect(client); in mqtt_transport_disconnect()
|
D | mqtt_transport_socket_tls.c | 21 int mqtt_client_tls_connect(struct mqtt_client *client) in mqtt_client_tls_connect() argument 23 const struct sockaddr *broker = client->broker; in mqtt_client_tls_connect() 24 struct mqtt_sec_config *tls_config = &client->transport.tls.config; in mqtt_client_tls_connect() 27 client->transport.tls.sock = zsock_socket(broker->sa_family, in mqtt_client_tls_connect() 29 if (client->transport.tls.sock < 0) { in mqtt_client_tls_connect() 33 NET_DBG("Created socket %d", client->transport.tls.sock); in mqtt_client_tls_connect() 36 if (client->transport.proxy.addrlen != 0) { in mqtt_client_tls_connect() 37 ret = setsockopt(client->transport.tls.sock, in mqtt_client_tls_connect() 39 &client->transport.proxy.addr, in mqtt_client_tls_connect() 40 client->transport.proxy.addrlen); in mqtt_client_tls_connect() [all …]
|
D | mqtt_transport_socket_tcp.c | 21 int mqtt_client_tcp_connect(struct mqtt_client *client) in mqtt_client_tcp_connect() argument 23 const struct sockaddr *broker = client->broker; in mqtt_client_tcp_connect() 26 client->transport.tcp.sock = zsock_socket(broker->sa_family, SOCK_STREAM, in mqtt_client_tcp_connect() 28 if (client->transport.tcp.sock < 0) { in mqtt_client_tcp_connect() 33 if (client->transport.proxy.addrlen != 0) { in mqtt_client_tcp_connect() 34 ret = setsockopt(client->transport.tcp.sock, in mqtt_client_tcp_connect() 36 &client->transport.proxy.addr, in mqtt_client_tcp_connect() 37 client->transport.proxy.addrlen); in mqtt_client_tcp_connect() 44 NET_DBG("Created socket %d", client->transport.tcp.sock); in mqtt_client_tcp_connect() 52 ret = zsock_connect(client->transport.tcp.sock, client->broker, in mqtt_client_tcp_connect() [all …]
|
/Zephyr-latest/subsys/net/lib/http/ |
D | http_server_http2.c | 41 static void print_http_frames(struct http_client_ctx *client) in print_http_frames() argument 55 struct http2_frame *frame = &client->current_frame; in print_http_frames() 67 struct http_client_ctx *client, uint32_t stream_id) in find_http_stream_context() argument 69 ARRAY_FOR_EACH(client->streams, i) { in find_http_stream_context() 70 if (client->streams[i].stream_id == stream_id) { in find_http_stream_context() 71 return &client->streams[i]; in find_http_stream_context() 79 struct http_client_ctx *client, uint32_t stream_id) in allocate_http_stream_context() argument 81 ARRAY_FOR_EACH(client->streams, i) { in allocate_http_stream_context() 82 if (client->streams[i].stream_state == HTTP2_STREAM_IDLE) { in allocate_http_stream_context() 83 client->streams[i].stream_id = stream_id; in allocate_http_stream_context() [all …]
|
D | http_server_http1.c | 42 struct http_client_ctx *client) in handle_http1_static_resource() argument 80 ret = http_server_sendall(client, http_response, in handle_http1_static_resource() 86 ret = http_server_sendall(client, data, len); in handle_http1_static_resource() 110 ret = http_server_sendall(client, http_response, \ 119 static int http1_send_headers(struct http_client_ctx *client, enum http_status status, in http1_send_headers() argument 141 ret = http_server_sendall(client, http_response, in http1_send_headers() 163 ret = http_server_sendall(client, http_response, in http1_send_headers() 170 ret = http_server_sendall(client, hdr->value, strlen(hdr->value)); in http1_send_headers() 176 ret = http_server_sendall(client, crlf, 2); in http1_send_headers() 194 ret = http_server_sendall(client, http_response, in http1_send_headers() [all …]
|
D | http_server_core.c | 65 static void close_client_connection(struct http_client_ctx *client); 294 struct http_client_ctx *client = in close_all_sockets() local 297 close_client_connection(client); in close_all_sockets() 304 static void client_release_resources(struct http_client_ctx *client) in client_release_resources() argument 321 if (dynamic_detail->holder != client) { in client_release_resources() 337 dynamic_detail->cb(client, HTTP_SERVER_DATA_ABORTED, &request_ctx, in client_release_resources() 343 void http_server_release_client(struct http_client_ctx *client) in http_server_release_client() argument 348 __ASSERT_NO_MSG(IS_ARRAY_ELEMENT(server_ctx.clients, client)); in http_server_release_client() 350 k_work_cancel_delayable_sync(&client->inactivity_timer, &sync); in http_server_release_client() 351 client_release_resources(client); in http_server_release_client() [all …]
|
/Zephyr-latest/subsys/net/lib/lwm2m/ |
D | lwm2m_rd_client.c | 137 } client; variable 149 if (client.rd_message.ctx) { in rd_get_message() 151 lwm2m_reset_message(&client.rd_message, true); in rd_get_message() 154 client.rd_message.ctx = client.ctx; in rd_get_message() 155 return &client.rd_message; in rd_get_message() 167 if (!client.ctx || !client.rd_message.ctx) { in lwm2m_get_ongoing_rd_msg() 170 return &client.rd_message; in lwm2m_get_ongoing_rd_msg() 175 client.last_tx = k_uptime_get(); in engine_update_tx_time() 180 client.next_event = timestamp; in next_event_at() 186 k_mutex_lock(&client.mutex, K_FOREVER); in set_sm_state_delayed() [all …]
|
/Zephyr-latest/subsys/net/lib/mqtt_sn/ |
D | mqtt_sn.c | 80 static void mqtt_sn_set_state(struct mqtt_sn_client *client, enum mqtt_sn_client_state state) in mqtt_sn_set_state() argument 82 int prev_state = client->state; in mqtt_sn_set_state() 84 client->state = state; in mqtt_sn_set_state() 85 LOG_DBG("Client %p state (%d) -> (%d)", client, prev_state, state); in mqtt_sn_set_state() 101 static int encode_and_send(struct mqtt_sn_client *client, struct mqtt_sn_param *p, in encode_and_send() argument 106 err = mqtt_sn_encode_msg(&client->tx, p); in encode_and_send() 111 LOG_HEXDUMP_DBG(client->tx.data, client->tx.len, "Send message"); in encode_and_send() 113 if (!client->transport->sendto) { in encode_and_send() 119 if (!client->tx.len) { in encode_and_send() 126 err = client->transport->sendto(client, client->tx.data, client->tx.len, NULL, in encode_and_send() [all …]
|
/Zephyr-latest/subsys/net/lib/http/headers/ |
D | server_internal.h | 20 int handle_http_frame_rst_stream(struct http_client_ctx *client); 21 int handle_http_frame_goaway(struct http_client_ctx *client); 22 int handle_http_frame_settings(struct http_client_ctx *client); 23 int handle_http_frame_priority(struct http_client_ctx *client); 24 int handle_http_frame_continuation(struct http_client_ctx *client); 25 int handle_http_frame_window_update(struct http_client_ctx *client); 26 int handle_http_frame_header(struct http_client_ctx *client); 27 int handle_http_frame_headers(struct http_client_ctx *client); 28 int handle_http_frame_data(struct http_client_ctx *client); 29 int handle_http_frame_padding(struct http_client_ctx *client); [all …]
|
/Zephyr-latest/tests/modules/thrift/ThriftTest/src/ |
D | client.cpp | 26 context.client->testVoid(); in ZTEST() 32 context.client->testString(s, "Test"); in ZTEST() 38 zassert_equal(false, context.client->testBool(false), ""); in ZTEST() 39 zassert_equal(true, context.client->testBool(true), ""); in ZTEST() 44 zassert_equal(0, context.client->testByte(0), ""); in ZTEST() 45 zassert_equal(-1, context.client->testByte(-1), ""); in ZTEST() 46 zassert_equal(42, context.client->testByte(42), ""); in ZTEST() 47 zassert_equal(-42, context.client->testByte(-42), ""); in ZTEST() 48 zassert_equal(127, context.client->testByte(127), ""); in ZTEST() 49 zassert_equal(-128, context.client->testByte(-128), ""); in ZTEST() [all …]
|
/Zephyr-latest/subsys/net/lib/coap/ |
D | coap_client.c | 29 static void cancel_requests_with(struct coap_client *client, int error); 30 static int recv_response(struct coap_client *client, struct coap_packet *response, bool *truncated); 31 static int handle_response(struct coap_client *client, const struct coap_packet *response, 33 static struct coap_client_internal_request *get_request_with_mid(struct coap_client *client, 87 static int coap_client_schedule_poll(struct coap_client *client, int sock, in coap_client_schedule_poll() argument 91 client->fd = sock; in coap_client_schedule_poll() 119 static bool has_ongoing_request(struct coap_client *client) in has_ongoing_request() argument 122 if (client->requests[i].request_ongoing == true) { in has_ongoing_request() 130 static bool has_ongoing_exchange(struct coap_client *client) in has_ongoing_exchange() argument 133 if (client->requests[i].request_ongoing == true || in has_ongoing_exchange() [all …]
|
/Zephyr-latest/subsys/bluetooth/audio/ |
D | csip_set_coordinator.c | 113 struct bt_csip_set_coordinator_inst *client = in active_members_reset() local 116 atomic_clear_bit(client->flags, SET_COORDINATOR_FLAG_BUSY); in active_members_reset() 126 struct bt_csip_set_coordinator_inst *client; in lookup_instance_by_handle() local 132 client = &client_insts[conn_index]; in lookup_instance_by_handle() 134 for (int i = 0; i < ARRAY_SIZE(client->svc_insts); i++) { in lookup_instance_by_handle() 135 if (client->svc_insts[i].start_handle <= handle && in lookup_instance_by_handle() 136 client->svc_insts[i].end_handle >= handle) { in lookup_instance_by_handle() 137 return &client->svc_insts[i]; in lookup_instance_by_handle() 148 struct bt_csip_set_coordinator_inst *client; in bt_csip_set_coordinator_lookup_instance_by_index() local 156 client = &client_insts[conn_index]; in bt_csip_set_coordinator_lookup_instance_by_index() [all …]
|
D | has.c | 73 static int read_preset_response(struct has_client *client); 74 static int preset_list_changed(struct has_client *client); 75 static int preset_list_changed_generic_update_tail(struct has_client *client); 76 static int preset_list_changed_record_deleted_last(struct has_client *client); 261 static void client_free(struct has_client *client) in client_free() argument 267 (void)k_work_cancel_delayable(&client->notify_work); in client_free() 270 err = bt_conn_get_info(client->conn, &info); in client_free() 273 if (client->context != NULL && !bt_addr_le_is_bonded(info.id, info.le.dst)) { in client_free() 275 context_free(client->context); in client_free() 276 client->context = NULL; in client_free() [all …]
|
D | cap_common.c | 86 struct bt_cap_common_client *client; in bt_cap_common_get_member_conn() local 92 client = bt_cap_common_get_client_by_csis(member->csip); in bt_cap_common_get_member_conn() 93 if (client == NULL) { in bt_cap_common_get_member_conn() 97 return client->conn; in bt_cap_common_get_member_conn() 222 struct bt_cap_common_client *client = bt_cap_common_get_client_by_acl(conn); in bt_cap_common_disconnected() local 224 if (client->conn != NULL) { in bt_cap_common_disconnected() 225 bt_conn_unref(client->conn); in bt_cap_common_disconnected() 227 (void)memset(client, 0, sizeof(*client)); in bt_cap_common_disconnected() 255 struct bt_cap_common_client *client = &bt_cap_common_clients[i]; in bt_cap_common_get_client_by_csis() local 257 if (client->csis_inst == csis_inst) { in bt_cap_common_get_client_by_csis() [all …]
|
/Zephyr-latest/samples/net/secure_mqtt_sensor_actuator/src/ |
D | mqtt_client.c | 72 static void prepare_fds(struct mqtt_client *client) in prepare_fds() argument 74 if (client->transport.type == MQTT_TRANSPORT_NON_SECURE) { in prepare_fds() 75 fds[0].fd = client->transport.tcp.sock; in prepare_fds() 78 else if (client->transport.type == MQTT_TRANSPORT_SECURE) { in prepare_fds() 79 fds[0].fd = client->transport.tls.sock; in prepare_fds() 123 static void on_mqtt_publish(struct mqtt_client *const client, const struct mqtt_evt *evt) in on_mqtt_publish() argument 128 rc = mqtt_read_publish_payload(client, payload, in on_mqtt_publish() 149 static void mqtt_event_handler(struct mqtt_client *const client, const struct mqtt_evt *evt) in mqtt_event_handler() argument 189 mqtt_publish_qos2_release(client, &rel_param); in mqtt_event_handler() 204 mqtt_publish_qos2_complete(client, &rec_param); in mqtt_event_handler() [all …]
|
/Zephyr-latest/subsys/net/lib/tftp/ |
D | tftp_client.c | 53 static int send_data(int sock, struct tftpc *client, uint32_t block_no, const uint8_t *data_buffer, in send_data() argument 72 sys_put_be16(DATA_OPCODE, client->tftp_buf); in send_data() 73 sys_put_be16(block_no, client->tftp_buf + 2); in send_data() 74 memcpy(client->tftp_buf + TFTP_HEADER_SIZE, data_buffer, data_size); in send_data() 76 ret = zsock_send(sock, client->tftp_buf, data_size + TFTP_HEADER_SIZE, 0); in send_data() 96 ret = zsock_recv(sock, client->tftp_buf, TFTPC_MAX_BUF_SIZE, 0); in send_data() 106 uint16_t opcode = sys_get_be16(client->tftp_buf); in send_data() 107 uint16_t blockno = sys_get_be16(client->tftp_buf + 2); in send_data() 119 if (client->callback) { in send_data() 124 evt.param.error.msg = client->tftp_buf + TFTP_HEADER_SIZE; in send_data() [all …]
|
/Zephyr-latest/samples/net/mqtt_publisher/src/ |
D | main.c | 109 static void prepare_fds(struct mqtt_client *client) in prepare_fds() argument 111 if (client->transport.type == MQTT_TRANSPORT_NON_SECURE) { in prepare_fds() 112 fds[0].fd = client->transport.tcp.sock; in prepare_fds() 115 else if (client->transport.type == MQTT_TRANSPORT_SECURE) { in prepare_fds() 116 fds[0].fd = client->transport.tls.sock; in prepare_fds() 143 void mqtt_evt_handler(struct mqtt_client *const client, in mqtt_evt_handler() argument 190 err = mqtt_publish_qos2_release(client, &rel_param); in mqtt_evt_handler() 243 static int publish(struct mqtt_client *client, enum mqtt_qos qos) in publish() argument 258 return mqtt_publish(client, ¶m); in publish() 298 static void client_init(struct mqtt_client *client) in client_init() argument [all …]
|
/Zephyr-latest/subsys/bluetooth/services/ias/ |
D | ias_client.c | 125 struct bt_ias_client *client = client_by_conn(conn); in bt_ias_prim_disc_cb() local 135 client->discover.uuid = alert_lvl_uuid; in bt_ias_prim_disc_cb() 136 client->discover.start_handle = attr->handle + 1; in bt_ias_prim_disc_cb() 137 client->discover.end_handle = data->end_handle; in bt_ias_prim_disc_cb() 138 client->discover.type = BT_GATT_DISCOVER_CHARACTERISTIC; in bt_ias_prim_disc_cb() 139 client->discover.func = bt_ias_alert_lvl_disc_cb; in bt_ias_prim_disc_cb() 141 err = bt_gatt_discover(conn, &client->discover); in bt_ias_prim_disc_cb() 152 struct bt_ias_client *client = client_by_conn(conn); in bt_ias_discover() local 158 if (atomic_test_bit(client->flags, IAS_DISCOVER_IN_PROGRESS)) { in bt_ias_discover() 162 client_cleanup(client); in bt_ias_discover() [all …]
|
/Zephyr-latest/include/zephyr/net/ |
D | mqtt_sn.h | 161 typedef void (*mqtt_sn_evt_cb_t)(struct mqtt_sn_client *client, const struct mqtt_sn_evt *evt); 196 int (*sendto)(struct mqtt_sn_client *client, void *buf, size_t sz, const void *dest_addr, 205 ssize_t (*recvfrom)(struct mqtt_sn_client *client, void *rx_buf, size_t rx_len, 218 int (*poll)(struct mqtt_sn_client *client); 336 int mqtt_sn_client_init(struct mqtt_sn_client *client, const struct mqtt_sn_data *client_id, 347 void mqtt_sn_client_deinit(struct mqtt_sn_client *client); 360 int mqtt_sn_add_gw(struct mqtt_sn_client *client, uint8_t gw_id, struct mqtt_sn_data gw_addr); 370 int mqtt_sn_search(struct mqtt_sn_client *client, uint8_t radius); 381 int mqtt_sn_connect(struct mqtt_sn_client *client, bool will, bool clean_session); 390 int mqtt_sn_disconnect(struct mqtt_sn_client *client); [all …]
|
D | mqtt.h | 340 typedef void (*mqtt_evt_cb_t)(struct mqtt_client *client, 577 void mqtt_client_init(struct mqtt_client *client); 592 int mqtt_client_set_proxy(struct mqtt_client *client, 615 int mqtt_connect(struct mqtt_client *client); 627 int mqtt_publish(struct mqtt_client *client, 641 int mqtt_publish_qos1_ack(struct mqtt_client *client, 655 int mqtt_publish_qos2_receive(struct mqtt_client *client, 668 int mqtt_publish_qos2_release(struct mqtt_client *client, 682 int mqtt_publish_qos2_complete(struct mqtt_client *client, 694 int mqtt_subscribe(struct mqtt_client *client, [all …]
|
/Zephyr-latest/subsys/bluetooth/mesh/ |
D | proxy_srv.c | 106 static int filter_set(struct bt_mesh_proxy_client *client, in filter_set() argument 121 (void)memset(client->filter, 0, sizeof(client->filter)); in filter_set() 122 client->filter_type = ACCEPT; in filter_set() 125 (void)memset(client->filter, 0, sizeof(client->filter)); in filter_set() 126 client->filter_type = REJECT; in filter_set() 136 static void filter_add(struct bt_mesh_proxy_client *client, uint16_t addr) in filter_add() argument 146 for (i = 0; i < ARRAY_SIZE(client->filter); i++) { in filter_add() 147 if (client->filter[i] == addr) { in filter_add() 152 for (i = 0; i < ARRAY_SIZE(client->filter); i++) { in filter_add() 153 if (client->filter[i] == BT_MESH_ADDR_UNASSIGNED) { in filter_add() [all …]
|