xref: /illumos-gate/usr/src/lib/libipsecutil/common/ikedoor.h (revision f48205be61a214698b763ff550ab9e657525104c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_IKEDOOR_H
27 #define	_IKEDOOR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <limits.h>
36 #include <sys/sysmacros.h>
37 #include <net/pfkeyv2.h>
38 #include <door.h>
39 
40 /*
41  * This version number is intended to stop the calling process from
42  * getting confused if a structure is changed and a mismatch occurs.
43  * This should be incremented each time a structure is changed.
44  */
45 #define	DOORVER 2
46 #define	DOORNM	"/var/run/ike_door"
47 
48 
49 typedef enum {
50 	IKE_SVC_GET_DBG,
51 	IKE_SVC_SET_DBG,
52 
53 	IKE_SVC_GET_PRIV,
54 	IKE_SVC_SET_PRIV,
55 
56 	IKE_SVC_GET_STATS,
57 
58 	IKE_SVC_GET_P1,
59 	IKE_SVC_DEL_P1,
60 	IKE_SVC_DUMP_P1S,
61 	IKE_SVC_FLUSH_P1S,
62 
63 	IKE_SVC_GET_RULE,
64 	IKE_SVC_NEW_RULE,
65 	IKE_SVC_DEL_RULE,
66 	IKE_SVC_DUMP_RULES,
67 	IKE_SVC_READ_RULES,
68 	IKE_SVC_WRITE_RULES,
69 
70 	IKE_SVC_GET_PS,
71 	IKE_SVC_NEW_PS,
72 	IKE_SVC_DEL_PS,
73 	IKE_SVC_DUMP_PS,
74 	IKE_SVC_READ_PS,
75 	IKE_SVC_WRITE_PS,
76 
77 	IKE_SVC_DBG_RBDUMP,
78 
79 	IKE_SVC_GET_DEFS,
80 
81 	IKE_SVC_ERROR
82 } ike_svccmd_t;
83 
84 #define	IKE_SVC_MAX	IKE_SVC_ERROR
85 
86 
87 /*
88  * Support structures/defines
89  */
90 
91 #define	IKEDOORROUNDUP(i)   P2ROUNDUP((i), sizeof (uint64_t))
92 
93 /*
94  * Debug categories.  The debug level is a bitmask made up of
95  * flags indicating the desired categories; only 31 bits are
96  * available, as the highest-order bit designates an invalid
97  * setting.
98  */
99 #define	D_INVALID	0x80000000
100 
101 #define	D_CERT		0x00000001	/* certificate management */
102 #define	D_KEY		0x00000002	/* key management */
103 #define	D_OP		0x00000004	/* operational: config, init, mem */
104 #define	D_P1		0x00000008	/* phase 1 negotiation */
105 #define	D_P2		0x00000010	/* phase 2 negotiation */
106 #define	D_PFKEY		0x00000020	/* pf key interface */
107 #define	D_POL		0x00000040	/* policy management */
108 #define	D_PROP		0x00000080	/* proposal construction */
109 #define	D_DOOR		0x00000100	/* door server */
110 #define	D_CONFIG	0x00000200	/* config file processing */
111 
112 #define	D_HIGHBIT	0x00000200
113 #define	D_ALL		0x000003ff
114 
115 /*
116  * Access privilege levels: define level of access to keying information.
117  * The privileges granted at each level is a superset of the privileges
118  * granted at all lower levels.
119  *
120  * The door operations which require special privileges are:
121  *
122  *	- receiving keying material for SAs and preshared key entries
123  *	  IKE_PRIV_KEYMAT must be set for this.
124  *
125  *	- get/dump/new/delete/read/write preshared keys
126  *	  IKE_PRIV_KEYMAT or IKE_PRIV_MODKEYS must be set to do this.
127  *	  If IKE_PRIV_MODKEYS is set, the information returned for a
128  *	  get/dump request will not include the actual key; in order
129  *	  to get the key itself, IKE_PRIV_KEYMAT must be set.
130  *
131  *	- modifying the privilege level: the daemon's privilege level
132  *	  is set when the daemon is started; the level may only be
133  *	  lowered via the door interface.
134  *
135  * All other operations are allowed at any privilege level.
136  */
137 #define	IKE_PRIV_MINIMUM	0
138 #define	IKE_PRIV_MODKEYS	1
139 #define	IKE_PRIV_KEYMAT		2
140 #define	IKE_PRIV_MAXIMUM	2
141 
142 /* global ike stats formatting structure */
143 typedef struct {
144 	uint32_t	st_init_p1_current;
145 	uint32_t	st_resp_p1_current;
146 	uint32_t	st_init_p1_total;
147 	uint32_t	st_resp_p1_total;
148 	uint32_t	st_init_p1_attempts;
149 	uint32_t	st_resp_p1_attempts;
150 	uint32_t	st_init_p1_noresp;   /* failed; no response from peer */
151 	uint32_t	st_init_p1_respfail; /* failed, but peer responded */
152 	uint32_t	st_resp_p1_fail;
153 	uint32_t	st_reserved;
154 	char		st_pkcs11_libname[PATH_MAX];
155 } ike_stats_t;
156 
157 /* structure used to pass default values used by in.iked back to ikeadm */
158 typedef struct {
159 	uint32_t	rule_p1_lifetime_secs;
160 	uint32_t	rule_p1_minlife;
161 	uint32_t	rule_p1_nonce_len;
162 	uint32_t	rule_p2_lifetime_secs;
163 	uint32_t	rule_p2_softlife_secs;
164 	uint32_t	rule_p2_lifetime_kb;
165 	uint32_t	rule_p2_softlife_kb;
166 	uint32_t	rule_p2_minlife;
167 	uint32_t	rule_p2_def_minlife;
168 	uint32_t	rule_p2_nonce_len;
169 	uint32_t	rule_p2_pfs;
170 	uint32_t	rule_p2_minsoft;
171 	uint32_t	rule_max_certs;
172 	uint32_t	rule_ike_port;
173 	uint32_t	rule_natt_port;
174 } ike_defaults_t;
175 
176 /* data formatting structures for P1 SA dumps */
177 typedef struct {
178 	struct sockaddr_storage	loc_addr;
179 	struct sockaddr_storage	rem_addr;
180 #define	beg_iprange	loc_addr
181 #define	end_iprange	rem_addr
182 } ike_addr_pr_t;
183 
184 typedef struct {
185 	uint64_t	cky_i;
186 	uint64_t	cky_r;
187 } ike_cky_pr_t;
188 
189 typedef struct {
190 	ike_cky_pr_t	p1hdr_cookies;
191 	uint8_t		p1hdr_major;
192 	uint8_t		p1hdr_minor;
193 	uint8_t		p1hdr_xchg;
194 	uint8_t		p1hdr_isinit;
195 	uint32_t	p1hdr_state;
196 } ike_p1_hdr_t;
197 
198 /* values for p1hdr_xchg (aligned with RFC2408, section 3.1) */
199 #define	IKE_XCHG_NONE			0
200 #define	IKE_XCHG_BASE			1
201 #define	IKE_XCHG_IDENTITY_PROTECT	2
202 #define	IKE_XCHG_AUTH_ONLY		3
203 #define	IKE_XCHG_AGGRESSIVE		4
204 /* following not from RFC; used only for preshared key definitions */
205 #define	IKE_XCHG_IP_AND_AGGR		240
206 /* also not from RFC; used as wildcard */
207 #define	IKE_XCHG_ANY			256
208 
209 /* values for p1hdr_state */
210 #define	IKE_SA_STATE_INVALID	0
211 #define	IKE_SA_STATE_INIT	1
212 #define	IKE_SA_STATE_SENT_SA	2
213 #define	IKE_SA_STATE_SENT_KE	3
214 #define	IKE_SA_STATE_SENT_LAST	4
215 #define	IKE_SA_STATE_DONE	5
216 #define	IKE_SA_STATE_DELETED	6
217 
218 typedef struct {
219 	uint16_t	p1xf_dh_group;
220 	uint16_t	p1xf_encr_alg;
221 	uint16_t	p1xf_encr_low_bits;
222 	uint16_t	p1xf_encr_high_bits;
223 	uint16_t	p1xf_auth_alg;
224 	uint16_t	p1xf_auth_meth;
225 	uint16_t	p1xf_prf;
226 	uint16_t	p1xf_pfs;
227 	uint32_t	p1xf_max_secs;
228 	uint32_t	p1xf_max_kbytes;
229 	uint32_t	p1xf_max_keyuses;
230 } ike_p1_xform_t;
231 
232 /* values for p1xf_dh_group (aligned with RFC2409, Appendix A) */
233 #define	IKE_GRP_DESC_MODP_768	1
234 #define	IKE_GRP_DESC_MODP_1024	2
235 #define	IKE_GRP_DESC_EC2N_155	3
236 #define	IKE_GRP_DESC_EC2N_185	4
237 #define	IKE_GRP_DESC_MODP_1536	5
238 
239 /* values for p1xf_auth_meth (aligned with RFC2409, Appendix A) */
240 #define	IKE_AUTH_METH_PRE_SHARED_KEY	1
241 #define	IKE_AUTH_METH_DSS_SIG		2
242 #define	IKE_AUTH_METH_RSA_SIG		3
243 #define	IKE_AUTH_METH_RSA_ENCR		4
244 #define	IKE_AUTH_METH_RSA_ENCR_REVISED	5
245 
246 /* values for p1xf_prf */
247 #define	IKE_PRF_NONE		0
248 #define	IKE_PRF_HMAC_MD5	1
249 #define	IKE_PRF_HMAC_SHA1	2
250 
251 typedef struct {
252 	/*
253 	 * NOTE: the new and del counters count the actual number of SAs,
254 	 * not the number of "suites", as defined in the ike monitoring
255 	 * mib draft; we do this because we don't have a good way of
256 	 * tracking the deletion of entire suites (we're notified of
257 	 * deleted qm sas individually).
258 	 */
259 	uint32_t	p1stat_new_qm_sas;
260 	uint32_t	p1stat_del_qm_sas;
261 	uint64_t	p1stat_start;
262 	uint32_t	p1stat_kbytes;
263 	uint32_t	p1stat_keyuses;
264 } ike_p1_stats_t;
265 
266 typedef struct {
267 	uint32_t	p1err_decrypt;
268 	uint32_t	p1err_hash;
269 	uint32_t	p1err_otherrx;
270 	uint32_t	p1err_tx;
271 } ike_p1_errors_t;
272 
273 typedef struct {
274 	uint32_t	p1key_type;
275 	uint32_t	p1key_len;
276 	/*
277 	 * followed by (len - sizeof (ike_p1_key_t)) bytes of hex data,
278 	 * 64-bit aligned (pad bytes are added at the end, if necessary,
279 	 * and NOT INCLUDED in the len value, which reflects the actual
280 	 * key size).
281 	 */
282 } ike_p1_key_t;
283 
284 /* key info types for ike_p1_key_t struct */
285 #define	IKE_KEY_PRESHARED	1
286 #define	IKE_KEY_SKEYID		2
287 #define	IKE_KEY_SKEYID_D	3
288 #define	IKE_KEY_SKEYID_A	4
289 #define	IKE_KEY_SKEYID_E	5
290 #define	IKE_KEY_ENCR		6
291 #define	IKE_KEY_IV		7
292 
293 typedef struct {
294 	ike_p1_hdr_t	p1sa_hdr;
295 	ike_p1_xform_t	p1sa_xform;
296 	ike_addr_pr_t	p1sa_ipaddrs;
297 	uint16_t	p1sa_stat_off;
298 	uint16_t	p1sa_stat_len;
299 	uint16_t	p1sa_error_off;
300 	uint16_t	p1sa_error_len;
301 	uint16_t	p1sa_localid_off;
302 	uint16_t	p1sa_localid_len;
303 	uint16_t	p1sa_remoteid_off;
304 	uint16_t	p1sa_remoteid_len;
305 	uint16_t	p1sa_key_off;
306 	uint16_t	p1sa_key_len;
307 	uint32_t	p1sa_reserved;
308 	/*
309 	 * variable-length structures will be included here, as
310 	 * indicated by offset/length fields.
311 	 * stats and errors will be formatted as ike_p1_stats_t and
312 	 * ike_p1_errors_t, respectively.
313 	 * key info will be formatted as a series of p1_key_t structs.
314 	 * local/remote ids will be formatted as sadb_ident_t structs.
315 	 */
316 } ike_p1_sa_t;
317 
318 
319 #define	MAX_LABEL_LEN	256
320 
321 
322 /* data formatting structure for policy (rule) dumps */
323 
324 typedef struct {
325 	char		rule_label[MAX_LABEL_LEN];
326 	uint32_t	rule_kmcookie;
327 	uint16_t	rule_ike_mode;
328 	uint16_t	rule_local_idtype;	/* SADB_IDENTTYPE_* value */
329 	uint32_t	rule_p1_nonce_len;
330 	uint32_t	rule_p2_nonce_len;
331 	uint32_t	rule_p2_pfs;
332 	uint32_t	rule_p2_lifetime_secs;
333 	uint32_t	rule_p2_softlife_secs;
334 	uint32_t	rule_p2_lifetime_kb;
335 	uint32_t	rule_p2_softlife_kb;
336 	uint16_t	rule_xform_cnt;
337 	uint16_t	rule_xform_off;
338 	uint16_t	rule_locip_cnt;
339 	uint16_t	rule_locip_off;
340 	uint16_t	rule_remip_cnt;
341 	uint16_t	rule_remip_off;
342 	uint16_t	rule_locid_inclcnt;
343 	uint16_t	rule_locid_exclcnt;
344 	uint16_t	rule_locid_off;
345 	uint16_t	rule_remid_inclcnt;
346 	uint16_t	rule_remid_exclcnt;
347 	uint16_t	rule_remid_off;
348 	/*
349 	 * Followed by several lists of variable-length structures, described
350 	 * by counts and offsets:
351 	 *	transforms			ike_p1_xform_t structs
352 	 *	ranges of local ip addrs	ike_addr_pr_t structs
353 	 *	ranges of remote ip addrs	ike_addr_pr_t structs
354 	 *	local identification strings	null-terminated ascii strings
355 	 *	remote identification strings	null-terminated ascii strings
356 	 */
357 } ike_rule_t;
358 
359 
360 /*
361  * data formatting structure for preshared keys
362  * ps_ike_mode field uses the IKE_XCHG_* defs
363  */
364 typedef struct {
365 	ike_addr_pr_t	ps_ipaddrs;
366 	uint16_t	ps_ike_mode;
367 	uint16_t	ps_localid_off;
368 	uint16_t	ps_localid_len;
369 	uint16_t	ps_remoteid_off;
370 	uint16_t	ps_remoteid_len;
371 	uint16_t	ps_key_off;
372 	uint16_t	ps_key_len;
373 	uint16_t	ps_key_bits;
374 	/*
375 	 * followed by variable-length structures, as indicated by
376 	 * offset/length fields.
377 	 * key info will be formatted as an array of bytes.
378 	 * local/remote ids will be formatted as sadb_ident_t structs.
379 	 */
380 } ike_ps_t;
381 
382 
383 /* identification types */
384 #define	IKE_ID_IDENT_PAIR	1
385 #define	IKE_ID_ADDR_PAIR	2
386 #define	IKE_ID_CKY_PAIR		3
387 #define	IKE_ID_LABEL		4
388 
389 
390 /* locations for read/write requests */
391 #define	IKE_RW_LOC_DEFAULT	1
392 #define	IKE_RW_LOC_USER_SPEC	2
393 
394 
395 /* door interface error codes */
396 #define	IKE_ERR_NO_OBJ		1	/* nothing found to match the request */
397 #define	IKE_ERR_NO_DESC		2	/* fd was required with this request */
398 #define	IKE_ERR_ID_INVALID	3	/* invalid id info was provided */
399 #define	IKE_ERR_LOC_INVALID	4	/* invalid location info was provided */
400 #define	IKE_ERR_CMD_INVALID	5	/* invalid command was provided */
401 #define	IKE_ERR_DATA_INVALID	6	/* invalid data was provided */
402 #define	IKE_ERR_CMD_NOTSUP	7	/* unsupported command */
403 #define	IKE_ERR_REQ_INVALID	8	/* badly formatted request */
404 #define	IKE_ERR_NO_PRIV		9	/* privilege level not high enough */
405 #define	IKE_ERR_SYS_ERR		10	/* syserr occurred while processing */
406 #define	IKE_ERR_DUP_IGNORED	11	/* attempt to add a duplicate entry */
407 
408 
409 /*
410  * IKE_SVC_GET_DBG
411  * Used to request the current debug level.
412  *
413  * Upon request, dbg_level is 0 (don't care).
414  *
415  * Upon return, dbg_level contains the current value.
416  *
417  *
418  * IKE_SVC_SET_DBG
419  * Used to request modification of the debug level.
420  *
421  * Upon request, dbg_level contains desired level.  If debug output is
422  * to be directed to a different file, the fd should be passed in the
423  * door_desc_t field of the door_arg_t param.  NOTE: if the daemon is
424  * currently running in the background with no debug set, an output
425  * file MUST be given.
426  *
427  * Upon return, dbg_level contains the old debug level, and acknowledges
428  * successful completion of the request.  If an error is encountered,
429  * ike_err_t is returned instead, with appropriate error value and cmd
430  * IKE_SVC_ERROR.
431  */
432 typedef struct {
433 	ike_svccmd_t	cmd;
434 	uint32_t	dbg_level;
435 } ike_dbg_t;
436 
437 /*
438  * IKE_SVC_GET_PRIV
439  * Used to request the current privilege level.
440  *
441  * Upon request, priv_level is 0 (don't care).
442  *
443  * Upon return, priv_level contains the current value.
444  *
445  *
446  * IKE_SVC_SET_PRIV
447  * Used to request modification of the privilege level.
448  *
449  * Upon request, priv_level contains the desired level.  The level may
450  * only be lowered via the door interface; it cannot be raised.  Thus,
451  * if in.iked is started at the lowest level, it cannot be changed.
452  *
453  * Upon return, priv_level contains the old privilege level, and
454  * acknowledges successful completion of the request.  If an error is
455  * encountered, ike_err_t is returned instead, with appropriate error
456  * value and cmd IKE_SVC_ERROR.
457  */
458 typedef struct {
459 	ike_svccmd_t	cmd;
460 	uint32_t	priv_level;
461 } ike_priv_t;
462 
463 
464 /*
465  * IKE_SVC_GET_STATS
466  * Used to request current statistics on Phase 1 SA creation and
467  * failures.  The statistics represent all activity in in.iked.
468  *
469  * Upon request, cmd is set, and stat_len does not matter.
470  *
471  * Upon successful return, stat_len contains the total size of the
472  * returned buffer, which contains first the ike_statreq_t struct,
473  * followed by the stat data in the ike_stats_t structure. In case
474  * of an error in processing the request, ike_err_t is returned with
475  * IKE_SVC_ERROR command and appropriate error code.
476  */
477 typedef struct {
478 	ike_svccmd_t	cmd;
479 	uint32_t	stat_len;
480 } ike_statreq_t;
481 
482 /*
483  * IKE_SVC_GET_DEFS
484  * Used to request default values from in.iked.
485  *
486  * Upon request, cmd is set, and stat_len does not matter.
487  *
488  * Upon successful return, stat_len contains the total size of the
489  * returned buffer, this contains a pair of ike_defaults_t's.
490  */
491 typedef struct {
492 	ike_svccmd_t	cmd;
493 	uint32_t	stat_len;
494 	uint32_t	version;
495 } ike_defreq_t;
496 
497 /*
498  * IKE_SVC_DUMP_{P1S|RULES|PS}
499  * Used to request a table dump, and to return info for a single table
500  * item.  The expectation is that all of the table data will be passed
501  * through the door, one entry at a time; an individual request must be
502  * sent for each entry, however (the door server can't send unrequested
503  * data).
504  *
505  * Upon request: cmd is set, and dump_next contains the item number
506  * requested (0 for first request).  dump_len is 0; no data follows.
507  *
508  * Upon return: cmd is set, and dump_next contains the item number of
509  * the *next* item in the table (to be used in the subsequent request).
510  * dump_next = 0 indicates that this is the last item in the table.
511  * dump_len is the total length (data + struct) returned.  Data is
512  * formatted as indicated by the cmd type:
513  *   IKE_SVC_DUMP_P1S:		ike_p1_sa_t
514  *   IKE_SVC_DUMP_RULES:	ike_rule_t
515  *   IKE_SVC_DUMP_PS:		ike_ps_t
516  */
517 typedef struct {
518 	ike_svccmd_t	cmd;
519 	uint32_t	dump_len;
520 	union {
521 		struct {
522 			uint32_t	dump_unext;
523 			uint32_t	dump_ureserved;
524 		} dump_actual;
525 		uint64_t dump_alignment;
526 	} dump_u;
527 #define	dump_next dump_u.dump_actual.dump_unext
528 #define	dump_reserved dump_u.dump_actual.dump_ureserved
529 	/* dump_len - sizeof (ike_dump_t) bytes of data included here */
530 } ike_dump_t;
531 
532 
533 /*
534  * IKE_SVC_GET_{P1|RULE|PS}
535  * Used to request and return individual table items.
536  *
537  * Upon request: get_len is the total msg length (struct + id data);
538  * get_idtype indicates the type of identification being used.
539  *   IKE_SVC_GET_P1:		ike_addr_pr_t or ike_cky_pr_t
540  *   IKE_SVC_GET_RULE:		char string (label)
541  *   IKE_SVC_GET_PS:		ike_addr_pr_t or pair of sadb_ident_t
542  *
543  * Upon return: get_len is the total size (struct + data), get_idtype
544  * is unused, and the data that follows is formatted according to cmd:
545  *   IKE_SVC_GET_P1:		ike_p1_sa_t
546  *   IKE_SVC_GET_RULE:		ike_rule_t
547  *   IKE_SVC_GET_PS:		ike_ps_t
548  */
549 typedef struct {
550 	ike_svccmd_t	cmd;
551 	uint32_t	get_len;
552 	union {
553 		struct {
554 			uint32_t	getu_idtype;
555 			uint32_t	getu_reserved;
556 		} get_actual;
557 		uint64_t get_alignment;
558 	} get_u;
559 #define	get_idtype get_u.get_actual.getu_idtype
560 #define	get_reserved get_u.get_actual.getu_reserved
561 	/* get_len - sizeof (ike_get_t) bytes of data included here */
562 } ike_get_t;
563 
564 
565 /*
566  * IKE_SVC_NEW_{RULE|PS}
567  * Used to request and acknowledge insertion of a table item.
568  *
569  * Upon request: new_len is the total (data + struct) size passed, or 0.
570  * new_len = 0 => a door_desc_t is also included with a file descriptor
571  * for a file containing the data to be added.  The file should include
572  * a single item: a rule, or a pre-shared key.  For new_len != 0, the
573  * data is formatted according to the cmd type:
574  *   IKE_SVC_NEW_RULE:		ike_rule_t
575  *   IKE_SVC_NEW_PS:		ike_ps_t
576  *
577  * Upon return: new_len is 0; simply acknowledges successful insertion
578  * of the requested item.  If insertion is not successful, ike_err_t is
579  * returned instead with appropriate error value.
580  */
581 typedef struct {
582 	ike_svccmd_t	cmd;
583 	uint32_t	new_len;
584 	/* new_len - sizeof (ike_new_t) bytes included here */
585 	uint64_t	new_align;	/* Padding for 64-bit alignment. */
586 } ike_new_t;
587 
588 
589 /*
590  * IKE_SVC_DEL_{P1|RULE|PS}
591  * Used to request and acknowledge the deletion of an individual table
592  * item.
593  *
594  * Upon request: del_len is the total msg length (struct + id data);
595  * del_idtype indicates the type of identification being used.
596  *   IKE_SVC_DEL_P1:		ike_addr_pr_t or ike_cky_pr_t
597  *   IKE_SVC_DEL_RULE:		char string (label)
598  *   IKE_SVC_DEL_PS:		ike_addr_pr_t or pair of sadb_ident_t
599  *
600  * Upon return: acknowledges deletion of the requested item; del_len and
601  * del_idtype are unspecified.  If deletion is not successful, ike_err_t
602  * is returned instead with appropriate error value.
603  */
604 typedef struct {
605 	ike_svccmd_t	cmd;
606 	uint32_t	del_len;
607 	uint32_t	del_idtype;
608 	uint32_t	del_reserved;
609 	/* del_len - sizeof (ike_del_t) bytes of data included here. */
610 } ike_del_t;
611 
612 
613 /*
614  * IKE_SVC_READ_{RULES|PS}
615  * Used to ask daemon to re-read particular configuration info.
616  *
617  * Upon request: rw_loc indicates where the info should be read from:
618  * either from a user-supplied file descriptor(s), or from the default
619  * location(s).  If rw_loc indicates user-supplied location, the file
620  * descriptor(s) should be passed in the door_desc_t struct.  For the
621  * IKE_SVC_READ_RULES cmd, two file descriptors should be specified:
622  * first, one for the config file which contains the data to be read,
623  * and second, one for the cookie file which will be written to as
624  * in.iked process the config file.
625  *
626  * Upon return: rw_loc is unspecified; the message simply acknowledges
627  * successful completion of the request.  If an error occurred,
628  * ike_err_t is returned instead with appropriate error value.
629  *
630  *
631  * IKE_SVC_WRITE_{RULES|PS}
632  * Used to ask daemon to write its current config info to files.
633  *
634  * Request and return are handled the same as for the IKE_SVC_READ_*
635  * cmds; however, the rw_loc MUST be a user-supplied location.  Also,
636  * for the IKE_SVC_WRITE_RULES cmd, the cookie file fd is not required;
637  * only a single fd, for the file to which the config info should be
638  * written, should be passed in.
639  */
640 typedef struct {
641 	ike_svccmd_t	cmd;
642 	uint32_t	rw_loc;
643 } ike_rw_t;
644 
645 
646 /*
647  * IKE_SVC_FLUSH_P1S
648  * Used to request and acknowledge tear-down of all P1 SAs.
649  */
650 typedef struct {
651 	ike_svccmd_t	cmd;
652 } ike_flush_t;
653 
654 
655 /*
656  * IKE_SVC_ERROR
657  * Used on return if server encountered an error while processing
658  * the request.  An appropriate error code is included (as defined
659  * in this header file); in the case of IKE_ERR_SYS_ERR, a value
660  * from the UNIX errno space is included in the ike_err_unix field.
661  */
662 typedef struct {
663 	ike_svccmd_t	cmd;
664 	uint32_t	ike_err;
665 	uint32_t	ike_err_unix;
666 	uint32_t	ike_err_reserved;
667 } ike_err_t;
668 
669 
670 /*
671  * Generic type for use when the request/reply type is unknown
672  */
673 typedef struct {
674 	ike_svccmd_t	cmd;
675 } ike_cmd_t;
676 
677 
678 /*
679  * Union containing all possible request/retrun structures.
680  */
681 typedef union {
682 	ike_cmd_t	svc_cmd;
683 	ike_dbg_t	svc_dbg;
684 	ike_priv_t	svc_priv;
685 	ike_statreq_t	svc_stats;
686 	ike_dump_t	svc_dump;
687 	ike_get_t	svc_get;
688 	ike_new_t	svc_new;
689 	ike_del_t	svc_del;
690 	ike_rw_t	svc_rw;
691 	ike_flush_t	svc_flush;
692 	ike_err_t	svc_err;
693 	ike_defreq_t	svc_defaults;
694 } ike_service_t;
695 
696 #ifdef	__cplusplus
697 }
698 #endif
699 
700 #endif	/* _IKEDOOR_H */
701