Mistake on this page?
Report an issue in GitHub or email us
upap.h
1 /*
2  * upap.h - User/Password Authentication Protocol definitions.
3  *
4  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * 3. The name "Carnegie Mellon University" must not be used to
19  * endorse or promote products derived from this software without
20  * prior written permission. For permission or any legal
21  * details, please contact
22  * Office of Technology Transfer
23  * Carnegie Mellon University
24  * 5000 Forbes Avenue
25  * Pittsburgh, PA 15213-3890
26  * (412) 268-4387, fax: (412) 268-7395
27  * tech-transfer@andrew.cmu.edu
28  *
29  * 4. Redistributions of any form whatsoever must retain the following
30  * acknowledgment:
31  * "This product includes software developed by Computing Services
32  * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
33  *
34  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
35  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
37  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
38  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
39  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
40  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41  *
42  * $Id: upap.h,v 1.8 2002/12/04 23:03:33 paulus Exp $
43  */
44 
45 #include "ppp_opts.h"
46 #if PPP_SUPPORT && PAP_SUPPORT /* don't build if not configured for use in ppp_opts.h */
47 
48 #ifndef UPAP_H
49 #define UPAP_H
50 
51 #include "ppp.h"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /*
58  * Packet header = Code, id, length.
59  */
60 #define UPAP_HEADERLEN 4
61 
62 
63 /*
64  * UPAP codes.
65  */
66 #define UPAP_AUTHREQ 1 /* Authenticate-Request */
67 #define UPAP_AUTHACK 2 /* Authenticate-Ack */
68 #define UPAP_AUTHNAK 3 /* Authenticate-Nak */
69 
70 
71 /*
72  * Client states.
73  */
74 #define UPAPCS_INITIAL 0 /* Connection down */
75 #define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */
76 #define UPAPCS_PENDING 2 /* Connection down, have requested auth */
77 #define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */
78 #define UPAPCS_OPEN 4 /* We've received an Ack */
79 #define UPAPCS_BADAUTH 5 /* We've received a Nak */
80 
81 /*
82  * Server states.
83  */
84 #define UPAPSS_INITIAL 0 /* Connection down */
85 #define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */
86 #define UPAPSS_PENDING 2 /* Connection down, have requested auth */
87 #define UPAPSS_LISTEN 3 /* Listening for an Authenticate */
88 #define UPAPSS_OPEN 4 /* We've sent an Ack */
89 #define UPAPSS_BADAUTH 5 /* We've sent a Nak */
90 
91 
92 /*
93  * Timeouts.
94  */
95 #if 0 /* moved to ppp_opts.h */
96 #define UPAP_DEFTIMEOUT 3 /* Timeout (seconds) for retransmitting req */
97 #define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
98 #endif /* moved to ppp_opts.h */
99 
100 /*
101  * Each interface is described by upap structure.
102  */
103 #if PAP_SUPPORT
104 typedef struct upap_state {
105  const char *us_user; /* User */
106  u8_t us_userlen; /* User length */
107  const char *us_passwd; /* Password */
108  u8_t us_passwdlen; /* Password length */
109  u8_t us_clientstate; /* Client state */
110 #if PPP_SERVER
111  u8_t us_serverstate; /* Server state */
112 #endif /* PPP_SERVER */
113  u8_t us_id; /* Current id */
114  u8_t us_transmits; /* Number of auth-reqs sent */
115 } upap_state;
116 #endif /* PAP_SUPPORT */
117 
118 
119 void upap_authwithpeer(ppp_pcb *pcb, const char *user, const char *password);
120 #if PPP_SERVER
121 void upap_authpeer(ppp_pcb *pcb);
122 #endif /* PPP_SERVER */
123 
124 extern const struct protent pap_protent;
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif /* UPAP_H */
131 #endif /* PPP_SUPPORT && PAP_SUPPORT */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.