1 /* $NetBSD: admin.h,v 1.7 2008/08/29 00:30:15 gmcgarry 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 39 extern char *adminsock_path; 40 extern uid_t adminsock_owner; 41 extern gid_t adminsock_group; 42 extern mode_t adminsock_mode; 43 44 /* command for administration. */ 45 /* NOTE: host byte order. */ 46 struct 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 } u; 53 u_int16_t ac_proto; 54 }; 55 #define ac_errno u.ac_un_errno 56 #define ac_version u.ac_un_version 57 58 /* 59 * Version field in request is valid. 60 */ 61 #define ADMIN_FLAG_VERSION 0x8000 62 63 /* 64 * No data follows as the data. 65 * These don't use proto field. 66 */ 67 #define ADMIN_RELOAD_CONF 0x0001 68 #define ADMIN_SHOW_SCHED 0x0002 69 #define ADMIN_SHOW_EVT 0x0003 70 71 /* 72 * No data follows as the data. 73 * These use proto field. 74 */ 75 #define ADMIN_SHOW_SA 0x0101 76 #define ADMIN_FLUSH_SA 0x0102 77 78 /* 79 * The admin_com_indexes follows, see below. 80 */ 81 #define ADMIN_DELETE_SA 0x0201 82 #define ADMIN_ESTABLISH_SA 0x0202 83 #define ADMIN_DELETE_ALL_SA_DST 0x0204 /* All SA for a given peer */ 84 85 #define ADMIN_GET_SA_CERT 0x0206 86 87 /* 88 * The admin_com_indexes and admin_com_psk follow, see below. 89 */ 90 #define ADMIN_ESTABLISH_SA_PSK 0x0203 91 92 /* 93 * user login follows 94 */ 95 #define ADMIN_LOGOUT_USER 0x0205 /* Delete SA for a given Xauth user */ 96 97 /* 98 * Range 0x08xx is reserved for privilege separation, see privsep.h 99 */ 100 101 /* the value of proto */ 102 #define ADMIN_PROTO_ISAKMP 0x01ff 103 #define ADMIN_PROTO_IPSEC 0x02ff 104 #define ADMIN_PROTO_AH 0x0201 105 #define ADMIN_PROTO_ESP 0x0202 106 #define ADMIN_PROTO_INTERNAL 0x0301 107 108 struct admin_com_indexes { 109 u_int8_t prefs; 110 u_int8_t prefd; 111 u_int8_t ul_proto; 112 u_int8_t reserved; 113 struct sockaddr_storage src; 114 struct sockaddr_storage dst; 115 }; 116 117 struct admin_com_psk { 118 int id_type; 119 size_t id_len; 120 size_t key_len; 121 /* Followed by id and key */ 122 }; 123 124 extern int admin2pfkey_proto __P((u_int)); 125 126 #endif /* _ADMIN_H */ 127