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

urn.c File Reference


Detailed Description

URN handling of specific formats.

Author:
Raphael Manfredi
Date:
2002-2004

#include "common.h"
#include "base32.h"
#include "misc.h"
#include "urn.h"
#include "override.h"

Functions

 RCSID ("$Id:urn.c, v 1.9 2005/06/25 01:37:43 daichik Exp $")
gboolean urn_get_http_sha1 (const gchar *buf, gchar *retval)
 Validate SHA1 starting in NUL-terminated `buf' as a proper base32 encoding of a SHA1 hash, and write decoded value in `retval'.

gboolean urn_get_sha1 (const gchar *buf, gchar *digest)
 Locate the start of "urn:sha1:" or "urn:bitprint:" indications and extract the SHA1 out of it, placing it in the supplied `digest' buffer.

gboolean urn_get_sha1_no_prefix (const gchar *buf, gchar *digest)
 This is the same as urn_get_sha1(), only the leading "urn:" part is missing (typically a URN embedded in a GGEP "u").


Function Documentation

RCSID "$Id:urn.  c,
v 1.9 2005/06/25 01:37:43 daichik Exp $" 
 

gboolean urn_get_http_sha1 const gchar *  buf,
gchar *  retval
 

Validate SHA1 starting in NUL-terminated `buf' as a proper base32 encoding of a SHA1 hash, and write decoded value in `retval'.

The SHA1 typically comes from HTTP, in a X-Gnutella-Content-URN header. Therefore, we unconditionally accept both old and new encodings.

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

gboolean urn_get_sha1 const gchar *  buf,
gchar *  digest
 

Locate the start of "urn:sha1:" or "urn:bitprint:" indications and extract the SHA1 out of it, placing it in the supplied `digest' buffer.

Returns:
whether we successfully extracted the SHA1.

gboolean urn_get_sha1_no_prefix const gchar *  buf,
gchar *  digest
 

This is the same as urn_get_sha1(), only the leading "urn:" part is missing (typically a URN embedded in a GGEP "u").

`buf' MUST start with "sha1:" or "bitprint:" indications. Since the leading "urn:" part is missing, we cannot be lenient.

Extract the SHA1 out of it, placing it in the supplied `digest' buffer.

Returns:
whether we successfully extracted the SHA1.


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