and added files
[bcm963xx.git] / userapps / opensource / ipsec-tools / src / racoon / isakmp_xauth.h
1 /*      $KAME$ */
2
3 /*
4  * Copyright (C) 2004 Emmanuel Dreyfus 
5  * All rights reserved.
6  * 
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the project nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  * 
19  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  */
31
32 /* ISAKMP mode config attribute types specific to the Xauth vendor ID */
33 #define XAUTH_TYPE                16520
34 #define XAUTH_USER_NAME           16521
35 #define XAUTH_USER_PASSWORD       16522
36 #define XAUTH_PASSCODE            16523
37 #define XAUTH_MESSAGE             16524
38 #define XAUTH_CHALLENGE           16525
39 #define XAUTH_DOMAIN              16526
40 #define XAUTH_STATUS              16527
41 #define XAUTH_NEXT_PIN            16528
42 #define XAUTH_ANSWER              16529
43
44 /* Types for XAUTH_TYPE */
45 #define XAUTH_TYPE_GENERIC      0
46 #define XAUTH_TYPE_CHAP         1
47 #define XAUTH_TYPE_OTP          2
48 #define XAUTH_TYPE_SKEY         3
49
50 /* Values for XAUTH_STATUS */
51 #define XAUTH_STATUS_FAIL       0
52 #define XAUTH_STATUS_OK         1
53
54 #ifdef LIBRADIUS
55 struct rad_handle;
56 #endif
57
58 struct xauth_state {
59         int status;
60         int vendorid;
61         int authtype;
62         union {
63                 struct authgeneric {
64                         char *usr;
65                         char *pwd;
66                 } generic;
67         } authdata;
68 };
69
70 /* status */
71 #define XAUTHST_NOTYET  0
72 #define XAUTHST_REQSENT 1
73 #define XAUTHST_OK      2
74
75 struct xauth_reply_arg {
76         isakmp_index index;
77         int port;
78         int id;
79         int res;
80 };
81
82 struct ph1handle;
83 void xauth_sendreq(struct ph1handle *);
84 void xauth_attr_reply(struct ph1handle *, struct isakmp_data *, int);
85 int xauth_login_system(struct ph1handle *, char *, char *);
86 void xauth_sendstatus(struct ph1handle *, int, int);
87 int xauth_check(struct ph1handle *);
88 vchar_t *isakmp_xauth_req(struct ph1handle *, struct isakmp_data *);
89 vchar_t *isakmp_xauth_set(struct ph1handle *, struct isakmp_data *);
90 void xauth_rmstate(struct xauth_state *);
91 void xauth_reply_stub(void *);
92 void xauth_reply(struct ph1handle *, int, int, int);
93
94 #ifdef HAVE_LIBRADIUS
95 int xauth_login_radius(struct ph1handle *, char *, char *);
96 #endif