I have a problem getting this to work. Server only recieves half of the data being sent. Whats wrong

Dependencies:   mbed

Committer:
tax
Date:
Tue Mar 29 13:20:15 2011 +0000
Revision:
0:66300c77c6e9

        

Who changed what in which revision?

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