1/* $NetBSD: admin.h,v 1.4 2006/09/09 16:22:09 manu 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 int16_t ac_errno; 50 u_int16_t ac_proto; 51}; 52 53/* 54 * No data follows as the data. 55 * These don't use proto field. 56 */ 57#define ADMIN_RELOAD_CONF 0x0001 58#define ADMIN_SHOW_SCHED 0x0002 59#define ADMIN_SHOW_EVT 0x0003 60 61/* 62 * No data follows as the data. 63 * These use proto field. 64 */ 65#define ADMIN_SHOW_SA 0x0101 66#define ADMIN_FLUSH_SA 0x0102 67 68/* 69 * The admin_com_indexes follows, see below. 70 */ 71#define ADMIN_DELETE_SA 0x0201 72#define ADMIN_ESTABLISH_SA 0x0202 73#define ADMIN_DELETE_ALL_SA_DST 0x0204 /* All SA for a given peer */ 74 75/* 76 * The admin_com_indexes and admin_com_psk follow, see below. 77 */ 78#define ADMIN_ESTABLISH_SA_PSK 0x0203 79 80/* 81 * user login follows 82 */ 83#define ADMIN_LOGOUT_USER 0x0205 /* Delete SA for a given Xauth user */ 84 85/* 86 * Range 0x08xx is reserved for privilege separation, see privsep.h 87 */ 88 89/* the value of proto */ 90#define ADMIN_PROTO_ISAKMP 0x01ff 91#define ADMIN_PROTO_IPSEC 0x02ff 92#define ADMIN_PROTO_AH 0x0201 93#define ADMIN_PROTO_ESP 0x0202 94#define ADMIN_PROTO_INTERNAL 0x0301 95 96struct admin_com_indexes { 97 u_int8_t prefs; 98 u_int8_t prefd; 99 u_int8_t ul_proto; 100 u_int8_t reserved; 101 struct sockaddr_storage src; 102 struct sockaddr_storage dst; 103}; 104 105struct admin_com_psk { 106 int id_type; 107 size_t id_len; 108 size_t key_len; 109 /* Followed by id and key */ 110}; 111 112extern int admin2pfkey_proto __P((u_int)); 113 114#endif /* _ADMIN_H */ 115