#include <xfn/xfn.h>
FN_attribute_t *fn_attribute_create(const FN_identifier_t *attribute_id, const FN_identifier_t *attribute_syntax);
void fn_attribute_destroy(FN_attribute_t *attr);
FN_attribute_t *fn_attribute_copy(const FN_attribute_t *attr);
FN_attribute_t *fn_attribute_assign(FN_attribute_t *dst, const FN_attribute_t *src);
const FN_identifier_t *fn_attribute_identifier(const FN_attribute_t *attr);
const FN_identifier_t *fn_attribute_syntax(const FN_attribute_t *attr);
unsigned int fn_attribute_valuecount(const FN_attribute_t *attr);
const FN_attrvalue_t *fn_attribute_first(const FN_attribute_t *attr, void **iter_pos);
const FN_attrvalue_t *fn_attribute_next(const FN_attribute_t *attr, void **iter_pos);
int fn_attribute_add(FN_attribute_t *attr, const FN_attrvalue_t *attribute_value, unsigned int exclusive);
int fn_attribute_remove(FN_attribute_t *attr, const FN_attrvalue_t *attribute_value);
The attribute identifier and its syntax are specified using an FN_identifier_t. fn_attribute_create() creates a new attribute object with the given identifier and syntax, and an empty set of values. fn_attribute_destroy() releases the storage associated with attr. fn_attribute_copy() returns a copy of the object pointed to by attr. fn_attribute_assign() makes a copy of the attribute object pointed to by src and assigns it to dst, releasing any old contents of dst. A pointer to the same object as dst is returned.
fn_attribute_identifier() returns the attribute identifer of attr. fn_attribute_syntax() returns the attribute syntax of attr. fn_attribute_valuecount() returns the number of attribute values in attr.
fn_attribute_first() and fn_attribute_next() are used to enumerate the values of an attribute. Enumeration of the values of an attribute may return the values in any order. fn_attribute_first() returns an attribute value from attr and sets the iteration marker iter_pos. Subsequent calls to fn_attribute_next() returns the next attribute value identified by iter_pos and advances iter_pos. Adding or removing values from an attribute invalidates any iteration markers that the caller holds.
fn_attribute_add() adds a new value attribute_value to attr. The operation succeeds (but no change is made) if attribute_value is already in attr and exclusive is 0; the operation fails if attribute_value is already in attr and exclusive is non-zero. fn_attribute_remove() removes attribute_value from attr. The operation succeeds even if attribute_value is not amongst attr’s values.
fn_attribute_add() and fn_attribute_remove() return 1 if the operation succeeds, 0 if it fails.