Ethernet test for ECE 4180 and others to find your IP address and do a simple HTTP GET request over port 80.

Dependencies:   mbed Socket lwip-eth lwip-sys lwip

Committer:
mkersh3
Date:
Thu Apr 04 05:26:09 2013 +0000
Revision:
0:e7ca326e76ee
Ethernet Test for ECE4180 and others to find their IP Address and do a simple HTTP GET request over port 80.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mkersh3 0:e7ca326e76ee 1 /*
mkersh3 0:e7ca326e76ee 2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
mkersh3 0:e7ca326e76ee 3 * All rights reserved.
mkersh3 0:e7ca326e76ee 4 *
mkersh3 0:e7ca326e76ee 5 * Redistribution and use in source and binary forms, with or without modification,
mkersh3 0:e7ca326e76ee 6 * are permitted provided that the following conditions are met:
mkersh3 0:e7ca326e76ee 7 *
mkersh3 0:e7ca326e76ee 8 * 1. Redistributions of source code must retain the above copyright notice,
mkersh3 0:e7ca326e76ee 9 * this list of conditions and the following disclaimer.
mkersh3 0:e7ca326e76ee 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
mkersh3 0:e7ca326e76ee 11 * this list of conditions and the following disclaimer in the documentation
mkersh3 0:e7ca326e76ee 12 * and/or other materials provided with the distribution.
mkersh3 0:e7ca326e76ee 13 * 3. The name of the author may not be used to endorse or promote products
mkersh3 0:e7ca326e76ee 14 * derived from this software without specific prior written permission.
mkersh3 0:e7ca326e76ee 15 *
mkersh3 0:e7ca326e76ee 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mkersh3 0:e7ca326e76ee 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mkersh3 0:e7ca326e76ee 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mkersh3 0:e7ca326e76ee 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mkersh3 0:e7ca326e76ee 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mkersh3 0:e7ca326e76ee 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mkersh3 0:e7ca326e76ee 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mkersh3 0:e7ca326e76ee 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mkersh3 0:e7ca326e76ee 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mkersh3 0:e7ca326e76ee 25 * OF SUCH DAMAGE.
mkersh3 0:e7ca326e76ee 26 *
mkersh3 0:e7ca326e76ee 27 * This file is part of the lwIP TCP/IP stack.
mkersh3 0:e7ca326e76ee 28 *
mkersh3 0:e7ca326e76ee 29 * Author: Adam Dunkels <adam@sics.se>
mkersh3 0:e7ca326e76ee 30 *
mkersh3 0:e7ca326e76ee 31 */
mkersh3 0:e7ca326e76ee 32 #ifndef __CC_H__
mkersh3 0:e7ca326e76ee 33 #define __CC_H__
mkersh3 0:e7ca326e76ee 34
mkersh3 0:e7ca326e76ee 35 #include <stdint.h>
mkersh3 0:e7ca326e76ee 36
mkersh3 0:e7ca326e76ee 37 /* Types based on stdint.h */
mkersh3 0:e7ca326e76ee 38 typedef uint8_t u8_t;
mkersh3 0:e7ca326e76ee 39 typedef int8_t s8_t;
mkersh3 0:e7ca326e76ee 40 typedef uint16_t u16_t;
mkersh3 0:e7ca326e76ee 41 typedef int16_t s16_t;
mkersh3 0:e7ca326e76ee 42 typedef uint32_t u32_t;
mkersh3 0:e7ca326e76ee 43 typedef int32_t s32_t;
mkersh3 0:e7ca326e76ee 44 typedef uintptr_t mem_ptr_t;
mkersh3 0:e7ca326e76ee 45
mkersh3 0:e7ca326e76ee 46 /* Define (sn)printf formatters for these lwIP types */
mkersh3 0:e7ca326e76ee 47 #define U16_F "hu"
mkersh3 0:e7ca326e76ee 48 #define S16_F "hd"
mkersh3 0:e7ca326e76ee 49 #define X16_F "hx"
mkersh3 0:e7ca326e76ee 50 #define U32_F "lu"
mkersh3 0:e7ca326e76ee 51 #define S32_F "ld"
mkersh3 0:e7ca326e76ee 52 #define X32_F "lx"
mkersh3 0:e7ca326e76ee 53 #define SZT_F "uz"
mkersh3 0:e7ca326e76ee 54
mkersh3 0:e7ca326e76ee 55 /* ARM/LPC17xx is little endian only */
mkersh3 0:e7ca326e76ee 56 #define BYTE_ORDER LITTLE_ENDIAN
mkersh3 0:e7ca326e76ee 57
mkersh3 0:e7ca326e76ee 58 /* Use LWIP error codes */
mkersh3 0:e7ca326e76ee 59 #define LWIP_PROVIDE_ERRNO
mkersh3 0:e7ca326e76ee 60
mkersh3 0:e7ca326e76ee 61 #if defined(__arm__) && defined(__ARMCC_VERSION)
mkersh3 0:e7ca326e76ee 62 /* Keil uVision4 tools */
mkersh3 0:e7ca326e76ee 63 #define PACK_STRUCT_BEGIN __packed
mkersh3 0:e7ca326e76ee 64 #define PACK_STRUCT_STRUCT
mkersh3 0:e7ca326e76ee 65 #define PACK_STRUCT_END
mkersh3 0:e7ca326e76ee 66 #define PACK_STRUCT_FIELD(fld) fld
mkersh3 0:e7ca326e76ee 67 #define ALIGNED(n) __align(n)
mkersh3 0:e7ca326e76ee 68 #elif defined (__IAR_SYSTEMS_ICC__)
mkersh3 0:e7ca326e76ee 69 /* IAR Embedded Workbench tools */
mkersh3 0:e7ca326e76ee 70 #define PACK_STRUCT_BEGIN __packed
mkersh3 0:e7ca326e76ee 71 #define PACK_STRUCT_STRUCT
mkersh3 0:e7ca326e76ee 72 #define PACK_STRUCT_END
mkersh3 0:e7ca326e76ee 73 #define PACK_STRUCT_FIELD(fld) fld
mkersh3 0:e7ca326e76ee 74 // #define PACK_STRUCT_USE_INCLUDES
mkersh3 0:e7ca326e76ee 75 #error NEEDS ALIGNED // FIXME TBD
mkersh3 0:e7ca326e76ee 76 #else
mkersh3 0:e7ca326e76ee 77 /* GCC tools (CodeSourcery) */
mkersh3 0:e7ca326e76ee 78 #define PACK_STRUCT_BEGIN
mkersh3 0:e7ca326e76ee 79 #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
mkersh3 0:e7ca326e76ee 80 #define PACK_STRUCT_END
mkersh3 0:e7ca326e76ee 81 #define PACK_STRUCT_FIELD(fld) fld
mkersh3 0:e7ca326e76ee 82 #define ALIGNED(n) __attribute__((aligned (n)))
mkersh3 0:e7ca326e76ee 83 #define ALIGNED(n) __align(n)
mkersh3 0:e7ca326e76ee 84 #endif
mkersh3 0:e7ca326e76ee 85
mkersh3 0:e7ca326e76ee 86 /* Used with IP headers only */
mkersh3 0:e7ca326e76ee 87 #define LWIP_CHKSUM_ALGORITHM 1
mkersh3 0:e7ca326e76ee 88
mkersh3 0:e7ca326e76ee 89 #ifdef LWIP_DEBUG
mkersh3 0:e7ca326e76ee 90
mkersh3 0:e7ca326e76ee 91 #include "stdio.h"
mkersh3 0:e7ca326e76ee 92
mkersh3 0:e7ca326e76ee 93 void assert_printf(char *msg, int line, char *file);
mkersh3 0:e7ca326e76ee 94
mkersh3 0:e7ca326e76ee 95 /* Plaform specific diagnostic output */
mkersh3 0:e7ca326e76ee 96 #define LWIP_PLATFORM_DIAG(vars) printf vars
mkersh3 0:e7ca326e76ee 97 #define LWIP_PLATFORM_ASSERT(flag) { assert_printf((flag), __LINE__, __FILE__); }
mkersh3 0:e7ca326e76ee 98 #else
mkersh3 0:e7ca326e76ee 99 #define LWIP_PLATFORM_DIAG(msg) { ; }
mkersh3 0:e7ca326e76ee 100 #define LWIP_PLATFORM_ASSERT(flag) { ; }
mkersh3 0:e7ca326e76ee 101 #endif
mkersh3 0:e7ca326e76ee 102
mkersh3 0:e7ca326e76ee 103 #include "cmsis.h"
mkersh3 0:e7ca326e76ee 104 #define LWIP_PLATFORM_HTONS(x) __REV16(x)
mkersh3 0:e7ca326e76ee 105 #define LWIP_PLATFORM_HTONL(x) __REV(x)
mkersh3 0:e7ca326e76ee 106
mkersh3 0:e7ca326e76ee 107 #endif /* __CC_H__ */