Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  Interfaces for Writing XFN Applications The Base Context Interface Lookup and List Contexts List Bindings  Previous   Contents   Next 
   
 

Lookup Link

This operation returns the XFN link bound to name. The terminal atomic part of name must be bound to an XFN link.

FN_ref_t *fn_ctx_lookup_link(
    FN_ctx_t *ctx,
    const FN_composite_name_t *name,
    FN_status_t *status);

The normal fn_ctx_lookup() operation follows all XFN links encountered, including any that are bound to the terminal atomic part of name. This operation differs from the normal lookup in that when the terminal atomic part of name is an XFN link, this last link is not followed, and the operation returns the link.

Updating Bindings

fn_ctx_bind
fn_ctx_unbind
fn_ctx_rename

Bindings can be added, overwritten, removed, or renamed.

Bind

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

int fn_ctx_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 nonzero and name is already bound, the operation fails. If exclusive is zero, the new binding replaces any existing binding.

The value of ref cannot be NULL. If you want to reserve a name using the fn_ctx_bind() operation, bind a reference containing no address. This reference can be naming service-specific or it can be the conventional NULL reference.

Unbind

This operation removes the terminal atomic name in name from the target context--that named by all but the terminal atomic part of name.

int fn_ctx_unbind(
    FN_ctx_t *ctx,
    const   FN_composite_name_t *name,
    FN_status_t *status);

This operation is successful even if the terminal atomic name was not bound in target context, but fails if any of the intermediate names are not bound. fn_ctx_unbind() operations are idempotent.

Rename

This operation binds the reference currently bound to oldname, resolved relative to ctx to newname, and unbinds oldname. The newname is resolved relative to the target context--that named by all but the terminal atomic part of oldname.

int fn_ctx_rename(
    FN_ctx_t *ctx,
    const FN_composite_name_t *oldname,
    const FN_composite_name_t *newname,
    unsigned int exclusive,
    FN_status_t *status);

If exclusive is zero, this operation overwrites any old binding of newname. If exclusive is nonzero, the operation fails if newname is already bound.

The only restriction that XFN places on newname is that it be resolved relative to the target context. For example, in some implementations, newname might be restricted to be a name in the same naming system as the terminal component of oldname. In another implementation, newname might be restricted to an atomic name.

Managing Contexts

fn_ctx_create_subcontext
fn_ctx_destroy_subcontext
fn_ctx_get_ref
fn_ctx_get_syntax_attrs
fn_ctx_handle_destroy
fn_ctx_equivalent_name

Contexts can be created, destroyed,and referenced.

Create Subcontext

This operation creates a new context of the same type as the target context--that named by all but the terminal atomic part of name--and binds it to the composite name name resolved relative to the context ctx, and returns a reference to the newly created context.

FN_ref_t *fn_ctx_create_subcontext(
    FN_ctx_t *ctx,
    const   FN_composite_name_t *name,
    FN_status_t *status);

As with the bind operation, 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 fails if the terminal atomic name already exists in the target context.

The new subcontext exports the context interface and is created in the same naming system as the target context. XFN does not specify any further properties of the new subcontext. Other properties of the subcontext are determined by the target context and its naming system.

Destroy Subcontext

This operation destroys the subcontext named by name, interpreted relative to ctx, and unbinds the name.

int fn_ctx_destroy_subcontext(
    FN_ctx_t *ctx,
    const FN_composite_name_t *name,
    FN_status_t *status);

As with the unbind operation, the operation succeeds if the terminal atomic name is not bound in the target context--that named by all but the terminal atomic part of name.

Some aspects of this operation are determined by the target context and its naming system. For example, XFN does not specify what happens if the named subcontext is not empty when the operation is invoked.

Get Reference to Context

This operation returns a reference to the supplied context object.
FN_ref_t *fn_ctx_get_ref(
    const FN_ctx_t *ctx,
    FN_status_t *status);

Get Syntax Attributes of Context

This operation returns the syntax attributes associated with the context named by name, relative to the context ctx.

FN_attrset_t *fn_ctx_get_syntax_attrs(
    FN_ctx_t *ctx,
    const   FN_composite_name_t *name,
    FN_status_t *status);

This operation is different from other XFN attribute operations in that these syntax attributes could be obtained directly from the context. Attributes obtained through other XFN attribute operations might not be associated with the context; they might be associated with the reference of the context, rather than with the context itself (see "Relationship to Naming Operations").

Destroy Context Handler

This operation destroys the context handle ctx and allows the implementation to free resources associated with the context handle. This operation does not affect the state of the context itself.
void fn_ctx_handle_destroy(FN_ctx_t *ctx);

Construct an Equivalent Name (Preliminary Specification)

Given the name of an object name relative to the context ctx, the operation returns an equivalent name for that object, relative to the same context ctx, that has leading_name as its initial atomic name. Two names are said to be equivalent if they have prefixes that resolve to the same context, and the parts of the names immediately following the prefixes are identical. For example, for user jsmith, the names "myself/service/calendar" is equivalent to "user/jsmith/service/calendar" when resolved relative to the Initial Context.

FN_composite_name_t *fn_ctx_equivalent_name(
    FN_ctx_t *ctx,
    const FN_composite_name_t *name,
    const FN_string_t *leading_name,
    FN_status_t *status);

If an equivalent name cannot be constructed, the value 0 is returned and the status argument set appropriately.

Base Attribute Interface

This section describes the operations in the base attribute interface. The interfaces to the objects used in operations in this interface are described in "Parameters Used in the Interface".

 
 
 
  Previous   Contents   Next