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

ggep_type.h File Reference


Detailed Description

GGEP type-specific routines.

Author:
Raphael Manfredi
Date:
2002-2003

#include "common.h"
#include "lib/host_addr.h"
#include "if/core/search.h"

Go to the source code of this file.

Data Structures

struct  ggep_gtkgv1
 Decompiled payload of "GTKGV1". More...

Typedefs

typedef enum ggept_status ggept_status_t
 Extraction interface return types.

Enumerations

enum  ggept_status { GGEP_OK = 0, GGEP_NOT_FOUND = 1, GGEP_INVALID = 2, GGEP_BAD_SIZE = 3 }
 Extraction interface return types. More...

Functions

ggept_status_t ggept_h_sha1_extract (extvec_t *exv, struct sha1 *sha1)
 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_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 *fs)
 Extract filesize length into `filesize' from GGEP "LF" extension.
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_ct_extract (extvec_t *exv, time_t *stamp_ptr)
ggept_status_t ggept_gtkg_ipv6_extract (extvec_t *exv, host_addr_t *addr)
 Extract IPv6 address into `addr' from GGEP "GTKG.IPV6" extension.
ggept_status_t ggept_alt_extract (extvec_t *exv, gnet_host_vec_t **hvec)
 Extract vector of IP:port alternate locations.
ggept_status_t ggept_push_extract (extvec_t *exv, gnet_host_vec_t **hvec)
 Extract vector of IP:port push proxy locations.
guint ggept_lf_encode (guint64 filesize, gchar *data)
 Encode `filesize' for the GGEP "LF" extension into `data'.
guint ggept_du_encode (guint32 uptime, gchar *data)
 Encode `uptime' for the GGEP "DU" extension into `data'.
guint ggept_ct_encode (time_t stamp, gchar *data)
 Encode `timestamp' for the GGEP "CT" extension into `data'.


Typedef Documentation

typedef enum ggept_status ggept_status_t
 

Extraction interface return types.


Enumeration Type Documentation

enum ggept_status
 

Extraction interface return types.

Enumeration values:
GGEP_OK  OK, extracted what was asked.
GGEP_NOT_FOUND  OK, but did not find it.
GGEP_INVALID  Error, found something invalid.
GGEP_BAD_SIZE  Error, buffer not correctly sized.


Function Documentation

ggept_status_t ggept_alt_extract extvec_t exv,
gnet_host_vec_t **  hvec
 

Extract vector of IP:port alternate locations.

Parameters:
`exv' no brief description.
`hvec' pointer is filled with a dynamically allocated vector.
Unless GGEP_OK is returned, no memory allocation takes place.

guint ggept_ct_encode time_t  timestamp,
gchar *  data
 

Encode `timestamp' for the GGEP "CT" extension into `data'.

Parameters:
timestamp The timestamp (seconds since epoch) to encode.
data A buffer of at least 8 bytes.
Returns:
the amount of chars written.

ggept_status_t ggept_ct_extract extvec_t exv,
time_t *  stamp_ptr
 

guint ggept_du_encode guint32  uptime,
gchar *  data
 

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

Parameters:
uptime The uptime (in seconds) to encode.
data A buffer of at least 4 bytes.
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,
struct sha1 sha1
 

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 'sha1'.

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.

guint ggept_lf_encode guint64  filesize,
gchar *  data
 

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

Parameters:
filesize The filesize to encode.
data A buffer of at least 8 bytes.
Returns:
the amount of chars written.

ggept_status_t ggept_lf_extract extvec_t exv,
guint64 *  fs
 

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

ggept_status_t ggept_push_extract extvec_t exv,
gnet_host_vec_t **  hvec
 

Extract vector of IP:port push proxy locations.

The `hvec' pointer is filled with a dynamically allocated vector.

Unless GGEP_OK is returned, no memory allocation takes place.


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