auth.h revision 50479
117683Spst/*
217683Spst *	    Written by Toshiharu OHNO (tony-o@iij.ad.jp)
317683Spst *
417683Spst *   Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
517683Spst *
617683Spst * Redistribution and use in source and binary forms are permitted
717683Spst * provided that the above copyright notice and this paragraph are
817683Spst * duplicated in all such forms and that any documentation,
917683Spst * advertising materials, and other materials related to such
1017683Spst * distribution and use acknowledge that the software was developed
1117683Spst * by the Internet Initiative Japan.  The name of the
1217683Spst * IIJ may not be used to endorse or promote products derived
1317683Spst * from this software without specific prior written permission.
1417683Spst * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1517683Spst * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1617683Spst * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1717683Spst *
1817683Spst * $FreeBSD: head/usr.sbin/ppp/auth.h 50479 1999-08-28 01:35:59Z peter $
1917683Spst *
2017683Spst *	TODO:
2117683Spst */
2217683Spst
2317683Spststruct physical;
2417683Spststruct bundle;
2517683Spststruct authinfo;
2617683Spsttypedef void (*auth_func)(struct authinfo *);
2717683Spst
2817683Spststruct authinfo {
2917683Spst  struct {
3017683Spst    auth_func req;
3117683Spst    auth_func success;
3217683Spst    auth_func failure;
3317683Spst  } fn;
3417683Spst  struct {
3517683Spst    struct fsmheader hdr;
3617683Spst    char name[AUTHLEN];
3717683Spst  } in;
3817683Spst  struct pppTimer authtimer;
3917683Spst  int retry;
4017683Spst  int id;
4117683Spst  struct physical *physical;
4217683Spst  struct {
4317683Spst    struct fsm_retry fsm;	/* How often/frequently to resend requests */
4417683Spst  } cfg;
4517683Spst};
4617683Spst
4717683Spst#define auth_Failure(a) (*a->fn.failure)(a);
4817683Spst#define auth_Success(a) (*a->fn.success)(a);
4917683Spst
5017683Spstextern const char *Auth2Nam(u_short, u_char);
5117683Spstextern void auth_Init(struct authinfo *, struct physical *,
5217683Spst                      auth_func, auth_func, auth_func);
5317683Spstextern void auth_StopTimer(struct authinfo *);
5417683Spstextern void auth_StartReq(struct authinfo *);
5517683Spstextern int auth_Validate(struct bundle *, const char *, const char *,
5617683Spst                         struct physical *);
5717683Spstextern char *auth_GetSecret(struct bundle *, const char *, int,
5817683Spst                            struct physical *);
5917683Spstextern int auth_SetPhoneList(const char *, char *, int);
6017683Spstextern int auth_Select(struct bundle *, const char *);
6117683Spstextern struct mbuf *auth_ReadHeader(struct authinfo *, struct mbuf *);
6217683Spstextern struct mbuf *auth_ReadName(struct authinfo *, struct mbuf *, int);
6317683Spst