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

guid.h File Reference


Detailed Description

Globally Unique ID (GUID) manager.

Author:
Raphael Manfredi
Date:
2002-2003

#include <glib.h>
#include "if/core/guid.h"
#include "lib/host_addr.h"

Go to the source code of this file.

Functions

void guid_init (void)
 Initialize GUID management.

gboolean guid_is_gtkg (const gchar *xuid, guint8 *majp, guint8 *minp, gboolean *relp)
 Test whether GUID is that of GTKG, and extract version major/minor, along with release status provided the `majp', `minp' and `relp' are non-NULL.

gboolean guid_is_requery (const gchar *xuid)
 Test whether a GTKG MUID in a Query is marked as being a retry.

void guid_random_muid (gchar *muid)
 Generate a new random GUID, flagged as GTKG.

void guid_ping_muid (gchar *muid)
 Generate a new random (modern) message ID for pings.

void guid_query_muid (gchar *muid, gboolean initial)
 Generate a new random message ID for queries.

gboolean guid_query_muid_is_gtkg (const gchar *guid, gboolean oob, guint8 *majp, guint8 *minp, gboolean *relp)
 Check whether the MUID of a query is that of GTKG.

void guid_query_oob_muid (gchar *muid, const host_addr_t addr, guint16 port, gboolean initial)
 Generate GUID for a query with OOB results delivery.

void guid_oob_get_addr_port (const gchar *guid, host_addr_t *addr, guint16 *port)
 Extract the IP and port number from the GUID of queries marked for OOB query hit delivery.


Function Documentation

void guid_init void   ) 
 

Initialize GUID management.

gboolean guid_is_gtkg const gchar *  xuid,
guint8 *  majp,
guint8 *  minp,
gboolean *  relp
 

Test whether GUID is that of GTKG, and extract version major/minor, along with release status provided the `majp', `minp' and `relp' are non-NULL.

gboolean guid_is_requery const gchar *  xuid  ) 
 

Test whether a GTKG MUID in a Query is marked as being a retry.

void guid_oob_get_addr_port const gchar *  guid,
host_addr_t addr,
guint16 *  port
 

Extract the IP and port number from the GUID of queries marked for OOB query hit delivery.

Bytes 0 to 3 of the guid are the 4 octet bytes of the IP address. Bytes 13 and 14 are the little endian representation of the port.

void guid_ping_muid gchar *  muid  ) 
 

Generate a new random (modern) message ID for pings.

void guid_query_muid gchar *  muid,
gboolean  initial
 

Generate a new random message ID for queries.

If `initial' is false, this is a requery.

gboolean guid_query_muid_is_gtkg const gchar *  guid,
gboolean  oob,
guint8 *  majp,
guint8 *  minp,
gboolean *  relp
 

Check whether the MUID of a query is that of GTKG.

GTKG uses GUID tagging, but unfortunately, the bytes uses to store the IP and port for OOB query hit delivery conflict with the bytes used for the tagging. Hence the need for a special routine.

Parameters:
guid the MUID of the message
oob whether the query requests OOB query hit delivery
majp where the major release version is written, if GTKG
minp where the minor release version is written, if GTKG
relp where the release indicator gets written, if GTKG

void guid_query_oob_muid gchar *  muid,
const host_addr_t  addr,
guint16  port,
gboolean  initial
 

Generate GUID for a query with OOB results delivery.

If `initial' is false, this is a requery.

Bytes 0 to 3 if the GUID are the 4 octet bytes of the IP address. Bytes 13 and 14 are the little endian representation of the port. Byte 15 holds an HEC with bit 0 indicating a requery.

void guid_random_muid gchar *  muid  ) 
 

Generate a new random GUID, flagged as GTKG.


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