GNUnet  0.11.x
gnunet_datacache_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2006, 2009, 2015 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 
37 #ifndef GNUNET_DATACACHE_LIB_H
38 #define GNUNET_DATACACHE_LIB_H
39 
40 #include "gnunet_util_lib.h"
41 #include "gnunet_block_lib.h"
42 #include "gnunet_dht_service.h"
43 
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #if 0 /* keep Emacsens' auto-indent happy */
48 }
49 #endif
50 #endif
51 
52 
57 
58 
68  const char *section);
69 
70 
76 void
78 
79 
93 typedef enum GNUNET_GenericReturnValue
94 (*GNUNET_DATACACHE_Iterator)(void *cls,
95  const struct GNUNET_HashCode *key,
96  size_t data_size,
97  const char *data,
99  struct GNUNET_TIME_Absolute exp,
100  unsigned int path_info_len,
101  const struct GNUNET_DHT_PathElement *path_info);
102 
103 
120  const struct GNUNET_HashCode *key,
121  uint32_t xor_distance,
122  size_t data_size,
123  const char *data,
124  enum GNUNET_BLOCK_Type type,
125  struct GNUNET_TIME_Absolute discard_time,
126  unsigned int path_info_len,
127  const struct GNUNET_DHT_PathElement *path_info);
128 
129 
141 unsigned int
143  const struct GNUNET_HashCode *key,
144  enum GNUNET_BLOCK_Type type,
146  void *iter_cls);
147 
148 
163 unsigned int
165  const struct GNUNET_HashCode *key,
166  enum GNUNET_BLOCK_Type type,
167  unsigned int num_results,
169  void *iter_cls);
170 
171 
172 #if 0 /* keep Emacsens' auto-indent happy */
173 {
174 #endif
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif
180  /* end of group */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
struct GNUNET_HashCode key
The key used in the DHT.
uint32_t data
The data value.
GNUNET_GenericReturnValue
Named constants for return values.
Definition: gnunet_common.h:92
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
unsigned int GNUNET_DATACACHE_get(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results for a particular key in the datacache.
Definition: datacache.c:315
enum GNUNET_GenericReturnValue(* GNUNET_DATACACHE_Iterator)(void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int path_info_len, const struct GNUNET_DHT_PathElement *path_info)
An iterator over a set of items stored in the datacache.
enum GNUNET_GenericReturnValue GNUNET_DATACACHE_put(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, uint32_t xor_distance, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute discard_time, unsigned int path_info_len, const struct GNUNET_DHT_PathElement *path_info)
Store an item in the datacache.
Definition: datacache.c:261
struct GNUNET_DATACACHE_Handle * GNUNET_DATACACHE_create(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Create a data cache.
Definition: datacache.c:128
void GNUNET_DATACACHE_destroy(struct GNUNET_DATACACHE_Handle *h)
Destroy a data cache (and free associated resources).
Definition: datacache.c:235
unsigned int GNUNET_DATACACHE_get_closest(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, unsigned int num_results, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results that are "close" to a particular key in the datacache.
Definition: datacache.c:349
Internal state of the datacache library.
Definition: datacache.c:41
char * section
Configuration section to use.
Definition: datacache.c:60
A (signed) path tracking a block's flow through the DHT is represented by an array of path elements,...
A 512-bit hashcode.
Time for absolute times used by GNUnet, in microseconds.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model