GNUnet  0.10.x
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 
33 #ifndef GNUNET_PEERSTORE_SERVICE_H
34 #define GNUNET_PEERSTORE_SERVICE_H
35 
36 #include "gnunet_util_lib.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #if 0 /* keep Emacsens' auto-indent happy */
41 }
42 #endif
43 #endif
44 
45 
49 #define GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY "transport-communicator-url"
50 
54 #define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY "transport-peer-hello"
55 
60 #define GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME \
61  "transport-backchannel-monotonic-time"
62 
67 #define GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME \
68  "transport-dv-learn-monotonic-time"
69 
70 
75 {
76 
81 
87 
88 };
89 
94 
99 
104 {
105 
109  char *sub_system;
110 
115 
119  char *key;
120 
124  void *value;
125 
129  size_t value_size;
130 
135 
141 };
142 
143 
150 typedef void (*GNUNET_PEERSTORE_Continuation) (void *cls, int success);
151 
152 
160 typedef void (*GNUNET_PEERSTORE_Processor) (
161  void *cls,
162  const struct GNUNET_PEERSTORE_Record *record,
163  const char *emsg);
164 
165 
173 
174 
183 void
184 GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, int sync_first);
185 
186 
205  const char *sub_system,
206  const struct GNUNET_PeerIdentity *peer,
207  const char *key,
208  const void *value,
209  size_t size,
213  void *cont_cls);
214 
215 
221 void
223 
224 
237  const char *sub_system,
238  const struct GNUNET_PeerIdentity *peer,
239  const char *key,
241  void *callback_cls);
242 
243 
250 void
252 
253 
268  const char *sub_system,
269  const struct GNUNET_PeerIdentity *peer,
270  const char *key,
272  void *callback_cls);
273 
274 
280 void
282 
283 
284 #if 0 /* keep Emacsens' auto-indent happy */
285 {
286 #endif
287 #ifdef __cplusplus
288 }
289 #endif
290 
291 #endif
292  /* end of group */
GNUNET_PEERSTORE_Processor callback
Callback with each record received.
void GNUNET_PEERSTORE_watch_cancel(struct GNUNET_PEERSTORE_WatchContext *wc)
Cancel a watch request.
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.
struct GNUNET_PeerIdentity peer
Peer Identity.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
Delete any previous values for the given key before storing the given value.
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.
size_t value_size
Size of value BLOB.
struct GNUNET_SERVICE_Client * client
Client from which this record originated.
Possibly store multiple values under given key.
void * callback_cls
Closure for callback.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:94
Handle to a client that is connected to a service.
Definition: service.c:249
char * key
Record key string.
GNUNET_PEERSTORE_Processor callback
Callback with each matching record.
void * value
Record value BLOB.
void * callback_cls
Closure for callback.
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h, int sync_first)
Disconnect from the PEERSTORE service.
Context for a store request.
Definition: peerstore_api.c:97
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 * cont_cls
Closure for cont.
GNUNET_PEERSTORE_StoreOption
Options for storing values in PEERSTORE.
void GNUNET_PEERSTORE_store_cancel(struct GNUNET_PEERSTORE_StoreContext *sc)
Cancel a store request.
Context for a watch request.
Handle to the PEERSTORE service.
Definition: peerstore_api.c:40
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
static unsigned int size
Size of the "table".
Definition: peer.c:67
void(* GNUNET_PEERSTORE_Continuation)(void *cls, int success)
Continuation called with a status result.
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
The identity of the host (wraps the signing key of the peer).
configuration data
Definition: configuration.c:85
struct GNUNET_TIME_Absolute expiry
Expiry time of entry.
char * sub_system
Responsible sub system string.
Single PEERSTORE record.
GNUNET_PEERSTORE_Continuation cont
Continuation called with service response.
void GNUNET_PEERSTORE_iterate_cancel(struct GNUNET_PEERSTORE_IterateContext *ic)
Cancel an iterate request Please do not call after the iterate request is done.
static void record(void *cls, size_t data_size, const void *data)
Process recorded audio data.
Time for absolute times used by GNUnet, in microseconds.
Context for a iterate request.