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

ggep_type.c File Reference


Detailed Description

GGEP type-specific routines.

Author:
Raphael Manfredi
Date:
2002-2004

#include "common.h"
#include "ggep.h"
#include "ggep_type.h"
#include "hosts.h"
#include "lib/endian.h"
#include "lib/misc.h"
#include "lib/walloc.h"
#include "if/core/hosts.h"
#include "lib/override.h"

Defines

#define TIGER_RAW_SIZE   24 /**< XXX temporary, until we implement tiger */

Functions

 RCSID ("$Id:ggep_type.c, v 1.19 2005/09/10 08:17:28 daichik Exp $")
ggept_status_t ggept_h_sha1_extract (extvec_t *exv, gchar *buf, gint len)
 Extract the SHA1 hash of the "H" extension into the supplied buffer.

ggept_status_t ggept_gtkgv1_extract (extvec_t *exv, struct ggep_gtkgv1 *info)
 Extract payload information from "GTKGV1" into `info'.

ggept_status_t ggept_ip_vec_extract (extvec_t *exv, struct gnutella_host **hvec, gint *hvcnt)
ggept_status_t ggept_alt_extract (extvec_t *exv, struct gnutella_host **hvec, gint *hvcnt)
 Extract vector of IP:port alternate locations.

ggept_status_t ggept_push_extract (extvec_t *exv, struct gnutella_host **hvec, gint *hvcnt)
 Extract vector of IP:port push proxy locations.

ggept_status_t ggept_hname_extract (extvec_t *exv, gchar *buf, gint len)
 Extract hostname of the "HNAME" extension into the supplied buffer.

ggept_status_t ggept_lf_extract (extvec_t *exv, guint64 *filesize)
 Extract filesize length into `filesize' from GGEP "LF" extension.

ggept_status_t ggept_gtkg_ipv6_extract (extvec_t *exv, host_addr_t *addr)
 Extract IPv6 address into `addr' from GGEP "GTKG.IPV6" extension.

gint ggep_vlint_encode (guint64 v, gchar *data)
 Encodes a variable-length integer.

gint ggept_lf_encode (guint64 filesize, gchar *data)
 Encode `filesize' for the GGEP "LF" extension into `data'.

ggept_status_t ggept_du_extract (extvec_t *exv, guint32 *uptime)
 Extract daily uptime into `uptime', from the GGEP "DU" extensions.

gint ggept_du_encode (guint32 uptime, gchar *data)
 Encode `uptime' for the GGEP "DU" extension into `data'.


Define Documentation

#define TIGER_RAW_SIZE   24 /**< XXX temporary, until we implement tiger */
 


Function Documentation

gint ggep_vlint_encode guint64  v,
gchar *  data
[inline, static]
 

Encodes a variable-length integer.

This encoding is equivalent to little-endian encoding whereas trailing zeros are discarded.

Parameters:
v the value to encode.
data must point to a sufficiently large buffer.
Returns:
the length in bytes of the encoded variable-length integer.

ggept_status_t ggept_alt_extract extvec_t exv,
struct gnutella_host **  hvec,
gint *  hvcnt
 

Extract vector of IP:port alternate locations.

Parameters:
`exv' no brief description.
`hvec' pointer is filled with a dynamically allocated vector.
`hvcnt' is filled with the size of the allocated vector (number of items).
Unless GGEP_OK is returned, no memory allocation takes place.

gint ggept_du_encode guint32  uptime,
gchar *  data
 

Encode `uptime' for the GGEP "DU" extension into `data'.

Returns:
the amount of chars written.

ggept_status_t ggept_du_extract extvec_t exv,
guint32 *  uptime
 

Extract daily uptime into `uptime', from the GGEP "DU" extensions.

ggept_status_t ggept_gtkg_ipv6_extract extvec_t exv,
host_addr_t addr
 

Extract IPv6 address into `addr' from GGEP "GTKG.IPV6" extension.

A zero length indicates IPv6 support, a length of 16 or more indicates that the first 16 bytes are a IPv6 address.

ggept_status_t ggept_gtkgv1_extract extvec_t exv,
struct ggep_gtkgv1 info
 

Extract payload information from "GTKGV1" into `info'.

ggept_status_t ggept_h_sha1_extract extvec_t exv,
gchar *  buf,
gint  len
 

Extract the SHA1 hash of the "H" extension into the supplied buffer.

Returns:
extraction status: only when GGEP_OK is returned will we have the SHA1 in buf.

< XXX temporary, until we implement tiger

ggept_status_t ggept_hname_extract extvec_t exv,
gchar *  buf,
gint  len
 

Extract hostname of the "HNAME" extension into the supplied buffer.

Returns:
extraction status: only when GGEP_OK is returned will we have extracted something in the supplied buffer.

ggept_status_t ggept_ip_vec_extract extvec_t exv,
struct gnutella_host **  hvec,
gint *  hvcnt
[static]
 

gint ggept_lf_encode guint64  filesize,
gchar *  data
 

Encode `filesize' for the GGEP "LF" extension into `data'.

Returns:
the amount of chars written.

ggept_status_t ggept_lf_extract extvec_t exv,
guint64 *  filesize
 

Extract filesize length into `filesize' from GGEP "LF" extension.

ggept_status_t ggept_push_extract extvec_t exv,
struct gnutella_host **  hvec,
gint *  hvcnt
 

Extract vector of IP:port push proxy locations.

The `hvec' pointer is filled with a dynamically allocated vector, and the `hvcnt' is filled with the size of the allocated vector (number of items).

Unless GGEP_OK is returned, no memory allocation takes place.

RCSID "$Id:ggep_type.  c,
v 1.19 2005/09/10 08:17:28 daichik Exp $" 
 


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