2 * upap.h - User/Password Authentication Protocol definitions.
4 * Copyright (c) 2000 by Sun Microsystems, Inc.
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.
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
18 * Copyright (c) 1989 Carnegie Mellon University.
19 * All rights reserved.
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.
33 * $Id: upap.h,v 1.7 1999/11/15 01:51:54 paulus Exp $
36 #pragma ident "%Z%%M% %I% %E% SMI"
46 * Packet header = Code, id, length.
48 #define UPAP_HEADERLEN 4
54 #define UPAP_AUTHREQ 1 /* Authenticate-Request */
55 #define UPAP_AUTHACK 2 /* Authenticate-Ack */
56 #define UPAP_AUTHNAK 3 /* Authenticate-Nak */
60 * Each interface is described by upap structure.
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 */
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 */
91 #define UPAPCS__NAMES \
92 "CliInitial", "CliClosed", "CliPending", "CliAuthReq", "CliOpen", \
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 */
105 #define UPAPSS__NAMES \
106 "SrvInitial", "SrvClosed", "SrvPending", "SrvListen", "SrvOpen", \
112 #define UPAP_DEFTIMEOUT 3 /* Timeout (seconds) for retransmitting req */
113 #define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
115 extern upap_state upap
[];
117 void upap_authwithpeer
__P((int, char *, char *));
118 void upap_authpeer
__P((int));
120 extern struct protent pap_protent
;
126 #endif /* __UPAP_H__ */