Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  Interfaces for Writing XFN Applications Base Attribute Interface Multiple-Attribute Operations Get Attribute Identifiers  Previous   Contents   Next 
   
 

Get Multiple Attributes

Get one or more attributes associated with the object named name relative to the context ctx. If name is empty, the attributes associated with ctx are returned.

FN_multigetlist_t *fn_attr_multiget(
    FN_ctx_t *ctx,
    const   FN_composite_name_t *name,
    const   FN_attrset_t *attr_ids,
    unsigned int follow_link,
    FN_status_t *status);
 
    FN_attribute_t *fn_multigetlist_next(
    FN_multigetlist_t *ml,
    FN_status_t *status);
 
void fn_multigetlist_destroy(   
    FN_multigetlist_t *ml);

The attributes returned are those specified in attr_ids. If the value of attr_ids is 0, all attributes associated with the named object are returned. Any attribute values in attr_ids provided by the caller are ignored; only the identifiers are relevant for this operation. Each attribute (identifier, syntax, and values) is returned one at a time using an enumeration scheme similar to that for listing a context. fn_attr_multi_get() initiates the enumeration process. It returns a handle to an FN_multigetlist_t object that can be used for subsequent fn_multigetlist_next() calls to enumerate the attributes requested.

The operation fn_multigetlist_next() returns the next attribute (identifier, syntax, and values) in the enumeration and updates ml to indicate the state of the enumeration. Successive calls to fn_multigetlist_next() using ml return successive attributes in the enumeration and further update the state of the enumeration.

The operation fn_multigetlist_destroy() frees the resources used during the enumeration. This operation can be invoked at any time to terminate the enumeration.

Implementations are not required to return all attributes requested by attr_ids. Some might choose to return only the attributes found successfully; such implementations might not necessarily return identifiers for attributes that could not be read.

Modify Multiple Attributes

Modify the attributes associated with the object named name, relative to ctx.

int fn_attr_multi_modify(
    FN_ctx_t *ctx,
    const   FN_composite_name_t *name,
    const   FN_attrmodlist_t *mods,
    unsigned int follow_link,                                  
    FN_attrmodlist_t **unexecuted_mods,
    FN_status_t *status);

In the mods parameter, the caller specifies a sequence of modifications that are to be performed in order on the attributes. Each modification in the sequence specifies a modification operation code (shown in Table 2-1) and an attribute on which to operate.

If all the modifications were performed successfully, unexecuted_mods is a NULL pointer. If an error is encountered while performing the list of modifications, status indicates the type of error and unexecuted_mods is set to point to a list of unexecuted modifications. The contents of unexecuted_mods do not share any state with mods; items in unexecuted_mods are copies of items in mods and appear in the same order in which they were originally supplied in mods. The first operation in unexecuted_mods is the first one that failed, and the code in status applies to this modification operation in particular. If status indicates a failure and a NULL pointer is returned in unexecuted_mods, that means no modifications were executed.

Extended Attribute Interface (Preliminary Specification)

fn_attr_search
fn_searchlist_next
fn_searchlist_destroy
fn_attr_ext_search
fn_ext_searchlist_next
fn_ext_searchlist_destroy

The XFN extended attribute interface consists of operations that perform searching and creation of objects in the namespace with attributes. The operations in this interface are considered "preliminary," in that they are not yet standard and might change in the next revision of the specification.

Attribute Search Interface

The search interface contains several operations: a basic search operation, which performs associative lookup in a single context, and an extended search operation that allows the search criteria to be specified using an expression . It also allows the scope of the search to encompass a wider scope than only a single context.

Basic Search

This set of operations is used to enumerate names of objects bound in the target context named name relative to the context ctx with attributes whose values match all those specified by match_attrs. Using return_ref specifies whether to return the references of named objects in the search, while return_attr_ids specifies the attributes to be returned in the search.

FN_searchlist_t *fn_attr_search(
    FN_ctx_t *ctx,
    const FN_composite_name_t *name,
    const FN_attrset_t *match_attrs,
    unsigned int return_ref,
    const FN_attrset_t *return_attr_ids,
    FN_status_t *status);
 
FN_string_t *fn_searchlist_next(
    FN_searchlist_t *sl,
    FN_ref_t **returned_ref,
    FN_attrset_t **returned_attrs,
    FN_status_t *status);
 
void fn_searchlist_destroy(
    FN_searchlist_t *sl);

The call to fn_attr_search() initiates the search in the target context. It returns a handle to an FN_searchlist_t object that is used to enumerate the names of the objects whose attributes match match_attrs.

fn_searchlist_next() returns the next name in the enumeration identified by sl. The reference of the name, if requested, is returned in returned_ref. The attributes specified by return_attr_ids are returned in returned_attrs. Successive calls to fn_searchlist_next() using sl return successive names, and optionally, references and attributes in the enumeration and further update the state of the enumeration.

fn_searchlist_destroy() releases resources used during the enumeration. It can be called at any time to terminate the enumeration.

Extended Search

This set of operations is used to list names of objects whose attributes satisfy the filter expression filter. The control argument encapsulates the option settings for the search.

FN_ext_searchlist_t *fn_attr_ext_search(
    FN_ctx_t *ctx,
    const FN_composite_name_t *name,,
    const FN_search_control_t *control
    FN_status_t *status);
 
FN_composite_name_t *fn_ext_searchlist_next(
    FN_ext_searchlist_t *esl,
    FN_ref_t **returned_ref,
    FN_attrset_t **returned_attrs,
    FN_status_t *status);
 
void fn_ext_searchlist_destroy(
    FN_ext_searchlist_t *esl);

These options are:

  1. The scope of the search. This can be any of the following:

    • Search the named object

    • Search the context named by name

    • Search the entire subtree rooted at the context named by name

    • Search the context implementation-defined subtree rooted at the context named by name.

  2. Whether XFN links are followed during the search

  3. A limit on the number of names returned

  4. Whether the reference associated with the named object is returned

  5. Which attributes associated with the named object are returned

The filter expression is evaluated against the attributes of the objects bound in the scope of the search. The filter evaluates to either true or false.

 
 
 
  Previous   Contents   Next