1 /* $OpenBSD: conf.h,v 1.34 2006/08/30 16:56:56 hshoexer Exp $ */ 2 /* $EOM: conf.h,v 1.13 2000/09/18 00:01:47 ho Exp $ */ 3 4 /* 5 * Copyright (c) 1998, 1999, 2001 Niklas Hallqvist. All rights reserved. 6 * Copyright (c) 2000, 2003 H�kan Olsson. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /* 30 * This code was written under funding by Ericsson Radio Systems. 31 */ 32 33 #ifndef _CONF_H_ 34 #define _CONF_H_ 35 36 #include <sys/types.h> 37 #include <sys/queue.h> 38 #include <sys/socket.h> 39 #include <stdio.h> 40 41 #define ISAKMPD_ROOT "/etc/isakmpd/" 42 43 #define CONFIG_FILE ISAKMPD_ROOT "isakmpd.conf" 44 45 /* Default values for autogenerated part of our configuration. */ 46 #define CONF_DFLT_TAG_LIFE_MAIN_MODE "LIFE_MAIN_MODE" 47 #define CONF_DFLT_TYPE_LIFE_MAIN_MODE "SECONDS" 48 #define CONF_DFLT_VAL_LIFE_MAIN_MODE "3600,60:86400" 49 50 #define CONF_DFLT_TAG_LIFE_QUICK_MODE "LIFE_QUICK_MODE" 51 #define CONF_DFLT_TYPE_LIFE_QUICK_MODE "SECONDS" 52 #define CONF_DFLT_VAL_LIFE_QUICK_MODE "1200,60:86400" 53 54 #define CONF_DFLT_VAL_BLF_KEYLEN "128,96:192" 55 #define CONF_DFLT_VAL_AES_KEYLEN "128,128:256" 56 57 #define CONF_DFLT_RETRANSMITS "3" 58 #define CONF_DFLT_EXCH_MAX_TIME "120" 59 60 #define CONF_DFLT_USE_KEYNOTE "yes" 61 #define CONF_DFLT_POLICY_FILE ISAKMPD_ROOT "isakmpd.policy" 62 63 #define CONF_DFLT_X509_CA_DIR ISAKMPD_ROOT "ca/" 64 #define CONF_DFLT_X509_CERT_DIR ISAKMPD_ROOT "certs/" 65 #define CONF_DFLT_X509_PRIVATE_KEY ISAKMPD_ROOT "private/local.key" 66 #define CONF_DFLT_X509_PRIVATE_KEY_DIR ISAKMPD_ROOT "private/" 67 #define CONF_DFLT_X509_CRL_DIR ISAKMPD_ROOT "crls/" 68 #define CONF_DFLT_PUBKEY_DIR ISAKMPD_ROOT "pubkeys/" 69 #define CONF_DFLT_KEYNOTE_CRED_DIR ISAKMPD_ROOT "keynote/" 70 71 #define CONF_DFLT_DELETE_SAS "yes" 72 73 #define CONF_DFLT_TAG_PHASE1_CONFIG "Default-phase-1-configuration" 74 #define CONF_DFLT_PHASE1_EXCH_TYPE "ID_PROT" 75 #define CONF_DFLT_PHASE1_TRANSFORMS "3DES-SHA-RSA_SIG" 76 77 struct conf_list_node { 78 TAILQ_ENTRY(conf_list_node) link; 79 char *field; 80 }; 81 82 struct conf_list { 83 size_t cnt; 84 TAILQ_HEAD(conf_list_fields_head, conf_list_node) fields; 85 }; 86 87 extern char *conf_path; 88 89 extern int conf_begin(void); 90 extern int conf_end(int, int); 91 extern void conf_free_list(struct conf_list *); 92 extern struct sockaddr *conf_get_address(char *, char *); 93 extern struct conf_list *conf_get_list(char *, char *); 94 extern struct conf_list *conf_get_tag_list(char *); 95 extern int conf_get_num(char *, char *, int); 96 extern char *conf_get_str(char *, char *); 97 extern void conf_init(void); 98 extern int conf_match_num(char *, char *, int); 99 extern void conf_reinit(void); 100 extern int conf_remove(int, char *, char *); 101 extern int conf_remove_section(int, char *); 102 extern int conf_set(int, char *, char *, char *, int, int); 103 extern void conf_report(void); 104 105 #endif /* _CONF_H_ */ 106