hattori&ide

Dependencies:   mbed

Committer:
hattori_atsushi
Date:
Sun Dec 18 08:16:01 2022 +0000
Revision:
0:f77369cabd75
hattori

Who changed what in which revision?

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