Control a robot over the internet using UDP and a Ethernet interface.

Dependencies:   EthernetInterface Motor TextLCD mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
apatel336
Date:
Thu Oct 17 13:26:38 2013 +0000
Revision:
0:1496281373a5
Initial Release

Who changed what in which revision?

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