Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  Interfaces for Writing XFN Applications Extended Attribute Interface (Preliminary Specification) Attribute Search Interface Extended Search  Previous   Contents   Next 
   
 

The call to fn_attr_ext_search() initiates the search and, if successful, returns a handle to an FN_ext_searchlist_t object, esl, that is used to enumerate the names of the objects that satisfy the filter.

fn_ext_searchlist_next() returns the next name, and optionally, its reference and attributes, in the enumeration identified by esl. The name returned is a composite name, to be resolved relative to the starting context for the search. The starting context is the context named name relative to ctx, unless the scope of the search is only the named object. If the scope of the search is only the named object, the terminal atomic name is returned. Successive calls to fn_ext_searchlist_next() using esl return successive names, and optionally, references and attributes, in the enumeration and further update the state of the enumeration.

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

Object Creation with Attributes

fn_attr_bind
fn_attr_create_subcontext

At times it is useful or necessary to associate attributes with an object at the time the object is created. The XFN extended attribute interface contains functions that provide these capabilities. The two functions in this interface, fn_attr_bind() and fn_attr_create_subcontext(), are analogous to their counterparts in the base context interface, fn_ctx_bind() and fn_ctx_create_subcontext(), respectively, except that the versions in the extended attribute interface allow an extra parameter for specifying attributes to be associated with the new binding.

Bind with Attributes

This operation binds the supplied reference ref to the supplied composite name name relative to ctx, and associates the attributes specified in attrs with the named object. The binding is made in the target context--that context named by all but the terminal atomic part of name. The operation binds the terminal atomic part of name to the supplied reference in the target context. The target context must already exist.

int fn_attr_bind(
    FN_ctx_t *ctx,
    const FN_composite_name_t *name,
    const FN_ref_t *ref,
    unsigned int exclusive,
    FN_status_t *status);

The value of exclusive determines what happens if the terminal atomic part of the name is already bound in the target context. If exclusive is non-zero and name is already bound, the operation fails. If exclusive is zero, the new binding replaces any existing binding, and attrs, if not NULL, replaces any existing attributes associated with the named object.

Create Subcontext with Attributes

This operation creates a new XFN context of the same type as the target context--that named by all but the terminal atomic component of name--and binds it to the supplied composite name name. In addition, attributes given in attrs are associated with the newly created context. The target context must already exist. The new context is created and bound in the target context using the terminal atomic name in name. The operation returns a reference to the newly created context.

FN_ref_t *fn_attr_create_subcontext(
    FN_ctx_t *ctx,
    const FN_composite_name_t *name,
    const FN_attrset_t *attrs,
    FN_status_t *status);

Status Objects and Status Codes

The result statuses of operations in the context interface and the attribute interface are encapsulated in FN_status_t objects. The FN_status_t object contains information about how the operation completed: whether an error occurred in performing the operation, the nature of the error, and information that helps locate where the error occurred. If the error occurred while resolving an XFN link, the status object contains additional information about that error.

The status object contains several items of information as shown in Table 2-2.

Table 2-2 Status Object

Information Type

Description

Primary status code

An unsigned int code describing the disposition of the operation.

Resolved name

In the case of a failure during the resolution phase of the operation, this is the leading portion of the name that was resolved successfully. Resolution might have been successful beyond this point, but the error can not be pinpointed further.

Resolved reference

The reference to which the resolved name is bound.

Remaining name

The remaining unresolved portion of the name.

Diagnostic message

Any diagnostic message returned by the context implementation.

Link status code

If an error occurs while resolving an XFN link, the primary status code has the value FN_E_LINK_ERROR, and this code describes the error that occurred while resolving the XFN link.

Resolved link name

In the case of a link error, this contains the resolved portion of the name in the XFN link.

Resolved link reference

In the case of a link error, this contains the reference to which the resolved link name is bound.

Remaining link name

In the case of a link error, this contains the remaining resolved portion of the name in the XFN link.

Link diagnostic message

Any diagnostic message related to the resolution of the link.

Both the primary status code and the link status code are values of type unsigned int that are drawn from the same set of meaningful values. XFN reserves the values 0 through 127 for standard meanings. Currently, values and interpretations for the codes in Table 2-3are determined by XFN.

Table 2-3 Status Codes

Code

Meaning

FN_SUCCESS

The operation succeeded.

FN_E_ATTR_IN_USE

When an attribute is being modified using the operation FN_ATTR_OP_ADD_EXCLUSIVE and an attribute with the same identifier already exists, the operation fails with FN_E_ATTR_IN_USE.

FN_E_ATTR_NO_PERMISSION

The caller did not have permission to perform the attempted attribute operation.

FN_E_ATTR_VALUE_REQUIRED

The operation attempted to create an attribute without a value, and the specific naming system does not allow this.

FN_E_AUTHENTICATION_FAILURE

The identity of the client principal could not be verified.

