EtcPal  0.4.1
ETC Platform Abstraction Layer (EtcPal)
View other versions:
error.h
1 /******************************************************************************
2  * Copyright 2022 ETC Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *******************************************************************************
16  * This file is a part of EtcPal. For more information, go to:
17  * https://github.com/ETCLabs/EtcPal
18  ******************************************************************************/
19 
20 /* etcpal/error.h: Platform-neutral error codes. */
21 
22 #ifndef ETCPAL_ERROR_H_
23 #define ETCPAL_ERROR_H_
24 
25 #include <stdlib.h>
26 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
48 typedef enum
49 {
118 
120 #define ETCPAL_NUM_ERROR_CODES 31
121 
122 const char* etcpal_strerror(etcpal_error_t code);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
132 #endif /* ETCPAL_ERROR_H_ */
const char * etcpal_strerror(etcpal_error_t code)
Get a string representation of an error code.
Definition: error.c:69
etcpal_error_t
A set of error codes that can be returned by library functions.
Definition: error.h:49
@ kEtcPalErrConnReset
A connection was reset (hard/abortive close) by the remote peer.
Definition: error.h:79
@ kEtcPalErrShutdown
Transport endpoint is shut down.
Definition: error.h:88
@ kEtcPalErrNotConn
Transport endpoint is not connected.
Definition: error.h:86
@ kEtcPalErrSys
A system call or C library call failed in a way not covered by other errors.
Definition: error.h:116
@ kEtcPalErrConnAborted
A connection has been aborted.
Definition: error.h:94
@ kEtcPalErrAddrNotAvail
Cannot assign the requested address.
Definition: error.h:75
@ kEtcPalErrBusy
The resource being requested is temporarily unavailable.
Definition: error.h:58
@ kEtcPalErrConnRefused
A connection was refused.
Definition: error.h:96
@ kEtcPalErrNetwork
The operation failed because a network was down or unreachable.
Definition: error.h:77
@ kEtcPalErrNotFound
An identifier or handle passed to a function was not valid or not previously initialized.
Definition: error.h:53
@ kEtcPalErrNoNetints
No network interfaces were found on the system, or there are no network interfaces of a type that can...
Definition: error.h:108
@ kEtcPalErrWouldBlock
The requested operation would block.
Definition: error.h:64
@ kEtcPalErrNoData
Returned from a function that is meant to be called repeatedly to indicate that there is no more data...
Definition: error.h:67
@ kEtcPalErrProtocol
A protocol parsing function encountered a malformed packet.
Definition: error.h:69
@ kEtcPalErrIsConn
Transport endpoint is already connected.
Definition: error.h:84
@ kEtcPalErrInProgress
The operation requested is now in progress and will complete later.
Definition: error.h:100
@ kEtcPalErrHostUnreach
Host is unreachable.
Definition: error.h:92
@ kEtcPalErrPerm
The operation is not permitted.
Definition: error.h:114
@ kEtcPalErrNoSockets
No sockets have been added to the context.
Definition: error.h:110
@ kEtcPalErrMsgSize
Message too long.
Definition: error.h:71
@ kEtcPalErrAlready
The operation requested is already in progress.
Definition: error.h:98
@ kEtcPalErrTimedOut
A connection timed out.
Definition: error.h:90
@ kEtcPalErrNotImpl
A function or specific use of a function is not implemented yet.
Definition: error.h:112
@ kEtcPalErrNoMem
A dynamic memory allocation failed, or there is no space left in a statically allocated array.
Definition: error.h:56
@ kEtcPalErrInvalid
An invalid argument was provided to an API function.
Definition: error.h:62
@ kEtcPalErrNotInit
An API function was called from a module that was not previously initialized.
Definition: error.h:105
@ kEtcPalErrAddrInUse
The requested address is already in use.
Definition: error.h:73
@ kEtcPalErrOk
The call was successful, no error occurred.
Definition: error.h:51
@ kEtcPalErrExists
The item being created already exists.
Definition: error.h:60
@ kEtcPalErrBufSize
A buffer provided to a function was not big enough to hold the data that needed to be packed into it.
Definition: error.h:103
@ kEtcPalErrConnClosed
A connection was gracefully closed by the remote peer.
Definition: error.h:82