Federated Naming Service Programming Guide

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);