mqtt_error.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * @Author: jiejie
  3. * @Github: https://github.com/jiejieTop
  4. * @Date: 2019-12-15 00:42:16
  5. * @LastEditTime: 2020-10-17 14:16:15
  6. * @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
  7. */
  8. #ifndef _MQTT_ERROR_H_
  9. #define _MQTT_ERROR_H_
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. typedef enum mqtt_error {
  14. MQTT_SSL_CERT_ERROR = -0x001C, /* cetr parse failed */
  15. MQTT_SOCKET_FAILED_ERROR = -0x001B, /* socket fd failed */
  16. MQTT_SOCKET_UNKNOWN_HOST_ERROR = -0x001A, /* socket unknown host ip or domain */
  17. MQTT_SET_PUBLISH_DUP_FAILED_ERROR = -0x0019, /* mqtt publish packet set udp bit failed */
  18. MQTT_CLEAN_SESSION_ERROR = -0x0018, /* mqtt clean session error */
  19. MQTT_ACK_NODE_IS_EXIST_ERROR = -0x0017, /* mqtt ack list is exist ack node */
  20. MQTT_ACK_HANDLER_NUM_TOO_MUCH_ERROR = -0x0016, /* mqtt ack handler number is too much */
  21. MQTT_RESUBSCRIBE_ERROR = -0x0015, /* mqtt resubscribe error */
  22. MQTT_SUBSCRIBE_ERROR = -0x0014, /* mqtt subscribe error */
  23. MQTT_SEND_PACKET_ERROR = -0x0013, /* mqtt send a packet */
  24. MQTT_SERIALIZE_PUBLISH_ACK_PACKET_ERROR = -0x0012, /* mqtt serialize publish ack packet error */
  25. MQTT_PUBLISH_PACKET_ERROR = -0x0011, /* mqtt publish packet error */
  26. MQTT_RECONNECT_TIMEOUT_ERROR = -0x0010, /* mqtt try reconnect, but timeout */
  27. MQTT_SUBSCRIBE_NOT_ACK_ERROR = -0x000F, /* mqtt subscribe, but not ack */
  28. MQTT_NOT_CONNECT_ERROR = -0x000E, /* mqtt not connect */
  29. MQTT_SUBSCRIBE_ACK_PACKET_ERROR = -0x000D, /* mqtt subscribe, but ack packet error */
  30. MQTT_UNSUBSCRIBE_ACK_PACKET_ERROR = -0x000C, /* mqtt unsubscribe, but ack packet error */
  31. MQTT_PUBLISH_ACK_PACKET_ERROR = -0x000B, /* mqtt pubilsh ack packet error */
  32. MQTT_PUBLISH_ACK_TYPE_ERROR = -0x000A, /* mqtt pubilsh ack type error */
  33. MQTT_PUBREC_PACKET_ERROR = -0x0009, /* mqtt pubrec packet error */
  34. MQTT_BUFFER_TOO_SHORT_ERROR = -0x0008, /* mqtt buffer too short */
  35. MQTT_NOTHING_TO_READ_ERROR = -0x0007, /* mqtt nothing to read */
  36. MQTT_SUBSCRIBE_QOS_ERROR = -0x0006, /* mqtt subsrcibe qos error */
  37. MQTT_BUFFER_OVERFLOW_ERROR = -0x0005, /* mqtt buffer overflow */
  38. MQTT_CONNECT_FAILED_ERROR = -0x0004, /* mqtt connect failed */
  39. MQTT_MEM_NOT_ENOUGH_ERROR = -0x0003, /* mqtt memory not enough */
  40. MQTT_NULL_VALUE_ERROR = -0x0002, /* mqtt value is null */
  41. MQTT_FAILED_ERROR = -0x0001, /* failed */
  42. MQTT_SUCCESS_ERROR = 0x0000 /* success */
  43. } mqtt_error_t;
  44. #define RETURN_ERROR(x) { return x; }
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif