Rtos API example

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 typedef enum {
00062 /** No error, everything OK. */
00063   ERR_OK         = 0,
00064 /** Out of memory error.     */
00065   ERR_MEM        = -1,
00066 /** Buffer error.            */
00067   ERR_BUF        = -2,
00068 /** Timeout.                 */
00069   ERR_TIMEOUT    = -3,
00070 /** Routing problem.         */
00071   ERR_RTE        = -4,
00072 /** Operation in progress    */
00073   ERR_INPROGRESS = -5,
00074 /** Illegal value.           */
00075   ERR_VAL        = -6,
00076 /** Operation would block.   */
00077   ERR_WOULDBLOCK = -7,
00078 /** Address in use.          */
00079   ERR_USE        = -8,
00080 /** Already connecting.      */
00081   ERR_ALREADY    = -9,
00082 /** Conn already established.*/
00083   ERR_ISCONN     = -10,
00084 /** Not connected.           */
00085   ERR_CONN       = -11,
00086 /** Low-level netif error    */
00087   ERR_IF         = -12,
00088 
00089 /** Connection aborted.      */
00090   ERR_ABRT       = -13,
00091 /** Connection reset.        */
00092   ERR_RST        = -14,
00093 /** Connection closed.       */
00094   ERR_CLSD       = -15,
00095 /** Illegal argument.        */
00096   ERR_ARG        = -16
00097 } err_enum_t;
00098 
00099 #define ERR_IS_FATAL(e) ((e) <= ERR_ABRT)
00100 
00101 /**
00102  * @}
00103  */
00104 
00105 #ifdef LWIP_DEBUG
00106 extern const char *lwip_strerr(err_t err);
00107 #else
00108 #define lwip_strerr(x) ""
00109 #endif /* LWIP_DEBUG */
00110 
00111 #if !NO_SYS
00112 int err_to_errno(err_t err);
00113 #endif /* !NO_SYS */
00114 
00115 #ifdef __cplusplus
00116 }
00117 #endif
00118 
00119 #endif /* LWIP_HDR_ERR_H */