GNUnet  0.11.x
gnunet_reclaim_attribute_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2017 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 
30 #ifndef GNUNET_RECLAIM_ATTRIBUTE_LIB_H
31 #define GNUNET_RECLAIM_ATTRIBUTE_LIB_H
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #if 0 /* keep Emacsens' auto-indent happy */
36 }
37 #endif
38 #endif
39 
40 #include "gnunet_util_lib.h"
41 
42 
46 #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE 0
47 
51 #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1
52 
53 
58 {
62  uint64_t id;
63 
67  uint32_t type;
68 
72  uint32_t version;
77  const char *name;
78 
82  size_t data_size;
83 
89  const void *data;
90 };
91 
92 
97 {
102 
107 };
108 
109 
111 {
116 
121 
126 };
127 
128 
140  uint32_t type,
141  const void *data,
142  size_t data_size);
143 
144 
151 size_t
153  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
154 
155 
161 void
163  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
164 
165 
174 void
177  const char *attr_name,
178  uint32_t type,
179  const void *data,
180  size_t data_size);
181 
182 
190 size_t
192  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
193  char *result);
194 
195 
205 
206 
213 size_t
215  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
216 
217 
225 size_t
227  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
228  char *result);
229 
230 
241 
242 
250  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
251 
252 
259 uint32_t
260 GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename);
261 
272 int
274  const char *s,
275  void **data,
276  size_t *data_size);
277 
278 
287 char *
289  const void *data,
290  size_t data_size);
291 
292 
299 const char *
301 
302 
303 #if 0 /* keep Emacsens' auto-indent happy */
304 {
305 #endif
306 #ifdef __cplusplus
307 }
308 #endif
309 
310 
311 /* ifndef GNUNET_RECLAIM_ATTRIBUTE_LIB_H */
312 #endif
313  /* end of group reclaim-attribute */
315 
316 /* end of gnunet_reclaim_attribute_lib.h */
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
char * GNUNET_RECLAIM_ATTRIBUTE_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attribute to a string.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_tail
List tail.
uint32_t GNUNET_RECLAIM_ATTRIBUTE_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
int GNUNET_RECLAIM_ATTRIBUTE_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a &#39;claim&#39; of an attribute to the binary representation.
const void * data
Binary value stored as attribute value.
void GNUNET_RECLAIM_ATTRIBUTE_list_destroy(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
Destroy claim list.
const char * GNUNET_RECLAIM_ATTRIBUTE_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
static char * attr_name
The attribute.
static int result
Global testing status.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * prev
DLL.
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
Get required size for serialization buffer.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_claim_new(const char *attr_name, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures.
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, char *result)
Serialize an attribute.
void GNUNET_RECLAIM_ATTRIBUTE_list_add(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, const char *attr_name, uint32_t type, const void *data, size_t data_size)
Add a new attribute to a claim list.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * next
DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * GNUNET_RECLAIM_ATTRIBUTE_list_dup(const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
Make a (deep) copy of a claim list.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size(const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
Get required size for serialization buffer.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * GNUNET_RECLAIM_ATTRIBUTE_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize(const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, char *result)
Serialize an attribute list.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_deserialize(const char *data, size_t data_size)
Deserialize an attribute.