Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

spam_sha1.c File Reference


Detailed Description

SHA-1 based spam filtering.

Author:
Markus Goetz
Date:
2003
Author:
Raphael Manfredi
Date:
2004
Author:
Christian Biere
Date:
2007

#include "common.h"
#include "spam.h"
#include "settings.h"
#include "lib/atoms.h"
#include "lib/file.h"
#include "lib/misc.h"
#include "lib/glib-missing.h"
#include "lib/sorted_array.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"

Data Structures

struct  spam_lut

Functions

int sha1_cmp_func (const void *a, const void *b)
void spam_sha1_add (const struct sha1 *sha1)
int sha1_collision (const void *a, const void *b)
void spam_sha1_sync (void)
gulong spam_sha1_load (FILE *f)
 Load spam database from the supplied FILE.
void spam_sha1_changed (const gchar *filename, gpointer unused_udata)
 Watcher callback, invoked when the file from which we read the spam changed.
void spam_sha1_retrieve_from_file (FILE *f, const gchar *path, const gchar *filename)
void spam_sha1_retrieve (void)
 Loads the spam.txt into memory.
void spam_sha1_init (void)
 Called on startup.
void spam_sha1_close (void)
 Frees all entries in the spam database.
gboolean spam_sha1_check (const struct sha1 *sha1)
 Check the given SHA-1 against the spam database.

Variables

const gchar spam_sha1_file [] = "spam_sha1.txt"
const gchar spam_sha1_what [] = "Spam SHA-1 database"
spam_lut spam_lut


Function Documentation

int sha1_cmp_func const void *  a,
const void *  b
[inline, static]
 

int sha1_collision const void *  a,
const void *  b
[static]
 

void spam_sha1_add const struct sha1 sha1  ) 
 

void spam_sha1_changed const gchar *  filename,
gpointer  unused_udata
[static]
 

Watcher callback, invoked when the file from which we read the spam changed.

gboolean spam_sha1_check const struct sha1 sha1  ) 
 

Check the given SHA-1 against the spam database.

Parameters:
sha1 the SHA-1 to check.
Returns:
TRUE if found, and FALSE if not.

void spam_sha1_close void   ) 
 

Frees all entries in the spam database.

void spam_sha1_init void   ) 
 

Called on startup.

Loads the spam.txt into memory.

gulong spam_sha1_load FILE *  f  )  [static]
 

Load spam database from the supplied FILE.

The current file format is as follows:

# Comment <SHA1 #1> <SHA1 #2> etc...

Returns:
the amount of entries loaded or -1 on failure.

void spam_sha1_retrieve void   )  [static]
 

Loads the spam.txt into memory.

The selected file will then be monitored and a reloading will occur shortly after a modification.

void spam_sha1_retrieve_from_file FILE *  f,
const gchar *  path,
const gchar *  filename
[static]
 

void spam_sha1_sync void   ) 
 


Variable Documentation

struct spam_lut spam_lut [static]
 

const gchar spam_sha1_file[] = "spam_sha1.txt" [static]
 

const gchar spam_sha1_what[] = "Spam SHA-1 database" [static]
 


Generated on Sat Jun 30 17:53:31 2007 for gtk-gnutella by  doxygen 1.3.9.1