00001 /* $Id: ha_config.h,v 1.19 2001/09/23 14:19:30 jm Exp $ 00002 * Home Agent - configuration reading routines 00003 * 00004 * Dynamic hierarchial IP tunnel 00005 * Copyright (C) 1998-2001, Dynamics group 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License version 2 as 00009 * published by the Free Software Foundation. See README and COPYING for 00010 * more details. 00011 */ 00012 00013 #ifndef HA_CONFIG_H 00014 #define HA_CONFIG_H 00015 00016 #include <net/if.h> 00017 #include <netinet/in.h> 00018 #include <sys/time.h> 00019 #include "list.h" 00020 #include "message.h" 00021 00022 #define MAXFILENAMELEN 256 00023 #define MAXSHAREDSECRETLEN 32 00024 #define MAXOWNERNAMELEN 8 00025 #define MAXGROUPNAMELEN 8 00026 00027 #define HA_DEFAULT_MAX_BINDINGS 20 00028 #define HA_DEFAULT_TUNNEL_LIFETIME 500 00029 #define HA_DEFAULT_REG_ERROR_REPLY_INTERVAL 10 00030 #define HA_DEFAULT_SYSLOG_FACILITY LOG_LOCAL0 00031 00032 /* default port to listen for registration requests */ 00033 #define HA_DEFAULT_REG_PORT 434 00034 00035 #define HA_MOBILE_HASHTABLE_SIZE 256 00036 00037 #define MAXMSG 2048 00038 00039 00040 #define HASH_METHOD_NONE 0 00041 #define HASH_METHOD_CHECK 1 00042 #define HASH_METHOD_REQUIRE 2 00043 00044 enum { 00045 INTERFACE_AGENTADV_ONLY_SOLICITED = 0, 00046 INTERFACE_AGENTADV_ALL = 1, 00047 INTERFACE_AGENTADV_NONE = -1 00048 }; 00049 00050 struct interface_entry { 00051 struct node node; 00052 00053 /* data from dynhad.conf */ 00054 char dev[IFNAMSIZ + 1]; 00055 int ha_disc; /* allow dynamics HA discovery */ 00056 int agentadv; /* whether to send agent advertisements or not */ 00057 int interval; /* interval to send advertisements */ 00058 struct in_addr force_addr; /* which source address to use if multiple 00059 * addresses available for interface */ 00060 00061 /* other data */ 00062 int if_index; 00063 struct in_addr addr; /* local address to be used for this interface */ 00064 struct in_addr bcaddr; /* broadcast address of this interfaced; used 00065 * used with HA discovery */ 00066 struct timeval last_adv; 00067 int icmp_sock, udp_sock, udp_bc_sock, udp_bc_sock2; 00068 }; 00069 00070 struct ha_config { 00071 int max_bindings; 00072 int ha_default_tunnel_lifetime; 00073 int reg_error_reply_interval; 00074 struct list spi_list; /* struct spi_entry */ 00075 struct list authorized_list; /* struct authorized_entry */ 00076 struct list fa_spi_list; /* struct fa_spi_entry */ 00077 struct list interfaces; /* struct interface_entry */ 00078 int syslog_facility; 00079 char ha_api_read_socket_path[MAXFILENAMELEN + 1]; 00080 char ha_api_read_socket_group[MAXGROUPNAMELEN + 1]; 00081 char ha_api_read_socket_owner[MAXOWNERNAMELEN + 1]; 00082 int ha_api_read_socket_permissions; 00083 char ha_api_admin_socket_path[MAXFILENAMELEN + 1]; 00084 char ha_api_admin_socket_group[MAXGROUPNAMELEN + 1]; 00085 char ha_api_admin_socket_owner[MAXOWNERNAMELEN + 1]; 00086 int ha_api_admin_socket_permissions; 00087 int udpport; 00088 int socket_priority; 00089 int enable_triangle_tunneling; 00090 int enable_reverse_tunneling; 00091 int pubkey_hash_method; 00092 char dhcp_if[MAXFILENAMELEN + 1]; 00093 char ha_nai[MAX_NAI_LEN + 1]; 00094 int ha_nai_len; 00095 struct in_addr sha_addr; 00096 __u32 priv_ha; 00097 }; 00098 00099 struct spi_entry { 00100 struct node node; 00101 int spi; 00102 int auth_alg; 00103 int replay_method; 00104 int timestamp_tolerance; 00105 int max_lifetime; 00106 unsigned char shared_secret[MAXSHAREDSECRETLEN]; 00107 int shared_secret_len; 00108 }; 00109 00110 struct authorized_entry { 00111 struct node node; 00112 int spi_low; 00113 int spi_high; 00114 struct in_addr network; 00115 struct in_addr netmask; 00116 }; 00117 00118 struct fa_spi_entry { 00119 struct node node; 00120 int spi; 00121 struct in_addr addr; 00122 int alg; 00123 unsigned char shared_secret[MAXSHAREDSECRETLEN]; 00124 int shared_secret_len; 00125 }; 00126 00127 int load_config(struct ha_config *ha, char *program_name, char *config_file); 00128 void cleanup_config(struct ha_config *cfg); 00129 00130 #endif /* HA_CONFIG_H */