1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/upap.h
|
4 |
|
|
//
|
5 |
|
|
//==========================================================================
|
6 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
7 |
|
|
// -------------------------------------------
|
8 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
9 |
|
|
// Copyright (C) 2003 Free Software Foundation, Inc.
|
10 |
|
|
//
|
11 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
12 |
|
|
// the terms of the GNU General Public License as published by the Free
|
13 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
14 |
|
|
// version.
|
15 |
|
|
//
|
16 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
17 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
19 |
|
|
// for more details.
|
20 |
|
|
//
|
21 |
|
|
// You should have received a copy of the GNU General Public License
|
22 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
23 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
24 |
|
|
//
|
25 |
|
|
// As a special exception, if other files instantiate templates or use
|
26 |
|
|
// macros or inline functions from this file, or you compile this file
|
27 |
|
|
// and link it with other works to produce a work based on this file,
|
28 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
29 |
|
|
// the GNU General Public License. However the source code for this file
|
30 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
31 |
|
|
// General Public License v2.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based
|
34 |
|
|
// on this file might be covered by the GNU General Public License.
|
35 |
|
|
// -------------------------------------------
|
36 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
37 |
|
|
// ####BSDALTCOPYRIGHTBEGIN####
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
// Portions of this software may have been derived from FreeBSD, OpenBSD,
|
40 |
|
|
// or other sources, and if so are covered by the appropriate copyright
|
41 |
|
|
// and license included herein.
|
42 |
|
|
// -------------------------------------------
|
43 |
|
|
// ####BSDALTCOPYRIGHTEND####
|
44 |
|
|
//==========================================================================
|
45 |
|
|
|
46 |
|
|
/*
|
47 |
|
|
* upap.h - User/Password Authentication Protocol definitions.
|
48 |
|
|
*
|
49 |
|
|
* Copyright (c) 1989 Carnegie Mellon University.
|
50 |
|
|
* All rights reserved.
|
51 |
|
|
*
|
52 |
|
|
* Redistribution and use in source and binary forms are permitted
|
53 |
|
|
* provided that the above copyright notice and this paragraph are
|
54 |
|
|
* duplicated in all such forms and that any documentation,
|
55 |
|
|
* advertising materials, and other materials related to such
|
56 |
|
|
* distribution and use acknowledge that the software was developed
|
57 |
|
|
* by Carnegie Mellon University. The name of the
|
58 |
|
|
* University may not be used to endorse or promote products derived
|
59 |
|
|
* from this software without specific prior written permission.
|
60 |
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
61 |
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
62 |
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
63 |
|
|
*
|
64 |
|
|
* $FreeBSD: src/usr.sbin/pppd/upap.h,v 1.7 1999/08/28 01:19:09 peter Exp $
|
65 |
|
|
*/
|
66 |
|
|
|
67 |
|
|
/*
|
68 |
|
|
* Packet header = Code, id, length.
|
69 |
|
|
*/
|
70 |
|
|
#define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
/*
|
74 |
|
|
* UPAP codes.
|
75 |
|
|
*/
|
76 |
|
|
#define UPAP_AUTHREQ 1 /* Authenticate-Request */
|
77 |
|
|
#define UPAP_AUTHACK 2 /* Authenticate-Ack */
|
78 |
|
|
#define UPAP_AUTHNAK 3 /* Authenticate-Nak */
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
/*
|
82 |
|
|
* Each interface is described by upap structure.
|
83 |
|
|
*/
|
84 |
|
|
typedef struct upap_state {
|
85 |
|
|
int us_unit; /* Interface unit number */
|
86 |
|
|
char *us_user; /* User */
|
87 |
|
|
int us_userlen; /* User length */
|
88 |
|
|
char *us_passwd; /* Password */
|
89 |
|
|
int us_passwdlen; /* Password length */
|
90 |
|
|
int us_clientstate; /* Client state */
|
91 |
|
|
int us_serverstate; /* Server state */
|
92 |
|
|
u_char us_id; /* Current id */
|
93 |
|
|
int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */
|
94 |
|
|
int us_transmits; /* Number of auth-reqs sent */
|
95 |
|
|
int us_maxtransmits; /* Maximum number of auth-reqs to send */
|
96 |
|
|
int us_reqtimeout; /* Time to wait for auth-req from peer */
|
97 |
|
|
} upap_state;
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
/*
|
101 |
|
|
* Client states.
|
102 |
|
|
*/
|
103 |
|
|
#define UPAPCS_INITIAL 0 /* Connection down */
|
104 |
|
|
#define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */
|
105 |
|
|
#define UPAPCS_PENDING 2 /* Connection down, have requested auth */
|
106 |
|
|
#define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */
|
107 |
|
|
#define UPAPCS_OPEN 4 /* We've received an Ack */
|
108 |
|
|
#define UPAPCS_BADAUTH 5 /* We've received a Nak */
|
109 |
|
|
|
110 |
|
|
/*
|
111 |
|
|
* Server states.
|
112 |
|
|
*/
|
113 |
|
|
#define UPAPSS_INITIAL 0 /* Connection down */
|
114 |
|
|
#define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */
|
115 |
|
|
#define UPAPSS_PENDING 2 /* Connection down, have requested auth */
|
116 |
|
|
#define UPAPSS_LISTEN 3 /* Listening for an Authenticate */
|
117 |
|
|
#define UPAPSS_OPEN 4 /* We've sent an Ack */
|
118 |
|
|
#define UPAPSS_BADAUTH 5 /* We've sent a Nak */
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
/*
|
122 |
|
|
* Timeouts.
|
123 |
|
|
*/
|
124 |
|
|
#define UPAP_DEFTIMEOUT 3 /* Timeout (seconds) for retransmitting req */
|
125 |
|
|
#define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
|
126 |
|
|
|
127 |
|
|
extern upap_state upap[];
|
128 |
|
|
|
129 |
|
|
void upap_authwithpeer __P((int, char *, char *));
|
130 |
|
|
void upap_authpeer __P((int));
|
131 |
|
|
|
132 |
|
|
extern struct protent pap_protent;
|