2 This file is part of GNUnet.
3 Copyright (C) 2012-2015 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 * @author Martin Schanzenbach
22 * @file identity-provider/identity_attribute.h
23 * @brief GNUnet Identity Provider library
26 #ifndef IDENTITY_ATTRIBUTE_H
27 #define IDENTITY_ATTRIBUTE_H
29 #include "gnunet_identity_provider_service.h"
36 uint32_t attribute_type;
41 uint32_t attribute_version;
53 //followed by data_size Attribute value data
57 * Get required size for serialization buffer
59 * @param attrs the attribute list to serialize
61 * @return the required buffer size
64 attribute_list_serialize_get_size (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs);
67 attribute_list_destroy (struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs);
71 * Serialize an attribute list
73 * @param attrs the attribute list to serialize
74 * @param result the serialized attribute
76 * @return length of serialized data
79 attribute_list_serialize (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs,
83 * Deserialize an attribute list
85 * @param data the serialized attribute list
86 * @param data_size the length of the serialized data
88 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
90 struct GNUNET_IDENTITY_PROVIDER_AttributeList *
91 attribute_list_deserialize (const char* data,
96 * Get required size for serialization buffer
98 * @param attr the attribute to serialize
100 * @return the required buffer size
103 attribute_serialize_get_size (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr);
108 * Serialize an attribute
110 * @param attr the attribute to serialize
111 * @param result the serialized attribute
113 * @return length of serialized data
116 attribute_serialize (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr,
120 * Deserialize an attribute
122 * @param data the serialized attribute
123 * @param data_size the length of the serialized data
125 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
127 struct GNUNET_IDENTITY_PROVIDER_Attribute *
128 attribute_deserialize (const char* data,
132 * Create a new attribute.
134 * @param name the attribute name
135 * @param type the attribute type
136 * @param data the attribute value
137 * @param data_size the attribute value size
138 * @return the new attribute
140 struct GNUNET_IDENTITY_PROVIDER_Attribute *
141 attribute_new (const char* attr_name,
146 struct GNUNET_IDENTITY_PROVIDER_AttributeList*
147 attribute_list_dup (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs);