This file is based a lot on the whitelist stuff by vidar.
#include "common.h"
#include "hostiles.h"
#include "settings.h"
#include "nodes.h"
#include "lib/file.h"
#include "lib/misc.h"
#include "lib/glib-missing.h"
#include "lib/iprange.h"
#include "lib/walloc.h"
#include "lib/watcher.h"
#include "if/gnet_property.h"
#include "if/gnet_property_priv.h"
#include "if/bridge/c2ui.h"
#include "lib/override.h"
Defines | |
| #define | THERE GUINT_TO_POINTER(0x2) | 
Enumerations | |
| enum | hostiles_t { HOSTILE_GLOBAL = 0, HOSTILE_PRIVATE = 1, NUM_HOSTILES } | 
Functions | |
| RCSID ("$Id:hostiles.c, v 1.27 2005/11/14 13:04:22 cbiere Exp $") | |
| void | hostiles_close_one (hostiles_t which) | 
| Frees all entries in the given hostiles.   | |
| gint | hostiles_load (FILE *f, hostiles_t which) | 
| Load hostile data from the supplied FILE.   | |
| void | hostiles_changed (const gchar *filename, gpointer udata) | 
| Watcher callback, invoked when the file from which we read the hostile addresses changed.   | |
| void | hostiles_retrieve_from_file (FILE *f, hostiles_t which, const gchar *path, const gchar *filename) | 
| void | hostiles_retrieve (hostiles_t which) | 
| Loads the hostiles.txt into memory.   | |
| gboolean | use_global_hostiles_txt_changed (property_t unused_prop) | 
| If the property was set to FALSE at startup time, hostile_db[HOSTILE_GLOBAL] is still NULL and we need to load the global hostiles.txt now.   | |
| void | hostiles_init (void) | 
| Called on startup.   | |
| void | hostiles_close (void) | 
| Frees all entries in all the hostiles.   | |
| gboolean | hostiles_check (const host_addr_t ha) | 
| Check the given address against the entries in the hostiles.   | |
Variables | |
| const gchar | hostiles_file [] = "hostiles.txt" | 
| const gchar | hostiles_what [] = "hostile IP addresses" | 
| gpointer | hostile_db [NUM_HOSTILES] | 
| The hostile database.   | |
      
  | 
  
| 
 
  | 
  
      
  | 
  
| 
 
  | 
  
      
  | 
  ||||||||||||
| 
 Watcher callback, invoked when the file from which we read the hostile addresses changed. 
  | 
  
      
  | 
  
| 
 Check the given address against the entries in the hostiles. 
 
 
  | 
  
      
  | 
  
| 
 Frees all entries in all the hostiles. 
  | 
  
      
  | 
  
| 
 Frees all entries in the given hostiles. 
  | 
  
      
  | 
  
| 
 Called on startup. Loads the hostiles.txt into memory.  | 
  
      
  | 
  ||||||||||||
| 
 Load hostile data from the supplied FILE. 
 
  | 
  
      
  | 
  
| 
 Loads the hostiles.txt into memory. Choosing the first file we find among the several places we look at, typically: 
 
 The selected file will then be monitored and a reloading will occur shortly after a modification.  | 
  
      
  | 
  ||||||||||||||||||||
| 
 
  | 
  
      
  | 
  ||||||||||||
| 
 
  | 
  
      
  | 
  
| 
 If the property was set to FALSE at startup time, hostile_db[HOSTILE_GLOBAL] is still NULL and we need to load the global hostiles.txt now. Otherwise, there's nothing to do, hostiles_check() will simply ignore hostile_db[HOSTILE_GLOBAL]. The file watcher keeps running though during this session and we keep the database in memory.  | 
  
      
  | 
  
| 
 The hostile database. 
  | 
  
      
  | 
  
| 
 
  | 
  
      
  | 
  
| 
 
  | 
  
 
1.3.6