Federated Naming Service Programming Guide

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.