Modification to work two socket servers at the same time

Fork of lwip by mbed official

Committer:
mmdonatti
Date:
Thu May 10 18:17:16 2018 +0000
Revision:
21:83acd30508d0
Parent:
0:51ac1d130fd4
hostname adjust + modified define to make 2 socket servers working at the same time

Who changed what in which revision?

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