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

hsep.h File Reference


Detailed Description

Horizon Size Estimation Protocol 0.2.

Author:
Thomas Schuerger

Jeroen Asselman

Date:
2004

#include "lib/event.h"
#include "if/core/hsep.h"

Go to the source code of this file.

Defines

#define HSEP_VERSION_MAJOR   0
#define HSEP_VERSION_MINOR   2
#define HSEP_MSG_INTERVAL   30
 Average time in seconds before resending a HSEP message to a node (can be increased to 60).

#define HSEP_MSG_SKEW   10
 Random skew in seconds for message interval times is in the interval msg_interval +/- msg_skew.


Typedefs

typedef void(* hsep_global_listener_t )(hsep_triple *table, guint32 triples)

Functions

void hsep_init (void)
 Initializes HSEP.

void hsep_reset (void)
 Resets all HSEP data.

void hsep_close (void)
 Used to shutdown HSEP.

void hsep_connection_init (struct gnutella_node *n)
 Initializes the connection's HSEP data.

void hsep_connection_close (struct gnutella_node *n)
 Updates the global HSEP table when a connection is about to be closed.

void hsep_send_msg (struct gnutella_node *, time_t now)
 Sends a HSEP message to the given node, but only if data to send has changed.

void hsep_process_msg (struct gnutella_node *, time_t now)
 Processes a received HSEP message by updating the connection's and the global HSEP table.

void hsep_timer (time_t now)
 Sends a HSEP message to all nodes where the last message has been sent some time ago.

void hsep_notify_shared (guint64 ownfiles, guint64 ownkibibytes)
 This should be called whenever the number of shared files or kibibytes change.

unsigned int hsep_get_global_table (hsep_triple *buffer, unsigned int maxtriples)
 Copies the first maxtriples triples from the global HSEP table into the specified buffer.

unsigned int hsep_get_connection_table (const struct gnutella_node *n, hsep_triple *buffer, unsigned int maxtriples)
 Copies the first maxtriples triples from the connection's HSEP table into the specified buffer.

const gchar * hsep_get_static_str (gint row, gint column)


Define Documentation

#define HSEP_MSG_INTERVAL   30
 

Average time in seconds before resending a HSEP message to a node (can be increased to 60).

#define HSEP_MSG_SKEW   10
 

Random skew in seconds for message interval times is in the interval msg_interval +/- msg_skew.

#define HSEP_VERSION_MAJOR   0
 

#define HSEP_VERSION_MINOR   2
 


Typedef Documentation

typedef void(* hsep_global_listener_t)(hsep_triple *table, guint32 triples)
 


Function Documentation

void hsep_close void   ) 
 

Used to shutdown HSEP.

void hsep_connection_close struct gnutella_node n  ) 
 

Updates the global HSEP table when a connection is about to be closed.

The connection's HSEP data is restored to zero and the CAN_HSEP attribute is cleared.

void hsep_connection_init struct gnutella_node n  ) 
 

Initializes the connection's HSEP data.

unsigned int hsep_get_connection_table const struct gnutella_node n,
hsep_triple buffer,
unsigned int  maxtriples
 

Copies the first maxtriples triples from the connection's HSEP table into the specified buffer.

If maxtriples is larger than the number of triples in the table, it is truncated appropriately. Note that also the 0'th triple is copied, which is always zero.

Returns:
The number of copied triples.

unsigned int hsep_get_global_table hsep_triple buffer,
unsigned int  maxtriples
 

Copies the first maxtriples triples from the global HSEP table into the specified buffer.

If maxtriples is larger than the number of triples in the table, it is truncated appropriately. Note that also the 0'th triple is copied, which is always zero.

Returns:
The number of copied triples.

const gchar* hsep_get_static_str gint  row,
gint  column
 

Returns:
a static string of the cell contents of the given row and column.
Attention:
NB: The static buffers for each column are disjunct.

void hsep_init void   ) 
 

Initializes HSEP.

void hsep_notify_shared guint64  own_files,
guint64  own_kibibytes
 

This should be called whenever the number of shared files or kibibytes change.

The values are checked for changes, nothing is done if nothing has changed. Note that kibibytes are determined by shifting the number of bytes right by 10 bits, not by dividing by 1000.

void hsep_process_msg struct gnutella_node ,
time_t  now
 

Processes a received HSEP message by updating the connection's and the global HSEP table.

void hsep_reset void   ) 
 

Resets all HSEP data.

The global HSEP table and all connections' HSEP tables are reset to zero. The number of own shared files and kibibytes is untouched. This can be used to watch how quickly the HSEP data converges back to the correct "static" state. As soon as we have received a HSEP message from each of our peers, this state should be reached. Use with care, because this reset will temporarily affect all HSEP-capable nodes in the radius of N_MAX hops!

void hsep_send_msg struct gnutella_node n,
time_t  now
 

Sends a HSEP message to the given node, but only if data to send has changed.

Should be called about every 30-60 seconds per node. Will automatically be called by hsep_timer() and hsep_connection_init(). Node must be HSEP-capable.

void hsep_timer time_t  now  ) 
 

Sends a HSEP message to all nodes where the last message has been sent some time ago.

This should be called frequently (e.g. every second or every few seconds).


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