1/*
2 * Layer Two Tunnelling Protocol Daemon
3 * Copyright (C) 1998 Adtran, Inc.
4 * Copyright (C) 2002 Jeff McAdams
5 *
6 * Mark Spencer
7 *
8 * This software is distributed under the terms
9 * of the GPL, which you should have received
10 * along with this source.
11 *
12 * Authorization, Accounting, and Access control
13 *
14 */
15
16#ifndef _AAA_H
17#define _AAA_H
18#include "md5.h"
19
20#define ADDR_HASH_SIZE 256
21#define MD_SIG_SIZE 16
22#define MAX_VECTOR_SIZE 1024
23#define VECTOR_SIZE 16
24
25#define STATE_NONE 		 0
26#define STATE_CHALLENGED 1
27#define STATE_COMPLETE	 2
28
29struct addr_ent
30{
31    unsigned int addr;
32    struct addr_ent *next;
33};
34
35struct challenge
36{
37    struct MD5Context md5;
38    unsigned char ss;           /* State we're sending in */
39    unsigned char secret[MAXSTRLEN];    /* The shared secret */
40    unsigned char *challenge;       /* The original challenge */
41    unsigned char response[MD_SIG_SIZE];        /* What we expect as a respsonse */
42    unsigned char reply[MD_SIG_SIZE];   /* What the peer sent */
43    unsigned char *vector;
44    unsigned int vector_len;
45    int state;                  /* What state is challenge in? */
46};
47
48extern struct lns *get_lns (struct tunnel *);
49extern struct addr_ent *uaddr[];
50extern unsigned int get_addr (struct iprange *);
51extern void reserve_addr (unsigned int);
52extern void unreserve_addr (unsigned int);
53extern void init_addr ();
54extern int handle_challenge (struct tunnel *, struct challenge *);
55extern void mk_challenge (char *, int);
56#endif
57