Rizky Ardi Maulana / mbed-os
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers err.h Source File

err.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * lwIP Error codes
00004  */
00005 /*
00006  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without modification,
00010  * are permitted provided that the following conditions are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright notice,
00013  *    this list of conditions and the following disclaimer.
00014  * 2. Redistributions in binary form must reproduce the above copyright notice,
00015  *    this list of conditions and the following disclaimer in the documentation
00016  *    and/or other materials provided with the distribution.
00017  * 3. The name of the author may not be used to endorse or promote products
00018  *    derived from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00021  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00022  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00023  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00024  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00025  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00028  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00029  * OF SUCH DAMAGE.
00030  *
00031  * This file is part of the lwIP TCP/IP stack.
00032  *
00033  * Author: Adam Dunkels <adam@sics.se>
00034  *
00035  */
00036 #ifndef LWIP_HDR_ERR_H
00037 #define LWIP_HDR_ERR_H
00038 
00039 #include "lwip/opt.h"
00040 #include "lwip/arch.h"
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 /**
00047  * @defgroup infrastructure_errors Error codes
00048  * @ingroup infrastructure
00049  * @{
00050  */
00051 
00052 /** Define LWIP_ERR_T in cc.h if you want to use
00053  *  a different type for your platform (must be signed). */
00054 #ifdef LWIP_ERR_T
00055 typedef LWIP_ERR_T err_t;
00056 #else /* LWIP_ERR_T */
00057 typedef s8_t err_t;
00058 #endif /* LWIP_ERR_T*/
00059 
00060 /* Definitions for error constants. */
00061 
00062 /** No error, everything OK. */
00063 #define ERR_OK          0 
00064 /** Out of memory error.     */
00065 #define ERR_MEM        -1
00066 /** Buffer error.            */
00067 #define ERR_BUF        -2
00068 /** Timeout.                 */
00069 #define ERR_TIMEOUT    -3
00070 /** Routing problem.         */
00071 #define ERR_RTE        -4
00072 /** Operation in progress    */
00073 #define ERR_INPROGRESS -5
00074 /** Illegal value.           */
00075 #define ERR_VAL        -6
00076 /** Operation would block.   */
00077 #define ERR_WOULDBLOCK -7
00078 /** Address in use.          */
00079 #define ERR_USE        -8
00080 /** Already connecting.      */
00081 #define ERR_ALREADY    -9
00082 /** Conn already established.*/
00083 #define ERR_ISCONN     -10
00084 /** Not connected.           */
00085 #define ERR_CONN       -11
00086 /** Low-level netif error    */
00087 #define ERR_IF         -12
00088 
00089 #define ERR_IS_FATAL(e) ((e) <= ERR_ABRT)
00090 /** Connection aborted.      */
00091 #define ERR_ABRT       -13
00092 /** Connection reset.        */
00093 #define ERR_RST        -14
00094 /** Connection closed.       */
00095 #define ERR_CLSD       -15
00096 /** Illegal argument.        */
00097 #define ERR_ARG        -16
00098 
00099 /**
00100  * @}
00101  */
00102 
00103 #ifdef LWIP_DEBUG
00104 extern const char *lwip_strerr(err_t err);
00105 #else
00106 #define lwip_strerr(x) ""
00107 #endif /* LWIP_DEBUG */
00108 
00109 #ifdef __cplusplus
00110 }
00111 #endif
00112 
00113 #endif /* LWIP_HDR_ERR_H */