xref: /titanic_41/usr/src/cmd/cmd-inet/usr.bin/pppd/upap.h (revision 2449e17f82f6097fd2c665b64723e31ceecbeca6)
1 /*
2  * upap.h - User/Password Authentication Protocol definitions.
3  *
4  * Copyright (c) 2000 by Sun Microsystems, Inc.
5  * All rights reserved.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation is hereby granted, provided that the above copyright
9  * notice appears in all copies.
10  *
11  * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF
12  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
13  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  SUN SHALL NOT BE LIABLE FOR
15  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
16  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
17  *
18  * Copyright (c) 1989 Carnegie Mellon University.
19  * All rights reserved.
20  *
21  * Redistribution and use in source and binary forms are permitted
22  * provided that the above copyright notice and this paragraph are
23  * duplicated in all such forms and that any documentation,
24  * advertising materials, and other materials related to such
25  * distribution and use acknowledge that the software was developed
26  * by Carnegie Mellon University.  The name of the
27  * University may not be used to endorse or promote products derived
28  * from this software without specific prior written permission.
29  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
30  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
31  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  * $Id: upap.h,v 1.7 1999/11/15 01:51:54 paulus Exp $
34  */
35 
36 #pragma ident	"%Z%%M%	%I%	%E% SMI"
37 
38 #ifndef __UPAP_H__
39 #define __UPAP_H__
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /*
46  * Packet header = Code, id, length.
47  */
48 #define UPAP_HEADERLEN	4
49 
50 
51 /*
52  * UPAP codes.
53  */
54 #define UPAP_AUTHREQ	1	/* Authenticate-Request */
55 #define UPAP_AUTHACK	2	/* Authenticate-Ack */
56 #define UPAP_AUTHNAK	3	/* Authenticate-Nak */
57 
58 
59 /*
60  * Each interface is described by upap structure.
61  */
62 typedef struct upap_state {
63     int us_unit;		/* Interface unit number */
64     char *us_user;		/* User */
65     int us_userlen;		/* User length */
66     char *us_passwd;		/* Password */
67     int us_clientstate;		/* Client state */
68     int us_serverstate;		/* Server state */
69     u_char us_id;		/* Current id */
70     int us_timeouttime;		/* Timeout (seconds) for auth-req retrans. */
71     int us_transmits;		/* Number of auth-reqs sent */
72     int us_maxtransmits;	/* Maximum number of auth-reqs to send */
73     int us_receives;		/* Number of auth-reqs received */
74     int us_maxreceives;		/* Maximum number of auth-reqs allowed */
75     int us_reqtimeout;		/* Time to wait for auth-req from peer */
76     char *us_msg;		/* Authentication response message */
77     int us_msglen;		/*   and its length */
78 } upap_state;
79 
80 
81 /*
82  * Client states.
83  */
84 #define UPAPCS_INITIAL	0	/* Connection down */
85 #define UPAPCS_CLOSED	1	/* Connection up, haven't requested auth */
86 #define UPAPCS_PENDING	2	/* Connection down, have requested auth */
87 #define UPAPCS_AUTHREQ	3	/* We've sent an Authenticate-Request */
88 #define UPAPCS_OPEN	4	/* We've received an Ack */
89 #define UPAPCS_BADAUTH	5	/* We've received a Nak */
90 
91 #define	UPAPCS__NAMES	\
92 	"CliInitial", "CliClosed", "CliPending", "CliAuthReq", "CliOpen", \
93 	"CliBadAuth"
94 
95 /*
96  * Server states.
97  */
98 #define UPAPSS_INITIAL	0	/* Connection down */
99 #define UPAPSS_CLOSED	1	/* Connection up, haven't requested auth */
100 #define UPAPSS_PENDING	2	/* Connection down, have requested auth */
101 #define UPAPSS_LISTEN	3	/* Listening for an Authenticate */
102 #define UPAPSS_OPEN	4	/* We've sent an Ack */
103 #define UPAPSS_BADAUTH	5	/* We've sent a Nak */
104 
105 #define	UPAPSS__NAMES	\
106 	"SrvInitial", "SrvClosed", "SrvPending", "SrvListen", "SrvOpen", \
107 	"SrvBadAuth"
108 
109 /*
110  * Timeouts.
111  */
112 #define UPAP_DEFTIMEOUT	3	/* Timeout (seconds) for retransmitting req */
113 #define UPAP_DEFREQTIME	30	/* Time to wait for auth-req from peer */
114 
115 extern upap_state upap[];
116 
117 void upap_authwithpeer __P((int, char *, char *));
118 void upap_authpeer __P((int));
119 
120 extern struct protent pap_protent;
121 
122 #ifdef	__cplusplus
123 }
124 #endif
125 
126 #endif /* __UPAP_H__ */
127