Some quick code to use UDP-only (no TCP) with mBed. Echos received packets and sends packets when a button is pressed

Dependencies:   mbed

Committer:
pehrhovey
Date:
Sun Mar 14 00:54:12 2010 +0000
Revision:
0:a548a085de55

        

Who changed what in which revision?

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