Committer:
mbed714
Date:
Sat Sep 18 23:05:49 2010 +0000
Revision:
0:d616ece2d859

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed714 0:d616ece2d859 1 /*****************************************************************************
mbed714 0:d616ece2d859 2 * pap.h - PPP Password Authentication Protocol header file.
mbed714 0:d616ece2d859 3 *
mbed714 0:d616ece2d859 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
mbed714 0:d616ece2d859 5 * portions Copyright (c) 1997 Global Election Systems Inc.
mbed714 0:d616ece2d859 6 *
mbed714 0:d616ece2d859 7 * The authors hereby grant permission to use, copy, modify, distribute,
mbed714 0:d616ece2d859 8 * and license this software and its documentation for any purpose, provided
mbed714 0:d616ece2d859 9 * that existing copyright notices are retained in all copies and that this
mbed714 0:d616ece2d859 10 * notice and the following disclaimer are included verbatim in any
mbed714 0:d616ece2d859 11 * distributions. No written agreement, license, or royalty fee is required
mbed714 0:d616ece2d859 12 * for any of the authorized uses.
mbed714 0:d616ece2d859 13 *
mbed714 0:d616ece2d859 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
mbed714 0:d616ece2d859 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
mbed714 0:d616ece2d859 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
mbed714 0:d616ece2d859 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
mbed714 0:d616ece2d859 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
mbed714 0:d616ece2d859 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
mbed714 0:d616ece2d859 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
mbed714 0:d616ece2d859 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbed714 0:d616ece2d859 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
mbed714 0:d616ece2d859 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed714 0:d616ece2d859 24 *
mbed714 0:d616ece2d859 25 ******************************************************************************
mbed714 0:d616ece2d859 26 * REVISION HISTORY
mbed714 0:d616ece2d859 27 *
mbed714 0:d616ece2d859 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
mbed714 0:d616ece2d859 29 * Ported to lwIP.
mbed714 0:d616ece2d859 30 * 97-12-04 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
mbed714 0:d616ece2d859 31 * Original derived from BSD codes.
mbed714 0:d616ece2d859 32 *****************************************************************************/
mbed714 0:d616ece2d859 33 /*
mbed714 0:d616ece2d859 34 * upap.h - User/Password Authentication Protocol definitions.
mbed714 0:d616ece2d859 35 *
mbed714 0:d616ece2d859 36 * Copyright (c) 1989 Carnegie Mellon University.
mbed714 0:d616ece2d859 37 * All rights reserved.
mbed714 0:d616ece2d859 38 *
mbed714 0:d616ece2d859 39 * Redistribution and use in source and binary forms are permitted
mbed714 0:d616ece2d859 40 * provided that the above copyright notice and this paragraph are
mbed714 0:d616ece2d859 41 * duplicated in all such forms and that any documentation,
mbed714 0:d616ece2d859 42 * advertising materials, and other materials related to such
mbed714 0:d616ece2d859 43 * distribution and use acknowledge that the software was developed
mbed714 0:d616ece2d859 44 * by Carnegie Mellon University. The name of the
mbed714 0:d616ece2d859 45 * University may not be used to endorse or promote products derived
mbed714 0:d616ece2d859 46 * from this software without specific prior written permission.
mbed714 0:d616ece2d859 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
mbed714 0:d616ece2d859 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
mbed714 0:d616ece2d859 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
mbed714 0:d616ece2d859 50 */
mbed714 0:d616ece2d859 51
mbed714 0:d616ece2d859 52 #ifndef PAP_H
mbed714 0:d616ece2d859 53 #define PAP_H
mbed714 0:d616ece2d859 54
mbed714 0:d616ece2d859 55 #if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
mbed714 0:d616ece2d859 56
mbed714 0:d616ece2d859 57 /*
mbed714 0:d616ece2d859 58 * Packet header = Code, id, length.
mbed714 0:d616ece2d859 59 */
mbed714 0:d616ece2d859 60 #define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
mbed714 0:d616ece2d859 61
mbed714 0:d616ece2d859 62
mbed714 0:d616ece2d859 63 /*
mbed714 0:d616ece2d859 64 * UPAP codes.
mbed714 0:d616ece2d859 65 */
mbed714 0:d616ece2d859 66 #define UPAP_AUTHREQ 1 /* Authenticate-Request */
mbed714 0:d616ece2d859 67 #define UPAP_AUTHACK 2 /* Authenticate-Ack */
mbed714 0:d616ece2d859 68 #define UPAP_AUTHNAK 3 /* Authenticate-Nak */
mbed714 0:d616ece2d859 69
mbed714 0:d616ece2d859 70 /*
mbed714 0:d616ece2d859 71 * Each interface is described by upap structure.
mbed714 0:d616ece2d859 72 */
mbed714 0:d616ece2d859 73 typedef struct upap_state {
mbed714 0:d616ece2d859 74 int us_unit; /* Interface unit number */
mbed714 0:d616ece2d859 75 const char *us_user; /* User */
mbed714 0:d616ece2d859 76 int us_userlen; /* User length */
mbed714 0:d616ece2d859 77 const char *us_passwd; /* Password */
mbed714 0:d616ece2d859 78 int us_passwdlen; /* Password length */
mbed714 0:d616ece2d859 79 int us_clientstate; /* Client state */
mbed714 0:d616ece2d859 80 int us_serverstate; /* Server state */
mbed714 0:d616ece2d859 81 u_char us_id; /* Current id */
mbed714 0:d616ece2d859 82 int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */
mbed714 0:d616ece2d859 83 int us_transmits; /* Number of auth-reqs sent */
mbed714 0:d616ece2d859 84 int us_maxtransmits; /* Maximum number of auth-reqs to send */
mbed714 0:d616ece2d859 85 int us_reqtimeout; /* Time to wait for auth-req from peer */
mbed714 0:d616ece2d859 86 } upap_state;
mbed714 0:d616ece2d859 87
mbed714 0:d616ece2d859 88 /*
mbed714 0:d616ece2d859 89 * Client states.
mbed714 0:d616ece2d859 90 */
mbed714 0:d616ece2d859 91 #define UPAPCS_INITIAL 0 /* Connection down */
mbed714 0:d616ece2d859 92 #define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */
mbed714 0:d616ece2d859 93 #define UPAPCS_PENDING 2 /* Connection down, have requested auth */
mbed714 0:d616ece2d859 94 #define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */
mbed714 0:d616ece2d859 95 #define UPAPCS_OPEN 4 /* We've received an Ack */
mbed714 0:d616ece2d859 96 #define UPAPCS_BADAUTH 5 /* We've received a Nak */
mbed714 0:d616ece2d859 97
mbed714 0:d616ece2d859 98 /*
mbed714 0:d616ece2d859 99 * Server states.
mbed714 0:d616ece2d859 100 */
mbed714 0:d616ece2d859 101 #define UPAPSS_INITIAL 0 /* Connection down */
mbed714 0:d616ece2d859 102 #define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */
mbed714 0:d616ece2d859 103 #define UPAPSS_PENDING 2 /* Connection down, have requested auth */
mbed714 0:d616ece2d859 104 #define UPAPSS_LISTEN 3 /* Listening for an Authenticate */
mbed714 0:d616ece2d859 105 #define UPAPSS_OPEN 4 /* We've sent an Ack */
mbed714 0:d616ece2d859 106 #define UPAPSS_BADAUTH 5 /* We've sent a Nak */
mbed714 0:d616ece2d859 107
mbed714 0:d616ece2d859 108
mbed714 0:d616ece2d859 109 extern upap_state upap[];
mbed714 0:d616ece2d859 110
mbed714 0:d616ece2d859 111 void upap_authwithpeer (int, char *, char *);
mbed714 0:d616ece2d859 112 void upap_authpeer (int);
mbed714 0:d616ece2d859 113
mbed714 0:d616ece2d859 114 extern struct protent pap_protent;
mbed714 0:d616ece2d859 115
mbed714 0:d616ece2d859 116 #endif /* PAP_SUPPORT */
mbed714 0:d616ece2d859 117
mbed714 0:d616ece2d859 118 #endif /* PAP_H */