Initial import of pppd 1.3
[unix-history] / libexec / pppd / upap.h
CommitLineData
2a905848
RG
1/*
2 * upap.h - User/Password Authentication Protocol definitions.
3 *
4 * Copyright (c) 1989 Carnegie Mellon University.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms are permitted
8 * provided that the above copyright notice and this paragraph are
9 * duplicated in all such forms and that any documentation,
10 * advertising materials, and other materials related to such
11 * distribution and use acknowledge that the software was developed
12 * by Carnegie Mellon University. The name of the
13 * University may not be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 */
19
20/*
21 * Packet header = Code, id, length.
22 */
23#define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
24
25
26/*
27 * UPAP codes.
28 */
29#define UPAP_AUTH 1 /* Authenticate */
30#define UPAP_AUTHACK 2 /* Authenticate Ack */
31#define UPAP_AUTHNAK 3 /* Authenticate Nak */
32
33
34/*
35 * Each interface is described by upap structure.
36 */
37typedef struct upap_state {
38 int us_unit; /* Interface unit number */
39 char *us_user; /* User */
40 int us_userlen; /* User length */
41 char *us_passwd; /* Password */
42 int us_passwdlen; /* Password length */
43 int us_clientstate; /* Client state */
44 int us_serverstate; /* Server state */
45 int us_flags; /* Flags */
46 u_char us_id; /* Current id */
47 int us_timeouttime; /* Timeout time in milliseconds */
48 int us_retransmits; /* Number of retransmissions */
49} upap_state;
50
51
52/*
53 * Client states.
54 */
55#define UPAPCS_CLOSED 1 /* Connection down */
56#define UPAPCS_AUTHSENT 2 /* We've sent an Authenticate */
57#define UPAPCS_OPEN 3 /* We've received an Ack */
58
59/*
60 * Server states.
61 */
62#define UPAPSS_CLOSED 1 /* Connection down */
63#define UPAPSS_LISTEN 2 /* Listening for an Authenticate */
64#define UPAPSS_OPEN 3 /* We've sent an Ack */
65
66/*
67 * Flags.
68 */
69#define UPAPF_LOWERUP 1 /* The lower level is UP */
70#define UPAPF_AWPPENDING 2 /* Auth with peer pending */
71#define UPAPF_APPENDING 4 /* Auth peer pending */
72#define UPAPF_UPVALID 8 /* User/passwd values valid */
73#define UPAPF_UPPENDING 0x10 /* User/passwd values pending */
74
75
76/*
77 * Timeouts.
78 */
79#define UPAP_DEFTIMEOUT 3 /* Timeout time in seconds */
80
81
82extern upap_state upap[];
83
84void upap_init __ARGS((int));
85void upap_authwithpeer __ARGS((int));
86void upap_authpeer __ARGS((int));
87void upap_lowerup __ARGS((int));
88void upap_lowerdown __ARGS((int));
89void upap_input __ARGS((int, u_char *, int));
90void upap_protrej __ARGS((int));