Jeroen Asselman
#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) |
|
Average time in seconds before resending a HSEP message to a node (can be increased to 60).
|
|
Random skew in seconds for message interval times is in the interval msg_interval +/- msg_skew.
|
|
|
|
|
|
|
|
Used to shutdown HSEP.
|
|
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. |
|
Initializes the connection's HSEP data.
|
|
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.
|
|
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.
|
|
|
|
Initializes HSEP.
|
|
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. |
|
Processes a received HSEP message by updating the connection's and the global HSEP table.
|
|
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! |
|
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. |
|
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). |