Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers upap.h Source File

upap.h

00001 /*
00002  * upap.h - User/Password Authentication Protocol definitions.
00003  *
00004  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  *
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in
00015  *    the documentation and/or other materials provided with the
00016  *    distribution.
00017  *
00018  * 3. The name "Carnegie Mellon University" must not be used to
00019  *    endorse or promote products derived from this software without
00020  *    prior written permission. For permission or any legal
00021  *    details, please contact
00022  *      Office of Technology Transfer
00023  *      Carnegie Mellon University
00024  *      5000 Forbes Avenue
00025  *      Pittsburgh, PA  15213-3890
00026  *      (412) 268-4387, fax: (412) 268-7395
00027  *      tech-transfer@andrew.cmu.edu
00028  *
00029  * 4. Redistributions of any form whatsoever must retain the following
00030  *    acknowledgment:
00031  *    "This product includes software developed by Computing Services
00032  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
00033  *
00034  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
00035  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00036  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
00037  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00038  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
00039  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
00040  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00041  *
00042  * $Id: upap.h,v 1.8 2002/12/04 23:03:33 paulus Exp $
00043  */
00044 
00045 #include "ppp_opts.h"
00046 #if PPP_SUPPORT && PAP_SUPPORT  /* don't build if not configured for use in ppp_opts.h */
00047 
00048 #ifndef UPAP_H
00049 #define UPAP_H
00050 
00051 #include "ppp.h"
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 /*
00058  * Packet header = Code, id, length.
00059  */
00060 #define UPAP_HEADERLEN  4
00061 
00062 
00063 /*
00064  * UPAP codes.
00065  */
00066 #define UPAP_AUTHREQ    1   /* Authenticate-Request */
00067 #define UPAP_AUTHACK    2   /* Authenticate-Ack */
00068 #define UPAP_AUTHNAK    3   /* Authenticate-Nak */
00069 
00070 
00071 /*
00072  * Client states.
00073  */
00074 #define UPAPCS_INITIAL  0   /* Connection down */
00075 #define UPAPCS_CLOSED   1   /* Connection up, haven't requested auth */
00076 #define UPAPCS_PENDING  2   /* Connection down, have requested auth */
00077 #define UPAPCS_AUTHREQ  3   /* We've sent an Authenticate-Request */
00078 #define UPAPCS_OPEN 4   /* We've received an Ack */
00079 #define UPAPCS_BADAUTH  5   /* We've received a Nak */
00080 
00081 /*
00082  * Server states.
00083  */
00084 #define UPAPSS_INITIAL  0   /* Connection down */
00085 #define UPAPSS_CLOSED   1   /* Connection up, haven't requested auth */
00086 #define UPAPSS_PENDING  2   /* Connection down, have requested auth */
00087 #define UPAPSS_LISTEN   3   /* Listening for an Authenticate */
00088 #define UPAPSS_OPEN 4   /* We've sent an Ack */
00089 #define UPAPSS_BADAUTH  5   /* We've sent a Nak */
00090 
00091 
00092 /*
00093  * Timeouts.
00094  */
00095 #if 0 /* moved to ppp_opts.h */
00096 #define UPAP_DEFTIMEOUT 3   /* Timeout (seconds) for retransmitting req */
00097 #define UPAP_DEFREQTIME 30  /* Time to wait for auth-req from peer */
00098 #endif /* moved to ppp_opts.h */
00099 
00100 /*
00101  * Each interface is described by upap structure.
00102  */
00103 #if PAP_SUPPORT
00104 typedef struct upap_state {
00105     const char *us_user;    /* User */
00106     u8_t us_userlen;        /* User length */
00107     const char *us_passwd;  /* Password */
00108     u8_t us_passwdlen;      /* Password length */
00109     u8_t us_clientstate;    /* Client state */
00110 #if PPP_SERVER
00111     u8_t us_serverstate;    /* Server state */
00112 #endif /* PPP_SERVER */
00113     u8_t us_id;             /* Current id */
00114     u8_t us_transmits;      /* Number of auth-reqs sent */
00115 } upap_state;
00116 #endif /* PAP_SUPPORT */
00117 
00118 
00119 void upap_authwithpeer(ppp_pcb *pcb, const char *user, const char *password);
00120 #if PPP_SERVER
00121 void upap_authpeer(ppp_pcb *pcb);
00122 #endif /* PPP_SERVER */
00123 
00124 extern const struct protent pap_protent;
00125 
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129 
00130 #endif /* UPAP_H */
00131 #endif /* PPP_SUPPORT && PAP_SUPPORT */