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-2004 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 __LWIP_INET_CHKSUM_H__
mkersh3 0:e7ca326e76ee 33 #define __LWIP_INET_CHKSUM_H__
mkersh3 0:e7ca326e76ee 34
mkersh3 0:e7ca326e76ee 35 #include "lwip/opt.h"
mkersh3 0:e7ca326e76ee 36
mkersh3 0:e7ca326e76ee 37 #include "lwip/pbuf.h"
mkersh3 0:e7ca326e76ee 38 #include "lwip/ip_addr.h"
mkersh3 0:e7ca326e76ee 39
mkersh3 0:e7ca326e76ee 40 /** Swap the bytes in an u16_t: much like htons() for little-endian */
mkersh3 0:e7ca326e76ee 41 #ifndef SWAP_BYTES_IN_WORD
mkersh3 0:e7ca326e76ee 42 #if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)
mkersh3 0:e7ca326e76ee 43 /* little endian and PLATFORM_BYTESWAP defined */
mkersh3 0:e7ca326e76ee 44 #define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w)
mkersh3 0:e7ca326e76ee 45 #else /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) */
mkersh3 0:e7ca326e76ee 46 /* can't use htons on big endian (or PLATFORM_BYTESWAP not defined)... */
mkersh3 0:e7ca326e76ee 47 #define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8)
mkersh3 0:e7ca326e76ee 48 #endif /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)*/
mkersh3 0:e7ca326e76ee 49 #endif /* SWAP_BYTES_IN_WORD */
mkersh3 0:e7ca326e76ee 50
mkersh3 0:e7ca326e76ee 51 /** Split an u32_t in two u16_ts and add them up */
mkersh3 0:e7ca326e76ee 52 #ifndef FOLD_U32T
mkersh3 0:e7ca326e76ee 53 #define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL))
mkersh3 0:e7ca326e76ee 54 #endif
mkersh3 0:e7ca326e76ee 55
mkersh3 0:e7ca326e76ee 56 #if LWIP_CHECKSUM_ON_COPY
mkersh3 0:e7ca326e76ee 57 /** Function-like macro: same as MEMCPY but returns the checksum of copied data
mkersh3 0:e7ca326e76ee 58 as u16_t */
mkersh3 0:e7ca326e76ee 59 #ifndef LWIP_CHKSUM_COPY
mkersh3 0:e7ca326e76ee 60 #define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len)
mkersh3 0:e7ca326e76ee 61 #ifndef LWIP_CHKSUM_COPY_ALGORITHM
mkersh3 0:e7ca326e76ee 62 #define LWIP_CHKSUM_COPY_ALGORITHM 1
mkersh3 0:e7ca326e76ee 63 #endif /* LWIP_CHKSUM_COPY_ALGORITHM */
mkersh3 0:e7ca326e76ee 64 #endif /* LWIP_CHKSUM_COPY */
mkersh3 0:e7ca326e76ee 65 #else /* LWIP_CHECKSUM_ON_COPY */
mkersh3 0:e7ca326e76ee 66 #define LWIP_CHKSUM_COPY_ALGORITHM 0
mkersh3 0:e7ca326e76ee 67 #endif /* LWIP_CHECKSUM_ON_COPY */
mkersh3 0:e7ca326e76ee 68
mkersh3 0:e7ca326e76ee 69 #ifdef __cplusplus
mkersh3 0:e7ca326e76ee 70 extern "C" {
mkersh3 0:e7ca326e76ee 71 #endif
mkersh3 0:e7ca326e76ee 72
mkersh3 0:e7ca326e76ee 73 u16_t inet_chksum(void *dataptr, u16_t len);
mkersh3 0:e7ca326e76ee 74 u16_t inet_chksum_pbuf(struct pbuf *p);
mkersh3 0:e7ca326e76ee 75 u16_t inet_chksum_pseudo(struct pbuf *p,
mkersh3 0:e7ca326e76ee 76 ip_addr_t *src, ip_addr_t *dest,
mkersh3 0:e7ca326e76ee 77 u8_t proto, u16_t proto_len);
mkersh3 0:e7ca326e76ee 78 u16_t inet_chksum_pseudo_partial(struct pbuf *p,
mkersh3 0:e7ca326e76ee 79 ip_addr_t *src, ip_addr_t *dest,
mkersh3 0:e7ca326e76ee 80 u8_t proto, u16_t proto_len, u16_t chksum_len);
mkersh3 0:e7ca326e76ee 81 #if LWIP_CHKSUM_COPY_ALGORITHM
mkersh3 0:e7ca326e76ee 82 u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len);
mkersh3 0:e7ca326e76ee 83 #endif /* LWIP_CHKSUM_COPY_ALGORITHM */
mkersh3 0:e7ca326e76ee 84
mkersh3 0:e7ca326e76ee 85 #ifdef __cplusplus
mkersh3 0:e7ca326e76ee 86 }
mkersh3 0:e7ca326e76ee 87 #endif
mkersh3 0:e7ca326e76ee 88
mkersh3 0:e7ca326e76ee 89 #endif /* __LWIP_INET_H__ */
mkersh3 0:e7ca326e76ee 90