auth.h revision 43693
16756Samurai/*
26756Samurai *	    Written by Toshiharu OHNO (tony-o@iij.ad.jp)
36756Samurai *
46756Samurai *   Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
56756Samurai *
66756Samurai * Redistribution and use in source and binary forms are permitted
76756Samurai * provided that the above copyright notice and this paragraph are
86756Samurai * duplicated in all such forms and that any documentation,
96756Samurai * advertising materials, and other materials related to such
106756Samurai * distribution and use acknowledge that the software was developed
116756Samurai * by the Internet Initiative Japan.  The name of the
126756Samurai * IIJ may not be used to endorse or promote products derived
136756Samurai * from this software without specific prior written permission.
146756Samurai * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
156756Samurai * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
166756Samurai * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
176756Samurai *
1843693Sbrian * $Id: auth.h,v 1.14 1999/02/02 09:35:17 brian Exp $
196756Samurai *
206756Samurai *	TODO:
216756Samurai */
226756Samurai
2336285Sbrianstruct physical;
2436285Sbrianstruct bundle;
2543693Sbrianstruct authinfo;
2643693Sbriantypedef void (*auth_func)(struct authinfo *);
276756Samurai
286756Samuraistruct authinfo {
2943693Sbrian  struct {
3043693Sbrian    auth_func req;
3143693Sbrian    auth_func success;
3243693Sbrian    auth_func failure;
3343693Sbrian  } fn;
3443693Sbrian  struct {
3543693Sbrian    struct fsmheader hdr;
3643693Sbrian    char name[AUTHLEN];
3743693Sbrian  } in;
386756Samurai  struct pppTimer authtimer;
396756Samurai  int retry;
406756Samurai  int id;
4136285Sbrian  struct physical *physical;
4236285Sbrian  struct {
4336285Sbrian    u_int fsmretry;
4436285Sbrian  } cfg;
456756Samurai};
466756Samurai
4743693Sbrian#define auth_Failure(a) (*a->fn.failure)(a);
4843693Sbrian#define auth_Success(a) (*a->fn.success)(a);
4943693Sbrian
5036285Sbrianextern const char *Auth2Nam(u_short);
5143693Sbrianextern void auth_Init(struct authinfo *, struct physical *,
5243693Sbrian                      auth_func, auth_func, auth_func);
5336285Sbrianextern void auth_StopTimer(struct authinfo *);
5443693Sbrianextern void auth_StartReq(struct authinfo *);
5536285Sbrianextern int auth_Validate(struct bundle *, const char *, const char *,
5636285Sbrian                         struct physical *);
5736285Sbrianextern char *auth_GetSecret(struct bundle *, const char *, int,
5836285Sbrian                            struct physical *);
5938174Sbrianextern int auth_SetPhoneList(const char *, char *, int);
6038174Sbrianextern int auth_Select(struct bundle *, const char *);
6143693Sbrianextern struct mbuf *auth_ReadHeader(struct authinfo *, struct mbuf *);
6243693Sbrianextern struct mbuf *auth_ReadName(struct authinfo *, struct mbuf *, int);
63