Main Page | Modules | Alphabetical List | Data Structures | Directories | 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.
gboolean 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_update_hashes (struct shared_file *sf, const struct sha1 *sha1, const struct tth *tth)
 Asynchronous computation of hash value.
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, struct sha1 *sha1, gconstpointer header)
 Validate `len' bytes starting from `buf' as a proper base32 encoding of a SHA1 hash, and write decoded value in `sha1'.
void huge_collect_locations (const struct sha1 *sha1, struct header *header)


Function Documentation

void huge_close void   ) 
 

Call this when servent is shutdown.

void huge_collect_locations const struct sha1 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,
struct sha1 sha1,
gconstpointer  header
 

Validate `len' bytes starting from `buf' as a proper base32 encoding of a SHA1 hash, and write decoded value in `sha1'.

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.

gboolean huge_update_hashes struct shared_file sf,
const struct sha1 sha1,
const struct tth tth
 

Asynchronous computation of hash value.

gboolean request_sha1 struct shared_file sf  ) 
 

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

Returns:
if shared_file_remove() was called, FALSE is returned and "sf" is no longer valid. Otherwise TRUE is returned.

gboolean sha1_is_cached const struct shared_file sf  ) 
 

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


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