]>
Commit | Line | Data |
---|---|---|
ac2f15b3 | 1 | /* $KAME: remoteconf.h,v 1.27 2001/12/07 08:39:39 sakane Exp $ */ |
7ba0088d A |
2 | |
3 | /* | |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
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 | /* remote configuration */ | |
33 | ||
34 | #include <sys/queue.h> | |
35 | ||
36 | struct etypes { | |
37 | int type; | |
38 | struct etypes *next; | |
39 | }; | |
40 | ||
41 | struct remoteconf { | |
42 | struct sockaddr *remote; /* remote IP address */ | |
43 | /* if family is AF_UNSPEC, that is | |
44 | * for anonymous configuration. */ | |
45 | ||
46 | struct etypes *etypes; /* exchange type list. the head | |
47 | * is a type to be sent first. */ | |
48 | int doitype; /* doi type */ | |
49 | int sittype; /* situation type */ | |
50 | ||
51 | int idvtype; /* my identifier type */ | |
52 | vchar_t *idv; /* my identifier */ | |
53 | int idvtype_p; /* peer's identifier type */ | |
54 | vchar_t *idv_p; /* peer's identifier */ | |
55 | ||
ac2f15b3 A |
56 | int secrettype; /* type of secret [use, key, keychain] */ |
57 | vchar_t *shared_secret; /* shared secret */ | |
58 | ||
7ba0088d A |
59 | int certtype; /* certificate type if need */ |
60 | char *mycertfile; /* file name of my certificate */ | |
61 | char *myprivfile; /* file name of my private key file */ | |
62 | char *peerscertfile; /* file name of peer's certifcate */ | |
63 | int getcert_method; /* the way to get peer's certificate */ | |
64 | int send_cert; /* send to CERT or not */ | |
65 | int send_cr; /* send to CR or not */ | |
66 | int verify_cert; /* verify a CERT strictly */ | |
67 | int verify_identifier; /* vefify the peer's identifier */ | |
68 | int nonce_size; /* the number of bytes of nonce */ | |
69 | int keepalive; /* XXX may not use */ | |
70 | int passive; /* never initiate */ | |
71 | int support_mip6; /* support mip6 */ | |
72 | int gen_policy; /* generate policy if no policy found */ | |
73 | int ini_contact; /* initial contact */ | |
74 | int pcheck_level; /* level of propocl checking */ | |
75 | ||
76 | int dh_group; /* use it when only aggressive mode */ | |
77 | struct dhgroup *dhgrp; /* use it when only aggressive mode */ | |
78 | /* avobe two cann't be defined by user*/ | |
79 | ||
80 | int retry_counter; /* times to retry. */ | |
81 | int retry_interval; /* interval each retry. */ | |
82 | /* above 2 values are copied from localconf. */ | |
83 | ||
84 | struct isakmpsa *proposal; /* proposal list */ | |
85 | LIST_ENTRY(remoteconf) chain; /* next remote conf */ | |
86 | }; | |
87 | ||
88 | struct dhgroup; | |
89 | ||
90 | /* ISAKMP SA specification */ | |
91 | struct isakmpsa { | |
92 | int prop_no; | |
93 | int trns_no; | |
94 | time_t lifetime; | |
95 | int lifebyte; | |
96 | int enctype; | |
97 | int encklen; | |
98 | int authmethod; | |
99 | int hashtype; | |
100 | int vendorid; | |
101 | #ifdef HAVE_GSSAPI | |
102 | vchar_t *gssid; | |
103 | #endif | |
104 | int dh_group; /* don't use it if aggressive mode */ | |
105 | struct dhgroup *dhgrp; /* don't use it if aggressive mode */ | |
106 | ||
107 | struct isakmpsa *next; /* next transform */ | |
108 | struct remoteconf *rmconf; /* backpointer to remoteconf */ | |
109 | }; | |
110 | ||
111 | struct remoteconf *getrmconf __P((struct sockaddr *)); | |
112 | extern struct remoteconf *newrmconf __P((void)); | |
113 | extern void delrmconf __P((struct remoteconf *)); | |
114 | extern void delisakmpsa __P((struct isakmpsa *)); | |
115 | extern void deletypes __P((struct etypes *)); | |
116 | extern void insrmconf __P((struct remoteconf *)); | |
117 | extern void remrmconf __P((struct remoteconf *)); | |
118 | extern void flushrmconf __P((void)); | |
119 | extern void initrmconf __P((void)); | |
120 | extern struct etypes *check_etypeok | |
121 | __P((struct remoteconf *, u_int8_t)); | |
122 | ||
123 | extern struct isakmpsa *newisakmpsa __P((void)); | |
124 | extern void insisakmpsa __P((struct isakmpsa *, struct remoteconf *)); | |
125 | extern const char *rm2str __P((const struct remoteconf *)); |