40#define MIN_CONNECTIONS 4
45#define MAX_NUMBER_HOSTLISTS 30
50#define SAVING_INTERVAL \
51 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30)
56#define TESTING_INTERVAL \
57 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
62#define WAITING_INTERVAL \
63 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
72#define HOSTLIST_INITIAL 10000
77#define HOSTLIST_FAILED_DOWNLOAD 100
82#define HOSTLIST_SUCCESSFUL_DOWNLOAD 100
87#define HOSTLIST_SUCCESSFUL_HELLO 1
351 "Hostlist entry stored successfully!\n");
354 "Error storing hostlist entry!\n");
374 const char *cbuf = ptr;
381 total =
size * nmemb;
390 "# bytes downloaded from hostlist servers"),
412 gettext_noop (
"# invalid HELLOs downloaded from hostlist servers"),
416 _ (
"Invalid `%s' message received from hostlist at `%s'\n"),
429 "Received valid `%s' message from hostlist server.\n",
433 gettext_noop (
"# valid HELLOs downloaded from hostlist servers"),
448 memmove (download_buffer, &download_buffer[msize],
download_pos - msize);
480 if (strlen (servers) > 0)
483 pos = strlen (servers) - 1;
486 if (servers[pos] ==
' ')
501 pos = strlen (servers) - 1;
504 if (servers[pos] ==
' ')
530 unsigned int counter;
536 "Using preconfigured bootstrap server\n");
544 "Testing new advertised hostlist if it is obtainable\n");
552 "Using preconfigured bootstrap server\n");
560 while (counter < index)
566 "Using learned hostlist `%s'\n",
573#define CURL_EASY_SETOPT(c, a, b) \
576 ret = curl_easy_setopt (c, a, b); \
577 if (CURLE_OK != ret) \
578 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \
579 _ ("%s failed at %s:%d: `%s'\n"), \
580 "curl_easy_setopt", \
583 curl_easy_strerror (ret)); \
606 static uint64_t temp;
607 static uint64_t maxv;
698 "Removing hostlist with URI `%s' which has the worst quality of all (%llu)\n",
700 (
unsigned long long) lowest_quality->
quality);
731 "Updating hostlist statistics for URI `%s'\n",
787 "Advertised hostlist with URI `%s' could not be downloaded. Advertised URI gets dismissed.\n"),
803 mret = curl_multi_remove_handle (
multi,
curl);
804 if (mret != CURLM_OK)
807 _ (
"%s failed at %s:%d: `%s'\n"),
808 "curl_multi_remove_handle",
811 curl_multi_strerror (mret));
813 mret = curl_multi_cleanup (
multi);
814 if (mret != CURLM_OK)
816 _ (
"%s failed at %s:%d: `%s'\n"),
817 "curl_multi_cleanup",
820 curl_multi_strerror (mret));
825 curl_easy_cleanup (
curl);
866 mret = curl_multi_fdset (
multi, &rs, &ws, &es, &
max);
867 if (mret != CURLM_OK)
870 _ (
"%s failed at %s:%d: `%s'\n"),
874 curl_multi_strerror (mret));
879 if (mret != CURLM_OK)
882 _ (
"%s failed at %s:%d: `%s'\n"),
883 "curl_multi_timeout",
886 curl_multi_strerror (mret));
898 "Scheduling task for hostlist download using cURL\n");
921 _ (
"Timeout trying to download hostlist from `%s'\n"),
928 "Ready for processing hostlist client request\n");
936 "Download limit of %u bytes exceeded, stopping download\n"),
941 mret = curl_multi_perform (
multi, &running);
946 msg = curl_multi_info_read (
multi, &running);
953 if ((
msg->data.result != CURLE_OK) &&
954 (
msg->data.result != CURLE_GOT_NOTHING))
956 _ (
"Download of hostlist from `%s' failed: `%s'\n"),
958 curl_easy_strerror (
msg->data.result));
962 _ (
"Download of hostlist `%s' completed.\n"),
970 _ (
"Adding successfully tested hostlist `%s' datastore.\n"),
984 while ((running > 0));
987 while (mret == CURLM_CALL_MULTI_PERFORM);
989 if (mret != CURLM_OK)
992 _ (
"%s failed at %s:%d: `%s'\n"),
993 "curl_multi_perform",
996 curl_multi_strerror (mret));
1017 curl = curl_easy_init ();
1026 _ (
"Bootstrapping using hostlist at `%s'.\n"),
1050 if (
ret != CURLE_OK)
1056 if (
ret != CURLE_OK)
1062#ifdef CURLOPT_REDIR_PROTOCOLS_STR
1063 if (0 == strncasecmp (
current_url,
"https://", strlen (
"https://")))
1065 CURLOPT_REDIR_PROTOCOLS_STR,
1069 CURLOPT_REDIR_PROTOCOLS_STR,
1072#ifdef CURLOPT_REDIR_PROTOCOLS
1073 if (0 == strncasecmp (
current_url,
"https://", strlen (
"https://")))
1079 | CURLPROTO_HTTPS));
1082#ifdef CURLOPT_PROTOCOLS_STR
1083 if (0 == strncasecmp (
current_url,
"https://", strlen (
"https://")))
1090#ifdef CURLOPT_PROTOCOLS
1091 if (0 == strncasecmp (
current_url,
"https://", strlen (
"https://")))
1097 | CURLPROTO_HTTPS));
1103 if (
ret != CURLE_OK)
1117 multi = curl_multi_init ();
1124 mret = curl_multi_add_handle (
multi,
curl);
1125 if (mret != CURLM_OK)
1128 _ (
"%s failed at %s:%d: `%s'\n"),
1129 "curl_multi_add_handle",
1132 curl_multi_strerror (mret));
1133 mret = curl_multi_cleanup (
multi);
1134 if (mret != CURLM_OK)
1136 _ (
"%s failed at %s:%d: `%s'\n"),
1137 "curl_multi_cleanup",
1140 curl_multi_strerror (mret));
1163 "Download in progress, have to wait...\n");
1186 curl_global_cleanup ();
1206 "# milliseconds between hostlist downloads"),
1216 _ (
"Have %u/%u connections. Will consider downloading hostlist in %s\n"),
1235 "Testing new hostlist advertisements is allowed again\n");
1251 "Hostlists will be saved to file again in %s\n",
1312 uri_size = strlen (
uri) + 1;
1314 "Hostlist client received advertisement containing URI `%s'\n",
1326 "Currently not accepting new advertisements: interval between to advertisements is not reached\n");
1333 "Currently not accepting new advertisements: we are already testing a hostlist\n");
1352 "Testing new hostlist advertisements is locked for the next %s\n",
1380 "Statistics request done, scheduling hostlist download\n");
1418 "Initial time between hostlist downloads is %s\n",
1436 uint32_t hellos_returned;
1456 _ (
"Loading saved hostlist entries from file `%s' \n"),
1461 _ (
"Hostlist file `%s' does not exist\n"),
1472 "Could not open file `%s' for reading to load hostlists: %s\n"),
1487 (int32_t *) &hellos_returned),
1506 "Added hostlist entry with URI `%s' \n",
1517 _ (
"%u hostlist URIs loaded from file\n"),
1571 "Could not open file `%s' for writing to save hostlists: %s\n"),
1578 _ (
"Writing %u hostlist URIs to `%s'\n"),
1611 _ (
"Error writing hostlist URIs to file `%s'\n"),
1630 _ (
"Error writing hostlist URIs to file `%s'\n"),
1656 char *proxytype_str;
1660 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
1681 "Found proxy username name: `%s'\n",
1692 "Found proxy password name: `%s'\n",
1705 "Unable to convert `%s' to UTF-8 uppercase\n",
1708 if (0 == strcmp (proxytype_str,
"HTTP"))
1710 else if (0 == strcmp (proxytype_str,
"HTTP_1_0"))
1712 else if (0 == strcmp (proxytype_str,
"SOCKS4"))
1714 else if (0 == strcmp (proxytype_str,
"SOCKS5"))
1716 else if (0 == strcmp (proxytype_str,
"SOCKS4A"))
1718 else if (0 == strcmp (proxytype_str,
"SOCKS5_HOSTNAME"))
1725 "Invalid proxy type: `%s', disabling proxy! Check configuration!\n")
1755 _ (
"Learning is enabled on this peer\n"));
1758 "Hostlists will be saved to file again in %s\n",
1768 _ (
"Learning is not enabled on this peer\n"));
1782 "Since learning is not enabled on this peer, hostlist file `%s' was removed\n"),
1793 "Loading stats value on hostlist download frequency\n");
1797 "# milliseconds between hostlist downloads"),
1804 "Statistics request failed, scheduling hostlist download\n");
1866 curl_global_cleanup ();
struct GNUNET_MQ_Handle * mq
struct GNUNET_MessageHeader * msg
#define gettext_noop(String)
static int once
Global to mark if we've run the initialization.
static int ret
Final status code.
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
static struct GNUNET_CADET_Channel * ch
Channel handle.
static struct GNUNET_SCHEDULER_Task * st
The shutdown task.
common internal definitions for hostlist daemon
#define MAX_URL_LEN
How long can hostlist URLs be?
#define MAX_BYTES_PER_HOSTLISTS
How many bytes do we download at most from a hostlist server?
static void task_download_dispatcher(void *cls)
static unsigned int stat_download_successful
Value saying if hostlist download was successful.
static struct GNUNET_TIME_Absolute end_time
At what time MUST the current hostlist request be done?
#define SAVING_INTERVAL
Time interval hostlists are saved to disk.
static char * proxy
Proxy hostname or ip we are using (can be NULL).
static uint64_t checked_add(uint64_t val1, uint64_t val2)
Add val2 to val1 with overflow check.
#define HOSTLIST_SUCCESSFUL_HELLO
Value added for each valid HELLO received during a hostlist download.
static void handler_disconnect(void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
Method called whenever a given peer disconnects.
static int process_stat(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
We've received the previous delay value from statistics.
static void task_check(void *cls)
Task that checks if we should try to download a hostlist.
#define MAX_NUMBER_HOSTLISTS
Maximum number of hostlist that are saved.
static int stat_download_in_progress
Value controlling if a hostlist download is running at the moment.
static void task_hostlist_saving(void *cls)
Task that writes hostlist entries to a file on a regular base.
static int stat_learning
Set if we are allowed to learn new hostlists and use them.
static struct GNUNET_TIME_Relative hostlist_delay
Amount of time we wait between hostlist downloads.
static struct Hostlist * linked_list_head
Head of the linked list used to store hostlists.
#define HOSTLIST_FAILED_DOWNLOAD
Value subtracted each time a hostlist download fails.
static void handler_advertisement(const char *uri)
Method called whenever an advertisement message arrives.
static unsigned int stat_use_bootstrap
Value saying if a preconfigured bootstrap server is used.
int GNUNET_HOSTLIST_client_start(const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_STATISTICS_Handle *st, GNUNET_CORE_ConnectEventHandler *ch, GNUNET_CORE_DisconnectEventHandler *dh, GNUNET_HOSTLIST_UriHandler *msgh, int learn)
Start downloading hostlists from hostlist servers as necessary.
static struct GNUNET_STATISTICS_Handle * stats
Statistics handle.
static int stat_testing_allowed
Value controlling if a hostlist testing is allowed at the moment.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static void insert_hostlist()
Method to insert a hostlist into the datastore.
static struct GNUNET_PEERSTORE_Handle * peerstore
Handle to the PEERSTORE service.
static size_t download_pos
Number of bytes valid in 'download_buffer'.
static CURL * curl
Current CURL handle.
static int stat_testing_hostlist
Value controlling if a hostlist is tested at the moment.
static char * current_url
Current URL that we are using.
static char * proxy_password
Proxy password we are using (can be NULL).
static struct StoreHelloEntry * she_head
Head of the linkd list to store the store context for hellos.
static void stat_timeout_task(void *cls)
Continuation called by the statistics code once we go the stat.
static unsigned int linked_list_size
Size of the linked list used to store hostlists.
static struct GNUNET_STATISTICS_GetHandle * sget
Handle for our statistics GET operation.
#define CURL_EASY_SETOPT(c, a, b)
static struct StoreHelloEntry * she_tail
Tail of the linkd list to store the store context for hellos.
#define WAITING_INTERVAL
Time interval for download dispatcher before a download is re-scheduled.
static void load_hostlist_file()
Method to load persistent hostlist file during hostlist client startup.
static struct GNUNET_SCHEDULER_Task * ti_testing_intervall_task
ID of the task controlling the locking between two hostlist tests.
static unsigned int stat_connection_count
Number of active connections (according to core service).
static int linked_list_contains(const char *uri)
Method to check if a URI is in hostlist linked list.
static CURLM * multi
Current multi-CURL handle.
#define HOSTLIST_INITIAL
Defines concerning the hostlist quality metric.
static size_t callback_download(void *ptr, size_t size, size_t nmemb, void *ctx)
Process downloaded bits by calling callback on each HELLO.
static void shc_cont(void *cls, int success)
#define TESTING_INTERVAL
Time interval between two hostlist tests.
#define MIN_CONNECTIONS
Number of connections that we must have to NOT download hostlists anymore.
static void update_hostlist()
Method updating hostlist statistics.
static int stat_bogus_url
Set to GNUNET_YES if the current URL had some problems.
static void task_download(void *cls)
Task that is run when we are ready to receive more data from the hostlist server.
static struct Hostlist * hostlist_to_test
Head of the linked list used to store hostlists.
static void download_hostlist()
Main function that will download a hostlist and process its data.
void GNUNET_HOSTLIST_client_stop()
Stop downloading hostlists from hostlist servers as necessary.
static unsigned int stat_hellos_obtained
Value saying how many valid HELLO messages were obtained during download.
static struct Hostlist * linked_list_tail
Tail of the linked list used to store hostlists.
static struct GNUNET_SCHEDULER_Task * ti_download
ID of the task downloading the hostlist.
static struct Hostlist * current_hostlist
Current hostlist used for downloading.
static struct GNUNET_SCHEDULER_Task * ti_check_download
ID of the task, checking if hostlist download should take plate.
static char * download_get_url()
Method deciding if a preconfigured or advertisied hostlist is used on a 50:50 ratio.
static struct GNUNET_SCHEDULER_Task * ti_saving_task
ID of the task saving the hostlsit in a regular interval.
static void save_hostlist_file(int shutdown)
Method to save hostlist to a file during hostlist client shutdown.
static void * handler_connect(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Method called whenever a given peer connects.
static uint32_t stat_bytes_downloaded
How many bytes did we download from the current hostlist URL?
static char * get_bootstrap_server()
Obtain a hostlist URL that we should use.
static char * proxy_username
Proxy username we are using (can be NULL).
#define HOSTLIST_SUCCESSFUL_DOWNLOAD
Value added each time a hostlist download is successful.
static struct GNUNET_SCHEDULER_Task * ti_download_dispatcher_task
ID of the task called to initiate a download.
static void clean_up()
Clean up the state from the task that downloaded the hostlist and schedule the next task.
static uint64_t checked_sub(uint64_t val1, uint64_t val2)
Subtract val2 from val1 with underflow check.
static curl_proxytype proxy_type
Proxy type we are using (can be NULL).
static struct Hostlist * linked_list_get_lowest_quality()
Method returning the hostlist element with the lowest quality in the datastore.
static void task_testing_intervall_reset(void *cls)
This tasks sets hostlist testing to allowed after interval between to testings is reached.
static void primary_task(void *cls, int success)
Continuation called by the statistics code once we go the stat.
static void download_prepare()
Ask CURL for the select set and then schedule the receiving task with the scheduler.
void(* GNUNET_HOSTLIST_UriHandler)(const char *uri)
Function that handles an advertised URI.
static struct GNUNET_FS_Handle * ctx
static char * name
Name (label) of the records to list.
static char * value
Value of the record to add/remove.
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
static int result
Global testing status.
static char * subsystem
Set to subsystem that we're going to get stats for (or NULL for all).
library to make it easy to download JSON replies over HTTP
API to the peerstore service.
API to create, modify and access statistics.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
enum GNUNET_GenericReturnValue GNUNET_BIO_write_close(struct GNUNET_BIO_WriteHandle *h, char **emsg)
Close an IO handle.
struct GNUNET_BIO_WriteHandle * GNUNET_BIO_write_open_file(const char *fn)
Open a file for writing.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_spec_commit(struct GNUNET_BIO_ReadHandle *h, struct GNUNET_BIO_ReadSpec *rs)
Execute the read specifications in order.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_string(struct GNUNET_BIO_ReadHandle *h, const char *what, char **result, size_t max_length)
Read 0-terminated string.
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_string(const char *what, const char *s)
Create the specification to write a 0-terminated string.
#define GNUNET_BIO_read_spec_end()
End of specifications marker.
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_int32(const char *what, int32_t *i)
Create the specification to read an (u)int32_t.
#define GNUNET_BIO_write_spec_end()
End of specifications marker.
enum GNUNET_GenericReturnValue GNUNET_BIO_write_spec_commit(struct GNUNET_BIO_WriteHandle *h, struct GNUNET_BIO_WriteSpec *ws)
Execute the write specifications in order.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_close(struct GNUNET_BIO_ReadHandle *h, char **emsg)
Close an open handle.
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_int32(const char *what, int32_t *i)
Create the specification to write an (u)int32_t.
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_int64(const char *what, int64_t *i)
Create the specification to read an (u)int64_t.
struct GNUNET_BIO_ReadHandle * GNUNET_BIO_read_open_file(const char *fn)
Open a file for reading.
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_int64(const char *what, int64_t *i)
Create the specification to write an (u)int64_t.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
void(* GNUNET_CORE_DisconnectEventHandler)(void *cls, const struct GNUNET_PeerIdentity *peer, void *peer_cls)
Method called whenever a peer disconnects.
void *(* GNUNET_CORE_ConnectEventHandler)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Method called whenever a given peer connects.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file(const char *filename)
Create the directory structure for storing a file.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
@ GNUNET_SCHEDULER_PRIORITY_DEFAULT
Run with the default priority (normal P2P operations).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_NETWORK_fdset_destroy(struct GNUNET_NETWORK_FDSet *fds)
Releases the associated memory of an fd set.
void GNUNET_NETWORK_fdset_copy_native(struct GNUNET_NETWORK_FDSet *to, const fd_set *from, int nfds)
Copy a native fd set into the GNUnet representation.
struct GNUNET_NETWORK_FDSet * GNUNET_NETWORK_fdset_create(void)
Creates an fd set.
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h)
Disconnect from the PEERSTORE service.
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
void GNUNET_PEERSTORE_hello_add_cancel(struct GNUNET_PEERSTORE_StoreHelloContext *huc)
Cancel the request to add a hello.
struct GNUNET_PEERSTORE_StoreHelloContext * GNUNET_PEERSTORE_hello_add(struct GNUNET_PEERSTORE_Handle *h, const struct GNUNET_MessageHeader *msg, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
Add hello to peerstore.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_select(enum GNUNET_SCHEDULER_Priority prio, struct GNUNET_TIME_Relative delay, const struct GNUNET_NETWORK_FDSet *rs, const struct GNUNET_NETWORK_FDSet *ws, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when any of the specified file descriptor set...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
void GNUNET_STATISTICS_get_cancel(struct GNUNET_STATISTICS_GetHandle *gh)
Cancel a GNUNET_STATISTICS_get request.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
struct GNUNET_STATISTICS_GetHandle * GNUNET_STATISTICS_get(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Callback cont, GNUNET_STATISTICS_Iterator proc, void *cls)
Get statistic from the peer.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_utf8_toupper(const char *input, char *output)
Convert the utf-8 input string to upper case.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_min(struct GNUNET_TIME_Relative t1, struct GNUNET_TIME_Relative t2)
Return the minimum of two relative time values.
#define GNUNET_TIME_UNIT_HOURS
One hour.
#define GNUNET_TIME_UNIT_SECONDS
One second.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
#define GNUNET_TIME_UNIT_MINUTES
One minute.
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
static unsigned int size
Size of the "table".
Handle for buffered reading.
Structure specifying a reading operation on an IO handle.
GNUNET_BIO_ReadHandler rh
Function performing data deserialization.
Handle for buffered writing.
Structure specifying a writing operation on an IO handle.
GNUNET_BIO_WriteHandler wh
Function performing data serialization.
Handle to a message queue.
collection of IO descriptors
Handle to the PEERSTORE service.
Context for a add hello uri request.
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Linked list of things we still need to do.
Time for absolute times used by GNUnet, in microseconds.
uint64_t abs_value_us
The actual value.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
A single hostlist obtained by hostlist advertisements.
struct GNUNET_TIME_Absolute time_last_usage
Last time the hostlist was obtained.
uint64_t quality
Value describing the quality of the hostlist, the bigger the better but (should) never < 0 used for d...
struct Hostlist * prev
previous entry, used to manage entries in a double linked list
uint32_t hello_count
Number of HELLO messages obtained during last download.
struct GNUNET_TIME_Absolute time_creation
Time the hostlist advertisement was received and the entry was created.
uint32_t times_used
Number of times the hostlist was successfully obtained.
struct Hostlist * next
next entry, used to manage entries in a double linked list
const char * hostlist_uri
URI where hostlist can be obtained.
Context for a add hello uri request.
struct GNUNET_PEERSTORE_StoreHelloContext * sc
Store hello ctx.
struct StoreHelloEntry * prev
Kept (also) in a DLL.
struct StoreHelloEntry * next
Kept (also) in a DLL.