Federated Naming Service Programming Guide

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.