GNUnet  0.17.5
gnunet_peerstore_plugin.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2012, 2013 GNUnet e.V.
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 
34 #ifndef GNUNET_PEERSTORE_PLUGIN_H
35 #define GNUNET_PEERSTORE_PLUGIN_H
36 
37 #include "gnunet_util_lib.h"
39 
40 #ifdef __cplusplus
41 extern "C"
42 {
43 #if 0 /* keep Emacsens' auto-indent happy */
44 }
45 #endif
46 #endif
47 
48 
53 {
57  void *cls;
58 
76  (*store_record) (void *cls,
77  const char *sub_system,
78  const struct GNUNET_PeerIdentity *peer,
79  const char *key,
80  const void *value,
81  size_t size,
82  struct GNUNET_TIME_Absolute expiry,
85  void *cont_cls);
86 
102  (*iterate_records) (void *cls,
103  const char *sub_system,
104  const struct GNUNET_PeerIdentity *peer,
105  const char *key,
107  void *iter_cls);
108 
120  (*expire_records) (void *cls,
121  struct GNUNET_TIME_Absolute now,
123  void *cont_cls);
124 };
125 
126 
127 #if 0 /* keep Emacsens' auto-indent happy */
128 {
129 #endif
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif
135  /* end of group */
137  /* end of group addition */
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
API to the peerstore service.
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_Continuation)(void *cls, int success)
Continuation called with a status result.
static unsigned int size
Size of the "table".
Definition: peer.c:67
struct returned by the initialization function of the plugin
void * cls
Closure to pass to all plugin functions.
int(* store_record)(void *cls, 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 record in the peerstore.
int(* expire_records)(void *cls, struct GNUNET_TIME_Absolute now, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
Delete expired records (expiry < now)
int(* iterate_records)(void *cls, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_PEERSTORE_Processor iter, void *iter_cls)
Iterate over the records given an optional peer id and/or key.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.