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

huge.h File Reference


Detailed Description

HUGE support (Hash/URN Gnutella Extension).

Author:
Raphael Manfredi
Date:
2002-2003
Author:
Ch. Tronche (http://tronche.com/)
Date:
2002-04-28

#include "common.h"

Go to the source code of this file.

Functions

void huge_init (void)
 Call this function at the beginning.

void huge_close (void)
 Call this when servent is shutdown.

void request_sha1 (struct shared_file *)
 External interface to call for getting the hash for a shared_file.

gboolean sha1_is_cached (const struct shared_file *sf)
 External interface to check whether the sha1 for shared_file is known.

gboolean huge_improbable_sha1 (const gchar *buf, size_t len)
 Test whether the SHA1 in its base32/binary form is improbable.

gboolean huge_sha1_extract32 (const gchar *buf, size_t len, gchar *retval, gpointer header, gboolean check_old)
 huge_sha1_extract32

void huge_collect_locations (gchar *sha1, struct header *header)


Function Documentation

void huge_close void   ) 
 

Call this when servent is shutdown.

void huge_collect_locations gchar *  sha1,
struct header header
 

gboolean huge_improbable_sha1 const gchar *  buf,
size_t  len
 

Test whether the SHA1 in its base32/binary form is improbable.

This is used to detect "urn:sha1:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" and things using the same pattern with other letters, as being rather improbable hashes.

void huge_init void   ) 
 

Call this function at the beginning.

gboolean huge_sha1_extract32 const gchar *  buf,
size_t  len,
gchar *  retval,
gpointer  header,
gboolean  check_old
 

huge_sha1_extract32

Validate `len' bytes starting from `buf' as a proper base32 encoding of a SHA1 hash, and write decoded value in `retval'. Also make sure that the SHA1 is not an improbable value.

`header' is the header of the packet where we found the SHA1, so that we may trace errors if needed.

When `check_old' is true, check the encoding against an earlier version of the base32 alphabet.

Returns:
TRUE if the SHA1 was valid and properly decoded, FALSE on error.

void request_sha1 struct shared_file  ) 
 

External interface to call for getting the hash for a shared_file.

gboolean sha1_is_cached const struct shared_file sf  ) 
 

External interface to check whether the sha1 for shared_file is known.


Generated on Sun Feb 12 10:50:03 2006 for Gtk-Gnutella by doxygen 1.3.6