API to monitor changes in the NAMESTORE. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
#include "gnunet_arm_service.h"
#include "gnunet_signatures.h"
#include "gnunet_namestore_service.h"
#include "namestore.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_NAMESTORE_ZoneMonitor |
Handle for a monitoring activity. More... | |
Functions | |
static void | reconnect (struct GNUNET_NAMESTORE_ZoneMonitor *zm) |
Reconnect to the namestore service. More... | |
static void | handle_sync (void *cls, const struct GNUNET_MessageHeader *msg) |
Handle SYNC message from the namestore service. More... | |
static int | check_result (void *cls, const struct RecordResultMessage *lrm) |
We've received a notification about a change to our zone. More... | |
static void | handle_result (void *cls, const struct RecordResultMessage *lrm) |
We've received a notification about a change to our zone. 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... | |
struct GNUNET_NAMESTORE_ZoneMonitor * | GNUNET_NAMESTORE_zone_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CRYPTO_PrivateKey *zone, int iterate_first, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor monitor, void *monitor_cls, GNUNET_SCHEDULER_TaskCallback sync_cb, void *sync_cb_cls) |
struct GNUNET_NAMESTORE_ZoneMonitor * | GNUNET_NAMESTORE_zone_monitor_start2 (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CRYPTO_PrivateKey *zone, int iterate_first, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordSetMonitor monitor, void *monitor_cls, GNUNET_SCHEDULER_TaskCallback sync_cb, void *sync_cb_cls, enum GNUNET_GNSRECORD_Filter filter) |
Begin monitoring a zone for changes. More... | |
void | GNUNET_NAMESTORE_zone_monitor_next (struct GNUNET_NAMESTORE_ZoneMonitor *zm, uint64_t limit) |
Calls the monitor processor specified in GNUNET_NAMESTORE_zone_monitor_start for the next record(s). More... | |
void | GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm) |
Stop monitoring a zone for changes. More... | |
API to monitor changes in the NAMESTORE.
Definition in file namestore_api_monitor.c.
|
static |
Reconnect to the namestore service.
zm | monitor to reconnect |
Definition at line 274 of file namestore_api_monitor.c.
References GNUNET_NAMESTORE_ZoneMonitor::cfg, env, GNUNET_NAMESTORE_ZoneMonitor::error_cb, GNUNET_NAMESTORE_ZoneMonitor::error_cb_cls, ZoneMonitorStartMessage::filter, GNUNET_NAMESTORE_ZoneMonitor::filter, GNUNET_CLIENT_connect(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START, GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_SYNC, GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT, GNUNET_MQ_destroy(), GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), handlers, ZoneMonitorStartMessage::iterate_first, GNUNET_NAMESTORE_ZoneMonitor::iterate_first, ZoneMonitorStartMessage::key_len, GNUNET_NAMESTORE_ZoneMonitor::key_len, GNUNET_NAMESTORE_ZoneMonitor::mq, mq_error_handler(), result, zm, and GNUNET_NAMESTORE_ZoneMonitor::zone.
Referenced by GNUNET_NAMESTORE_zone_monitor_start(), GNUNET_NAMESTORE_zone_monitor_start2(), and mq_error_handler().
|
static |
Handle SYNC message from the namestore service.
cls | the monitor |
msg | the sync message |
Definition at line 123 of file namestore_api_monitor.c.
References msg, GNUNET_NAMESTORE_ZoneMonitor::sync_cb, GNUNET_NAMESTORE_ZoneMonitor::sync_cb_cls, and zm.
|
static |
We've received a notification about a change to our zone.
Check that it is well-formed.
cls | the zone monitor handle |
lrm | the message from the service. |
Definition at line 142 of file namestore_api_monitor.c.
References RecordResultMessage::gns_header, GNUNET_break, GNUNET_GNSRECORD_records_deserialize(), GNUNET_OK, GNUNET_SYSERR, GNUNET_NAMESTORE_Header::header, RecordResultMessage::key_len, GNUNET_NAMESTORE_ZoneMonitor::key_len, MAX_NAME_LEN, RecordResultMessage::name_len, rd, rd_count, RecordResultMessage::rd_count, RecordResultMessage::rd_len, GNUNET_MessageHeader::size, and zm.
|
static |
We've received a notification about a change to our zone.
Forward to monitor callback.
cls | the zone monitor handle |
lrm | the message from the service. |
Definition at line 211 of file namestore_api_monitor.c.
References RecordResultMessage::expire, GNUNET_assert, GNUNET_CRYPTO_read_private_key_from_buffer(), GNUNET_GNSRECORD_records_deserialize(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_absolute_ntoh(), RecordResultMessage::key_len, GNUNET_NAMESTORE_ZoneMonitor::monitor, GNUNET_NAMESTORE_ZoneMonitor::monitor2, GNUNET_NAMESTORE_ZoneMonitor::monitor_cls, RecordResultMessage::name_len, rd, rd_count, RecordResultMessage::rd_count, RecordResultMessage::rd_len, and zm.
|
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_NAMESTORE_ZoneMonitor * |
error | error code |
Definition at line 259 of file namestore_api_monitor.c.
References reconnect(), and zm.
Referenced by reconnect().