rpc_ep_register(3) — Subroutines
NAME
rpc_ep_register - Adds to, or replaces, server address information in the local endpoint map
Used by server applications.
SYNOPSIS
#include <dce/rpc.h>
void rpc_ep_register(
rpc_if_handle_t if_handle ,
rpc_binding_vector_t ∗binding_vec ,
uuid_vector_t ∗object_uuid_vec ,
unsigned_char_t ∗annotation ,
unsigned32 ∗status );
PARAMETERS
Input
if_handleSpecifies an interface specification to register with the local endpoint map.
binding_vecSpecifies a vector of binding handles over which the server can receive remote procedure calls.
object_uuid_vecSpecifies a vector of object UUIDs that the server offers. The server application constructs this vector. Supply the value NULL to indicate there are no object UUIDs to register.
annotationDefines a character string comment applied to each cross-product element added to the local endpoint map. The string can be up to 64 characters long, including the null terminating character. Specify NULL or the string \0 if there is no annotation string. The string is used by applications for informational purposes only. The RPC runtime does not use this string to determine which server instance a client communicates with, or for enumerating endpoint map elements.
Output
statusReturns the status code from this routine. This status code indicates whether the routine completed successfully or, if not, why not. The possible status codes and their meanings are as follows:
rpc_s_okSuccess.
ept_s_cant_accessError reading endpoint database.
ept_s_cant_createError creating endpoint database.
ept_s_cant_perform_opCannot perform requested operation.
ept_s_database_invalidEndpoint map database invalid.
ept_s_invalid_entryInvalid database entry.
ept_s_update_failedUpdate failed.
rpc_s_comm_failureCommunications failure.
rpc_s_invalid_bindingInvalid binding handle.
rpc_s_invalid_if_handleInvalid interface handle.
rpc_s_no_bindingsNo bindings.
rpc_s_wrong_kind_of_binding
Wrong kind of binding for operation.
DESCRIPTION
The rpc_ep_register routine adds elements to, or replaces elements in, the local host’s endpoint map. For an existing map element that matches the provided interface specification, object UUID, and binding information exclusive of endpoint information, this routine replaces the element’s endpoint with the endpoint in the provided binding information.
Each element added to the local endpoint map logically contains the following:
•Interface ID, consisting of an interface UUID and versions (major and minor)
•Binding information
•Object UUID (optional)
•Annotation (optional)
A server uses this routine, instead of routine rpc_ep_register_no_replace, when only a single instance of the server runs on the server’s host. Use this routine if, at any time, no more than one server instance offers the same interface UUID, object UUID, and protocol sequence.
When local endpoint map elements are not replaced, obsolete elements accumulate each time a server instance stops running without calling routine rpc_ep_unregister. Periodically the RPC daemon (RPCD) identifies these obsolete elements and removes them. However, during the time between these removals the obsolete elements increase the chance that a client will receive endpoints to nonexistent servers. The client then wastes time trying to communicate with these servers before obtaining another endpoint.
Using this routine to replace any existing local endpoint map elements reduces the chance that a client will receive the endpoint of a nonexistent server instance.
A server program calls this routine to register endpoints that have been specified by calling any of the following routines:
•rpc_server_use_all_protseqs
•rpc_server_use_protseq
•rpc_server_use_protseq_ep
A server that calls only the rpc_server_use_all_protseqs_if or rpc_server_use_protseq_if routines does not need to call this routine. In such cases, the client’s runtime uses an endpoint from the client’s interface specification to fill in a partially bound binding handle. However, it is recommended that you also register well-known endpoints that the server specifies (registering endpoints from interface definitions is unnecessary).
If the server also exports to the name service database, the server calls this routine with the same if_handle, binding_vec and object_uuid_vec arguments as the server uses when calling the rpc_ns_binding_export routine.
Routine rpc_ep_register communicates with the RPC daemon (RPCD) which, in turn, communicates with the local endpoint map. The routine communicates using one of the protocol sequences specified in one of the binding handles in argument binding_vec. Attempting to register a binding that specifies a protocol sequence that the RPC daemon is not listening on results in the failure of routine rpc_ep_register. The routine indicates this failure by placing the value rpc_s_comm_failure into argument status.
For information on how the endpoint map service selects an element for an interface ID and an object UUID, see the NCS 2.0 Programmer’s Guide.
For an explanation of how a server can establish a client-server relationship without using the local endpoint map, see the explanation of a string binding in the rpc_intro(3) reference page.
This routine creates a cross-product from the if_handle, binding_vec and object_uuid_vec arguments, and adds each element in the cross-product as a separate registration in the local endpoint map.
For example, suppose that if_handle has the value ifhand, binding_vec has the values b1, b2, b3, and object_uuid_vec has the values u1, u2, u3, u4. The resulting 12 elements in the cross-product are as follows.
(ifhand,b1,u1) (ifhand,b1,u2) (ifhand,b1,u3) (ifhand,b1,u4)
(ifhand,b2,u1) (ifhand,b2,u2) (ifhand,b2,u3) (ifhand,b2,u4)
(ifhand,b3,u1) (ifhand,b3,u2) (ifhand,b3,u3) (ifhand,b3,u4)
(An annotation string is part of each of these 12 elements.)
RETURN VALUES
None.
RELATED INFORMATION
Functions: rpc_ep_register_no_replace(3), rpc_ep_resolve_binding(3), rpc_ep_unregister(3), rpc_mgmt_ep_unregister(3), rpc_ns_binding_export(3), rpc_server_inq_bindings(3), rpc_server_use_all_protseqs(3), rpc_server_use_all_protseqs_if(3), rpc_server_use_protseq(3), rpc_server_use_protseq_ep(3), rpc_server_use_protseq_if(3)