xref: /freebsd/usr.sbin/ppp/auth.h (revision 7f3dea244c40159a41ab22da77a434d7c5b5e85a)
1 /*
2  *	    Written by Toshiharu OHNO (tony-o@iij.ad.jp)
3  *
4  *   Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
5  *
6  * Redistribution and use in source and binary forms are permitted
7  * provided that the above copyright notice and this paragraph are
8  * duplicated in all such forms and that any documentation,
9  * advertising materials, and other materials related to such
10  * distribution and use acknowledge that the software was developed
11  * by the Internet Initiative Japan.  The name of the
12  * IIJ may not be used to endorse or promote products derived
13  * from this software without specific prior written permission.
14  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  *
18  * $Id: auth.h,v 1.16 1999/02/18 00:52:12 brian Exp $
19  *
20  *	TODO:
21  */
22 
23 struct physical;
24 struct bundle;
25 struct authinfo;
26 typedef void (*auth_func)(struct authinfo *);
27 
28 struct authinfo {
29   struct {
30     auth_func req;
31     auth_func success;
32     auth_func failure;
33   } fn;
34   struct {
35     struct fsmheader hdr;
36     char name[AUTHLEN];
37   } in;
38   struct pppTimer authtimer;
39   int retry;
40   int id;
41   struct physical *physical;
42   struct {
43     struct fsm_retry fsm;	/* How often/frequently to resend requests */
44   } cfg;
45 };
46 
47 #define auth_Failure(a) (*a->fn.failure)(a);
48 #define auth_Success(a) (*a->fn.success)(a);
49 
50 extern const char *Auth2Nam(u_short, u_char);
51 extern void auth_Init(struct authinfo *, struct physical *,
52                       auth_func, auth_func, auth_func);
53 extern void auth_StopTimer(struct authinfo *);
54 extern void auth_StartReq(struct authinfo *);
55 extern int auth_Validate(struct bundle *, const char *, const char *,
56                          struct physical *);
57 extern char *auth_GetSecret(struct bundle *, const char *, int,
58                             struct physical *);
59 extern int auth_SetPhoneList(const char *, char *, int);
60 extern int auth_Select(struct bundle *, const char *);
61 extern struct mbuf *auth_ReadHeader(struct authinfo *, struct mbuf *);
62 extern struct mbuf *auth_ReadName(struct authinfo *, struct mbuf *, int);
63