Lines Matching refs:client

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()
99 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_PUBCOMP!", client); in mqtt_handle_packet()
107 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_SUBACK!", client); in mqtt_handle_packet()
115 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_UNSUBACK!", client); in mqtt_handle_packet()
123 NET_DBG("[CID %p]: Received MQTT_PKT_TYPE_PINGRSP!", client); in mqtt_handle_packet()
125 if (client->unacked_ping <= 0) { in mqtt_handle_packet()
127 client->unacked_ping = 0; in mqtt_handle_packet()
129 client->unacked_ping--; in mqtt_handle_packet()
142 event_notify(client, &evt); in mqtt_handle_packet()
148 static int mqtt_read_message_chunk(struct mqtt_client *client, in mqtt_read_message_chunk() argument
165 if ((buf->end + remaining > client->rx_buf + client->rx_buf_size) || in mqtt_read_message_chunk()
166 (buf->end + remaining < client->rx_buf)) { in mqtt_read_message_chunk()
168 client); in mqtt_read_message_chunk()
172 len = mqtt_transport_read(client, buf->end, remaining, false); in mqtt_read_message_chunk()
175 NET_ERR("[CID %p]: Transport read error: %d", client, len); in mqtt_read_message_chunk()
181 NET_ERR("[CID %p]: Connection closed.", client); in mqtt_read_message_chunk()
185 client->internal.rx_buf_datalen += len; in mqtt_read_message_chunk()
189 NET_ERR("[CID %p]: Message partially received.", client); in mqtt_read_message_chunk()
196 static int mqtt_read_publish_var_header(struct mqtt_client *client, in mqtt_read_publish_var_header() argument
205 err_code = mqtt_read_message_chunk(client, buf, sizeof(uint16_t)); in mqtt_read_publish_var_header()
222 err_code = mqtt_read_message_chunk(client, buf, in mqtt_read_publish_var_header()
231 static int mqtt_read_and_parse_fixed_header(struct mqtt_client *client, in mqtt_read_and_parse_fixed_header() argument
241 err_code = mqtt_read_message_chunk(client, buf, chunk_size); in mqtt_read_and_parse_fixed_header()
247 buf->cur = client->rx_buf; in mqtt_read_and_parse_fixed_header()
256 int mqtt_handle_rx(struct mqtt_client *client) in mqtt_handle_rx() argument
263 buf.cur = client->rx_buf; in mqtt_handle_rx()
264 buf.end = client->rx_buf + client->internal.rx_buf_datalen; in mqtt_handle_rx()
266 err_code = mqtt_read_and_parse_fixed_header(client, &type_and_flags, in mqtt_handle_rx()
273 err_code = mqtt_read_publish_var_header(client, type_and_flags, in mqtt_handle_rx()
276 err_code = mqtt_read_message_chunk(client, &buf, var_length); in mqtt_handle_rx()
284 err_code = mqtt_handle_packet(client, type_and_flags, var_length, &buf); in mqtt_handle_rx()
289 client->internal.rx_buf_datalen = 0U; in mqtt_handle_rx()