PreviousNext

Searching a Namespace

To obtain binding information from a namespace, a client can do one of the following:

· The client must call the import routines rpc_ns_binding_import_begin( ), rpc_ns_binding_import_next( ), and rpc_ns_binding_import_done( ) to obtain a binding handle for a compatible server.

· The client must call the lookup routines rpc_ns_binding_lookup_begin( ), rpc_ns_binding_lookup_next( ), and rpc_ns_binding_lookup_done( ) to obtain a list of binding handles for a compatible server. Select a binding handle from the list by calling either of the following:

- The NSI select routine rpc_ns_binding_select( ), which selects a binding handle at random

- A user-defined select routine, which implements an application-specific selection algorithm

· The client must use the automatic method of binding management to make the client stub transparently manage binding information.

In this case, the application code lacks any calls to the NSI interface. However, the automatic method does require the client to identify the directory service entry at which to begin the search for binding information. The client must specify the starting entry name as the value of the NSI-defined RPC_DEFAULT_ENTRY environment variable.

An NSI import or lookup operation searches server entries for a compatible server. On finding such a server entry, the search operation copies the server binding information associated with the requested interface and an object UUID. The search operation then creates a randomly ordered list of server binding handles to refer to the potential bindings represented by the binding information.

The following figure illustrates the use of a server binding handle to refer to server binding information selected by an import operation.


Importing Server Binding Information

The callouts in the figure refer to the following operations:

1. The import operation looks up binding information of a server that is compatible with the client.

The import operation finds a server entry based on the specified interface identifier, and then looks at the list of object UUIDs. If the importing client specifies a non-nil object UUID, the import operation looks for and returns that object UUID. If the client specifies the nil object UUID and the server entry contains any object UUIDs, the import operation selects and returns one UUID at random. If the entry lacks any object UUIDs, the import operation returns the nil UUID.

2. The import operation fetches the compatible binding information and creates a binding handle for each potential binding represented in the binding information.

3. The import operation then selects a binding handle at random and passes it to the client application.