Changes to enabled on-line compiler

Committer:
JMF
Date:
Wed May 30 20:59:51 2018 +0000
Revision:
0:082731ede69f
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 0:082731ede69f 1 /*
JMF 0:082731ede69f 2 * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
JMF 0:082731ede69f 3 *
JMF 0:082731ede69f 4 * Licensed under the Apache License, Version 2.0 (the "License").
JMF 0:082731ede69f 5 * You may not use this file except in compliance with the License.
JMF 0:082731ede69f 6 * A copy of the License is located at
JMF 0:082731ede69f 7 *
JMF 0:082731ede69f 8 * http://aws.amazon.com/apache2.0
JMF 0:082731ede69f 9 *
JMF 0:082731ede69f 10 * or in the "license" file accompanying this file. This file is distributed
JMF 0:082731ede69f 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
JMF 0:082731ede69f 12 * express or implied. See the License for the specific language governing
JMF 0:082731ede69f 13 * permissions and limitations under the License.
JMF 0:082731ede69f 14 */
JMF 0:082731ede69f 15
JMF 0:082731ede69f 16 /**
JMF 0:082731ede69f 17 * @file aws_iot_error.h
JMF 0:082731ede69f 18 * @brief Definition of error types for the SDK.
JMF 0:082731ede69f 19 */
JMF 0:082731ede69f 20
JMF 0:082731ede69f 21 #ifndef AWS_IOT_SDK_SRC_IOT_ERROR_H_
JMF 0:082731ede69f 22 #define AWS_IOT_SDK_SRC_IOT_ERROR_H_
JMF 0:082731ede69f 23
JMF 0:082731ede69f 24 #ifdef __cplusplus
JMF 0:082731ede69f 25 extern "C" {
JMF 0:082731ede69f 26 #endif
JMF 0:082731ede69f 27
JMF 0:082731ede69f 28 /* Used to avoid warnings in case of unused parameters in function pointers */
JMF 0:082731ede69f 29 #define IOT_UNUSED(x) (void)(x)
JMF 0:082731ede69f 30
JMF 0:082731ede69f 31 /*! \public
JMF 0:082731ede69f 32 * @brief IoT Error enum
JMF 0:082731ede69f 33 *
JMF 0:082731ede69f 34 * Enumeration of return values from the IoT_* functions within the SDK.
JMF 0:082731ede69f 35 * Values less than -1 are specific error codes
JMF 0:082731ede69f 36 * Value of -1 is a generic failure response
JMF 0:082731ede69f 37 * Value of 0 is a generic success response
JMF 0:082731ede69f 38 * Values greater than 0 are specific non-error return codes
JMF 0:082731ede69f 39 */
JMF 0:082731ede69f 40 typedef enum {
JMF 0:082731ede69f 41 /** Returned when the Network physical layer is connected */
JMF 0:082731ede69f 42 NETWORK_PHYSICAL_LAYER_CONNECTED = 6,
JMF 0:082731ede69f 43 /** Returned when the Network is manually disconnected */
JMF 0:082731ede69f 44 NETWORK_MANUALLY_DISCONNECTED = 5,
JMF 0:082731ede69f 45 /** Returned when the Network is disconnected and the reconnect attempt is in progress */
JMF 0:082731ede69f 46 NETWORK_ATTEMPTING_RECONNECT = 4,
JMF 0:082731ede69f 47 /** Return value of yield function to indicate auto-reconnect was successful */
JMF 0:082731ede69f 48 NETWORK_RECONNECTED = 3,
JMF 0:082731ede69f 49 /** Returned when a read attempt is made on the TLS buffer and it is empty */
JMF 0:082731ede69f 50 MQTT_NOTHING_TO_READ = 2,
JMF 0:082731ede69f 51 /** Returned when a connection request is successful and packet response is connection accepted */
JMF 0:082731ede69f 52 MQTT_CONNACK_CONNECTION_ACCEPTED = 1,
JMF 0:082731ede69f 53 /** Success return value - no error occurred */
JMF 0:082731ede69f 54 AWS_SUCCESS = 0,
JMF 0:082731ede69f 55 /** A generic error. Not enough information for a specific error code */
JMF 0:082731ede69f 56 FAILURE = -1,
JMF 0:082731ede69f 57 /** A required parameter was passed as null */
JMF 0:082731ede69f 58 NULL_VALUE_ERROR = -2,
JMF 0:082731ede69f 59 /** The TCP socket could not be established */
JMF 0:082731ede69f 60 TCP_CONNECTION_ERROR = -3,
JMF 0:082731ede69f 61 /** The TLS handshake failed */
JMF 0:082731ede69f 62 SSL_CONNECTION_ERROR = -4,
JMF 0:082731ede69f 63 /** Error associated with setting up the parameters of a Socket */
JMF 0:082731ede69f 64 TCP_SETUP_ERROR = -5,
JMF 0:082731ede69f 65 /** A timeout occurred while waiting for the TLS handshake to complete. */
JMF 0:082731ede69f 66 NETWORK_SSL_CONNECT_TIMEOUT_ERROR = -6,
JMF 0:082731ede69f 67 /** A Generic write error based on the platform used */
JMF 0:082731ede69f 68 NETWORK_SSL_WRITE_ERROR = -7,
JMF 0:082731ede69f 69 /** SSL initialization error at the TLS layer */
JMF 0:082731ede69f 70 NETWORK_SSL_INIT_ERROR = -8,
JMF 0:082731ede69f 71 /** An error occurred when loading the certificates. The certificates could not be located or are incorrectly formatted. */
JMF 0:082731ede69f 72 NETWORK_SSL_CERT_ERROR = -9,
JMF 0:082731ede69f 73 /** SSL Write times out */
JMF 0:082731ede69f 74 NETWORK_SSL_WRITE_TIMEOUT_ERROR = -10,
JMF 0:082731ede69f 75 /** SSL Read times out */
JMF 0:082731ede69f 76 NETWORK_SSL_READ_TIMEOUT_ERROR = -11,
JMF 0:082731ede69f 77 /** A Generic error based on the platform used */
JMF 0:082731ede69f 78 NETWORK_SSL_READ_ERROR = -12,
JMF 0:082731ede69f 79 /** Returned when the Network is disconnected and reconnect is either disabled or physical layer is disconnected */
JMF 0:082731ede69f 80 NETWORK_DISCONNECTED_ERROR = -13,
JMF 0:082731ede69f 81 /** Returned when the Network is disconnected and the reconnect attempt has timed out */
JMF 0:082731ede69f 82 NETWORK_RECONNECT_TIMED_OUT_ERROR = -14,
JMF 0:082731ede69f 83 /** Returned when the Network is already connected and a connection attempt is made */
JMF 0:082731ede69f 84 NETWORK_ALREADY_CONNECTED_ERROR = -15,
JMF 0:082731ede69f 85 /** Network layer Error Codes */
JMF 0:082731ede69f 86 /** Network layer Random number generator seeding failed */
JMF 0:082731ede69f 87 NETWORK_MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED = -16,
JMF 0:082731ede69f 88 /** A generic error code for Network layer errors */
JMF 0:082731ede69f 89 NETWORK_SSL_UNKNOWN_ERROR = -17,
JMF 0:082731ede69f 90 /** Returned when the physical layer is disconnected */
JMF 0:082731ede69f 91 NETWORK_PHYSICAL_LAYER_DISCONNECTED = -18,
JMF 0:082731ede69f 92 /** Returned when the root certificate is invalid */
JMF 0:082731ede69f 93 NETWORK_X509_ROOT_CRT_PARSE_ERROR = -19,
JMF 0:082731ede69f 94 /** Returned when the device certificate is invalid */
JMF 0:082731ede69f 95 NETWORK_X509_DEVICE_CRT_PARSE_ERROR = -20,
JMF 0:082731ede69f 96 /** Returned when the private key failed to parse */
JMF 0:082731ede69f 97 NETWORK_PK_PRIVATE_KEY_PARSE_ERROR = -21,
JMF 0:082731ede69f 98 /** Returned when the network layer failed to open a socket */
JMF 0:082731ede69f 99 NETWORK_ERR_NET_SOCKET_FAILED = -22,
JMF 0:082731ede69f 100 /** Returned when the server is unknown */
JMF 0:082731ede69f 101 NETWORK_ERR_NET_UNKNOWN_HOST = -23,
JMF 0:082731ede69f 102 /** Returned when connect request failed */
JMF 0:082731ede69f 103 NETWORK_ERR_NET_CONNECT_FAILED = -24,
JMF 0:082731ede69f 104 /** Returned when there is nothing to read in the TLS read buffer */
JMF 0:082731ede69f 105 NETWORK_SSL_NOTHING_TO_READ = -25,
JMF 0:082731ede69f 106 /** A connection could not be established. */
JMF 0:082731ede69f 107 MQTT_CONNECTION_ERROR = -26,
JMF 0:082731ede69f 108 /** A timeout occurred while waiting for the TLS handshake to complete */
JMF 0:082731ede69f 109 MQTT_CONNECT_TIMEOUT_ERROR = -27,
JMF 0:082731ede69f 110 /** A timeout occurred while waiting for the TLS request complete */
JMF 0:082731ede69f 111 MQTT_REQUEST_TIMEOUT_ERROR = -28,
JMF 0:082731ede69f 112 /** The current client state does not match the expected value */
JMF 0:082731ede69f 113 MQTT_UNEXPECTED_CLIENT_STATE_ERROR = -29,
JMF 0:082731ede69f 114 /** The client state is not idle when request is being made */
JMF 0:082731ede69f 115 MQTT_CLIENT_NOT_IDLE_ERROR = -30,
JMF 0:082731ede69f 116 /** The MQTT RX buffer received corrupt or unexpected message */
JMF 0:082731ede69f 117 MQTT_RX_MESSAGE_PACKET_TYPE_INVALID_ERROR = -31,
JMF 0:082731ede69f 118 /** The MQTT RX buffer received a bigger message. The message will be dropped */
JMF 0:082731ede69f 119 MQTT_RX_BUFFER_TOO_SHORT_ERROR = -32,
JMF 0:082731ede69f 120 /** The MQTT TX buffer is too short for the outgoing message. Request will fail */
JMF 0:082731ede69f 121 MQTT_TX_BUFFER_TOO_SHORT_ERROR = -33,
JMF 0:082731ede69f 122 /** The client is subscribed to the maximum possible number of subscriptions */
JMF 0:082731ede69f 123 MQTT_MAX_SUBSCRIPTIONS_REACHED_ERROR = -34,
JMF 0:082731ede69f 124 /** Failed to decode the remaining packet length on incoming packet */
JMF 0:082731ede69f 125 MQTT_DECODE_REMAINING_LENGTH_ERROR = -35,
JMF 0:082731ede69f 126 /** Connect request failed with the server returning an unknown error */
JMF 0:082731ede69f 127 MQTT_CONNACK_UNKNOWN_ERROR = -36,
JMF 0:082731ede69f 128 /** Connect request failed with the server returning an unacceptable protocol version error */
JMF 0:082731ede69f 129 MQTT_CONNACK_UNACCEPTABLE_PROTOCOL_VERSION_ERROR = -37,
JMF 0:082731ede69f 130 /** Connect request failed with the server returning an identifier rejected error */
JMF 0:082731ede69f 131 MQTT_CONNACK_IDENTIFIER_REJECTED_ERROR = -38,
JMF 0:082731ede69f 132 /** Connect request failed with the server returning an unavailable error */
JMF 0:082731ede69f 133 MQTT_CONNACK_SERVER_UNAVAILABLE_ERROR = -39,
JMF 0:082731ede69f 134 /** Connect request failed with the server returning a bad userdata error */
JMF 0:082731ede69f 135 MQTT_CONNACK_BAD_USERDATA_ERROR = -40,
JMF 0:082731ede69f 136 /** Connect request failed with the server failing to authenticate the request */
JMF 0:082731ede69f 137 MQTT_CONNACK_NOT_AUTHORIZED_ERROR = -41,
JMF 0:082731ede69f 138 /** An error occurred while parsing the JSON string. Usually malformed JSON. */
JMF 0:082731ede69f 139 JSON_PARSE_ERROR = -42,
JMF 0:082731ede69f 140 /** Shadow: The response Ack table is currently full waiting for previously published updates */
JMF 0:082731ede69f 141 SHADOW_WAIT_FOR_PUBLISH = -43,
JMF 0:082731ede69f 142 /** Any time an snprintf writes more than size value, this error will be returned */
JMF 0:082731ede69f 143 SHADOW_JSON_BUFFER_TRUNCATED = -44,
JMF 0:082731ede69f 144 /** Any time an snprintf encounters an encoding error or not enough space in the given buffer */
JMF 0:082731ede69f 145 SHADOW_JSON_ERROR = -45,
JMF 0:082731ede69f 146 /** Mutex initialization failed */
JMF 0:082731ede69f 147 MUTEX_INIT_ERROR = -46,
JMF 0:082731ede69f 148 /** Mutex lock request failed */
JMF 0:082731ede69f 149 MUTEX_LOCK_ERROR = -47,
JMF 0:082731ede69f 150 /** Mutex unlock request failed */
JMF 0:082731ede69f 151 MUTEX_UNLOCK_ERROR = -48,
JMF 0:082731ede69f 152 /** Mutex destroy failed */
JMF 0:082731ede69f 153 MUTEX_DESTROY_ERROR = -49,
JMF 0:082731ede69f 154 /** Input argument exceeded the allowed maximum size */
JMF 0:082731ede69f 155 MAX_SIZE_ERROR = -50,
JMF 0:082731ede69f 156 /** Some limit has been exceeded, e.g. the maximum number of subscriptions has been reached */
JMF 0:082731ede69f 157 LIMIT_EXCEEDED_ERROR = -51,
JMF 0:082731ede69f 158 /** Invalid input topic type */
JMF 0:082731ede69f 159 INVALID_TOPIC_TYPE_ERROR = -52
JMF 0:082731ede69f 160 } IoT_Error_t;
JMF 0:082731ede69f 161
JMF 0:082731ede69f 162 #ifdef __cplusplus
JMF 0:082731ede69f 163 }
JMF 0:082731ede69f 164 #endif
JMF 0:082731ede69f 165
JMF 0:082731ede69f 166 #endif /* AWS_IOT_SDK_SRC_IOT_ERROR_H_ */