FN_E_COMMUNICATION_FAILURE

An error occurred in communicating with one of the contexts involved in the operation.

FN_E_CONFIGURATION_ERROR

A problem was detected that indicated an error in the installation of the XFN interfaces.

FN_E_CONTINUE

The operation should be continued using the remaining name and the resolved reference returned in the status.

FN_E_CTX_NO_PERMISSION

The client did not have permission to perform the operation.

FN_E_CTX_NOT_EMPTY

Applies only to fn_ctx_destroy_subcontext(). The naming system required that the context be empty before its destruction, and it was not empty.

FN_E_CTX_UNAVAILABLE

Service could not be obtained from one of the contexts involved in the operation. This might be because the naming system is busy or is not providing service. In some implementations this might not be distinguished from a communication failure.

FN_E_ILLEGAL_NAME

The name supplied to the operation was not a well-formed composite name, or one of the component names was not well formed according to the syntax of the naming systems involved in its resolution.

FN_E_INCOMPATIBLE_CODE_SETS

The operation involved character strings of incompatible code sets or the supplied code set is not supported by the implementation.

FN_E_INCOMPATIBLE_LOCALES

The operation involved character strings of incompatible language or territory locale information, or the specified locale is not supported by the implementation.

FN_E_INSUFFICIENT_RESOURCES

Either the client or one of the involved contexts could not obtain sufficient resources (on memory, file descriptors, communication ports, stable media space, for example) to complete the operation successfully.

FN_E_INVALID_ATTR_IDENTIFIER

The attribute identifier was not in a format acceptable to the naming system, or its contents were not valid for the format specified for the identifier.

FN_E_INVALID_ATTR_VALUE

One of the values supplied was not in the appropriate form for the given attribute.

FN_E_INVALID_ENUM_HANDLE

The enumeration handle supplied was invalid, either because it was from another enumeration, because an update operation occurred during the enumeration, or for some other reason.

FN_E_INVALID_SYNTAX_ATTRS

The syntax attributes supplied are invalid or insufficient to fully specify the syntax.

FN_E_LINK_ERROR

An error occurred while resolving an XFN link encountered during resolution of the supplied name.

FN_E_LINK_LOOP_LIMIT

A nonterminating loop (cycle) in the resolution is suspected. This arises due to XFN links encountered during the resolution of a supplied composite name. This code indicates either the definite detection of such a cycle, or that resolution exceeded an implementation-defined limit on the number of XFN links allowed for a single operation invoked by the caller (and thus a cycle is suspected).

FN_E_MALFORMED_LINK

A malformed link reference was encountered. For fn_ctx_lookup_link(), the name supplied resolved to a reference that was not a link.

FN_E_MALFORMED_REFERENCE

A context object could not be constructed from the supplied reference because the reference was not properly formed.

FN_E_NAME_IN_USE

(Only for operations that bind names.) The supplied name was already in use.

FN_E_NAME_NOT_FOUND

Resolution of the supplied composite name proceeded to a context in which the next atomic component of the name was not bound.

FN_E_NO_EQUIVALENT_NAME

No equivalent name can be constructed, either because there is no meaningful equivalence between name and leading_name, or the system does not support constructing the requested equivalent name, for implementation-specific reasons.

FN_E_NO_SUCH_ATTRIBUTE

The object does not have an attribute with the given identifier.

FN_E_NO_SUPPORTED_ADDRESS

A context object could not be constructed from a particular reference. The reference contained no address type over which the context interface was supported.

FN_E_NOT_A_CONTEXT

Either one of the intermediate atomic names did not name a context, and resolution could not proceed beyond this point, or the operation required that the caller supply the name of a context, and the name did not resolve to a reference for a context.

FN_E_OPERATION_NOT_SUPPORTED

The operation attempted is not supported.

FN_E_PARTIAL_RESULT

The operation attempted is returning a partial result.

FN_E_SEARCH_INVALID_FILTER

The filter expression had a syntax error or some other problem.

FN_E_SEARCH_INVALID_OP

An operator in the filter expression is not supported or, if the operator is an extended operator, the number of types of arguments supplied does not match the signature of the operation.

FN_E_SEARCH_INVALID_OPTION

A supplied search control option could not be supported.

FN_E_SYNTAX_NOT_SUPPORTED

The syntax type specified is not supported.

FN_E_TOO_MANY_ATTR_VALUES

The operation attempted to associate more values with an attribute than the naming system supported.

FN_E_UNSPECIFIED_ERROR

An error occurred that could not be classified by any of the other error codes.

Parameters Used in the Interface

This section gives an overview of the types of parameters that are passed and returned by operations in the base context and attribute interfaces. Manipulation of these objects using their corresponding interfaces does not affect their representation in the underlying naming system.

Changes to objects in the underlying naming system can only be effected through the use of the interfaces described in "The Base Context Interface"and "Base Attribute Interface".

 
 
 
  Previous   Contents   Next