1 /* $Id: remoteconf.h,v 1.17 2004/12/01 10:59:41 vanhu Exp $ */
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
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
35 /* remote configuration */
37 #include <sys/queue.h>
48 #define SCRIPT_PHASE1_UP 0
49 #define SCRIPT_PHASE1_DOWN 1
51 char *script_names[SCRIPT_MAX + 1];
54 struct sockaddr *remote; /* remote IP address */
55 /* if family is AF_UNSPEC, that is
56 * for anonymous configuration. */
58 struct etypes *etypes; /* exchange type list. the head
59 * is a type to be sent first. */
60 int doitype; /* doi type */
61 int sittype; /* situation type */
63 int idvtype; /* my identifier type */
64 vchar_t *idv; /* my identifier */
65 vchar_t *key; /* my pre-shared key */
66 struct genlist *idvl_p; /* peer's identifiers list */
68 int certtype; /* certificate type if need */
69 char *mycertfile; /* file name of my certificate */
70 char *myprivfile; /* file name of my private key file */
71 char *peerscertfile; /* file name of peer's certifcate */
72 int getcert_method; /* the way to get peer's certificate */
73 int cacerttype; /* CA type is needed */
74 char *cacertfile; /* file name of CA */
75 int getcacert_method; /* the way to get the CA */
76 int send_cert; /* send to CERT or not */
77 int send_cr; /* send to CR or not */
78 int verify_cert; /* verify a CERT strictly */
79 int verify_identifier; /* vefify the peer's identifier */
80 int nonce_size; /* the number of bytes of nonce */
81 int passive; /* never initiate */
82 int ike_frag; /* IKE fragmentation */
83 int mode_cfg; /* Gets config through mode config */
84 int support_proxy; /* support mip6/proxy */
85 int gen_policy; /* generate policy if no policy found */
86 int ini_contact; /* initial contact */
87 int pcheck_level; /* level of propocl checking */
88 int nat_traversal; /* NAT-Traversal */
89 vchar_t *script[SCRIPT_MAX + 1];/* Shell script hooks */
90 int dh_group; /* use it when only aggressive mode */
91 struct dhgroup *dhgrp; /* use it when only aggressive mode */
92 /* above two can't be defined by user*/
94 int retry_counter; /* times to retry. */
95 int retry_interval; /* interval each retry. */
96 /* above 2 values are copied from localconf. */
98 int dpd; /* Negociate DPD support ? */
99 int dpd_retry; /* in seconds */
100 int dpd_interval; /* in seconds */
103 struct isakmpsa *proposal; /* proposal list */
104 struct remoteconf *inherited_from; /* the original rmconf
107 struct proposalspec *prhead;
109 struct genlist *rsa_private, /* lists of PlainRSA keys to use */
111 TAILQ_ENTRY(remoteconf) chain; /* next remote conf */
116 /* ISAKMP SA specification */
130 int dh_group; /* don't use it if aggressive mode */
131 struct dhgroup *dhgrp; /* don't use it if aggressive mode */
133 struct isakmpsa *next; /* next transform */
134 struct remoteconf *rmconf; /* backpointer to remoteconf */
138 int idtype; /* identifier type */
139 vchar_t *id; /* identifier */
142 typedef struct remoteconf * (rmconf_func_t)(struct remoteconf *rmconf, void *data);
144 extern struct remoteconf *getrmconf __P((struct sockaddr *));
145 extern struct remoteconf *getrmconf_strict
146 __P((struct sockaddr *remote, int allow_anon));
147 extern struct remoteconf *copyrmconf __P((struct sockaddr *));
148 extern struct remoteconf *newrmconf __P((void));
149 extern struct remoteconf *duprmconf __P((struct remoteconf *));
150 extern void delrmconf __P((struct remoteconf *));
151 extern void delisakmpsa __P((struct isakmpsa *));
152 extern void deletypes __P((struct etypes *));
153 extern struct etypes * dupetypes __P((struct etypes *));
154 extern void insrmconf __P((struct remoteconf *));
155 extern void remrmconf __P((struct remoteconf *));
156 extern void flushrmconf __P((void));
157 extern void initrmconf __P((void));
158 extern struct etypes *check_etypeok
159 __P((struct remoteconf *, u_int8_t));
160 extern struct remoteconf *foreachrmconf __P((rmconf_func_t rmconf_func,
163 extern struct isakmpsa *newisakmpsa __P((void));
164 extern void insisakmpsa __P((struct isakmpsa *, struct remoteconf *));
166 extern void dumprmconf __P((void));
168 extern struct idspec *newidspec __P((void));
170 #endif /* _REMOTECONF_H */