Onenet
Dependents: K64F_eCompass_OneNET_JW
lwip/api/err.c@0:b2805b6888dc, 2016-06-20 (annotated)
- Committer:
- robert_jw
- Date:
- Mon Jun 20 01:40:20 2016 +0000
- Revision:
- 0:b2805b6888dc
ADS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
robert_jw | 0:b2805b6888dc | 1 | /** |
robert_jw | 0:b2805b6888dc | 2 | * @file |
robert_jw | 0:b2805b6888dc | 3 | * Error Management module |
robert_jw | 0:b2805b6888dc | 4 | * |
robert_jw | 0:b2805b6888dc | 5 | */ |
robert_jw | 0:b2805b6888dc | 6 | |
robert_jw | 0:b2805b6888dc | 7 | /* |
robert_jw | 0:b2805b6888dc | 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
robert_jw | 0:b2805b6888dc | 9 | * All rights reserved. |
robert_jw | 0:b2805b6888dc | 10 | * |
robert_jw | 0:b2805b6888dc | 11 | * Redistribution and use in source and binary forms, with or without modification, |
robert_jw | 0:b2805b6888dc | 12 | * are permitted provided that the following conditions are met: |
robert_jw | 0:b2805b6888dc | 13 | * |
robert_jw | 0:b2805b6888dc | 14 | * 1. Redistributions of source code must retain the above copyright notice, |
robert_jw | 0:b2805b6888dc | 15 | * this list of conditions and the following disclaimer. |
robert_jw | 0:b2805b6888dc | 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
robert_jw | 0:b2805b6888dc | 17 | * this list of conditions and the following disclaimer in the documentation |
robert_jw | 0:b2805b6888dc | 18 | * and/or other materials provided with the distribution. |
robert_jw | 0:b2805b6888dc | 19 | * 3. The name of the author may not be used to endorse or promote products |
robert_jw | 0:b2805b6888dc | 20 | * derived from this software without specific prior written permission. |
robert_jw | 0:b2805b6888dc | 21 | * |
robert_jw | 0:b2805b6888dc | 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
robert_jw | 0:b2805b6888dc | 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
robert_jw | 0:b2805b6888dc | 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
robert_jw | 0:b2805b6888dc | 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
robert_jw | 0:b2805b6888dc | 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
robert_jw | 0:b2805b6888dc | 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
robert_jw | 0:b2805b6888dc | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
robert_jw | 0:b2805b6888dc | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
robert_jw | 0:b2805b6888dc | 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
robert_jw | 0:b2805b6888dc | 31 | * OF SUCH DAMAGE. |
robert_jw | 0:b2805b6888dc | 32 | * |
robert_jw | 0:b2805b6888dc | 33 | * This file is part of the lwIP TCP/IP stack. |
robert_jw | 0:b2805b6888dc | 34 | * |
robert_jw | 0:b2805b6888dc | 35 | * Author: Adam Dunkels <adam@sics.se> |
robert_jw | 0:b2805b6888dc | 36 | * |
robert_jw | 0:b2805b6888dc | 37 | */ |
robert_jw | 0:b2805b6888dc | 38 | |
robert_jw | 0:b2805b6888dc | 39 | #include "lwip/err.h" |
robert_jw | 0:b2805b6888dc | 40 | |
robert_jw | 0:b2805b6888dc | 41 | #ifdef LWIP_DEBUG |
robert_jw | 0:b2805b6888dc | 42 | |
robert_jw | 0:b2805b6888dc | 43 | static const char *err_strerr[] = { |
robert_jw | 0:b2805b6888dc | 44 | "Ok.", /* ERR_OK 0 */ |
robert_jw | 0:b2805b6888dc | 45 | "Out of memory error.", /* ERR_MEM -1 */ |
robert_jw | 0:b2805b6888dc | 46 | "Buffer error.", /* ERR_BUF -2 */ |
robert_jw | 0:b2805b6888dc | 47 | "Timeout.", /* ERR_TIMEOUT -3 */ |
robert_jw | 0:b2805b6888dc | 48 | "Routing problem.", /* ERR_RTE -4 */ |
robert_jw | 0:b2805b6888dc | 49 | "Operation in progress.", /* ERR_INPROGRESS -5 */ |
robert_jw | 0:b2805b6888dc | 50 | "Illegal value.", /* ERR_VAL -6 */ |
robert_jw | 0:b2805b6888dc | 51 | "Operation would block.", /* ERR_WOULDBLOCK -7 */ |
robert_jw | 0:b2805b6888dc | 52 | "Address in use.", /* ERR_USE -8 */ |
robert_jw | 0:b2805b6888dc | 53 | "Already connected.", /* ERR_ISCONN -9 */ |
robert_jw | 0:b2805b6888dc | 54 | "Connection aborted.", /* ERR_ABRT -10 */ |
robert_jw | 0:b2805b6888dc | 55 | "Connection reset.", /* ERR_RST -11 */ |
robert_jw | 0:b2805b6888dc | 56 | "Connection closed.", /* ERR_CLSD -12 */ |
robert_jw | 0:b2805b6888dc | 57 | "Not connected.", /* ERR_CONN -13 */ |
robert_jw | 0:b2805b6888dc | 58 | "Illegal argument.", /* ERR_ARG -14 */ |
robert_jw | 0:b2805b6888dc | 59 | "Low-level netif error.", /* ERR_IF -15 */ |
robert_jw | 0:b2805b6888dc | 60 | }; |
robert_jw | 0:b2805b6888dc | 61 | |
robert_jw | 0:b2805b6888dc | 62 | /** |
robert_jw | 0:b2805b6888dc | 63 | * Convert an lwip internal error to a string representation. |
robert_jw | 0:b2805b6888dc | 64 | * |
robert_jw | 0:b2805b6888dc | 65 | * @param err an lwip internal err_t |
robert_jw | 0:b2805b6888dc | 66 | * @return a string representation for err |
robert_jw | 0:b2805b6888dc | 67 | */ |
robert_jw | 0:b2805b6888dc | 68 | const char * |
robert_jw | 0:b2805b6888dc | 69 | lwip_strerr(err_t err) |
robert_jw | 0:b2805b6888dc | 70 | { |
robert_jw | 0:b2805b6888dc | 71 | return err_strerr[-err]; |
robert_jw | 0:b2805b6888dc | 72 | |
robert_jw | 0:b2805b6888dc | 73 | } |
robert_jw | 0:b2805b6888dc | 74 | |
robert_jw | 0:b2805b6888dc | 75 | #endif /* LWIP_DEBUG */ |