38{
43
48
53
58
63
68
73
82
87
92
96 char *sub_system;
97
101 uint32_t rid;
102
107
112
116 void *sync_cb_cls;
117
122
126 int iterate_first;
127};
128
129static void
131{
133
134 if (NULL !=
mc->sync_cb)
136}
137
138
146static int
148{
149
151}
152
153
160static void
162{
165
169 {
170 mc->callback (
mc->callback_cls,
171 NULL,
172 _ (
"Received a malformed response from service."));
173 }
174 else
175 {
176 mc->callback (
mc->callback_cls,
record, NULL);
178 }
179}
180
181
183
184static void
186{
188
190}
191
192
193static void
195{
205 };
208 size_t key_len = 0;
209 size_t ss_size = 0;
210
212 {
214
215
216
218 if (NULL !=
mc->error_cb)
219 mc->error_cb (
mc->error_cb_cls);
220 }
222 "peerstore",
227 return;
229 key_len = strlen (
mc->key) + 1;
230 if (NULL !=
mc->sub_system)
231 ss_size = strlen (
mc->sub_system) + 1;
234 htons (key_len) + htons (ss_size),
237 if (NULL !=
mc->peer)
238 {
241 }
242 if (NULL !=
mc->sub_system)
249}
250
251
265{
267
278 {
280 mc->peer = &
mc->peer_buf;
281 }
287 {
291 return NULL;
292 }
294}
295
296
302void
304{
306 {
309 }
313}
314
315
316void
318 uint64_t limit)
319{
322
324 {
325
326
327 return;
328 }
332}
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static void error_cb(void *cls)
Function called if lookup fails.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static void record(void *cls, size_t data_size, const void *data)
Process recorded audio data.
struct GNUNET_HashCode key
The key used in the DHT.
static void sync_cb(void *cls)
Function called once we are in sync in monitor mode.
static struct GNUNET_NAMESTORE_ZoneMonitor * zm
Monitor handle.
static struct GNUNET_TESTBED_Controller * mc
Handle to the master controller.
static int result
Global testing status.
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.
#define GNUNET_log(kind,...)
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#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_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#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_PEERSTORE_monitor_stop(struct GNUNET_PEERSTORE_Monitor *zm)
Stop monitoring.
struct GNUNET_PEERSTORE_Monitor * GNUNET_PEERSTORE_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, int iterate_first, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_SCHEDULER_TaskCallback sync_cb, void *sync_cb_cls, GNUNET_PEERSTORE_Processor callback, void *callback_cls)
Request watching a given key The monitoring can be filtered to contain only records matching peer and...
void GNUNET_PEERSTORE_monitor_next(struct GNUNET_PEERSTORE_Monitor *zm, uint64_t limit)
Calls the monitor processor specified in GNUNET_PEERSTORE_monitor_start for the next record(s).
void(* GNUNET_PEERSTORE_Processor)(void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)
Function called by PEERSTORE for each matching record.
#define GNUNET_MESSAGE_TYPE_PEERSTORE_MONITOR_SYNC
Monitor sync.
#define GNUNET_MESSAGE_TYPE_PEERSTORE_MONITOR_NEXT
Monitor next request.
#define GNUNET_MESSAGE_TYPE_PEERSTORE_MONITOR_START
Monitor request.
#define GNUNET_MESSAGE_TYPE_PEERSTORE_RECORD
Record result message.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
static int check_result(void *cls, const struct PeerstoreRecordMessage *msg)
When a response for iterate request is received, check the message is well-formed.
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error err)
static void handle_sync(void *cls, const struct GNUNET_MessageHeader *msg)
static void handle_result(void *cls, const struct PeerstoreRecordMessage *msg)
When a response to monitor is received.
struct GNUNET_PEERSTORE_Record * PEERSTORE_parse_record_message(const struct PeerstoreRecordMessage *srm)
Parses a message carrying a record.
void PEERSTORE_destroy_record(struct GNUNET_PEERSTORE_Record *record)
Free any memory allocated for this record.
static void reconnect(void)
Adjust exponential back-off and reconnect to the service.
static struct GNUNET_MQ_Handle * mq
Our connection to the resolver service, created on-demand, but then persists until error or shutdown.
Handle to a message queue.
Message handler for a specific message type.
struct GNUNET_MQ_Handle * mq
Handle to namestore service.
void * error_cb_cls
Closure for error_cb.
void * callback_cls
Closure for callback.
const struct GNUNET_PeerIdentity * peer
The peer we are watching for values, pointing at peer_buf, or NULL if we watch all peers.
int iterate_first
Iterate first flag.
GNUNET_PEERSTORE_Processor callback
Callback with each record received.
struct GNUNET_PEERSTORE_Monitor * next
Kept in a DLL.
GNUNET_SCHEDULER_TaskCallback sync_cb
Sync CB.
char * sub_system
The sub system requested the watch.
void * sync_cb_cls
Sync CB cls.
struct GNUNET_PEERSTORE_Monitor * prev
Kept in a DLL.
The identity of the host (wraps the signing key of the peer).
uint64_t limit
Number of records to return.
uint16_t iterate_first
GNUNET_YES if iterate first, GNUNET_NO otherwise
struct GNUNET_PeerIdentity peer
Peer Identity.
uint16_t peer_set
GNUNET_YES if peer id value set, GNUNET_NO otherwise
uint16_t key_size
Size of the key string Allocated at position 1 after this struct.
uint16_t sub_system_size
Size of the sub_system string Allocated at position 0 after this struct.
Message carrying a PEERSTORE record message.