Sun Java System Portal Server 7 Developer's Guide

Attribute-Value Pair Routines

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:

char *attribute;

Attribute string; ”\\0’ terminated

char *value;

Primary value; may be ”\\0’ terminated

size_t vsize;

Number of bytes (8 bits) for primary value

char **values;

Multiple values for multivalued attributes

size_t *vsizes;

The sizes for the values

int nvalues;

Number of values associated with attribute

int last_slot;

Last valid slot - array may contain holes

SOIFAVPair_Create
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.

SOIFAVPair_Free
NSAPI_PUBLIC void SOIFAVPair_Free(SOIFAVPair *avp);

Frees the memory used by the given SOIFAVPair structure

SOIF_Replace
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.

SOIF_InsertStr
#define SOIF_InsertStr(soif, attribute, value)

Inserts the given attribute with the given value into the soif.

SOIF_ReplaceStr
#define SOIF_ReplaceStr(soif, attribute, value)

Replaces the existing value of the given attribute in the soif with the given value.

SOIF_Rename
NSAPI_PUBLIC int SOIF_Rename(SOIF *s, char *old_attr, char *new_attr);

Renames the given attribute to the given new name.

SOIF_AttributeCompare
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