test

Committer:
peyo
Date:
Wed Apr 12 14:09:46 2017 +0200
Revision:
1:3f75eb8d46f4
Parent:
0:cd5404401c2f
add main

Who changed what in which revision?

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