Lines Matching refs:err_code
52 int err_code; in client_disconnect() local
54 err_code = mqtt_transport_disconnect(client); in client_disconnect()
55 if (err_code < 0) { in client_disconnect()
75 int err_code; in client_connect() local
78 err_code = mqtt_transport_connect(client); in client_connect()
79 if (err_code < 0) { in client_connect()
80 return err_code; in client_connect()
86 err_code = connect_request_encode(client, &packet); in client_connect()
87 if (err_code < 0) { in client_connect()
92 err_code = mqtt_transport_write(client, packet.cur, in client_connect()
94 if (err_code < 0) { in client_connect()
108 client_disconnect(client, err_code, false); in client_connect()
109 return err_code; in client_connect()
114 int err_code; in client_read() local
120 err_code = mqtt_handle_rx(client); in client_read()
121 if (err_code < 0) { in client_read()
122 client_disconnect(client, err_code, true); in client_read()
125 return err_code; in client_read()
131 int err_code; in client_write() local
135 err_code = mqtt_transport_write(client, data, datalen); in client_write()
136 if (err_code < 0) { in client_write()
138 "closing connection", err_code); in client_write()
139 client_disconnect(client, err_code, true); in client_write()
140 return err_code; in client_write()
152 int err_code; in client_write_msg() local
156 err_code = mqtt_transport_write_msg(client, message); in client_write_msg()
157 if (err_code < 0) { in client_write_msg()
159 "closing connection", err_code); in client_write_msg()
160 client_disconnect(client, err_code, true); in client_write_msg()
161 return err_code; in client_write_msg()
206 int err_code; in mqtt_connect() local
214 err_code = -ENOMEM; in mqtt_connect()
218 err_code = client_connect(client); in mqtt_connect()
221 if (err_code < 0) { in mqtt_connect()
227 return err_code; in mqtt_connect()
242 int err_code; in mqtt_publish() local
259 err_code = verify_tx_state(client); in mqtt_publish()
260 if (err_code < 0) { in mqtt_publish()
264 err_code = publish_encode(param, &packet); in mqtt_publish()
265 if (err_code < 0) { in mqtt_publish()
279 err_code = client_write_msg(client, &msg); in mqtt_publish()
283 client, client->internal.state, err_code); in mqtt_publish()
287 return err_code; in mqtt_publish()
293 int err_code; in mqtt_publish_qos1_ack() local
306 err_code = verify_tx_state(client); in mqtt_publish_qos1_ack()
307 if (err_code < 0) { in mqtt_publish_qos1_ack()
311 err_code = publish_ack_encode(param, &packet); in mqtt_publish_qos1_ack()
312 if (err_code < 0) { in mqtt_publish_qos1_ack()
316 err_code = client_write(client, packet.cur, packet.end - packet.cur); in mqtt_publish_qos1_ack()
320 client, client->internal.state, err_code); in mqtt_publish_qos1_ack()
324 return err_code; in mqtt_publish_qos1_ack()
330 int err_code; in mqtt_publish_qos2_receive() local
343 err_code = verify_tx_state(client); in mqtt_publish_qos2_receive()
344 if (err_code < 0) { in mqtt_publish_qos2_receive()
348 err_code = publish_receive_encode(param, &packet); in mqtt_publish_qos2_receive()
349 if (err_code < 0) { in mqtt_publish_qos2_receive()
353 err_code = client_write(client, packet.cur, packet.end - packet.cur); in mqtt_publish_qos2_receive()
357 client, client->internal.state, err_code); in mqtt_publish_qos2_receive()
361 return err_code; in mqtt_publish_qos2_receive()
367 int err_code; in mqtt_publish_qos2_release() local
380 err_code = verify_tx_state(client); in mqtt_publish_qos2_release()
381 if (err_code < 0) { in mqtt_publish_qos2_release()
385 err_code = publish_release_encode(param, &packet); in mqtt_publish_qos2_release()
386 if (err_code < 0) { in mqtt_publish_qos2_release()
390 err_code = client_write(client, packet.cur, packet.end - packet.cur); in mqtt_publish_qos2_release()
394 client, client->internal.state, err_code); in mqtt_publish_qos2_release()
398 return err_code; in mqtt_publish_qos2_release()
404 int err_code; in mqtt_publish_qos2_complete() local
417 err_code = verify_tx_state(client); in mqtt_publish_qos2_complete()
418 if (err_code < 0) { in mqtt_publish_qos2_complete()
422 err_code = publish_complete_encode(param, &packet); in mqtt_publish_qos2_complete()
423 if (err_code < 0) { in mqtt_publish_qos2_complete()
427 err_code = client_write(client, packet.cur, packet.end - packet.cur); in mqtt_publish_qos2_complete()
428 if (err_code < 0) { in mqtt_publish_qos2_complete()
434 client, client->internal.state, err_code); in mqtt_publish_qos2_complete()
438 return err_code; in mqtt_publish_qos2_complete()
443 int err_code; in mqtt_disconnect() local
452 err_code = verify_tx_state(client); in mqtt_disconnect()
453 if (err_code < 0) { in mqtt_disconnect()
457 err_code = disconnect_encode(&packet); in mqtt_disconnect()
458 if (err_code < 0) { in mqtt_disconnect()
462 err_code = client_write(client, packet.cur, packet.end - packet.cur); in mqtt_disconnect()
463 if (err_code < 0) { in mqtt_disconnect()
472 return err_code; in mqtt_disconnect()
478 int err_code; in mqtt_subscribe() local
492 err_code = verify_tx_state(client); in mqtt_subscribe()
493 if (err_code < 0) { in mqtt_subscribe()
497 err_code = subscribe_encode(param, &packet); in mqtt_subscribe()
498 if (err_code < 0) { in mqtt_subscribe()
502 err_code = client_write(client, packet.cur, packet.end - packet.cur); in mqtt_subscribe()
506 client, client->internal.state, err_code); in mqtt_subscribe()
510 return err_code; in mqtt_subscribe()
516 int err_code; in mqtt_unsubscribe() local
526 err_code = verify_tx_state(client); in mqtt_unsubscribe()
527 if (err_code < 0) { in mqtt_unsubscribe()
531 err_code = unsubscribe_encode(param, &packet); in mqtt_unsubscribe()
532 if (err_code < 0) { in mqtt_unsubscribe()
536 err_code = client_write(client, packet.cur, packet.end - packet.cur); in mqtt_unsubscribe()
541 return err_code; in mqtt_unsubscribe()
546 int err_code; in mqtt_ping() local
555 err_code = verify_tx_state(client); in mqtt_ping()
556 if (err_code < 0) { in mqtt_ping()
560 err_code = ping_request_encode(&packet); in mqtt_ping()
561 if (err_code < 0) { in mqtt_ping()
565 err_code = client_write(client, packet.cur, packet.end - packet.cur); in mqtt_ping()
576 return err_code; in mqtt_ping()
596 int err_code = 0; in mqtt_live() local
608 err_code = mqtt_ping(client); in mqtt_live()
615 return err_code; in mqtt_live()
641 int err_code = 0; in mqtt_input() local
650 err_code = client_read(client); in mqtt_input()
652 err_code = -ENOTCONN; in mqtt_input()
657 return err_code; in mqtt_input()