Dependents:   SNMPAgent HTTPServer think_speak_a cyassl-client ... more

Committer:
mamezu
Date:
Thu Dec 09 01:33:56 2010 +0000
Revision:
0:0f6c82fcde82

        

Who changed what in which revision?

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