notify API to access peerinfo service More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_peerinfo_service.h"
#include "gnunet_protocols.h"
#include "peerinfo.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_PEERINFO_NotifyContext |
Context for the info handler. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "peerinfo-api", __VA_ARGS__) |
Functions | |
static void | reconnect (void *cls) |
Task to re-try connecting to peerinfo. More... | |
static void | do_reconnect (struct GNUNET_PEERINFO_NotifyContext *nc) |
We encountered an error, reconnect to the service. More... | |
static void | mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
We got a disconnect after asking regex to do the announcement. More... | |
static int | check_notification (void *cls, const struct InfoMessage *im) |
Check that a peerinfo information message is well-formed. More... | |
static void | handle_notification (void *cls, const struct InfoMessage *im) |
Receive a peerinfo information message, process it. More... | |
static void | handle_end_iteration (void *cls, const struct GNUNET_MessageHeader *msg) |
Type of a function to call when we receive a message from the service. More... | |
struct GNUNET_PEERINFO_NotifyContext * | GNUNET_PEERINFO_notify (const struct GNUNET_CONFIGURATION_Handle *cfg, int include_friend_only, GNUNET_PEERINFO_Processor callback, void *callback_cls) |
Call a method whenever our known information about peers changes. More... | |
void | GNUNET_PEERINFO_notify_cancel (struct GNUNET_PEERINFO_NotifyContext *nc) |
Stop notifying about changes. More... | |
notify API to access peerinfo service
Definition in file peerinfo_api_notify.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "peerinfo-api", __VA_ARGS__) |
Definition at line 32 of file peerinfo_api_notify.c.
|
static |
Task to re-try connecting to peerinfo.
cls | the struct GNUNET_PEERINFO_NotifyContext * |
Definition at line 196 of file peerinfo_api_notify.c.
References GNUNET_PEERINFO_NotifyContext::cfg, env, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_PEERINFO_INFO, GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END, GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), handlers, NotifyMessage::include_friend_only, GNUNET_PEERINFO_NotifyContext::include_friend_only, GNUNET_PEERINFO_NotifyContext::mq, mq_error_handler(), nc, and GNUNET_PEERINFO_NotifyContext::task.
Referenced by do_reconnect(), and GNUNET_PEERINFO_notify().
|
static |
We encountered an error, reconnect to the service.
nc | context to reconnect |
Definition at line 86 of file peerinfo_api_notify.c.
References GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_now(), GNUNET_PEERINFO_NotifyContext::mq, nc, reconnect(), and GNUNET_PEERINFO_NotifyContext::task.
Referenced by mq_error_handler().
|
static |
We got a disconnect after asking regex to do the announcement.
Retry.
cls | the struct GNUNET_PEERINFO_NotifyContext to retry |
error | error code |
Definition at line 103 of file peerinfo_api_notify.c.
References do_reconnect(), and nc.
Referenced by reconnect().
|
static |
Check that a peerinfo information message is well-formed.
cls | closure |
im | message received |
Definition at line 120 of file peerinfo_api_notify.c.
References GNUNET_break, GNUNET_HELLO_size(), GNUNET_OK, GNUNET_SYSERR, InfoMessage::header, and GNUNET_MessageHeader::size.
|
static |
Receive a peerinfo information message, process it.
cls | closure |
im | message received |
Definition at line 153 of file peerinfo_api_notify.c.
References GNUNET_PEERINFO_NotifyContext::callback, GNUNET_PEERINFO_NotifyContext::callback_cls, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), InfoMessage::header, LOG, nc, InfoMessage::peer, and GNUNET_MessageHeader::size.
|
static |
Type of a function to call when we receive a message from the service.
Call the iterator with the result and (if applicable) continue to receive more messages or trigger processing the next event (if applicable).
cls | closure |
msg | message received, NULL on timeout or fatal error |
Definition at line 183 of file peerinfo_api_notify.c.