#include <net/if.h>
#include <netinet/in.h>
#include <sys/time.h>
#include "list.h"
#include "message.h"
Include dependency graph for ha_config.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | interface_entry |
struct | ha_config |
struct | spi_entry |
struct | authorized_entry |
struct | fa_spi_entry |
Defines | |
#define | MAXFILENAMELEN 256 |
#define | MAXSHAREDSECRETLEN 32 |
#define | MAXOWNERNAMELEN 8 |
#define | MAXGROUPNAMELEN 8 |
#define | HA_DEFAULT_MAX_BINDINGS 20 |
#define | HA_DEFAULT_TUNNEL_LIFETIME 500 |
#define | HA_DEFAULT_REG_ERROR_REPLY_INTERVAL 10 |
#define | HA_DEFAULT_SYSLOG_FACILITY LOG_LOCAL0 |
#define | HA_DEFAULT_REG_PORT 434 |
#define | HA_MOBILE_HASHTABLE_SIZE 256 |
#define | MAXMSG 2048 |
#define | HASH_METHOD_NONE 0 |
#define | HASH_METHOD_CHECK 1 |
#define | HASH_METHOD_REQUIRE 2 |
Enumerations | |
enum | { INTERFACE_AGENTADV_ONLY_SOLICITED = 0, INTERFACE_AGENTADV_ALL = 1, INTERFACE_AGENTADV_NONE = -1 } |
Functions | |
int | load_config (struct ha_config *ha, char *program_name, char *config_file) |
void | cleanup_config (struct ha_config *cfg) |
#define HA_DEFAULT_MAX_BINDINGS 20 |
#define HA_DEFAULT_REG_ERROR_REPLY_INTERVAL 10 |
#define HA_DEFAULT_REG_PORT 434 |
#define HA_DEFAULT_SYSLOG_FACILITY LOG_LOCAL0 |
#define HA_DEFAULT_TUNNEL_LIFETIME 500 |
#define HA_MOBILE_HASHTABLE_SIZE 256 |
Definition at line 35 of file ha_config.h.
#define HASH_METHOD_CHECK 1 |
#define HASH_METHOD_NONE 0 |
Definition at line 40 of file ha_config.h.
#define HASH_METHOD_REQUIRE 2 |
Definition at line 42 of file ha_config.h.
#define MAXFILENAMELEN 256 |
Definition at line 22 of file ha_config.h.
#define MAXGROUPNAMELEN 8 |
Definition at line 25 of file ha_config.h.
#define MAXMSG 2048 |
Definition at line 37 of file ha_config.h.
#define MAXOWNERNAMELEN 8 |
Definition at line 24 of file ha_config.h.
#define MAXSHAREDSECRETLEN 32 |
Definition at line 23 of file ha_config.h.
anonymous enum |
Definition at line 44 of file ha_config.h.
00044 { 00045 INTERFACE_AGENTADV_ONLY_SOLICITED = 0, 00046 INTERFACE_AGENTADV_ALL = 1, 00047 INTERFACE_AGENTADV_NONE = -1 00048 };
void cleanup_config | ( | struct ha_config * | cfg | ) |
Definition at line 47 of file ha_config.c.
References ha_config::authorized_list, ha_config::fa_spi_list, interface_entry::icmp_sock, ha_config::interfaces, spi_entry::spi, ha_config::spi_list, interface_entry::udp_bc_sock, interface_entry::udp_bc_sock2, and interface_entry::udp_sock.
Referenced by load_config().
00048 { 00049 struct spi_entry *spi; 00050 struct fa_spi_entry *fa_spi; 00051 struct authorized_entry *auth; 00052 struct interface_entry *iface; 00053 00054 if (cfg == NULL) return; 00055 00056 spi = (struct spi_entry *) list_remove_first(&cfg->spi_list); 00057 while (spi != NULL) { 00058 free(spi); 00059 spi = (struct spi_entry *) list_remove_first(&cfg->spi_list); 00060 } 00061 00062 /* remove all from authorized list */ 00063 auth = (struct authorized_entry *) 00064 list_remove_first(&cfg->authorized_list); 00065 while (auth != NULL) { 00066 free(auth); 00067 auth = (struct authorized_entry *) 00068 list_remove_first(&cfg->authorized_list); 00069 } 00070 00071 fa_spi = (struct fa_spi_entry *) list_remove_first(&cfg->fa_spi_list); 00072 while (fa_spi != NULL) { 00073 free(fa_spi); 00074 fa_spi = (struct fa_spi_entry *) 00075 list_remove_first(&cfg->fa_spi_list); 00076 } 00077 00078 iface = (struct interface_entry *) 00079 list_remove_first(&cfg->interfaces); 00080 while (iface != NULL) { 00081 if (iface->icmp_sock >= 0) 00082 close(iface->icmp_sock); 00083 if (iface->udp_sock >= 0) 00084 close(iface->udp_sock); 00085 if (iface->udp_bc_sock >= 0) 00086 close(iface->udp_bc_sock); 00087 if (iface->udp_bc_sock2 >= 0) 00088 close(iface->udp_bc_sock2); 00089 free(iface); 00090 iface = (struct interface_entry *) 00091 list_remove_first(&cfg->interfaces); 00092 } 00093 }
int load_config | ( | struct ha_config * | ha, | |
char * | program_name, | |||
char * | config_file | |||
) |
Definition at line 97 of file ha_config.c.
References ASSERT, ha_config::authorized_list, load_ha_data::cfg, cleanup_config(), ha_config::enable_reverse_tunneling, ha_config::enable_triangle_tunneling, ha_config::fa_spi_list, FALSE, HA_DEFAULT_MAX_BINDINGS, HA_DEFAULT_REG_ERROR_REPLY_INTERVAL, HA_DEFAULT_REG_PORT, HA_DEFAULT_SYSLOG_FACILITY, HA_DEFAULT_TUNNEL_LIFETIME, ha_config::ha_default_tunnel_lifetime, HASH_METHOD_CHECK, ha_config::interfaces, ha_config::max_bindings, load_ha_data::process_authorized_list, load_ha_data::process_fa_spi_list, load_ha_data::process_interfaces, load_ha_data::process_spi_list, ha_config::pubkey_hash_method, ha_config::reg_error_reply_interval, ha_config::socket_priority, ha_config::spi_list, ha_config::syslog_facility, TRUE, and ha_config::udpport.
00098 { 00099 FILE *file; 00100 struct load_ha_data ha; 00101 00102 ASSERT(cfg); 00103 ha.cfg = cfg; 00104 memset(cfg, 0, sizeof(struct ha_config)); 00105 ha.process_spi_list = FALSE; 00106 list_init(&cfg->spi_list); 00107 ha.process_authorized_list = FALSE; 00108 list_init(&cfg->authorized_list); 00109 ha.process_fa_spi_list = FALSE; 00110 list_init(&cfg->fa_spi_list); 00111 ha.process_interfaces = FALSE; 00112 list_init(&cfg->interfaces); 00113 00114 /* set default values */ 00115 cfg->max_bindings = HA_DEFAULT_MAX_BINDINGS; 00116 cfg->ha_default_tunnel_lifetime = HA_DEFAULT_TUNNEL_LIFETIME; 00117 cfg->reg_error_reply_interval = HA_DEFAULT_REG_ERROR_REPLY_INTERVAL; 00118 cfg->syslog_facility = HA_DEFAULT_SYSLOG_FACILITY; 00119 cfg->udpport = HA_DEFAULT_REG_PORT; 00120 cfg->socket_priority = -1; 00121 cfg->enable_triangle_tunneling = TRUE; 00122 cfg->enable_reverse_tunneling = TRUE; 00123 cfg->pubkey_hash_method = HASH_METHOD_CHECK; 00124 00125 file = fopen(config_file, "r"); 00126 if (file == NULL) { 00127 fprintf(stderr, 00128 "%s: Could not open configuration file '%s'.\n", 00129 program_name, config_file); 00130 return FALSE; 00131 } 00132 if (load_data(&ha, file, process_load_ha) == FALSE) { 00133 fprintf(stderr, 00134 "%s: Error while interpreting file '%s'!\n", 00135 program_name, config_file); 00136 fclose(file); 00137 cleanup_config(cfg); 00138 return FALSE; 00139 } 00140 fclose(file); 00141 00142 openlog("home agent", LOG_PID | LOG_CONS, cfg->syslog_facility); 00143 00144 return TRUE; 00145 }
Here is the call graph for this function: