sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
upap.h
Go to the documentation of this file.
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
49#include "netif/ppp/ppp_opts.h"
50#if PPP_SUPPORT && PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
51
52#ifndef UPAP_H
53#define UPAP_H
54
55#include "ppp.h"
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61/*
62 * Packet header = Code, id, length.
63 */
64#define UPAP_HEADERLEN 4
65
66
67/*
68 * UPAP codes.
69 */
70#define UPAP_AUTHREQ 1 /* Authenticate-Request */
71#define UPAP_AUTHACK 2 /* Authenticate-Ack */
72#define UPAP_AUTHNAK 3 /* Authenticate-Nak */
73
74
75/*
76 * Client states.
77 */
78#define UPAPCS_INITIAL 0 /* Connection down */
79#define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */
80#define UPAPCS_PENDING 2 /* Connection down, have requested auth */
81#define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */
82#define UPAPCS_OPEN 4 /* We've received an Ack */
83#define UPAPCS_BADAUTH 5 /* We've received a Nak */
84
85/*
86 * Server states.
87 */
88#define UPAPSS_INITIAL 0 /* Connection down */
89#define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */
90#define UPAPSS_PENDING 2 /* Connection down, have requested auth */
91#define UPAPSS_LISTEN 3 /* Listening for an Authenticate */
92#define UPAPSS_OPEN 4 /* We've sent an Ack */
93#define UPAPSS_BADAUTH 5 /* We've sent a Nak */
94
95
96/*
97 * Timeouts.
98 */
99#if 0 /* moved to ppp_opts.h */
100#define UPAP_DEFTIMEOUT 3 /* Timeout (seconds) for retransmitting req */
101#define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
102#endif /* moved to ppp_opts.h */
103
104/*
105 * Each interface is described by upap structure.
106 */
107#if PAP_SUPPORT
108typedef struct upap_state {
109 const char *us_user; /* User */
110 u8_t us_userlen; /* User length */
111 const char *us_passwd; /* Password */
112 u8_t us_passwdlen; /* Password length */
113 u8_t us_clientstate; /* Client state */
114#if PPP_SERVER
115 u8_t us_serverstate; /* Server state */
116#endif /* PPP_SERVER */
117 u8_t us_id; /* Current id */
118 u8_t us_transmits; /* Number of auth-reqs sent */
119} upap_state;
120#endif /* PAP_SUPPORT */
121
122
123void upap_authwithpeer(ppp_pcb *pcb, const char *user, const char *password);
124#if PPP_SERVER
125void upap_authpeer(ppp_pcb *pcb);
126#endif /* PPP_SERVER */
127
128extern const struct protent pap_protent;
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif /* UPAP_H */
135#endif /* PPP_SUPPORT && PAP_SUPPORT */