Forked from the DieterGraef Library

Fork of F7_Ethernet by Dieter Graef

Committer:
EmbeddedSam
Date:
Fri Nov 18 12:48:10 2016 +0000
Revision:
2:fdef48f830c0
Parent:
0:d26c1b55cfca
Linking MQTT together, starting with mbed-cli

Who changed what in which revision?

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