GNUnet  0.20.0
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 
38 #include "gnunet_util_lib.h"
40 
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #if 0 /* keep Emacsens' auto-indent happy */
45 }
46 #endif
47 #endif
48 
49 
54 {
58  void *cls;
59 
77  (*store_record) (void *cls,
78  const char *sub_system,
79  const struct GNUNET_PeerIdentity *peer,
80  const char *key,
81  const void *value,
82  size_t size,
83  struct GNUNET_TIME_Absolute expiry,
86  void *cont_cls);
87 
103  (*iterate_records) (void *cls,
104  const char *sub_system,
105  const struct GNUNET_PeerIdentity *peer,
106  const char *key,
108  void *iter_cls);
109 
121  (*expire_records) (void *cls,
122  struct GNUNET_TIME_Absolute now,
124  void *cont_cls);
125 };
126 
127 
128 #if 0 /* keep Emacsens' auto-indent happy */
129 {
130 #endif
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif
136  /* end of group */
138  /* 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:68
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.