Modification to work two socket servers at the same time

Fork of lwip by mbed official

Committer:
mbed_official
Date:
Fri Jun 22 09:25:39 2012 +0000
Revision:
0:51ac1d130fd4
Initial import from lwip-1.4.0: http://download.savannah.gnu.org/releases/lwip/lwip-1.4.0.zip

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:51ac1d130fd4 1 /*****************************************************************************
mbed_official 0:51ac1d130fd4 2 * pap.h - PPP Password Authentication 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-12-04 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 * upap.h - User/Password Authentication 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
mbed_official 0:51ac1d130fd4 52 #ifndef PAP_H
mbed_official 0:51ac1d130fd4 53 #define PAP_H
mbed_official 0:51ac1d130fd4 54
mbed_official 0:51ac1d130fd4 55 #if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
mbed_official 0:51ac1d130fd4 56
mbed_official 0:51ac1d130fd4 57 /*
mbed_official 0:51ac1d130fd4 58 * Packet header = Code, id, length.
mbed_official 0:51ac1d130fd4 59 */
mbed_official 0:51ac1d130fd4 60 #define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
mbed_official 0:51ac1d130fd4 61
mbed_official 0:51ac1d130fd4 62
mbed_official 0:51ac1d130fd4 63 /*
mbed_official 0:51ac1d130fd4 64 * UPAP codes.
mbed_official 0:51ac1d130fd4 65 */
mbed_official 0:51ac1d130fd4 66 #define UPAP_AUTHREQ 1 /* Authenticate-Request */
mbed_official 0:51ac1d130fd4 67 #define UPAP_AUTHACK 2 /* Authenticate-Ack */
mbed_official 0:51ac1d130fd4 68 #define UPAP_AUTHNAK 3 /* Authenticate-Nak */
mbed_official 0:51ac1d130fd4 69
mbed_official 0:51ac1d130fd4 70 /*
mbed_official 0:51ac1d130fd4 71 * Each interface is described by upap structure.
mbed_official 0:51ac1d130fd4 72 */
mbed_official 0:51ac1d130fd4 73 typedef struct upap_state {
mbed_official 0:51ac1d130fd4 74 int us_unit; /* Interface unit number */
mbed_official 0:51ac1d130fd4 75 const char *us_user; /* User */
mbed_official 0:51ac1d130fd4 76 int us_userlen; /* User length */
mbed_official 0:51ac1d130fd4 77 const char *us_passwd; /* Password */
mbed_official 0:51ac1d130fd4 78 int us_passwdlen; /* Password length */
mbed_official 0:51ac1d130fd4 79 int us_clientstate; /* Client state */
mbed_official 0:51ac1d130fd4 80 int us_serverstate; /* Server state */
mbed_official 0:51ac1d130fd4 81 u_char us_id; /* Current id */
mbed_official 0:51ac1d130fd4 82 int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */
mbed_official 0:51ac1d130fd4 83 int us_transmits; /* Number of auth-reqs sent */
mbed_official 0:51ac1d130fd4 84 int us_maxtransmits; /* Maximum number of auth-reqs to send */
mbed_official 0:51ac1d130fd4 85 int us_reqtimeout; /* Time to wait for auth-req from peer */
mbed_official 0:51ac1d130fd4 86 } upap_state;
mbed_official 0:51ac1d130fd4 87
mbed_official 0:51ac1d130fd4 88 /*
mbed_official 0:51ac1d130fd4 89 * Client states.
mbed_official 0:51ac1d130fd4 90 */
mbed_official 0:51ac1d130fd4 91 #define UPAPCS_INITIAL 0 /* Connection down */
mbed_official 0:51ac1d130fd4 92 #define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */
mbed_official 0:51ac1d130fd4 93 #define UPAPCS_PENDING 2 /* Connection down, have requested auth */
mbed_official 0:51ac1d130fd4 94 #define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */
mbed_official 0:51ac1d130fd4 95 #define UPAPCS_OPEN 4 /* We've received an Ack */
mbed_official 0:51ac1d130fd4 96 #define UPAPCS_BADAUTH 5 /* We've received a Nak */
mbed_official 0:51ac1d130fd4 97
mbed_official 0:51ac1d130fd4 98 /*
mbed_official 0:51ac1d130fd4 99 * Server states.
mbed_official 0:51ac1d130fd4 100 */
mbed_official 0:51ac1d130fd4 101 #define UPAPSS_INITIAL 0 /* Connection down */
mbed_official 0:51ac1d130fd4 102 #define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */
mbed_official 0:51ac1d130fd4 103 #define UPAPSS_PENDING 2 /* Connection down, have requested auth */
mbed_official 0:51ac1d130fd4 104 #define UPAPSS_LISTEN 3 /* Listening for an Authenticate */
mbed_official 0:51ac1d130fd4 105 #define UPAPSS_OPEN 4 /* We've sent an Ack */
mbed_official 0:51ac1d130fd4 106 #define UPAPSS_BADAUTH 5 /* We've sent a Nak */
mbed_official 0:51ac1d130fd4 107
mbed_official 0:51ac1d130fd4 108
mbed_official 0:51ac1d130fd4 109 extern upap_state upap[];
mbed_official 0:51ac1d130fd4 110
mbed_official 0:51ac1d130fd4 111 void upap_authwithpeer (int, char *, char *);
mbed_official 0:51ac1d130fd4 112 void upap_authpeer (int);
mbed_official 0:51ac1d130fd4 113
mbed_official 0:51ac1d130fd4 114 extern struct protent pap_protent;
mbed_official 0:51ac1d130fd4 115
mbed_official 0:51ac1d130fd4 116 #endif /* PAP_SUPPORT */
mbed_official 0:51ac1d130fd4 117
mbed_official 0:51ac1d130fd4 118 #endif /* PAP_H */