Attribute-value pairs contain an attribute and an associated value. The value often is a simple null-terminated string; however, the value can also be binary data. Attribute-value pairs are stored as SOIFAVPair structures.
The important fields in a SOIFAVPair structure are the following:
Attribute string; ”\\0’ terminated
Primary value; may be ”\\0’ terminated
Number of bytes (8 bits) for primary value
Multiple values for multivalued attributes
The sizes for the values
Number of values associated with attribute
Last valid slot - array may contain holes
NSAPI_PUBLIC SOIFAVPair * SOIFAVPair_Create(char *a, char *v, int vsz);
Creates an AVPair structure with the given attribute a and value v. The value v is a buffer of vsz bytes.
NSAPI_PUBLIC void SOIFAVPair_Free(SOIFAVPair *avp);
Frees the memory used by the given SOIFAVPair structure
NSAPI_PUBLIC int SOIF_Replace(SOIF *s, char *att, char *val, int valsz);
Replaces the value of an existing attribute att with a new value val of size valsz in the SOIF s.
#define SOIF_InsertStr(soif, attribute, value)
Inserts the given attribute with the given value into the soif.
#define SOIF_ReplaceStr(soif, attribute, value)
Replaces the existing value of the given attribute in the soif with the given value.
NSAPI_PUBLIC int SOIF_Rename(SOIF *s, char *old_attr, char *new_attr);
Renames the given attribute to the given new name.
NSAPI_PUBLIC int SOIF_AttributeCompare(const char *a1, const char *a2);
Compares two attribute names. Returns 0 (zero) if they are equal, or non-zero if they are different. Case (upper and lower) and trailing -s are ignored when comparing attribute names. The following table illustrates the results of comparing some attribute names.
AttibuteA |
AttributeB |
Does SOIF_AttributeCompare() consider them to be the same? |
---|---|---|
title |
Title |
yes |
title |
Title |
yes |
title |
title |
yes |
title |
title-page |
no |
title |
title |
no |
author |
title |
no |