Richard Eckart
#include "common.h"
#include "lib/eval.h"
#include "settings.h"
#include "search.h"
#include "hosts.h"
#include "upload_stats.h"
#include "sockets.h"
#include "inet.h"
#include "hcache.h"
#include "downloads.h"
#include "share.h"
#include "if/gnet_property.h"
#include "if/gnet_property_priv.h"
#include "if/core/main.h"
#include "if/core/net_stats.h"
#include "if/bridge/c2ui.h"
#include "lib/cq.h"
#include "lib/file.h"
#include "lib/glib-missing.h"
#include "lib/tm.h"
#include "lib/override.h"
Data Structures | |
struct | prop_map |
The property maps contain informaiton about which widget should reflect which property. More... | |
Defines | |
#define | debug dbg |
#define | PID_FILE_MODE (S_IRUSR | S_IWUSR) /* 0600 */ |
#define | CONFIG_DIR_MODE |
#define | RESET_PROP_TM (10*60*1000) /**< 10 minutes in ms */ |
10 minutes in ms | |
#define | PROPERTY_MAP_SIZE G_N_ELEMENTS(property_map) |
Typedefs | |
typedef prop_map | prop_map_t |
Functions | |
RCSID ("$Id:settings.c, v 1.51 2005/12/08 00:49:08 cbiere Exp $") | |
void | settings_callbacks_init (void) |
void | settings_callbacks_shutdown (void) |
void | update_uptimes (void) |
Called at shutdown time to update the average_uptime property before saving the properties to disk. | |
host_addr_t | listen_address (gboolean update) |
void | listen_address_update (void) |
host_addr_t | listen_addr (void) |
gint | ensure_unicity (const gchar *file) |
Look for any existing PID file. | |
void | save_pid (gint fd) |
Write our pid to the pidfile. | |
guint64 | settings_getphysmemsize (void) |
void | settings_init (void) |
const gchar * | settings_config_dir (void) |
Get the config directory. | |
const gchar * | settings_home_dir (void) |
Gets the home dir. | |
void | settings_remove_pidfile (void) |
Remove pidfile. | |
void | settings_addr_changed (const host_addr_t new_addr, const host_addr_t peer) |
This routine is called when we determined that our IP was no longer the one we computed. | |
guint32 | settings_max_msg_size (void) |
Maximum message payload size we are configured to handle. | |
void | settings_ask_for_property (const gchar *name, const gchar *value) |
Ask them to set a property to be able to run. | |
void | settings_shutdown (void) |
Called at exit time to flush the property files. | |
void | settings_save_if_dirty (void) |
Save settings if dirty. | |
void | settings_close (void) |
Finally free all memory allocated. | |
void | gnet_get_bw_stats (gnet_bw_source type, gnet_bw_stats_t *s) |
guint32 | get_average_ip_lifetime (time_t now) |
Compute the EMA of the IP address lifetime up to now, but do not update the property. | |
void | update_address_lifetime (void) |
Called whenever the IP address we advertise changed. | |
guint32 | get_average_servent_uptime (time_t now) |
Compute the EMA of the averate servent uptime, up to now, but do not update the property. | |
gboolean | up_connections_changed (property_t prop) |
gboolean | max_connections_changed (property_t prop) |
gboolean | max_hosts_cached_changed (property_t prop) |
gboolean | max_ultra_hosts_cached_changed (property_t prop) |
gboolean | max_bad_hosts_cached_changed (property_t prop) |
gboolean | enable_udp_changed (property_t prop) |
gboolean | listen_port_changed (property_t prop) |
gboolean | network_protocol_changed (property_t prop) |
gboolean | bw_http_in_enabled_changed (property_t prop) |
gboolean | bw_http_out_enabled_changed (property_t prop) |
gboolean | bw_gnet_in_enabled_changed (property_t prop) |
gboolean | bw_gnet_out_enabled_changed (property_t prop) |
gboolean | bw_gnet_lin_enabled_changed (property_t prop) |
gboolean | bw_gnet_lout_enabled_changed (property_t prop) |
gboolean | node_sendqueue_size_changed (property_t unused_prop) |
gboolean | scan_extensions_changed (property_t prop) |
gboolean | file_path_changed (property_t prop) |
gboolean | shared_dirs_paths_changed (property_t prop) |
gboolean | local_netmasks_string_changed (property_t prop) |
gboolean | hard_ttl_limit_changed (property_t prop) |
gboolean | max_ttl_changed (property_t prop) |
gboolean | bw_http_in_changed (property_t prop) |
gboolean | bw_http_out_changed (property_t prop) |
gboolean | bw_gnet_in_changed (property_t prop) |
gboolean | bw_gnet_out_changed (property_t prop) |
gboolean | bw_gnet_lin_changed (property_t prop) |
gboolean | bw_gnet_lout_changed (property_t prop) |
gboolean | bw_allow_stealing_changed (property_t prop) |
gboolean | node_online_mode_changed (property_t prop) |
gboolean | lib_debug_changed (property_t unused_prop) |
gboolean | force_local_addr_changed (property_t prop) |
gboolean | local_addr_changed (property_t prop) |
gboolean | configured_peermode_changed (property_t prop) |
gboolean | current_peermode_changed (property_t prop) |
gboolean | download_rx_size_changed (property_t prop) |
gboolean | node_rx_size_changed (property_t prop) |
void | reset_property_cb (cqueue_t *unused_cq, gpointer obj) |
callout queue callback | |
gboolean | file_descriptor_x_changed (property_t prop) |
Variables | |
const gchar | config_file [] = "config_gnet" |
const gchar | ul_stats_file [] = "upload_stats" |
gchar * | home_dir = NULL |
gchar * | config_dir = NULL |
prop_set_t * | properties = NULL |
const gchar | pidfile [] = "gtk-gnutella.pid" |
gpointer | ev_file_descriptor_shortage = NULL |
gpointer | ev_file_descriptor_runout = NULL |
prop_map_t | property_map [] |
gboolean | init_list [GNET_PROPERTY_NUM] |
|
Value: /* 0750 */ \
(S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP)
|
|
|
|
|
|
|
|
10 minutes in ms
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Look for any existing PID file. If found, look at the pid recorded there and make sure it has died. Abort operations if it hasn't...
|
|
|
|
|
|
|
|
Compute the EMA of the IP address lifetime up to now, but do not update the property.
|
|
Compute the EMA of the averate servent uptime, up to now, but do not update the property.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callout queue callback Reset the property. |
|
Write our pid to the pidfile.
|
|
|
|
This routine is called when we determined that our IP was no longer the one we computed. We base this on some headers sent back when we handshake with other nodes, and as a result, cannot trust the information. What we do henceforth is trust 3 successive indication that our IP changed, provided we get the same information each time. --RAM, 13/01/2002
--cbiere, 2004-08-01 |
|
Ask them to set a property to be able to run.
|
|
|
|
|
|
Finally free all memory allocated. Call after settings_shutdown. |
|
Get the config directory.
|
|
|
|
Gets the home dir.
|
|
|
|
Maximum message payload size we are configured to handle.
|
|
Remove pidfile.
|
|
Save settings if dirty.
|
|
Called at exit time to flush the property files.
|
|
|
|
|
|
Called whenever the IP address we advertise changed. Update the average uptime for a given IP address. |
|
Called at shutdown time to update the average_uptime property before saving the properties to disk.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|