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 43extern "C" { 44#endif 45 46/** 47 * @defgroup infrastructure_errors Error codes 48 * @ingroup infrastructure 49 * @{ 50 */ 51 52/** Define LWIP_ERR_T in cc.h if you want to use 53 * a different type for your platform (must be signed). */ 54#ifdef LWIP_ERR_T 55typedef LWIP_ERR_T err_t; 56#else /* LWIP_ERR_T */ 57typedef s8_t err_t; 58#endif /* LWIP_ERR_T*/ 59 60/** Definitions for error constants. */ 61typedef enum { 62/** No error, everything OK. */ 63 ERR_OK = 0, 64/** Out of memory error. */ 65 ERR_MEM = -1, 66/** Buffer error. */ 67 ERR_BUF = -2, 68/** Timeout. */ 69 ERR_TIMEOUT = -3, 70/** Routing problem. */ 71 ERR_RTE = -4, 72/** Operation in progress */ 73 ERR_INPROGRESS = -5, 74/** Illegal value. */ 75 ERR_VAL = -6, 76/** Operation would block. */ 77 ERR_WOULDBLOCK = -7, 78/** Address in use. */ 79 ERR_USE = -8, 80/** Already connecting. */ 81 ERR_ALREADY = -9, 82/** Conn already established.*/ 83 ERR_ISCONN = -10, 84/** Not connected. */ 85 ERR_CONN = -11, 86/** Low-level netif error */ 87 ERR_IF = -12, 88 89/** Connection aborted. */ 90 ERR_ABRT = -13, 91/** Connection reset. */ 92 ERR_RST = -14, 93/** Connection closed. */ 94 ERR_CLSD = -15, 95/** Illegal argument. */ 96 ERR_ARG = -16 97} err_enum_t; 98 99#define ERR_IS_FATAL(e) ((e) <= ERR_ABRT) 100 101/** 102 * @} 103 */ 104 105#ifdef LWIP_DEBUG 106extern const char *lwip_strerr(err_t err); 107#else 108#define lwip_strerr(x) "" 109#endif /* LWIP_DEBUG */ 110 111#if !NO_SYS 112int err_to_errno(err_t err); 113#endif /* !NO_SYS */ 114 115#ifdef __cplusplus 116} 117#endif 118 119#endif /* LWIP_HDR_ERR_H */ 120