1 /**
2  * @file
3  * lwIP Error codes
4  */
5 /*
6  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without modification,
10  * are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  *    this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  *    this list of conditions and the following disclaimer in the documentation
16  *    and/or other materials provided with the distribution.
17  * 3. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
21  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
23  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
25  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
29  * OF SUCH DAMAGE.
30  *
31  * This file is part of the lwIP TCP/IP stack.
32  *
33  * Author: Adam Dunkels <adam@sics.se>
34  *
35  */
36 #ifndef LWIP_HDR_ERR_H
37 #define LWIP_HDR_ERR_H
38 
39 #include "lwip/opt.h"
40 #include "lwip/arch.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**
47  * @defgroup infrastructure_errors Error codes
48  * @ingroup infrastructure
49  * @{
50  */
51 
52 /** Definitions for error constants. */
53 typedef enum {
54 /** No error, everything OK. */
55   ERR_OK         = 0,
56 /** Out of memory error.     */
57   ERR_MEM        = -1,
58 /** Buffer error.            */
59   ERR_BUF        = -2,
60 /** Timeout.                 */
61   ERR_TIMEOUT    = -3,
62 /** Routing problem.         */
63   ERR_RTE        = -4,
64 /** Operation in progress    */
65   ERR_INPROGRESS = -5,
66 /** Illegal value.           */
67   ERR_VAL        = -6,
68 /** Operation would block.   */
69   ERR_WOULDBLOCK = -7,
70 /** Address in use.          */
71   ERR_USE        = -8,
72 /** Already connecting.      */
73   ERR_ALREADY    = -9,
74 /** Conn already established.*/
75   ERR_ISCONN     = -10,
76 /** Not connected.           */
77   ERR_CONN       = -11,
78 /** Low-level netif error    */
79   ERR_IF         = -12,
80 
81 /** Connection aborted.      */
82   ERR_ABRT       = -13,
83 /** Connection reset.        */
84   ERR_RST        = -14,
85 /** Connection closed.       */
86   ERR_CLSD       = -15,
87 /** Illegal argument.        */
88   ERR_ARG        = -16
89 } err_enum_t;
90 
91 /** Define LWIP_ERR_T in cc.h if you want to use
92  *  a different type for your platform (must be signed). */
93 #ifdef LWIP_ERR_T
94 typedef LWIP_ERR_T err_t;
95 #else /* LWIP_ERR_T */
96 typedef s8_t err_t;
97 #endif /* LWIP_ERR_T*/
98 
99 /**
100  * @}
101  */
102 
103 #ifdef LWIP_DEBUG
104 extern const char *lwip_strerr(err_t err);
105 #else
106 #define lwip_strerr(x) ""
107 #endif /* LWIP_DEBUG */
108 
109 #if !NO_SYS
110 int err_to_errno(err_t err);
111 #endif /* !NO_SYS */
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif /* LWIP_HDR_ERR_H */
118