Virgil IoT KIT
status_code.h
Go to the documentation of this file.
1 // Copyright (C) 2015-2020 Virgil Security, Inc.
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // (1) Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // (2) Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in
14 // the documentation and/or other materials provided with the
15 // distribution.
16 //
17 // (3) Neither the name of the copyright holder nor the names of its
18 // contributors may be used to endorse or promote products derived from
19 // this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
22 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32 //
33 // Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
34 
63 #ifndef VS_IOT_SDK_STATUS_CODE
64 #define VS_IOT_SDK_STATUS_CODE
65 
67 
68 #ifdef __cplusplus
69 namespace VirgilIoTKit {
70 extern "C" {
71 #endif
72 
77 typedef enum {
80  VS_CODE_OK = 0,
133 } vs_status_e;
134 
145 #define STATUS_CHECK(OPERATION, MESSAGE, ...) CHECK(VS_CODE_OK == (OPERATION), (MESSAGE), ##__VA_ARGS__)
146 
159 #define STATUS_CHECK_RET(OPERATION, MESSAGE, ...) CHECK_RET(VS_CODE_OK == (ret_code = (OPERATION)), ret_code, (MESSAGE), ##__VA_ARGS__)
160 
171 #define STATUS_CHECK_RET_BOOL(OPERATION, MESSAGE, ...) BOOL_CHECK_RET(VS_CODE_OK == (OPERATION), (MESSAGE), ##__VA_ARGS__)
172 
173 #ifdef __cplusplus
174 } // extern "C"
175 } // namespace VirgilIoTKit
176 #endif
177 
178 #endif // VS_IOT_SDK_STATUS_CODE
VS_CODE_ERR_INIT_SNAP
@ VS_CODE_ERR_INIT_SNAP
Error while vs_netif_t .
Definition: status_code.h:125
VS_CODE_ERR_TX_SNAP
@ VS_CODE_ERR_TX_SNAP
Error while vs_netif_t .
Definition: status_code.h:127
VS_CODE_ERR_VERIFY
@ VS_CODE_ERR_VERIFY
Incorrect result of verification.
Definition: status_code.h:99
VS_CODE_ERR_SNAP_NOT_MY_PACKET
@ VS_CODE_ERR_SNAP_NOT_MY_PACKET
SNAP error "not my packet".
Definition: status_code.h:116
VS_CODE_ERR_SNAP_TOO_MUCH_SERVICES
@ VS_CODE_ERR_SNAP_TOO_MUCH_SERVICES
Too much services to be registered by SNAP.
Definition: status_code.h:117
VS_CODE_ERR_NULLPTR_ARGUMENT
@ VS_CODE_ERR_NULLPTR_ARGUMENT
Argument is NULL pointer while it must be not NULL.
Definition: status_code.h:81
VS_CODE_ERR_ZERO_ARGUMENT
@ VS_CODE_ERR_ZERO_ARGUMENT
Argument is zero while it must be not zero.
Definition: status_code.h:82
VS_CODE_ERR_NOT_FOUND
@ VS_CODE_ERR_NOT_FOUND
Entity has not been found.
Definition: status_code.h:89
vs_status_e
vs_status_e
Status code.
Definition: status_code.h:77
VS_CODE_ERR_JSON
@ VS_CODE_ERR_JSON
Error during JSON processing.
Definition: status_code.h:109
VS_CODE_ERR_FILE_WRITE
@ VS_CODE_ERR_FILE_WRITE
Error during file write.
Definition: status_code.h:105
macros.h
Macros to simplify code.
VS_CODE_ERR_THREAD
@ VS_CODE_ERR_THREAD
Error during thread processing.
Definition: status_code.h:119
VS_CODE_ERR_CTX_NOT_READY
@ VS_CODE_ERR_CTX_NOT_READY
Context is not ready.
Definition: status_code.h:87
VS_CODE_ERR_PLC
@ VS_CODE_ERR_PLC
PLC error.
Definition: status_code.h:122
VS_CODE_ERR_AMBIGUOUS_INIT_CALL
@ VS_CODE_ERR_AMBIGUOUS_INIT_CALL
Ambiguous initialization call.
Definition: status_code.h:86
VS_CODE_ERR_NO_CALLBACK
@ VS_CODE_ERR_NO_CALLBACK
There is no callback.
Definition: status_code.h:91
VS_CODE_ERR_FILE
@ VS_CODE_ERR_FILE
Error during file processing.
Definition: status_code.h:103
VS_CODE_COMMAND_NO_RESPONSE
@ VS_CODE_COMMAND_NO_RESPONSE
No need in response.
Definition: status_code.h:78
VS_CODE_OK
@ VS_CODE_OK
Successful operation.
Definition: status_code.h:80
VS_CODE_ERR_NOT_IMPLEMENTED
@ VS_CODE_ERR_NOT_IMPLEMENTED
This feature is not implemented.
Definition: status_code.h:88
VS_CODE_ERR_REQUEST_PREPARE
@ VS_CODE_ERR_REQUEST_PREPARE
Error during request preparation.
Definition: status_code.h:110
VS_CODE_ERR_DEINIT_SNAP
@ VS_CODE_ERR_DEINIT_SNAP
Error while vs_netif_t .
Definition: status_code.h:126
VS_CODE_ERR_FILE_READ
@ VS_CODE_ERR_FILE_READ
Error during file read.
Definition: status_code.h:104
VS_CODE_ERR_PRVS_UNKNOWN
@ VS_CODE_ERR_PRVS_UNKNOWN
Provision error.
Definition: status_code.h:113
VS_CODE_ERR_REQUEST_SEND
@ VS_CODE_ERR_REQUEST_SEND
Error during request send.
Definition: status_code.h:111
VS_CODE_OLD_VERSION
@ VS_CODE_OLD_VERSION
Provided file is not newer than the current file.
Definition: status_code.h:79
VS_CODE_ERR_UNREGISTERED_MAPPING_TYPE
@ VS_CODE_ERR_UNREGISTERED_MAPPING_TYPE
Unsupported mapping type.
Definition: status_code.h:92
VS_CODE_ERR_INCORRECT_SEND_REQUEST
@ VS_CODE_ERR_INCORRECT_SEND_REQUEST
Incorrect send request.
Definition: status_code.h:93
VS_CODE_ERR_UNSUPPORTED
@ VS_CODE_ERR_UNSUPPORTED
Unsupported crypto data.
Definition: status_code.h:100
VS_CODE_ERR_NO_MEMORY
@ VS_CODE_ERR_NO_MEMORY
No memory.
Definition: status_code.h:95
VS_CODE_ERR_SNAP_UNKNOWN
@ VS_CODE_ERR_SNAP_UNKNOWN
SNAP error.
Definition: status_code.h:115
VS_CODE_ERR_NO_SIMULATOR
@ VS_CODE_ERR_NO_SIMULATOR
No simulator has been found.
Definition: status_code.h:120
VS_CODE_ERR_TOO_SMALL_BUFFER
@ VS_CODE_ERR_TOO_SMALL_BUFFER
Buffer is too small.
Definition: status_code.h:96
VS_CODE_ERR_USER
@ VS_CODE_ERR_USER
User specific error codes start with this value.
Definition: status_code.h:131
VS_CODE_ERR_CRYPTO
@ VS_CODE_ERR_CRYPTO
Error during crypto operation processing.
Definition: status_code.h:101
VS_CODE_ERR_POLLING_INFO_CLIENT
@ VS_CODE_ERR_POLLING_INFO_CLIENT
Error while starting polling.
Definition: status_code.h:129
VS_CODE_ERR_NOINIT
@ VS_CODE_ERR_NOINIT
Not initialized.
Definition: status_code.h:123
VS_CODE_ERR_INCORRECT_PARAMETER
@ VS_CODE_ERR_INCORRECT_PARAMETER
Incorrect parameter.
Definition: status_code.h:84
VS_CODE_ERR_UNSUPPORTED_PARAMETER
@ VS_CODE_ERR_UNSUPPORTED_PARAMETER
Unsupported parameter.
Definition: status_code.h:85
VS_CODE_ERR_INCORRECT_ARGUMENT
@ VS_CODE_ERR_INCORRECT_ARGUMENT
Incorrect argument.
Definition: status_code.h:83
VS_CODE_ERR_SOCKET
@ VS_CODE_ERR_SOCKET
Error during socket operations.
Definition: status_code.h:121
VS_CODE_ERR_FORMAT_OVERFLOW
@ VS_CODE_ERR_FORMAT_OVERFLOW
Incorrect data format.
Definition: status_code.h:97
VS_CODE_ERR_MAC_SNAP
@ VS_CODE_ERR_MAC_SNAP
Error while vs_netif_t .
Definition: status_code.h:128
VS_CODE_ERR_FILE_DELETE
@ VS_CODE_ERR_FILE_DELETE
Error during file delete.
Definition: status_code.h:106
VS_CODE_ERR_CLOUD
@ VS_CODE_ERR_CLOUD
Error during operation with cloud.
Definition: status_code.h:108