GNUnet 0.21.0
gnunet_peerstore_service.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) GNUnet e.V. 2004--2019
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
36#ifndef GNUNET_PEERSTORE_SERVICE_H
37#define GNUNET_PEERSTORE_SERVICE_H
38
39
40#include "gnunet_util_lib.h"
41
42#ifdef __cplusplus
43extern "C" {
44#if 0 /* keep Emacsens' auto-indent happy */
45}
46#endif
47#endif
48
52#define GNUNET_PEERSTORE_HELLO_KEY "peerstore-peer-hello-uri"
53
57#define GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY "transport-communicator-url"
58
62#define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY "transport-peer-hello"
63
68#define GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME \
69 "transport-backchannel-monotonic-time"
70
75#define GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME \
76 "transport-dv-learn-monotonic-time"
77
81#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE \
82 "transport-tcp-communicator-handshake"
83
87#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK \
88 "transport-tcp-communicator-handshake-ack"
89
93#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY \
94 "transport-tcp-communicator-rekey"
95
96
101{
106
112
113};
114
119
124
129
134{
139
144
148 char *key;
149
153 void *value;
154
159
164
165};
166
167
174typedef void (*GNUNET_PEERSTORE_Continuation) (void *cls, int success);
175
176
181
182
192 void *cls,
193 const struct GNUNET_PEERSTORE_Record *record,
194 const char *emsg);
195
203 void *cls,
204 const struct GNUNET_PeerIdentity *peer,
205 const struct GNUNET_MessageHeader *hello,
206 const char *err_msg);
207
219 const struct GNUNET_MessageHeader *msg,
221 void *cont_cls);
222
223
229void
232
233
241
242
249void
251
252
271 const char *sub_system,
272 const struct GNUNET_PeerIdentity *peer,
273 const char *key,
274 const void *value,
275 size_t size,
279 void *cont_cls);
280
281
287void
289
290
311 const char *sub_system,
312 const struct GNUNET_PeerIdentity *peer,
313 const char *key,
315 void *callback_cls);
316
317
325void
327 uint64_t limit);
328
329
336void
338
373 int iterate_first,
374 const char *sub_system,
375 const struct GNUNET_PeerIdentity *peer,
376 const char *key,
378 void *error_cb_cls,
380 void *sync_cb_cls,
382 void *callback_cls);
383
405void
407 uint64_t limit);
408
414void
416
417#if 0 /* keep Emacsens' auto-indent happy */
418{
419#endif
420#ifdef __cplusplus
421}
422#endif
423
424#endif
425 /* end of group */
427 /* end of group addition */
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static void error_cb(void *cls)
Function called if lookup fails.
Definition: gnunet-abd.c:479
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:109
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 char * value
Value of the record to add/remove.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:87
void GNUNET_PEERSTORE_monitor_stop(struct GNUNET_PEERSTORE_Monitor *zm)
Stop monitoring.
struct GNUNET_PEERSTORE_IterateContext * GNUNET_PEERSTORE_iteration_start(struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_PEERSTORE_Processor callback, void *callback_cls)
Iterate over peerstore entries.
void GNUNET_PEERSTORE_iteration_next(struct GNUNET_PEERSTORE_IterateContext *ic, uint64_t limit)
Continue an iteration.
void GNUNET_PEERSTORE_store_cancel(struct GNUNET_PEERSTORE_StoreContext *sc)
Cancel a store request.
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h)
Disconnect from the PEERSTORE service.
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_hello_notify_cb)(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *hello, const char *err_msg)
Function called by PEERSTORE when notifying a client about a changed hello.
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
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).
GNUNET_PEERSTORE_StoreOption
Options for storing values in PEERSTORE.
void(* GNUNET_PEERSTORE_Processor)(void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)
Function called by PEERSTORE for each matching record.
void GNUNET_PEERSTORE_hello_add_cancel(struct GNUNET_PEERSTORE_StoreHelloContext *huc)
Cancel the request to add a hello.
struct GNUNET_PEERSTORE_StoreContext * GNUNET_PEERSTORE_store(struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, const void *value, size_t size, struct GNUNET_TIME_Absolute expiry, enum GNUNET_PEERSTORE_StoreOption options, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
Store a new entry in the PEERSTORE.
void(* GNUNET_PEERSTORE_Continuation)(void *cls, int success)
Continuation called with a status result.
void GNUNET_PEERSTORE_iteration_stop(struct GNUNET_PEERSTORE_IterateContext *ic)
Cancel an iteration.
struct GNUNET_PEERSTORE_StoreHelloContext * GNUNET_PEERSTORE_hello_add(struct GNUNET_PEERSTORE_Handle *h, const struct GNUNET_MessageHeader *msg, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
Add hello to peerstore.
@ GNUNET_PEERSTORE_STOREOPTION_MULTIPLE
Possibly store multiple values under given key.
@ GNUNET_PEERSTORE_STOREOPTION_REPLACE
Delete any previous values for the given key before storing the given value.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
static unsigned int size
Size of the "table".
Definition: peer.c:68
Header for all communications.
Handle to the PEERSTORE service.
Definition: peerstore_api.c:46
Context for a iterate request.
char * sub_system
Which subsystem does the store?
void * callback_cls
Closure for callback.
GNUNET_PEERSTORE_Processor callback
Callback with each matching record.
struct GNUNET_PeerIdentity peer
Peer the store is for.
Context for a monitor.
const char * sub_system
The sub system requested the watch.
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.
int iterate_first
Iterate first flag.
GNUNET_PEERSTORE_Processor callback
Callback with each record received.
Context for the info handler.
Single PEERSTORE record.
size_t value_size
Size of value BLOB.
struct GNUNET_PeerIdentity peer
Peer Identity.
void * value
Record value BLOB.
struct GNUNET_TIME_Absolute expiry
Expiry time of entry.
char * sub_system
Responsible sub system string.
char * key
Record key string.
Context for a store request.
char * sub_system
Which subsystem does the store?
struct GNUNET_TIME_Absolute expiry
When does the value expire?
void * cont_cls
Closure for cont.
GNUNET_PEERSTORE_Continuation cont
Continuation called with service response.
struct GNUNET_PeerIdentity peer
Peer the store is for.
Context for a add hello uri request.
GNUNET_PEERSTORE_Continuation cont
Function to call with information.
void * cont_cls
Closure for callback.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.