Onenet

Dependents:   K64F_eCompass_OneNET_JW

Committer:
robert_jw
Date:
Mon Jun 20 01:40:20 2016 +0000
Revision:
0:b2805b6888dc
ADS

Who changed what in which revision?

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