code for bootstrapping via hostlist servers More...
#include "platform.h"
#include "gnunet-daemon-hostlist_client.h"
#include "gnunet_core_service.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_statistics_service.h"
#include "gnunet-daemon-hostlist_server.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_HOSTLIST_ADV_Message |
A HOSTLIST_ADV message is used to exchange information about hostlist advertisements. More... | |
Functions | |
static void | core_init (void *cls, const struct GNUNET_PeerIdentity *my_identity) |
Callback invoked once our connection to CORE service is up. More... | |
static int | check_advertisement (void *cls, const struct GNUNET_MessageHeader *message) |
Core handler for p2p hostlist advertisements. More... | |
static void | handle_advertisement (void *cls, const struct GNUNET_MessageHeader *message) |
Core handler for p2p hostlist advertisements. More... | |
static void * | connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq) |
Method called whenever a given peer connects. More... | |
static void | disconnect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls) |
Method called whenever a given peer disconnects. More... | |
static void | cleaning_task (void *cls) |
Last task run during shutdown. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run. More... | |
int | main (int argc, char *const *argv) |
The main function for the hostlist daemon. More... | |
Variables | |
static int | advertising |
Set if we are allowed to advertise our hostlist to others. More... | |
static int | provide_hostlist |
Set if the user wants us to run a hostlist server. More... | |
static GNUNET_CORE_ConnectEventHandler | server_ch |
Handle to hostlist server's connect handler. More... | |
static int | bootstrapping |
Set if we are allowed to learn about peers by accessing hostlist servers. More... | |
static int | learning |
Set if the user allows us to learn about new hostlists from the network. More... | |
static struct GNUNET_STATISTICS_Handle * | stats |
Statistics handle. More... | |
static struct GNUNET_CORE_Handle * | core |
Handle to the core service (NULL until we've connected to it). More... | |
static GNUNET_HOSTLIST_UriHandler | client_adv_handler |
Handle to the hostlist client's advertisement handler. More... | |
static GNUNET_CORE_ConnectEventHandler | client_ch |
Handle to hostlist client's connect handler. More... | |
static GNUNET_CORE_DisconnectEventHandler | client_dh |
Handle to hostlist client's disconnect handler. More... | |
static GNUNET_NETWORK_STRUCT_END struct GNUNET_PeerIdentity | me |
Our own peer identity. More... | |
code for bootstrapping via hostlist servers
Definition in file gnunet-daemon-hostlist.c.
|
static |
Callback invoked once our connection to CORE service is up.
cls | NULL |
my_identity | our peer's identity |
Definition at line 129 of file gnunet-daemon-hostlist.c.
References me, and my_identity.
Referenced by run().
|
static |
Core handler for p2p hostlist advertisements.
cls | closure |
message | advertisement message we got |
Definition at line 144 of file gnunet-daemon-hostlist.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_MessageHeader::size, size, and uri.
|
static |
Core handler for p2p hostlist advertisements.
cls | closure |
message | advertisement message we got |
Definition at line 176 of file gnunet-daemon-hostlist.c.
References client_adv_handler, GNUNET_assert, and uri.
|
static |
Method called whenever a given peer connects.
Wrapper to call both client's and server's functions
cls | closure |
peer | peer identity this notification is about |
mq | queue for sending messages to peer |
Definition at line 196 of file gnunet-daemon-hostlist.c.
References client_ch, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcmp, me, mq, and server_ch.
Referenced by run().
|
static |
Method called whenever a given peer disconnects.
Wrapper to call both client's and server's functions
cls | closure |
peer | peer identity this notification is about |
Definition at line 227 of file gnunet-daemon-hostlist.c.
References client_dh, GNUNET_memcmp, and me.
Referenced by run().
|
static |
Last task run during shutdown.
Disconnects us from the other services.
cls | NULL |
Definition at line 249 of file gnunet-daemon-hostlist.c.
References bootstrapping, core, GNUNET_CORE_disconnect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_HOSTLIST_client_stop(), GNUNET_HOSTLIST_server_stop(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_destroy(), provide_hostlist, and stats.
Referenced by run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 284 of file gnunet-daemon-hostlist.c.
References _, advertising, bootstrapping, cfg, cleaning_task(), client_adv_handler, client_ch, client_dh, connect_handler(), core, core_init(), disconnect_handler(), GNUNET_break, GNUNET_CORE_connect(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_HOSTLIST_client_start(), GNUNET_HOSTLIST_server_start(), GNUNET_log, GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), learning, provide_hostlist, server_ch, and stats.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function for the hostlist daemon.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 358 of file gnunet-daemon-hostlist.c.
References _, advertising, bootstrapping, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_log_setup(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), learning, options, provide_hostlist, ret, and run().
|
static |
Set if we are allowed to advertise our hostlist to others.
Definition at line 38 of file gnunet-daemon-hostlist.c.
|
static |
Set if the user wants us to run a hostlist server.
Definition at line 43 of file gnunet-daemon-hostlist.c.
Referenced by cleaning_task(), main(), and run().
|
static |
Handle to hostlist server's connect handler.
Definition at line 48 of file gnunet-daemon-hostlist.c.
Referenced by connect_handler(), GNUNET_HOSTLIST_server_start(), and run().
|
static |
Set if we are allowed to learn about peers by accessing hostlist servers.
Definition at line 54 of file gnunet-daemon-hostlist.c.
Referenced by cleaning_task(), main(), and run().
|
static |
Set if the user allows us to learn about new hostlists from the network.
Definition at line 60 of file gnunet-daemon-hostlist.c.
|
static |
Statistics handle.
Definition at line 65 of file gnunet-daemon-hostlist.c.
Referenced by cleaning_task(), and run().
|
static |
Handle to the core service (NULL until we've connected to it).
Definition at line 70 of file gnunet-daemon-hostlist.c.
Referenced by cleaning_task(), and run().
|
static |
Handle to the hostlist client's advertisement handler.
Definition at line 75 of file gnunet-daemon-hostlist.c.
Referenced by handle_advertisement(), and run().
|
static |
Handle to hostlist client's connect handler.
Definition at line 80 of file gnunet-daemon-hostlist.c.
Referenced by connect_handler(), and run().
|
static |
Handle to hostlist client's disconnect handler.
Definition at line 85 of file gnunet-daemon-hostlist.c.
Referenced by disconnect_handler(), and run().
|
static |
Our own peer identity.
Definition at line 119 of file gnunet-daemon-hostlist.c.
Referenced by connect_handler(), construct_task_graph(), construct_task_graph_gradecast(), core_init(), disconnect_handler(), free_queue(), GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_contains_value(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_get_random(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_multihashmap_remove_all(), GNUNET_CONTAINER_multipeermap_contains(), GNUNET_CONTAINER_multipeermap_contains_value(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_get(), GNUNET_CONTAINER_multipeermap_get_multiple(), GNUNET_CONTAINER_multipeermap_get_random(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_CONTAINER_multipeermap_remove(), GNUNET_CONTAINER_multipeermap_remove_all(), GNUNET_CONTAINER_multishortmap_contains(), GNUNET_CONTAINER_multishortmap_contains_value(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_CONTAINER_multishortmap_get(), GNUNET_CONTAINER_multishortmap_get_multiple(), GNUNET_CONTAINER_multishortmap_get_random(), GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_CONTAINER_multishortmap_remove_all(), GNUNET_CONTAINER_multiuuidmap_contains(), GNUNET_CONTAINER_multiuuidmap_contains_value(), GNUNET_CONTAINER_multiuuidmap_destroy(), GNUNET_CONTAINER_multiuuidmap_get(), GNUNET_CONTAINER_multiuuidmap_get_multiple(), GNUNET_CONTAINER_multiuuidmap_get_random(), GNUNET_CONTAINER_multiuuidmap_iterate(), GNUNET_CONTAINER_multiuuidmap_put(), GNUNET_CONTAINER_multiuuidmap_remove(), GNUNET_CONTAINER_multiuuidmap_remove_all(), GNUNET_DHT_verify_path(), GNUNET_TRANSPORT_TESTING_log_connect(), GNUNET_TRANSPORT_TESTING_log_disconnect(), handle_add_queue_message(), notify_client_queues(), notify_monitor(), notify_monitors(), task_other_peer(), and update_next_cache().