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;
48 //followed by data_size Attribute value data
52 * Get required size for serialization buffer
54 * @param attrs the attribute list to serialize
56 * @return the required buffer size
59 attribute_list_serialize_get_size (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs);
62 attribute_list_destroy (struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs);
66 * Serialize an attribute list
68 * @param attrs the attribute list to serialize
69 * @param result the serialized attribute
71 * @return length of serialized data
74 attribute_list_serialize (const struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs,
78 * Deserialize an attribute list
80 * @param data the serialized attribute list
81 * @param data_size the length of the serialized data
83 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
85 struct GNUNET_IDENTITY_PROVIDER_AttributeList *
86 attribute_list_deserialize (const char* data,
91 * Get required size for serialization buffer
93 * @param attr the attribute to serialize
95 * @return the required buffer size
98 attribute_serialize_get_size (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr);
103 * Serialize an attribute
105 * @param attr the attribute to serialize
106 * @param result the serialized attribute
108 * @return length of serialized data
111 attribute_serialize (const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr,
115 * Deserialize an attribute
117 * @param data the serialized attribute
118 * @param data_size the length of the serialized data
120 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
122 struct GNUNET_IDENTITY_PROVIDER_Attribute *
123 attribute_deserialize (const char* data,
127 * Create a new attribute.
129 * @param name the attribute name
130 * @param type the attribute type
131 * @param data the attribute value
132 * @param data_size the attribute value size
133 * @return the new attribute
135 struct GNUNET_IDENTITY_PROVIDER_Attribute *
136 attribute_new (const char* attr_name,