1/*	$NetBSD: admin.h,v 1.8 2010/11/12 09:08:26 tteras Exp $	*/
2
3/* Id: admin.h,v 1.11 2005/06/19 22:37:47 manubsd Exp */
4
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.
20 *
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.
32 */
33
34#ifndef _ADMIN_H
35#define _ADMIN_H
36
37#define ADMINSOCK_PATH ADMINPORTDIR "/racoon.sock"
38
39extern char *adminsock_path;
40extern uid_t adminsock_owner;
41extern gid_t adminsock_group;
42extern mode_t adminsock_mode;
43
44/* command for administration. */
45/* NOTE: host byte order. */
46struct admin_com {
47	u_int16_t ac_len;	/* total packet length including data */
48	u_int16_t ac_cmd;
49	union {
50		int16_t ac_un_errno;
51		uint16_t ac_un_version;
52		uint16_t ac_un_len_high;
53	} u;
54	u_int16_t ac_proto;
55};
56#define ac_errno u.ac_un_errno
57#define ac_version u.ac_un_version
58#define ac_len_high u.ac_un_len_high
59
60/*
61 * Version field in request is valid.
62 */
63#define ADMIN_FLAG_VERSION	0x8000
64#define ADMIN_FLAG_LONG_REPLY	0x8000
65
66/*
67 * No data follows as the data.
68 * These don't use proto field.
69 */
70#define ADMIN_RELOAD_CONF	0x0001
71#define ADMIN_SHOW_SCHED	0x0002
72#define ADMIN_SHOW_EVT		0x0003
73
74/*
75 * No data follows as the data.
76 * These use proto field.
77 */
78#define ADMIN_SHOW_SA		0x0101
79#define ADMIN_FLUSH_SA		0x0102
80
81/*
82 * The admin_com_indexes follows, see below.
83 */
84#define ADMIN_DELETE_SA		0x0201
85#define ADMIN_ESTABLISH_SA	0x0202
86#define ADMIN_DELETE_ALL_SA_DST	0x0204	/* All SA for a given peer */
87
88#define ADMIN_GET_SA_CERT	0x0206
89
90/*
91 * The admin_com_indexes and admin_com_psk follow, see below.
92 */
93#define ADMIN_ESTABLISH_SA_PSK	0x0203
94
95/*
96 * user login follows
97 */
98#define ADMIN_LOGOUT_USER	0x0205  /* Delete SA for a given Xauth user */
99
100/*
101 * Range 0x08xx is reserved for privilege separation, see privsep.h
102 */
103
104/* the value of proto */
105#define ADMIN_PROTO_ISAKMP	0x01ff
106#define ADMIN_PROTO_IPSEC	0x02ff
107#define ADMIN_PROTO_AH		0x0201
108#define ADMIN_PROTO_ESP		0x0202
109#define ADMIN_PROTO_INTERNAL	0x0301
110
111struct admin_com_indexes {
112	u_int8_t prefs;
113	u_int8_t prefd;
114	u_int8_t ul_proto;
115	u_int8_t reserved;
116	struct sockaddr_storage src;
117	struct sockaddr_storage dst;
118};
119
120struct admin_com_psk {
121	int id_type;
122	size_t id_len;
123	size_t key_len;
124	/* Followed by id and key */
125};
126
127extern int admin2pfkey_proto __P((u_int));
128
129#endif /* _ADMIN_H */
130