GNUnet  0.10.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 
61  uint64_t id;
62 
66  uint32_t type;
67 
71  uint32_t version;
76  const char *name;
77 
81  size_t data_size;
82 
88  const void *data;
89 };
90 
91 
100 
105 };
106 
107 
113 
118 
123 };
124 
125 
137  uint32_t type,
138  const void *data,
139  size_t data_size);
140 
141 
148 size_t
150  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
151 
152 
158 void
160  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
161 
162 
171 void
174  const char *attr_name,
175  uint32_t type,
176  const void *data,
177  size_t data_size);
178 
179 
187 size_t
189  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
190  char *result);
191 
192 
202 
203 
210 size_t
212  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
213 
214 
222 size_t
224  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
225  char *result);
226 
227 
238 
239 
247  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
248 
249 
256 uint32_t
257 GNUNET_RECLAIM_ATTRIBUTE_typename_to_number(const char *typename);
258 
269 int
271  const char *s,
272  void **data,
273  size_t *data_size);
274 
275 
284 char *
286  const void *data,
287  size_t data_size);
288 
289 
296 const char *
298 
299 
300 #if 0 /* keep Emacsens' auto-indent happy */
301 {
302 #endif
303 #ifdef __cplusplus
304 }
305 #endif
306 
307 
308 /* ifndef GNUNET_RECLAIM_ATTRIBUTE_LIB_H */
309 #endif
310  /* end of group reclaim-attribute */
312 
313 /* 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.