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 * lcp.h - Network Link Control Protocol header file.
mkersh3 0:e7ca326e76ee 3 *
mkersh3 0:e7ca326e76ee 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
mkersh3 0:e7ca326e76ee 5 * portions Copyright (c) 1997 Global Election Systems Inc.
mkersh3 0:e7ca326e76ee 6 *
mkersh3 0:e7ca326e76ee 7 * The authors hereby grant permission to use, copy, modify, distribute,
mkersh3 0:e7ca326e76ee 8 * and license this software and its documentation for any purpose, provided
mkersh3 0:e7ca326e76ee 9 * that existing copyright notices are retained in all copies and that this
mkersh3 0:e7ca326e76ee 10 * notice and the following disclaimer are included verbatim in any
mkersh3 0:e7ca326e76ee 11 * distributions. No written agreement, license, or royalty fee is required
mkersh3 0:e7ca326e76ee 12 * for any of the authorized uses.
mkersh3 0:e7ca326e76ee 13 *
mkersh3 0:e7ca326e76ee 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
mkersh3 0:e7ca326e76ee 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
mkersh3 0:e7ca326e76ee 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
mkersh3 0:e7ca326e76ee 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
mkersh3 0:e7ca326e76ee 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
mkersh3 0:e7ca326e76ee 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
mkersh3 0:e7ca326e76ee 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
mkersh3 0:e7ca326e76ee 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mkersh3 0:e7ca326e76ee 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
mkersh3 0:e7ca326e76ee 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mkersh3 0:e7ca326e76ee 24 *
mkersh3 0:e7ca326e76ee 25 ******************************************************************************
mkersh3 0:e7ca326e76ee 26 * REVISION HISTORY
mkersh3 0:e7ca326e76ee 27 *
mkersh3 0:e7ca326e76ee 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
mkersh3 0:e7ca326e76ee 29 * Ported to lwIP.
mkersh3 0:e7ca326e76ee 30 * 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
mkersh3 0:e7ca326e76ee 31 * Original derived from BSD codes.
mkersh3 0:e7ca326e76ee 32 *****************************************************************************/
mkersh3 0:e7ca326e76ee 33 /*
mkersh3 0:e7ca326e76ee 34 * lcp.h - Link Control Protocol definitions.
mkersh3 0:e7ca326e76ee 35 *
mkersh3 0:e7ca326e76ee 36 * Copyright (c) 1989 Carnegie Mellon University.
mkersh3 0:e7ca326e76ee 37 * All rights reserved.
mkersh3 0:e7ca326e76ee 38 *
mkersh3 0:e7ca326e76ee 39 * Redistribution and use in source and binary forms are permitted
mkersh3 0:e7ca326e76ee 40 * provided that the above copyright notice and this paragraph are
mkersh3 0:e7ca326e76ee 41 * duplicated in all such forms and that any documentation,
mkersh3 0:e7ca326e76ee 42 * advertising materials, and other materials related to such
mkersh3 0:e7ca326e76ee 43 * distribution and use acknowledge that the software was developed
mkersh3 0:e7ca326e76ee 44 * by Carnegie Mellon University. The name of the
mkersh3 0:e7ca326e76ee 45 * University may not be used to endorse or promote products derived
mkersh3 0:e7ca326e76ee 46 * from this software without specific prior written permission.
mkersh3 0:e7ca326e76ee 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
mkersh3 0:e7ca326e76ee 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
mkersh3 0:e7ca326e76ee 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
mkersh3 0:e7ca326e76ee 50 *
mkersh3 0:e7ca326e76ee 51 * $Id: lcp.h,v 1.4 2010/01/18 20:49:43 goldsimon Exp $
mkersh3 0:e7ca326e76ee 52 */
mkersh3 0:e7ca326e76ee 53
mkersh3 0:e7ca326e76ee 54 #ifndef LCP_H
mkersh3 0:e7ca326e76ee 55 #define LCP_H
mkersh3 0:e7ca326e76ee 56 /*
mkersh3 0:e7ca326e76ee 57 * Options.
mkersh3 0:e7ca326e76ee 58 */
mkersh3 0:e7ca326e76ee 59 #define CI_MRU 1 /* Maximum Receive Unit */
mkersh3 0:e7ca326e76ee 60 #define CI_ASYNCMAP 2 /* Async Control Character Map */
mkersh3 0:e7ca326e76ee 61 #define CI_AUTHTYPE 3 /* Authentication Type */
mkersh3 0:e7ca326e76ee 62 #define CI_QUALITY 4 /* Quality Protocol */
mkersh3 0:e7ca326e76ee 63 #define CI_MAGICNUMBER 5 /* Magic Number */
mkersh3 0:e7ca326e76ee 64 #define CI_PCOMPRESSION 7 /* Protocol Field Compression */
mkersh3 0:e7ca326e76ee 65 #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
mkersh3 0:e7ca326e76ee 66 #define CI_CALLBACK 13 /* callback */
mkersh3 0:e7ca326e76ee 67 #define CI_MRRU 17 /* max reconstructed receive unit; multilink */
mkersh3 0:e7ca326e76ee 68 #define CI_SSNHF 18 /* short sequence numbers for multilink */
mkersh3 0:e7ca326e76ee 69 #define CI_EPDISC 19 /* endpoint discriminator */
mkersh3 0:e7ca326e76ee 70
mkersh3 0:e7ca326e76ee 71 /*
mkersh3 0:e7ca326e76ee 72 * LCP-specific packet types (code numbers).
mkersh3 0:e7ca326e76ee 73 */
mkersh3 0:e7ca326e76ee 74 #define PROTREJ 8 /* Protocol Reject */
mkersh3 0:e7ca326e76ee 75 #define ECHOREQ 9 /* Echo Request */
mkersh3 0:e7ca326e76ee 76 #define ECHOREP 10 /* Echo Reply */
mkersh3 0:e7ca326e76ee 77 #define DISCREQ 11 /* Discard Request */
mkersh3 0:e7ca326e76ee 78 #define CBCP_OPT 6 /* Use callback control protocol */
mkersh3 0:e7ca326e76ee 79
mkersh3 0:e7ca326e76ee 80 /*
mkersh3 0:e7ca326e76ee 81 * The state of options is described by an lcp_options structure.
mkersh3 0:e7ca326e76ee 82 */
mkersh3 0:e7ca326e76ee 83 typedef struct lcp_options {
mkersh3 0:e7ca326e76ee 84 u_int passive : 1; /* Don't die if we don't get a response */
mkersh3 0:e7ca326e76ee 85 u_int silent : 1; /* Wait for the other end to start first */
mkersh3 0:e7ca326e76ee 86 u_int restart : 1; /* Restart vs. exit after close */
mkersh3 0:e7ca326e76ee 87 u_int neg_mru : 1; /* Negotiate the MRU? */
mkersh3 0:e7ca326e76ee 88 u_int neg_asyncmap : 1; /* Negotiate the async map? */
mkersh3 0:e7ca326e76ee 89 u_int neg_upap : 1; /* Ask for UPAP authentication? */
mkersh3 0:e7ca326e76ee 90 u_int neg_chap : 1; /* Ask for CHAP authentication? */
mkersh3 0:e7ca326e76ee 91 u_int neg_magicnumber : 1; /* Ask for magic number? */
mkersh3 0:e7ca326e76ee 92 u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */
mkersh3 0:e7ca326e76ee 93 u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
mkersh3 0:e7ca326e76ee 94 u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */
mkersh3 0:e7ca326e76ee 95 u_int neg_cbcp : 1; /* Negotiate use of CBCP */
mkersh3 0:e7ca326e76ee 96 #ifdef PPP_MULTILINK
mkersh3 0:e7ca326e76ee 97 u_int neg_mrru : 1; /* Negotiate multilink MRRU */
mkersh3 0:e7ca326e76ee 98 u_int neg_ssnhf : 1; /* Negotiate short sequence numbers */
mkersh3 0:e7ca326e76ee 99 u_int neg_endpoint : 1; /* Negotiate endpoint discriminator */
mkersh3 0:e7ca326e76ee 100 #endif
mkersh3 0:e7ca326e76ee 101 u_short mru; /* Value of MRU */
mkersh3 0:e7ca326e76ee 102 #ifdef PPP_MULTILINK
mkersh3 0:e7ca326e76ee 103 u_short mrru; /* Value of MRRU, and multilink enable */
mkersh3 0:e7ca326e76ee 104 #endif
mkersh3 0:e7ca326e76ee 105 u_char chap_mdtype; /* which MD type (hashing algorithm) */
mkersh3 0:e7ca326e76ee 106 u32_t asyncmap; /* Value of async map */
mkersh3 0:e7ca326e76ee 107 u32_t magicnumber;
mkersh3 0:e7ca326e76ee 108 int numloops; /* Number of loops during magic number neg. */
mkersh3 0:e7ca326e76ee 109 u32_t lqr_period; /* Reporting period for LQR 1/100ths second */
mkersh3 0:e7ca326e76ee 110 #ifdef PPP_MULTILINK
mkersh3 0:e7ca326e76ee 111 struct epdisc endpoint; /* endpoint discriminator */
mkersh3 0:e7ca326e76ee 112 #endif
mkersh3 0:e7ca326e76ee 113 } lcp_options;
mkersh3 0:e7ca326e76ee 114
mkersh3 0:e7ca326e76ee 115 /*
mkersh3 0:e7ca326e76ee 116 * Values for phase from BSD pppd.h based on RFC 1661.
mkersh3 0:e7ca326e76ee 117 */
mkersh3 0:e7ca326e76ee 118 typedef enum {
mkersh3 0:e7ca326e76ee 119 PHASE_DEAD = 0,
mkersh3 0:e7ca326e76ee 120 PHASE_INITIALIZE,
mkersh3 0:e7ca326e76ee 121 PHASE_ESTABLISH,
mkersh3 0:e7ca326e76ee 122 PHASE_AUTHENTICATE,
mkersh3 0:e7ca326e76ee 123 PHASE_CALLBACK,
mkersh3 0:e7ca326e76ee 124 PHASE_NETWORK,
mkersh3 0:e7ca326e76ee 125 PHASE_TERMINATE
mkersh3 0:e7ca326e76ee 126 } LinkPhase;
mkersh3 0:e7ca326e76ee 127
mkersh3 0:e7ca326e76ee 128
mkersh3 0:e7ca326e76ee 129
mkersh3 0:e7ca326e76ee 130 extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
mkersh3 0:e7ca326e76ee 131 extern lcp_options lcp_wantoptions[];
mkersh3 0:e7ca326e76ee 132 extern lcp_options lcp_gotoptions[];
mkersh3 0:e7ca326e76ee 133 extern lcp_options lcp_allowoptions[];
mkersh3 0:e7ca326e76ee 134 extern lcp_options lcp_hisoptions[];
mkersh3 0:e7ca326e76ee 135 extern ext_accm xmit_accm[];
mkersh3 0:e7ca326e76ee 136
mkersh3 0:e7ca326e76ee 137
mkersh3 0:e7ca326e76ee 138 void lcp_init (int);
mkersh3 0:e7ca326e76ee 139 void lcp_open (int);
mkersh3 0:e7ca326e76ee 140 void lcp_close (int, char *);
mkersh3 0:e7ca326e76ee 141 void lcp_lowerup (int);
mkersh3 0:e7ca326e76ee 142 void lcp_lowerdown(int);
mkersh3 0:e7ca326e76ee 143 void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
mkersh3 0:e7ca326e76ee 144
mkersh3 0:e7ca326e76ee 145 extern struct protent lcp_protent;
mkersh3 0:e7ca326e76ee 146
mkersh3 0:e7ca326e76ee 147 /* Default number of times we receive our magic number from the peer
mkersh3 0:e7ca326e76ee 148 before deciding the link is looped-back. */
mkersh3 0:e7ca326e76ee 149 #define DEFLOOPBACKFAIL 10
mkersh3 0:e7ca326e76ee 150
mkersh3 0:e7ca326e76ee 151 #endif /* LCP_H */