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_RAW_H__
mkersh3 0:e7ca326e76ee 33 #define __LWIP_RAW_H__
mkersh3 0:e7ca326e76ee 34
mkersh3 0:e7ca326e76ee 35 #include "lwip/opt.h"
mkersh3 0:e7ca326e76ee 36
mkersh3 0:e7ca326e76ee 37 #if LWIP_RAW /* don't build if not configured for use in lwipopts.h */
mkersh3 0:e7ca326e76ee 38
mkersh3 0:e7ca326e76ee 39 #include "lwip/pbuf.h"
mkersh3 0:e7ca326e76ee 40 #include "lwip/def.h"
mkersh3 0:e7ca326e76ee 41 #include "lwip/ip.h"
mkersh3 0:e7ca326e76ee 42 #include "lwip/ip_addr.h"
mkersh3 0:e7ca326e76ee 43
mkersh3 0:e7ca326e76ee 44 #ifdef __cplusplus
mkersh3 0:e7ca326e76ee 45 extern "C" {
mkersh3 0:e7ca326e76ee 46 #endif
mkersh3 0:e7ca326e76ee 47
mkersh3 0:e7ca326e76ee 48 struct raw_pcb;
mkersh3 0:e7ca326e76ee 49
mkersh3 0:e7ca326e76ee 50 /** Function prototype for raw pcb receive callback functions.
mkersh3 0:e7ca326e76ee 51 * @param arg user supplied argument (raw_pcb.recv_arg)
mkersh3 0:e7ca326e76ee 52 * @param pcb the raw_pcb which received data
mkersh3 0:e7ca326e76ee 53 * @param p the packet buffer that was received
mkersh3 0:e7ca326e76ee 54 * @param addr the remote IP address from which the packet was received
mkersh3 0:e7ca326e76ee 55 * @return 1 if the packet was 'eaten' (aka. deleted),
mkersh3 0:e7ca326e76ee 56 * 0 if the packet lives on
mkersh3 0:e7ca326e76ee 57 * If returning 1, the callback is responsible for freeing the pbuf
mkersh3 0:e7ca326e76ee 58 * if it's not used any more.
mkersh3 0:e7ca326e76ee 59 */
mkersh3 0:e7ca326e76ee 60 typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
mkersh3 0:e7ca326e76ee 61 ip_addr_t *addr);
mkersh3 0:e7ca326e76ee 62
mkersh3 0:e7ca326e76ee 63 struct raw_pcb {
mkersh3 0:e7ca326e76ee 64 /* Common members of all PCB types */
mkersh3 0:e7ca326e76ee 65 IP_PCB;
mkersh3 0:e7ca326e76ee 66
mkersh3 0:e7ca326e76ee 67 struct raw_pcb *next;
mkersh3 0:e7ca326e76ee 68
mkersh3 0:e7ca326e76ee 69 u8_t protocol;
mkersh3 0:e7ca326e76ee 70
mkersh3 0:e7ca326e76ee 71 /** receive callback function */
mkersh3 0:e7ca326e76ee 72 raw_recv_fn recv;
mkersh3 0:e7ca326e76ee 73 /* user-supplied argument for the recv callback */
mkersh3 0:e7ca326e76ee 74 void *recv_arg;
mkersh3 0:e7ca326e76ee 75 };
mkersh3 0:e7ca326e76ee 76
mkersh3 0:e7ca326e76ee 77 /* The following functions is the application layer interface to the
mkersh3 0:e7ca326e76ee 78 RAW code. */
mkersh3 0:e7ca326e76ee 79 struct raw_pcb * raw_new (u8_t proto);
mkersh3 0:e7ca326e76ee 80 void raw_remove (struct raw_pcb *pcb);
mkersh3 0:e7ca326e76ee 81 err_t raw_bind (struct raw_pcb *pcb, ip_addr_t *ipaddr);
mkersh3 0:e7ca326e76ee 82 err_t raw_connect (struct raw_pcb *pcb, ip_addr_t *ipaddr);
mkersh3 0:e7ca326e76ee 83
mkersh3 0:e7ca326e76ee 84 void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg);
mkersh3 0:e7ca326e76ee 85 err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr);
mkersh3 0:e7ca326e76ee 86 err_t raw_send (struct raw_pcb *pcb, struct pbuf *p);
mkersh3 0:e7ca326e76ee 87
mkersh3 0:e7ca326e76ee 88 /* The following functions are the lower layer interface to RAW. */
mkersh3 0:e7ca326e76ee 89 u8_t raw_input (struct pbuf *p, struct netif *inp);
mkersh3 0:e7ca326e76ee 90 #define raw_init() /* Compatibility define, not init needed. */
mkersh3 0:e7ca326e76ee 91
mkersh3 0:e7ca326e76ee 92 #ifdef __cplusplus
mkersh3 0:e7ca326e76ee 93 }
mkersh3 0:e7ca326e76ee 94 #endif
mkersh3 0:e7ca326e76ee 95
mkersh3 0:e7ca326e76ee 96 #endif /* LWIP_RAW */
mkersh3 0:e7ca326e76ee 97
mkersh3 0:e7ca326e76ee 98 #endif /* __LWIP_RAW_H__ */