32 #define LOG(kind, ...) GNUNET_log_from (kind, "peerinfo-api", __VA_ARGS__)
123 uint16_t ms = ntohs (im->
header.
size) -
sizeof(*im);
164 "Received information about peer `%s' from peerinfo database\n",
261 "Could not connect to PEERINFO service.\n");
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static int include_friend_only
Option '-f'.
static struct GNUNET_PEERINFO_NotifyContext * nc
Iterator context.
Maintain the list of currently known hosts.
Constants for network protocols.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
uint16_t GNUNET_HELLO_size(const struct GNUNET_HELLO_Message *hello)
Return the size of the given HELLO message.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
void(* GNUNET_PEERINFO_Processor)(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Message *hello, const char *err_msg)
Type of an iterator over the hosts.
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.
void GNUNET_PEERINFO_notify_cancel(struct GNUNET_PEERINFO_NotifyContext *nc)
Stop notifying about changes.
#define GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END
End of information about other peers.
#define GNUNET_MESSAGE_TYPE_PEERINFO_INFO
Information about one of the peers.
#define GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY
Start notifying this client about all changes to the known peers until it disconnects.
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.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
common internal definitions for peerinfo service
static int check_notification(void *cls, const struct InfoMessage *im)
Check that a peerinfo information message is well-formed.
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
We got a disconnect after asking regex to do the announcement.
static void reconnect(void *cls)
Task to re-try connecting to peerinfo.
static void handle_notification(void *cls, const struct InfoMessage *im)
Receive a peerinfo information message, process it.
static void do_reconnect(struct GNUNET_PEERINFO_NotifyContext *nc)
We encountered an error, reconnect to the service.
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.
A HELLO message is used to exchange information about transports with other peers.
Handle to a message queue.
Message handler for a specific message type.
Context for the info handler.
struct GNUNET_MQ_Handle * mq
Our connection to the PEERINFO service.
void * callback_cls
Closure for callback.
struct GNUNET_SCHEDULER_Task * task
Tasked used for delayed re-connection attempt.
int include_friend_only
Include friend only HELLOs in callbacks.
GNUNET_PEERINFO_Processor callback
Function to call with information.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration.
Entry in list of pending tasks.
Message used to inform the client about a particular peer; this message is optionally followed by a H...
struct GNUNET_PeerIdentity peer
About which peer are we talking here?
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_PEERINFO_INFO.
Header for all communications.
uint32_t include_friend_only
Include friend only HELLOs and peers in callbacks.