xref: /titanic_52/usr/src/lib/libipsecutil/common/ikedoor.h (revision c2580b931007758eab8cb5ae8726ebe1588e259b)
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 2006 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 1
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_auth_alg;
222 	uint16_t	p1xf_auth_meth;
223 	uint16_t	p1xf_prf;
224 	uint16_t	p1xf_pfs;
225 	uint32_t	p1xf_max_secs;
226 	uint32_t	p1xf_max_kbytes;
227 	uint32_t	p1xf_max_keyuses;
228 } ike_p1_xform_t;
229 
230 /* values for p1xf_dh_group (aligned with RFC2409, Appendix A) */
231 #define	IKE_GRP_DESC_MODP_768	1
232 #define	IKE_GRP_DESC_MODP_1024	2
233 #define	IKE_GRP_DESC_EC2N_155	3
234 #define	IKE_GRP_DESC_EC2N_185	4
235 #define	IKE_GRP_DESC_MODP_1536	5
236 
237 /* values for p1xf_auth_meth (aligned with RFC2409, Appendix A) */
238 #define	IKE_AUTH_METH_PRE_SHARED_KEY	1
239 #define	IKE_AUTH_METH_DSS_SIG		2
240 #define	IKE_AUTH_METH_RSA_SIG		3
241 #define	IKE_AUTH_METH_RSA_ENCR		4
242 #define	IKE_AUTH_METH_RSA_ENCR_REVISED	5
243 
244 /* values for p1xf_prf */
245 #define	IKE_PRF_NONE		0
246 #define	IKE_PRF_HMAC_MD5	1
247 #define	IKE_PRF_HMAC_SHA1	2
248 
249 typedef struct {
250 	/*
251 	 * NOTE: the new and del counters count the actual number of SAs,
252 	 * not the number of "suites", as defined in the ike monitoring
253 	 * mib draft; we do this because we don't have a good way of
254 	 * tracking the deletion of entire suites (we're notified of
255 	 * deleted qm sas individually).
256 	 */
257 	uint32_t	p1stat_new_qm_sas;
258 	uint32_t	p1stat_del_qm_sas;
259 	uint64_t	p1stat_start;
260 	uint32_t	p1stat_kbytes;
261 	uint32_t	p1stat_keyuses;
262 } ike_p1_stats_t;
263 
264 typedef struct {
265 	uint32_t	p1err_decrypt;
266 	uint32_t	p1err_hash;
267 	uint32_t	p1err_otherrx;
268 	uint32_t	p1err_tx;
269 } ike_p1_errors_t;
270 
271 typedef struct {
272 	uint32_t	p1key_type;
273 	uint32_t	p1key_len;
274 	/*
275 	 * followed by (len - sizeof (ike_p1_key_t)) bytes of hex data,
276 	 * 64-bit aligned (pad bytes are added at the end, if necessary,
277 	 * and NOT INCLUDED in the len value, which reflects the actual
278 	 * key size).
279 	 */
280 } ike_p1_key_t;
281 
282 /* key info types for ike_p1_key_t struct */
283 #define	IKE_KEY_PRESHARED	1
284 #define	IKE_KEY_SKEYID		2
285 #define	IKE_KEY_SKEYID_D	3
286 #define	IKE_KEY_SKEYID_A	4
287 #define	IKE_KEY_SKEYID_E	5
288 #define	IKE_KEY_ENCR		6
289 #define	IKE_KEY_IV		7
290 
291 typedef struct {
292 	ike_p1_hdr_t	p1sa_hdr;
293 	ike_p1_xform_t	p1sa_xform;
294 	ike_addr_pr_t	p1sa_ipaddrs;
295 	uint16_t	p1sa_stat_off;
296 	uint16_t	p1sa_stat_len;
297 	uint16_t	p1sa_error_off;
298 	uint16_t	p1sa_error_len;
299 	uint16_t	p1sa_localid_off;
300 	uint16_t	p1sa_localid_len;
301 	uint16_t	p1sa_remoteid_off;
302 	uint16_t	p1sa_remoteid_len;
303 	uint16_t	p1sa_key_off;
304 	uint16_t	p1sa_key_len;
305 	uint32_t	p1sa_reserved;
306 	/*
307 	 * variable-length structures will be included here, as
308 	 * indicated by offset/length fields.
309 	 * stats and errors will be formatted as ike_p1_stats_t and
310 	 * ike_p1_errors_t, respectively.
311 	 * key info will be formatted as a series of p1_key_t structs.
312 	 * local/remote ids will be formatted as sadb_ident_t structs.
313 	 */
314 } ike_p1_sa_t;
315 
316 
317 #define	MAX_LABEL_LEN	256
318 
319 
320 /* data formatting structure for policy (rule) dumps */
321 
322 typedef struct {
323 	char		rule_label[MAX_LABEL_LEN];
324 	uint32_t	rule_kmcookie;
325 	uint16_t	rule_ike_mode;
326 	uint16_t	rule_local_idtype;	/* SADB_IDENTTYPE_* value */
327 	uint32_t	rule_p1_nonce_len;
328 	uint32_t	rule_p2_nonce_len;
329 	uint32_t	rule_p2_pfs;
330 	uint32_t	rule_p2_lifetime_secs;
331 	uint32_t	rule_p2_softlife_secs;
332 	uint32_t	rule_p2_lifetime_kb;
333 	uint32_t	rule_p2_softlife_kb;
334 	uint16_t	rule_xform_cnt;
335 	uint16_t	rule_xform_off;
336 	uint16_t	rule_locip_cnt;
337 	uint16_t	rule_locip_off;
338 	uint16_t	rule_remip_cnt;
339 	uint16_t	rule_remip_off;
340 	uint16_t	rule_locid_inclcnt;
341 	uint16_t	rule_locid_exclcnt;
342 	uint16_t	rule_locid_off;
343 	uint16_t	rule_remid_inclcnt;
344 	uint16_t	rule_remid_exclcnt;
345 	uint16_t	rule_remid_off;
346 	/*
347 	 * Followed by several lists of variable-length structures, described
348 	 * by counts and offsets:
349 	 *	transforms			ike_p1_xform_t structs
350 	 *	ranges of local ip addrs	ike_addr_pr_t structs
351 	 *	ranges of remote ip addrs	ike_addr_pr_t structs
352 	 *	local identification strings	null-terminated ascii strings
353 	 *	remote identification strings	null-terminated ascii strings
354 	 */
355 } ike_rule_t;
356 
357 
358 /*
359  * data formatting structure for preshared keys
360  * ps_ike_mode field uses the IKE_XCHG_* defs
361  */
362 typedef struct {
363 	ike_addr_pr_t	ps_ipaddrs;
364 	uint16_t	ps_ike_mode;
365 	uint16_t	ps_localid_off;
366 	uint16_t	ps_localid_len;
367 	uint16_t	ps_remoteid_off;
368 	uint16_t	ps_remoteid_len;
369 	uint16_t	ps_key_off;
370 	uint16_t	ps_key_len;
371 	uint16_t	ps_key_bits;
372 	/*
373 	 * followed by variable-length structures, as indicated by
374 	 * offset/length fields.
375 	 * key info will be formatted as an array of bytes.
376 	 * local/remote ids will be formatted as sadb_ident_t structs.
377 	 */
378 } ike_ps_t;
379 
380 
381 /* identification types */
382 #define	IKE_ID_IDENT_PAIR	1
383 #define	IKE_ID_ADDR_PAIR	2
384 #define	IKE_ID_CKY_PAIR		3
385 #define	IKE_ID_LABEL		4
386 
387 
388 /* locations for read/write requests */
389 #define	IKE_RW_LOC_DEFAULT	1
390 #define	IKE_RW_LOC_USER_SPEC	2
391 
392 
393 /* door interface error codes */
394 #define	IKE_ERR_NO_OBJ		1	/* nothing found to match the request */
395 #define	IKE_ERR_NO_DESC		2	/* fd was required with this request */
396 #define	IKE_ERR_ID_INVALID	3	/* invalid id info was provided */
397 #define	IKE_ERR_LOC_INVALID	4	/* invalid location info was provided */
398 #define	IKE_ERR_CMD_INVALID	5	/* invalid command was provided */
399 #define	IKE_ERR_DATA_INVALID	6	/* invalid data was provided */
400 #define	IKE_ERR_CMD_NOTSUP	7	/* unsupported command */
401 #define	IKE_ERR_REQ_INVALID	8	/* badly formatted request */
402 #define	IKE_ERR_NO_PRIV		9	/* privilege level not high enough */
403 #define	IKE_ERR_SYS_ERR		10	/* syserr occurred while processing */
404 #define	IKE_ERR_DUP_IGNORED	11	/* attempt to add a duplicate entry */
405 
406 
407 /*
408  * IKE_SVC_GET_DBG
409  * Used to request the current debug level.
410  *
411  * Upon request, dbg_level is 0 (don't care).
412  *
413  * Upon return, dbg_level contains the current value.
414  *
415  *
416  * IKE_SVC_SET_DBG
417  * Used to request modification of the debug level.
418  *
419  * Upon request, dbg_level contains desired level.  If debug output is
420  * to be directed to a different file, the fd should be passed in the
421  * door_desc_t field of the door_arg_t param.  NOTE: if the daemon is
422  * currently running in the background with no debug set, an output
423  * file MUST be given.
424  *
425  * Upon return, dbg_level contains the old debug level, and acknowledges
426  * successful completion of the request.  If an error is encountered,
427  * ike_err_t is returned instead, with appropriate error value and cmd
428  * IKE_SVC_ERROR.
429  */
430 typedef struct {
431 	ike_svccmd_t	cmd;
432 	uint32_t	dbg_level;
433 } ike_dbg_t;
434 
435 /*
436  * IKE_SVC_GET_PRIV
437  * Used to request the current privilege level.
438  *
439  * Upon request, priv_level is 0 (don't care).
440  *
441  * Upon return, priv_level contains the current value.
442  *
443  *
444  * IKE_SVC_SET_PRIV
445  * Used to request modification of the privilege level.
446  *
447  * Upon request, priv_level contains the desired level.  The level may
448  * only be lowered via the door interface; it cannot be raised.  Thus,
449  * if in.iked is started at the lowest level, it cannot be changed.
450  *
451  * Upon return, priv_level contains the old privilege level, and
452  * acknowledges successful completion of the request.  If an error is
453  * encountered, ike_err_t is returned instead, with appropriate error
454  * value and cmd IKE_SVC_ERROR.
455  */
456 typedef struct {
457 	ike_svccmd_t	cmd;
458 	uint32_t	priv_level;
459 } ike_priv_t;
460 
461 
462 /*
463  * IKE_SVC_GET_STATS
464  * Used to request current statistics on Phase 1 SA creation and
465  * failures.  The statistics represent all activity in in.iked.
466  *
467  * Upon request, cmd is set, and stat_len does not matter.
468  *
469  * Upon successful return, stat_len contains the total size of the
470  * returned buffer, which contains first the ike_statreq_t struct,
471  * followed by the stat data in the ike_stats_t structure. In case
472  * of an error in processing the request, ike_err_t is returned with
473  * IKE_SVC_ERROR command and appropriate error code.
474  */
475 typedef struct {
476 	ike_svccmd_t	cmd;
477 	uint32_t	stat_len;
478 } ike_statreq_t;
479 
480 /*
481  * IKE_SVC_GET_DEFS
482  * Used to request default values from in.iked.
483  *
484  * Upon request, cmd is set, and stat_len does not matter.
485  *
486  * Upon successful return, stat_len contains the total size of the
487  * returned buffer, this contains a pair of ike_defaults_t's.
488  */
489 typedef struct {
490 	ike_svccmd_t	cmd;
491 	uint32_t	stat_len;
492 	uint32_t	version;
493 } ike_defreq_t;
494 
495 /*
496  * IKE_SVC_DUMP_{P1S|RULES|PS}
497  * Used to request a table dump, and to return info for a single table
498  * item.  The expectation is that all of the table data will be passed
499  * through the door, one entry at a time; an individual request must be
500  * sent for each entry, however (the door server can't send unrequested
501  * data).
502  *
503  * Upon request: cmd is set, and dump_next contains the item number
504  * requested (0 for first request).  dump_len is 0; no data follows.
505  *
506  * Upon return: cmd is set, and dump_next contains the item number of
507  * the *next* item in the table (to be used in the subsequent request).
508  * dump_next = 0 indicates that this is the last item in the table.
509  * dump_len is the total length (data + struct) returned.  Data is
510  * formatted as indicated by the cmd type:
511  *   IKE_SVC_DUMP_P1S:		ike_p1_sa_t
512  *   IKE_SVC_DUMP_RULES:	ike_rule_t
513  *   IKE_SVC_DUMP_PS:		ike_ps_t
514  */
515 typedef struct {
516 	ike_svccmd_t	cmd;
517 	uint32_t	dump_len;
518 	union {
519 		struct {
520 			uint32_t	dump_unext;
521 			uint32_t	dump_ureserved;
522 		} dump_actual;
523 		uint64_t dump_alignment;
524 	} dump_u;
525 #define	dump_next dump_u.dump_actual.dump_unext
526 #define	dump_reserved dump_u.dump_actual.dump_ureserved
527 	/* dump_len - sizeof (ike_dump_t) bytes of data included here */
528 } ike_dump_t;
529 
530 
531 /*
532  * IKE_SVC_GET_{P1|RULE|PS}
533  * Used to request and return individual table items.
534  *
535  * Upon request: get_len is the total msg length (struct + id data);
536  * get_idtype indicates the type of identification being used.
537  *   IKE_SVC_GET_P1:		ike_addr_pr_t or ike_cky_pr_t
538  *   IKE_SVC_GET_RULE:		char string (label)
539  *   IKE_SVC_GET_PS:		ike_addr_pr_t or pair of sadb_ident_t
540  *
541  * Upon return: get_len is the total size (struct + data), get_idtype
542  * is unused, and the data that follows is formatted according to cmd:
543  *   IKE_SVC_GET_P1:		ike_p1_sa_t
544  *   IKE_SVC_GET_RULE:		ike_rule_t
545  *   IKE_SVC_GET_PS:		ike_ps_t
546  */
547 typedef struct {
548 	ike_svccmd_t	cmd;
549 	uint32_t	get_len;
550 	union {
551 		struct {
552 			uint32_t	getu_idtype;
553 			uint32_t	getu_reserved;
554 		} get_actual;
555 		uint64_t get_alignment;
556 	} get_u;
557 #define	get_idtype get_u.get_actual.getu_idtype
558 #define	get_reserved get_u.get_actual.getu_reserved
559 	/* get_len - sizeof (ike_get_t) bytes of data included here */
560 } ike_get_t;
561 
562 
563 /*
564  * IKE_SVC_NEW_{RULE|PS}
565  * Used to request and acknowledge insertion of a table item.
566  *
567  * Upon request: new_len is the total (data + struct) size passed, or 0.
568  * new_len = 0 => a door_desc_t is also included with a file descriptor
569  * for a file containing the data to be added.  The file should include
570  * a single item: a rule, or a pre-shared key.  For new_len != 0, the
571  * data is formatted according to the cmd type:
572  *   IKE_SVC_NEW_RULE:		ike_rule_t
573  *   IKE_SVC_NEW_PS:		ike_ps_t
574  *
575  * Upon return: new_len is 0; simply acknowledges successful insertion
576  * of the requested item.  If insertion is not successful, ike_err_t is
577  * returned instead with appropriate error value.
578  */
579 typedef struct {
580 	ike_svccmd_t	cmd;
581 	uint32_t	new_len;
582 	/* new_len - sizeof (ike_new_t) bytes included here */
583 	uint64_t	new_align;	/* Padding for 64-bit alignment. */
584 } ike_new_t;
585 
586 
587 /*
588  * IKE_SVC_DEL_{P1|RULE|PS}
589  * Used to request and acknowledge the deletion of an individual table
590  * item.
591  *
592  * Upon request: del_len is the total msg length (struct + id data);
593  * del_idtype indicates the type of identification being used.
594  *   IKE_SVC_DEL_P1:		ike_addr_pr_t or ike_cky_pr_t
595  *   IKE_SVC_DEL_RULE:		char string (label)
596  *   IKE_SVC_DEL_PS:		ike_addr_pr_t or pair of sadb_ident_t
597  *
598  * Upon return: acknowledges deletion of the requested item; del_len and
599  * del_idtype are unspecified.  If deletion is not successful, ike_err_t
600  * is returned instead with appropriate error value.
601  */
602 typedef struct {
603 	ike_svccmd_t	cmd;
604 	uint32_t	del_len;
605 	uint32_t	del_idtype;
606 	uint32_t	del_reserved;
607 	/* del_len - sizeof (ike_del_t) bytes of data included here. */
608 } ike_del_t;
609 
610 
611 /*
612  * IKE_SVC_READ_{RULES|PS}
613  * Used to ask daemon to re-read particular configuration info.
614  *
615  * Upon request: rw_loc indicates where the info should be read from:
616  * either from a user-supplied file descriptor(s), or from the default
617  * location(s).  If rw_loc indicates user-supplied location, the file
618  * descriptor(s) should be passed in the door_desc_t struct.  For the
619  * IKE_SVC_READ_RULES cmd, two file descriptors should be specified:
620  * first, one for the config file which contains the data to be read,
621  * and second, one for the cookie file which will be written to as
622  * in.iked process the config file.
623  *
624  * Upon return: rw_loc is unspecified; the message simply acknowledges
625  * successful completion of the request.  If an error occurred,
626  * ike_err_t is returned instead with appropriate error value.
627  *
628  *
629  * IKE_SVC_WRITE_{RULES|PS}
630  * Used to ask daemon to write its current config info to files.
631  *
632  * Request and return are handled the same as for the IKE_SVC_READ_*
633  * cmds; however, the rw_loc MUST be a user-supplied location.  Also,
634  * for the IKE_SVC_WRITE_RULES cmd, the cookie file fd is not required;
635  * only a single fd, for the file to which the config info should be
636  * written, should be passed in.
637  */
638 typedef struct {
639 	ike_svccmd_t	cmd;
640 	uint32_t	rw_loc;
641 } ike_rw_t;
642 
643 
644 /*
645  * IKE_SVC_FLUSH_P1S
646  * Used to request and acknowledge tear-down of all P1 SAs.
647  */
648 typedef struct {
649 	ike_svccmd_t	cmd;
650 } ike_flush_t;
651 
652 
653 /*
654  * IKE_SVC_ERROR
655  * Used on return if server encountered an error while processing
656  * the request.  An appropriate error code is included (as defined
657  * in this header file); in the case of IKE_ERR_SYS_ERR, a value
658  * from the UNIX errno space is included in the ike_err_unix field.
659  */
660 typedef struct {
661 	ike_svccmd_t	cmd;
662 	uint32_t	ike_err;
663 	uint32_t	ike_err_unix;
664 	uint32_t	ike_err_reserved;
665 } ike_err_t;
666 
667 
668 /*
669  * Generic type for use when the request/reply type is unknown
670  */
671 typedef struct {
672 	ike_svccmd_t	cmd;
673 } ike_cmd_t;
674 
675 
676 /*
677  * Union containing all possible request/retrun structures.
678  */
679 typedef union {
680 	ike_cmd_t	svc_cmd;
681 	ike_dbg_t	svc_dbg;
682 	ike_priv_t	svc_priv;
683 	ike_statreq_t	svc_stats;
684 	ike_dump_t	svc_dump;
685 	ike_get_t	svc_get;
686 	ike_new_t	svc_new;
687 	ike_del_t	svc_del;
688 	ike_rw_t	svc_rw;
689 	ike_flush_t	svc_flush;
690 	ike_err_t	svc_err;
691 	ike_defreq_t	svc_defaults;
692 } ike_service_t;
693 
694 #ifdef	__cplusplus
695 }
696 #endif
697 
698 #endif	/* _IKEDOOR_H */
699