library to access the GNS service More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
#include "gnunet_arm_service.h"
#include "gnunet_protocols.h"
#include "gnunet_dht_service.h"
#include "gns.h"
#include "gns_api.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_GNS_LookupRequest |
Handle to a lookup request. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "gns-api", __VA_ARGS__) |
#define | DEFAULT_LIMIT 128 |
Default recursion depth limit to apply if the application does not specify any. More... | |
Functions | |
static void | reconnect (struct GNUNET_GNS_Handle *handle) |
Reconnect to GNS service. More... | |
static void | reconnect_task (void *cls) |
Reconnect to GNS. More... | |
static void | force_reconnect (struct GNUNET_GNS_Handle *handle) |
Disconnect from service and then reconnect. More... | |
static void | mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More... | |
static int | check_result (void *cls, const struct LookupResultMessage *lookup_msg) |
Check validity of message received from the GNS service. More... | |
static void | handle_result (void *cls, const struct LookupResultMessage *lookup_msg) |
Handler for messages received from the GNS service. More... | |
struct GNUNET_GNS_Handle * | GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Initialize the connection with the GNS service. More... | |
void | GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle) |
Shutdown connection with the GNS service. More... | |
void * | GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) |
Cancel pending lookup request. More... | |
struct GNUNET_GNS_LookupRequest * | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_PublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, uint16_t recursion_depth_limit, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls) |
Perform an asynchronous lookup operation on the GNS. More... | |
struct GNUNET_GNS_LookupRequest * | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_PublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls) |
Perform an asynchronous lookup operation on the GNS. More... | |
library to access the GNS service
Definition in file gns_api.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "gns-api", __VA_ARGS__) |
#define DEFAULT_LIMIT 128 |
|
static |
Reconnect to GNS service.
handle | the handle to the GNS service |
Definition at line 232 of file gns_api.c.
References GNUNET_VPN_Handle::cfg, GNUNET_assert, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_send_copy(), handle, handlers, LOG, GNUNET_VPN_Handle::mq, mq_error_handler(), and result.
Referenced by GNUNET_GNS_connect(), and reconnect_task().
|
static |
Reconnect to GNS.
cls | the handle |
Definition at line 101 of file gns_api.c.
References handle, and reconnect().
Referenced by force_reconnect().
|
static |
Disconnect from service and then reconnect.
handle | our handle |
Definition at line 116 of file gns_api.c.
References GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, handle, GNUNET_VPN_Handle::mq, and reconnect_task().
Referenced by mq_error_handler().
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure with the struct GNUNET_GNS_Handle * |
error | error code |
Definition at line 138 of file gns_api.c.
References force_reconnect(), GNUNET_ERROR_TYPE_WARNING, handle, and LOG.
Referenced by reconnect().
|
static |
Check validity of message received from the GNS service.
cls | the struct GNUNET_GNS_Handle * |
loookup_msg | the incoming message |
Definition at line 157 of file gns_api.c.
References GNUNET_break, GNUNET_GNSRECORD_records_deserialize(), GNUNET_OK, GNUNET_SYSERR, LookupResultMessage::header, rd, rd_count, LookupResultMessage::rd_count, and GNUNET_MessageHeader::size.
|
static |
Handler for messages received from the GNS service.
cls | the struct GNUNET_GNS_Handle * |
loookup_msg | the incoming message |
Definition at line 185 of file gns_api.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_records_deserialize(), GNUNET_MQ_discard(), GNUNET_OK, handle, LookupResultMessage::header, LookupResultMessage::id, LOG, GNUNET_GNS_LookupWithTldRequest::lookup_proc, lr, GNUNET_GNS_LookupRequest::proc_cls, GNUNET_GNS_LookupRequest::r_id, rd, rd_count, LookupResultMessage::rd_count, and GNUNET_MessageHeader::size.