GNUnet  0.17.6
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 #include "gnunet_util_lib.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #if 0 /* keep Emacsens' auto-indent happy */
44 }
45 #endif
46 #endif
47 
48 
52 #define GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY "transport-communicator-url"
53 
57 #define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY "transport-peer-hello"
58 
63 #define GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME \
64  "transport-backchannel-monotonic-time"
65 
70 #define GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME \
71  "transport-dv-learn-monotonic-time"
72 
76 #define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE \
77  "transport-tcp-communicator-handshake"
78 
82 #define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK \
83  "transport-tcp-communicator-handshake-ack"
84 
88 #define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY \
89  "transport-tcp-communicator-rekey"
90 
91 
96 {
101 
107 };
108 
113 
118 
123 {
127  char *sub_system;
128 
132  struct GNUNET_PeerIdentity peer;
133 
137  char *key;
138 
142  void *value;
143 
147  size_t value_size;
148 
153 
159 };
160 
161 
168 typedef void (*GNUNET_PEERSTORE_Continuation) (void *cls, int success);
169 
170 
178 typedef void (*GNUNET_PEERSTORE_Processor) (
179  void *cls,
180  const struct GNUNET_PEERSTORE_Record *record,
181  const char *emsg);
182 
183 
191 
192 
201 void
202 GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, int sync_first);
203 
204 
223  const char *sub_system,
224  const struct GNUNET_PeerIdentity *peer,
225  const char *key,
226  const void *value,
227  size_t size,
231  void *cont_cls);
232 
233 
239 void
241 
242 
255  const char *sub_system,
256  const struct GNUNET_PeerIdentity *peer,
257  const char *key,
259  void *callback_cls);
260 
261 
268 void
270 
271 
286  const char *sub_system,
287  const struct GNUNET_PeerIdentity *peer,
288  const char *key,
290  void *callback_cls);
291 
292 
298 void
300 
301 
302 #if 0 /* keep Emacsens' auto-indent happy */
303 {
304 #endif
305 #ifdef __cplusplus
306 }
307 #endif
308 
309 #endif
310  /* end of group */
312  /* end of group addition */
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
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 char * value
Value of the record to add/remove.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:84
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
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_store_cancel(struct GNUNET_PEERSTORE_StoreContext *sc)
Cancel a store request.
void GNUNET_PEERSTORE_iterate_cancel(struct GNUNET_PEERSTORE_IterateContext *ic)
Cancel an iterate request Please do not call after the iterate request is done.
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.
struct GNUNET_PEERSTORE_WatchContext * GNUNET_PEERSTORE_watch(struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_PEERSTORE_Processor callback, void *callback_cls)
Request watching a given key User will be notified with any new values added to key.
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h, int sync_first)
Disconnect from the PEERSTORE service.
void GNUNET_PEERSTORE_watch_cancel(struct GNUNET_PEERSTORE_WatchContext *wc)
Cancel a watch request.
void(* GNUNET_PEERSTORE_Continuation)(void *cls, int success)
Continuation called with a status result.
struct GNUNET_PEERSTORE_IterateContext * GNUNET_PEERSTORE_iterate(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 records matching supplied key information.
@ 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.
static unsigned int size
Size of the "table".
Definition: peer.c:67
Handle to the PEERSTORE service.
Definition: peerstore_api.c:41
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.
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.
struct GNUNET_SERVICE_Client * client
Client from which this record originated.
char * sub_system
Responsible sub system string.
char * key
Record key string.
Context for a store request.
Definition: peerstore_api.c:97
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.
Context for a watch request.
void * callback_cls
Closure for callback.
GNUNET_PEERSTORE_Processor callback
Callback with each record received.
The identity of the host (wraps the signing key of the peer).
Handle to a client that is connected to a service.
Definition: service.c:251
Time for absolute times used by GNUnet, in microseconds.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.