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

kuid.h File Reference


Detailed Description

Kademlia Unique ID (KUID) manager.

Author:
Raphael Manfredi
Date:
2006

#include "common.h"

Go to the source code of this file.

Data Structures

struct  kuid

Defines

#define KUID_RAW_SIZE   20

Typedefs

typedef kuid kuid_t

Functions

void kuid_init (void)
 Initialize KUID management.
void kuid_random_fill (kuid_t *kuid)
 Generate a new random KUID within given `kuid'.
gint kuid_cmp (const kuid_t *target, const kuid_t *kuid1, const kuid_t *kuid2)
 Compare three KUID with the XOR distance, to determine whether `kuid1' is closer to `target' than `kuid2'.
const gchar * kuid_to_string (const kuid_t *kuid)
 Convert a KUID to a base32 string.
kuid_tkuid_get_atom (const kuid_t *k)
void kuid_atom_free (const kuid_t *k)


Define Documentation

#define KUID_RAW_SIZE   20
 


Typedef Documentation

typedef struct kuid kuid_t
 


Function Documentation

void kuid_atom_free const kuid_t k  ) 
 

gint kuid_cmp const kuid_t target,
const kuid_t kuid1,
const kuid_t kuid2
 

Compare three KUID with the XOR distance, to determine whether `kuid1' is closer to `target' than `kuid2'.

Parameters:
target the target KUID we want to get the closest to
kuid1 KUID #1
kuid2 KUID #2
Returns:
-1 if KUID #1 is closer to target that KUID #2, +1 if KUID #1 is farther away from target than KUID #2, and 0 if both are equidistant.

kuid_t* kuid_get_atom const kuid_t k  ) 
 

void kuid_init void   ) 
 

Initialize KUID management.

void kuid_random_fill kuid_t kuid  ) 
 

Generate a new random KUID within given `kuid'.

const gchar* kuid_to_string const kuid_t kuid  ) 
 

Convert a KUID to a base32 string.

Returns:
pointer to static data.


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