hello management implementation More...
#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_hello_lib.h"
#include "gnunet_peerinfo_service.h"
#include "gnunet_statistics_service.h"
#include "gnunet-service-transport_hello.h"
#include "gnunet-service-transport.h"
#include "gnunet-service-transport_plugins.h"
Go to the source code of this file.
Data Structures | |
struct | OwnAddressList |
Entry in linked list of network addresses for ourselves. More... | |
struct | GeneratorContext |
Closure for address_generator(). More... | |
Macros | |
#define | HELLO_REFRESH_PERIOD |
How often do we refresh our HELLO (due to expiration concerns)? More... | |
Functions | |
static ssize_t | address_generator (void *cls, size_t max, void *buf) |
Add an address from the struct OwnAddressList to the buffer. More... | |
static void | refresh_hello_task (void *cls) |
Construct our HELLO message from all of the addresses of all of the transports. More... | |
static void | refresh_hello () |
Schedule task to refresh hello (but only if such a task exists already, as otherwise the module might have been shutdown). More... | |
void | GST_hello_start (int friend_only, GST_HelloCallback cb, void *cb_cls) |
Initialize the HELLO module. More... | |
void | GST_hello_stop () |
Shutdown the HELLO module. More... | |
const struct GNUNET_MessageHeader * | GST_hello_get () |
Obtain this peers HELLO message. More... | |
void | GST_hello_modify_addresses (int addremove, const struct GNUNET_HELLO_Address *address) |
Add or remove an address from this peer's HELLO message. More... | |
int | GST_hello_test_address (const struct GNUNET_HELLO_Address *address, struct GNUNET_CRYPTO_EddsaSignature **sig, struct GNUNET_TIME_Absolute **sig_expiration) |
Test if a particular address is one of ours. More... | |
Variables | |
struct GNUNET_TIME_Relative | hello_expiration |
Hello address expiration. More... | |
static struct GNUNET_HELLO_Message * | our_hello |
Our HELLO message. More... | |
static GST_HelloCallback | hello_cb |
Function to call on HELLO changes. More... | |
static void * | hello_cb_cls |
Closure for hello_cb. More... | |
static struct OwnAddressList * | oal_head |
Head of my addresses. More... | |
static struct OwnAddressList * | oal_tail |
Tail of my addresses. More... | |
static int | friend_option |
Should we use a friend-only HELLO? More... | |
static struct GNUNET_SCHEDULER_Task * | hello_task |
Identifier of refresh_hello_task(). More... | |
hello management implementation
Definition in file gnunet-service-transport_hello.c.
#define HELLO_REFRESH_PERIOD |
How often do we refresh our HELLO (due to expiration concerns)?
Definition at line 39 of file gnunet-service-transport_hello.c.
|
static |
Add an address from the struct OwnAddressList
to the buffer.
cls | the struct GeneratorContext |
max | maximum number of bytes left |
buf | where to write the address |
Definition at line 152 of file gnunet-service-transport_hello.c.
References GeneratorContext::addr_pos, OwnAddressList::address, buf, GeneratorContext::expiration, GNUNET_HELLO_add_address(), GNUNET_SYSERR, max, OwnAddressList::next, and ret.
Referenced by refresh_hello_task().
|
static |
Construct our HELLO message from all of the addresses of all of the transports.
cls | unused |
Definition at line 177 of file gnunet-service-transport_hello.c.
References GeneratorContext::addr_pos, address_generator(), GeneratorContext::expiration, friend_option, gettext_noop, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_HELLO_create(), GNUNET_HELLO_size(), GNUNET_log, GNUNET_NO, GNUNET_PEERINFO_add_peer(), GNUNET_SCHEDULER_add_delayed(), GNUNET_STATISTICS_update(), GNUNET_TIME_relative_to_absolute(), GNUNET_YES, GST_hello_get(), GST_my_identity, GST_peerinfo, GST_stats, hello_cb, hello_cb_cls, hello_expiration, HELLO_REFRESH_PERIOD, hello_task, oal_head, our_hello, and GNUNET_PeerIdentity::public_key.
Referenced by GST_hello_start(), and refresh_hello().
|
static |
Schedule task to refresh hello (but only if such a task exists already, as otherwise the module might have been shutdown).
Definition at line 218 of file gnunet-service-transport_hello.c.
References GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), hello_task, and refresh_hello_task().
Referenced by GST_hello_modify_addresses().
void GST_hello_start | ( | int | friend_only, |
GST_HelloCallback | cb, | ||
void * | cb_cls | ||
) |
Initialize the HELLO module.
friend_only | use a friend only hello |
cb | function to call whenever our HELLO changes |
cb_cls | closure for cb |
Definition at line 237 of file gnunet-service-transport_hello.c.
References friend_option, hello_cb, hello_cb_cls, and refresh_hello_task().
Referenced by run().
void GST_hello_stop | ( | void | ) |
Shutdown the HELLO module.
Definition at line 252 of file gnunet-service-transport_hello.c.
References GNUNET_free, GNUNET_SCHEDULER_cancel(), hello_cb, hello_cb_cls, hello_task, and our_hello.
Referenced by shutdown_task().
const struct GNUNET_MessageHeader* GST_hello_get | ( | void | ) |
Obtain this peers HELLO message.
Definition at line 275 of file gnunet-service-transport_hello.c.
References our_hello.
Referenced by GST_plugins_load(), handle_client_start(), refresh_hello_task(), and transmit_ping_if_allowed().
void GST_hello_modify_addresses | ( | int | addremove, |
const struct GNUNET_HELLO_Address * | address | ||
) |
Add or remove an address from this peer's HELLO message.
addremove | GNUNET_YES to add, GNUNET_NO to remove |
address | address to add or remove |
Definition at line 288 of file gnunet-service-transport_hello.c.
References address, OwnAddressList::address, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_HELLO_address_cmp(), GNUNET_HELLO_address_copy(), GNUNET_HELLO_address_free, GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_YES, GST_plugins_a2s(), OwnAddressList::next, oal_head, oal_tail, OwnAddressList::rc, and refresh_hello().
Referenced by plugin_env_address_change_notification().
int GST_hello_test_address | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_CRYPTO_EddsaSignature ** | sig, | ||
struct GNUNET_TIME_Absolute ** | sig_expiration | ||
) |
Test if a particular address is one of ours.
address | the address to test |
sig | location where to cache PONG signatures for this address [set] |
sig_expiration | how long until the current 'sig' expires? (ZERO if sig was never created) [set] |
Definition at line 338 of file gnunet-service-transport_hello.c.
References address, OwnAddressList::address, GNUNET_HELLO_address_cmp(), GNUNET_NO, GNUNET_YES, OwnAddressList::next, oal_head, OwnAddressList::pong_sig_expires, and OwnAddressList::pong_signature.
Referenced by GST_validation_handle_ping().
|
extern |
Hello address expiration.
Definition at line 397 of file gnunet-service-transport.c.
Referenced by refresh_hello_task(), run(), and transmit_our_hello().
|
static |
Our HELLO message.
Definition at line 92 of file gnunet-service-transport_hello.c.
Referenced by GST_hello_get(), GST_hello_stop(), and refresh_hello_task().
|
static |
Function to call on HELLO changes.
Definition at line 97 of file gnunet-service-transport_hello.c.
Referenced by GST_hello_start(), GST_hello_stop(), and refresh_hello_task().
|
static |
Closure for hello_cb.
Definition at line 102 of file gnunet-service-transport_hello.c.
Referenced by GST_hello_start(), GST_hello_stop(), and refresh_hello_task().
|
static |
Head of my addresses.
Definition at line 107 of file gnunet-service-transport_hello.c.
Referenced by GST_hello_modify_addresses(), GST_hello_test_address(), and refresh_hello_task().
|
static |
Tail of my addresses.
Definition at line 112 of file gnunet-service-transport_hello.c.
Referenced by GST_hello_modify_addresses().
|
static |
Should we use a friend-only HELLO?
Definition at line 117 of file gnunet-service-transport_hello.c.
Referenced by GST_hello_start(), and refresh_hello_task().
|
static |
Identifier of refresh_hello_task().
Definition at line 122 of file gnunet-service-transport_hello.c.
Referenced by GST_hello_stop(), refresh_hello(), and refresh_hello_task().