GNUnet  0.10.x
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 
31 #ifndef GNUNET_PEERSTORE_PLUGIN_H
32 #define GNUNET_PEERSTORE_PLUGIN_H
33 
34 #include "gnunet_util_lib.h"
36 
37 #ifdef __cplusplus
38 extern "C"
39 {
40 #if 0 /* keep Emacsens' auto-indent happy */
41 }
42 #endif
43 #endif
44 
45 
50 {
51 
55  void *cls;
56 
73  int
74  (*store_record) (void *cls,
75  const char *sub_system,
76  const struct GNUNET_PeerIdentity *peer,
77  const char *key,
78  const void *value,
79  size_t size,
80  struct GNUNET_TIME_Absolute expiry,
83  void *cont_cls);
84 
99  int
100  (*iterate_records) (void *cls,
101  const char *sub_system,
102  const struct GNUNET_PeerIdentity *peer,
103  const char *key,
105  void *iter_cls);
106 
117  int
118  (*expire_records) (void *cls,
119  struct GNUNET_TIME_Absolute now,
121  void *cont_cls);
122 
123 };
124 
125 
126 #if 0 /* keep Emacsens' auto-indent happy */
127 {
128 #endif
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif
134  /* end of group */
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_GETOPT_CommandLineOption options[]
Definition: 002.c:5
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.
void * cls
Closure to pass to all plugin functions.
int(* expire_records)(void *cls, struct GNUNET_TIME_Absolute now, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
Delete expired records (expiry < now)
static char * value
Value of the record to add/remove.
GNUNET_PEERSTORE_StoreOption
Options for storing values in PEERSTORE.
struct returned by the initialization function of the plugin
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_HashCode key
The key used in the DHT.
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.
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.