No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / ipsec-tools / src / racoon / remoteconf.h
blobd286d59ea435949ca79af450533c055b3bbe1f4e
1 /* $NetBSD: remoteconf.h,v 1.10 2009/03/13 04:49:16 tteras Exp $ */
3 /* Id: remoteconf.h,v 1.26 2006/05/06 15:52:44 manubsd Exp */
5 /*
6 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the project nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
34 #ifndef _REMOTECONF_H
35 #define _REMOTECONF_H
37 /* remote configuration */
39 #include <sys/queue.h>
40 #include "genlist.h"
41 #ifdef ENABLE_HYBRID
42 #include "isakmp_var.h"
43 #include "isakmp_xauth.h"
44 #endif
46 struct ph1handle;
47 struct secprotospec;
49 struct etypes {
50 int type;
51 struct etypes *next;
54 /* ISAKMP SA specification */
55 struct isakmpsa {
56 int prop_no;
57 int trns_no;
58 time_t lifetime;
59 size_t lifebyte;
60 int enctype;
61 int encklen;
62 int authmethod;
63 int hashtype;
64 int vendorid;
65 #ifdef HAVE_GSSAPI
66 vchar_t *gssid;
67 #endif
68 int dh_group; /* don't use it if aggressive mode */
69 struct dhgroup *dhgrp; /* don't use it if aggressive mode */
71 struct isakmpsa *next; /* next transform */
74 /* Certificate information */
75 struct rmconf_cert {
76 vchar_t *data; /* certificate payload */
77 char *filename; /* name of local file */
80 /* Script hooks */
81 #define SCRIPT_PHASE1_UP 0
82 #define SCRIPT_PHASE1_DOWN 1
83 #define SCRIPT_MAX 1
84 extern char *script_names[SCRIPT_MAX + 1];
86 struct remoteconf {
87 char *name; /* remote configuration name */
88 struct sockaddr *remote; /* remote IP address */
89 /* if family is AF_UNSPEC, that is
90 * for anonymous configuration. */
92 struct etypes *etypes; /* exchange type list. the head
93 * is a type to be sent first. */
94 int doitype; /* doi type */
95 int sittype; /* situation type */
97 int idvtype; /* my identifier type */
98 vchar_t *idv; /* my identifier */
99 vchar_t *key; /* my pre-shared key */
100 struct genlist *idvl_p; /* peer's identifiers list */
102 char *myprivfile; /* file name of my private key file */
103 char *mycertfile; /* file name of my certificate */
104 vchar_t *mycert; /* my certificate */
105 char *peerscertfile; /* file name of peer's certifcate */
106 vchar_t *peerscert; /* peer's certificate */
107 char *cacertfile; /* file name of CA */
108 vchar_t *cacert; /* CA certificate */
110 int send_cert; /* send to CERT or not */
111 int send_cr; /* send to CR or not */
112 int match_empty_cr; /* does this match if CR is empty */
113 int verify_cert; /* verify a CERT strictly */
114 int verify_identifier; /* vefify the peer's identifier */
115 int nonce_size; /* the number of bytes of nonce */
116 int passive; /* never initiate */
117 int ike_frag; /* IKE fragmentation */
118 int esp_frag; /* ESP fragmentation */
119 int mode_cfg; /* Gets config through mode config */
120 int support_proxy; /* support mip6/proxy */
121 #define GENERATE_POLICY_NONE 0
122 #define GENERATE_POLICY_REQUIRE 1
123 #define GENERATE_POLICY_UNIQUE 2
124 int gen_policy; /* generate policy if no policy found */
125 int ini_contact; /* initial contact */
126 int pcheck_level; /* level of propocl checking */
127 int nat_traversal; /* NAT-Traversal */
128 vchar_t *script[SCRIPT_MAX + 1];/* script hooks paths */
129 int dh_group; /* use it when only aggressive mode */
130 struct dhgroup *dhgrp; /* use it when only aggressive mode */
131 /* above two can't be defined by user*/
133 int dpd; /* Negociate DPD support ? */
134 int dpd_retry; /* in seconds */
135 int dpd_interval; /* in seconds */
136 int dpd_maxfails;
138 int rekey; /* rekey ph1 when active ph2s? */
139 #define REKEY_OFF FALSE
140 #define REKEY_ON TRUE
141 #define REKEY_FORCE 2
143 int ph1id; /* ph1id to be matched with sainfo sections */
145 int weak_phase1_check; /* act on unencrypted deletions ? */
147 struct isakmpsa *proposal; /* proposal list */
148 struct remoteconf *inherited_from; /* the original rmconf
149 from which this one
150 was inherited */
152 time_t lifetime; /* for isakmp/ipsec */
153 int lifebyte; /* for isakmp/ipsec */
154 struct secprotospec *spspec; /* the head is always current spec. */
156 struct genlist *rsa_private, /* lists of PlainRSA keys to use */
157 *rsa_public;
159 #ifdef ENABLE_HYBRID
160 struct xauth_rmconf *xauth;
161 #endif
163 TAILQ_ENTRY(remoteconf) chain; /* next remote conf */
166 #define RMCONF_NONCE_SIZE(rmconf) \
167 (rmconf != NULL ? rmconf->nonce_size : DEFAULT_NONCE_SIZE)
169 struct dhgroup;
171 struct idspec {
172 int idtype; /* identifier type */
173 vchar_t *id; /* identifier */
176 struct rmconfselector {
177 int flags;
178 struct sockaddr *remote;
179 int etype;
180 struct isakmpsa *approval;
181 vchar_t *identity;
182 vchar_t *certificate_request;
185 extern void rmconf_selector_from_ph1 __P((struct rmconfselector *rmsel,
186 struct ph1handle *iph1));
187 extern int enumrmconf __P((struct rmconfselector *rmsel,
188 int (* enum_func)(struct remoteconf *rmconf, void *arg),
189 void *enum_arg));
191 #define GETRMCONF_F_NO_ANONYMOUS 0x0001
192 #define GETRMCONF_F_NO_PASSIVE 0x0002
194 #define RMCONF_ERR_MULTIPLE ((struct remoteconf *) -1)
196 extern int rmconf_match_identity __P((struct remoteconf *rmconf,
197 vchar_t *id_p));
198 extern struct remoteconf *getrmconf __P((struct sockaddr *remote, int flags));
199 extern struct remoteconf *getrmconf_by_ph1 __P((struct ph1handle *iph1));
200 extern struct remoteconf *getrmconf_by_name __P((const char *name));
202 extern struct remoteconf *newrmconf __P((void));
203 extern struct remoteconf *duprmconf __P((struct remoteconf *));
204 extern void delrmconf __P((struct remoteconf *));
205 extern void deletypes __P((struct etypes *));
206 extern struct etypes * dupetypes __P((struct etypes *));
207 extern void insrmconf __P((struct remoteconf *));
208 extern void remrmconf __P((struct remoteconf *));
209 extern void flushrmconf __P((void));
210 extern void initrmconf __P((void));
211 extern void save_rmconf __P((void));
212 extern void save_rmconf_flush __P((void));
214 extern int check_etypeok __P((struct remoteconf *, void *));
216 extern struct isakmpsa *newisakmpsa __P((void));
217 extern struct isakmpsa *dupisakmpsa __P((struct isakmpsa *));
218 extern void delisakmpsa __P((struct isakmpsa *));
219 extern void insisakmpsa __P((struct isakmpsa *, struct remoteconf *));
220 #ifdef ENABLE_HYBRID
221 extern int isakmpsa_switch_authmethod __P((int authmethod));
222 #else
223 static inline int isakmpsa_switch_authmethod(int authmethod)
225 return authmethod;
227 #endif
228 extern struct isakmpsa * checkisakmpsa __P((int pcheck,
229 struct isakmpsa *proposal,
230 struct isakmpsa *acceptable));
233 extern void dumprmconf __P((void));
235 extern struct idspec *newidspec __P((void));
237 extern vchar_t *script_path_add __P((vchar_t *));
239 #endif /* _REMOTECONF_H */