### Server Export

This topic lists the steps that the server must perform to set up and initialize its namespace. Each step consists of the NSI function that must be called to perform the operation.

1. uuid_create( )
To create an object UUID for each object that the server intends to export.

2. rpc_server_register_if( )
To register interface(s) and EPVs with the RPC runtime. (This is also where manager types, if any, are registered.)

3. rpc_server_use_all_protseqs( )
To request bindings from the RPC runtime for each object.

4. rpc_server_inq_bindings( )
To get the binding handles for each object.

5. rpc_ns_binding_export( )
To export the binding information of the objects' common server and the object UUIDs for each of the namespace objects to the server's own separate name entry. This step is performed only once for each collection of objects managed by the same server.
The final three steps set up the grouped collection of service objects. Note that the next two steps are executed once for each object managed by the server:

6. rpc_ns_binding_export( )
To export each object's object UUID to its own name entry. A NULL is passed as the binding_vec parameter to specify that only an object UUID, and no bindings are being exported.

Note that each object UUID must be exported to both the object name entry and the server entry; hence the need for this export operation in addition to the operation described in Step 5 above.

7. rpc_ns_group_mbr_add( )
To add the server's name entry (created in the first step) as the sole member of an NSI group attribute in each of the separate objects' name entries created in the second step.

8. rpc_ep_register( )
To register each object's UUID with the server's host machine's endpoint mapper. Note that rpc_ep_register( ) takes an object UUID vector as an argument, and generates from this all the necessary relationships between UUIDs and bindings; thus the call is made only once.
The point of this step is to make sure that when presented with an object UUID in an incoming RPC, the endpoint mapper can look that UUID up in its database and find an endpoint that has been registered with it. Registering the server's bindings (that is, endpoints) with all object UUIDs will accomplish this.

Step 6 above is made necessary by the way the ACL editor's binding mechanism works. (Applications gain access to the ACLs that an application maintains on its objects through the client agent acl_edit, which uses a standard DCE-wide interface for ACL operations.) The acl_edit mechanism contains code that allows it to bind to the server that implements the ACL manager responsible for the object whose ACL is desired. However, these generalized binding routines necessarily conform to certain fixed ways of doing things. If the acl_edit binding mechanism obtains an exported object's object UUID from the object entry, it will use that object UUID in its subsequent import through the group attribute.

Thus, the object UUID will be contained in the handle structure that the client presents to the rpc_ns_binding_import_next( ) call, expecting it to be filled in with binding information. However, the RPC runtime always tries to match such an input object UUID with a UUID contained in the entry that the caller is trying to import from. If no matching object UUID is found, no binding information will be returned. Thus, all the single object UUIDs separately exported to the object entries must be exported to the server entry as well, if the exported objects are to have ACLs accessible through the acl_edit mechanism.

The following figure illustrates the resulting namespace arrangement.

The Export Operation in a Model with Grouped Bindings

This generic server manages four objects, called simply A, B, C, and D. One entry is created for each of these objects, and a separate entry is created for the server itself, where the binding information is held.

The result of all this is that there is now one more namespace entry for a given service instance than there would have been with the object-oriented model discussed earlier. The group attribute in each entry is a level of indirection that allows the server to dispense with exporting many copies of the same thing.

If a directory with the proper permissions has been set up for it in the namespace by the system administrator, a server should be able to create the object entries simply by making the calls described here.

###