OpenTP1 Version 7 Programming Reference C Language
dc_rpc_call - Request a remote service
Format
ANSI C, C++
#include <dcrpc.h> int dc_rpc_call (char *group, char *service, char *in, DCULONG *in_len, char *out, DCULONG *out_len, DCLONG flags) |
K&R C
#include <dcrpc.h> int dc_rpc_call (group, service, in, in_len, out, out_len, flags) char *group; char *service; char *in; DCULONG *in_len; char *out; DCULONG *out_len; DCLONG flags; |
Description
The function dc_rpc_call() requests an SPP service. This function can be called without consideration of the node containing the requesting service.
Specify a service group name and service name as arguments of the function dc_rpc_call() to request a service. A service request is addressed to the service function corresponding to the specified names.
A UAP which calls the function dc_rpc_call() can be used regardless of whether it has been executed as a transaction. When a service is requested by the function dc_rpc_call() from the process which has been executed as a transaction, the requested service process runs as a transaction branch.
Before this function can be used, the OpenTP1 at the node containing the server UAP to which the service request is addressed must be active.
Receiving a signal while waiting for a response after execution of the function dc_rpc_call() does not cause the function to be returned.
The following items are described after the list of return values. See each description For details on the function dc_rpc_call().
(1) Arguments of the function dc_rpc_call()
(2) Error cases of the function dc_rpc_call()
(3) Timing when the function dc_rpc_call() results in error
(4) Specification for reexecuting the service request if the function dc_rpc_call() results in error
(5) When a priority is given to a service request
(6) Difference between return values DCRPCER_NO_SUCH_SERVICE_GROUP and DCRPCER_NET_DOWN
(7) Specification for returning the value DCRPCER_SERVICE_TERMINATED
(8) Relationship between return values and synchronization point processing
(9) Notes on requesting a service
(10) When a service is requested with domain qualification
Arguments whose values are set in the UAP
group
Specify the SPP service group name with an ASCII character string of up to 31 bytes. End the character string with a null character. The null character is not counted in the length of the character string.
When requesting a service with domain qualification, specify the service group name suffixed by an at mark (@) and the DNS domain name, and end the character string with a null character.
service
Specify the SPP service name with an ASCII character string of up to 31 bytes. End the character string with a null character. The null character is not counted in the length of the character string.
in
Specify the input parameter of the service.
in_len
Specify the input parameter length of the service within the range from 1 to DCRPC_MAX_MESSAGE_SIZE#. DCRPC_MAX_MESSAGE_SIZE is defined in dcrpc.h.
out
Specify the area for the response from the service function. This area will receive the response from the service function.
out_len
Specify the length of the response from the service function within the range from 1 to DCRPC_MAX_MESSAGE_SIZE#. DCRPC_MAX_MESSAGE_SIZE is defined in dcrpc.h.
#: If you used the rpc_max_message_size operand, the value of this data area is the value specified in the rpc_max_message_size operand and not the value of DCRPC_MAX_MESSAGE_SIZE (1 megabyte).
Even if the RPC is the non response-type, you must specify the address of the area for which the length of the response from the service is specified. If it is, the length of the response from the service must be 0.
flags
Specify the RPC mode and option in the following format:
{DCNOFLAGS|DCRPC_NOWAIT|DCRPC_NOREPLY|DCRPC_CHAINED} [|DCRPC_TPNOTRAN][|DCRPC_DOMAIN] |
Specify DCRPC_TPNOTRAN and/or DCRPC_DOMAIN together with the RPC mode.
DCNOFLAGS|DCRPC_TPNOTRAN |
DCNOFLAGS|DCRPC_TPNOTRAN|DCRPC_DOMAIN |
Arguments whose values are returned from server UAP
out
The response set by the service function is returned.
out_len
The length of the response set by the service function is returned.
Return values
The following return values are returned from the OpenTP1, not from the service function.
Return value | Return value (numeric) | Explanation |
---|---|---|
0 or positive integer | Normal termination. In the case of asynchronous response-type RPC, the positive integer is the descriptor. | |
DCRPCER_INVALID_ARGS | -301 | The value specified for the argument is invalid. |
DCRPCER_PROTO | -302 | The function dc_rpc_open() was not called. |
DCRPCER_NO_BUFS | -304 | A memory shortage occurred. Or, a service request was not accepted because a space shortage occurred in the message storage buffer pool (message_store_buflen operand) of the SPP to which the service was requested. If necessary, revise the message_store_buflen operand in the user service default definition or in the user service definition of the SPP to which the service was requested. |
DCRPCER_NET_DOWN | -306 | A communication failure occurred. Check if a network failure has occurred. |
DCRPCER_TIMED_OUT | -307 | The response wait time in the dc_rpc_call() function has elapsed. If necessary, revise the response wait time specified in the dc_rpc_call() function (watch_time operand and arguments in the dc_rpc_set_watch_time() function). |
The SPP to which the service was requested terminated abnormally during execution of a service function. Check the cause of abnormal termination of the SPP to which the service was requested. |
||
DCRPCER_MESSAGE_TOO_BIG | -308 | The input parameter length specified in in_len exceeded the maximum. If necessary, revise the in_len setting. |
DCRPCER_REPLY_TOO_BIG | -309 | The length of the response (out_len) set in the service function of the SPP to which the service was requested exceeded the response length (out_len) in the dc_rpc_call() function. If necessary, revise the response length (out_len) set in the service function of the SPP to which the service was requested. |
DCRPCER_NO_SUCH_SERVICE_GROUP | -310 | The service group name set in group is invalid, or the SPP to which the service was requested with the service group set in group was not running. If necessary, revise the group setting, or start the SPP to which the service was requested with the service group set in group. |
DCRPCER_NO_SUCH_SERVICE | -311 | The service name set in service is invalid, or the service name set in service by the SPP to which the service was requested has not been specified in the service operand in the user service definition file. If necessary, revise the service setting, or specify the service name set in service also in the service operand for the SPP to which the service was requested. |
DCRPCER_SERVICE_CLOSED | -312 | The SPP to which the service was requested with the service group set in group is under server shutdown or service shutdown status. Check the cause of the shutdown, and then release the SPP from shutdown status. |
DCRPCER_SERVICE_TERMINATING | -313 | The SPP to which the service was requested is under termination processing. |
DCRPCER_SERVICE_NOT_UP | -314 | The SPP to which the service was requested with the service group set in group is not running, or a communication failure might have occurred during the service request send processing. Start the SPP to which the service was requested with the service group set in group. If the SPP is already running, check to see if a network failure has occurred. |
While 0 was specified for the service request response time (watch_time operand and an argument in the dc_rpc_set_watch_time() function), the SPP to which the service was requested terminated abnormally during execution of a service function. Check the cause of abnormal termination of the SPP to which the service was requested. |
||
DCRPCER_OLTF_NOT_UP | -315 | OpenTP1 for the SPP to which the service was requested is not running. OpenTP1 might be under termination processing or a communication failure might have occurred during the service request send processing. Start OpenTP1 for the SPP to which the service was requested, or check for a network failure. |
DCRPCER_SYSERR_AT_SERVER | -316 | A system error (internal conflict) occurred in the SPP to which the service was requested. |
DCRPCER_NO_BUFS_AT_SERVER | -317 | A memory shortage occurred in the SPP to which the service was requested. |
DCRPCER_SYSERR | -318 | A system error (internal conflict) occurred in the UAP that requested the service. |
DCRPCER_INVALID_REPLY | -319 | The response length (out_len) set by a service function of the SPP to which the service was requested is outside the range from 1 to the value defined in DCRPC_MAX_MESSAGE_SIZE.# If necessary, revise the response length (out_len) in the service function of the SPP to which the service was requested. |
DCRPCER_OLTF_INITIALIZING | -320 | OpenTP1 for the SPP to which the service was requested is under start processing. |
DCRPCER_NO_BUFS_RB | -323 | A memory shortage occurred in the UAP that is requesting the service or the SPP to which the service was requested. When this value is returned, the transaction branch rolls back. Check whether unneeded memory was allocated by the UAP that is requesting the service, or by the SPP to which the service was requested. |
DCRPCER_SYSERR_RB | -324 | A system error (internal conflict) occurred in the UAP that requested the service. When this value is returned, the transaction branch rolls back. |
DCRPCER_SYSERR_AT_SERVER_RB | -325 | A system error (internal conflict) occurred in the SPP to which the service was requested. When this value is returned, the transaction branch rolls back. |
DCRPCER_REPLY_TOO_BIG_RB | -326 | The response length (out_len) set in the service function of the SPP to which the service was requested exceeded the response length (out_len) in the dc_rpc_call() function. When this value is returned, the transaction branch rolls back. If necessary, revise the response length (out_len) set in the service function of the SPP to which the service was requested. |
DCRPCER_TRNCHK | -327 | When the inter-node load-balancing facility and the extended internode load-balancing facility are used, the transaction attributes (atomic_update operand) do not match among the SPPs with the same service group name to which the service was requested. Another possibility is that the inter-node load-balancing facility and the extended internode load-balancing facility cannot be used because the version of OpenTP1 at the node to which loads are to be distributed is earlier than that of the OpenTP1 for the UAP that is requesting the service. This value is returned only when the service request is issued to an SPP that uses the inter-node load-balancing facility and the extended internode load-balancing facility. If necessary, revise the transaction attribute (atomic_update operand) of the SPP that uses the inter-node load-balancing facility and the extended internode load-balancing facility, or revise if necessary the version of OpenTP1. |
The dcsvgdef definition command was used to issue a service request to a user server with the non-transaction attribute (the atomic_update operand is N in the user service definition or the jnl_fileless_option operand is Y in the system common definition), but a disjunction with DCRPC_TPNOTRAN was not specified in the flags argument of the dc_rpc_call() function. If necessary, revise the dcsvgdef definition command or the flags argument of the dc_rpc_call() function. |
||
DCRPCER_NO_SUCH_DOMAIN | -328 | The domain name of the service group name with the domain qualification in group is invalid. If necessary, revise the domain name. |
DCRPCER_NO_PORT | -329 | A service was requested with a domain qualification in group, but the port number of the domain representative schedule service was not found. If necessary, revise the domain_masters_port operand setting in the system common definition and the port number setting for the domain representative schedule service in /etc/services. |
DCRPCER_SERVER_BUSY | -356 | The SPP to which the service was requested (on a server that receives requests through a socket) cannot receive the service request. If necessary, revise the max_socket_msg and max_socket_msglen operands in the user service definition or the user service default definition for the SPP to which the service was requested. |
DCRPCER_TESTMODE | -366 | When the online tester was being used, a service request was issued from a UAP in the test mode to an SPP in the nontest mode or from a UAP in the nontest mode to an SPP in the test mode. If necessary, revise the UAP's test mode setting. |
DCRPCER_NOT_TRN_EXTEND | -367 | The dc_rpc_call() function with DCRPC_TPNOTRAN set in flags was called to request a service after a chained RPC with the transaction attribute was executed. |
DCRPCER_SECCHK | -370 | The SPP to which the service was requested is protected by the security facility. The UAP that requested the service by executing the dc_rpc_call() function does not have permission to access the SPP to which the service was requested. If necessary, revise the access permissions for the SPP to which the service was requested. |
DCRPCER_TRNCHK_EXTEND | -372 | The transaction branch cannot be started because it exceeds the maximum number of transaction branches that can be activated concurrently in the OpenTP1 for the SPP to which the service was requested. If necessary, revise the setting in the trn_tran_process_count operand in the transaction service definition. |
The transaction branch cannot be started because it exceeds the maximum number of child transaction branches that can be activated from one transaction branch by the UAP that is requesting the service. If necessary, revise the setting in the trn_max_subordinate_count operand in the transaction service definition. |
||
DCRPC_TPNOTRAN is not specified for flags when a service with domain qualification specified in a transaction is requested. | ||
Transaction branching cannot start because the SPP to which the service was requested encountered a resource manager (RM) error. Eliminate the cause of the resource manager (RM) error, and then re-execute the function. |
||
In the System Environment window of TP1/LiNK, the Transaction Facility item is not set to Yes. If necessary, revise the Transaction Facility setting in the System Environment window of TP1/LiNK. |
||
DCRPCER_SERVICE_TERMINATED | -378 | The SPP to which the service was requested terminated abnormally during service function execution. If necessary, revise the service function processing of the SPP to which the service was requested. This value is returned only for a UAP that was requesting a service for which 00000001 was specified in the rpc_extend_function operand in the user service definition. If 0000000 is specified in the rpc_extend_function operand or if the operand is omitted, DCRPCER_TIMED_OUT or DCRPCER_SERVICE_NOT_UP is returned rather than this value. |
(1) Arguments of the function dc_rpc_call()
Arguments of the function dc_rpc_call() are explained below.
Values passed to server UAP
Allocate an area (out) for the response from the service function before requesting a service. The client UAP sets the following values in the function dc_rpc_call().
Values returned from server UAP
When the service function terminates and response is returned, the following values can be referenced:
The value of out_len is the length of the response which is actually returned from the service function. The values of out and out_len can be referenced in the following cases depending on the RPC mode:
If the function dc_rpc_call() or dc_rpc_poll_any_replies() returns with an error, the values of out and out_len cannot be referenced.
If the returned response is larger than the response area acquired by the client UAP, the function returns with an error, giving the return value DCRPCER_REPLY_TOO_BIG.
Value specified for flags
The value specified for flags and the execution result of the function dc_rpc_call() are explained below.
There are the following restrictions on the use of chained RPCs:
(2) Error cases of the function dc_rpc_call()
Reasons why the function dc_rpc_call() returns with an error are explained below.
If the OpenTP1 at the node containing the server UAP is not active
If the OpenTP1 to which the service request is addressed is not active, the function dc_rpc_call() returns with an error, giving one of the following return values:
If the server UAP is not active
When the server UAP is a multiserver, the service request is dealt with a new process which is activated by the OpenTP1 even if the server UAP is being terminated abnormally or being partially recovered. However, the function dc_rpc_call() returns with an error in the following cases:
When a service is requested in the environment for the internode load-balancing facility and the extended internode load-balancing facility
In the environment for the internode load-balancing facility and the extended internode load-balancing facility, if the schedule of the applicable service is closed, OpenTP1 automatically transfers a service request to another node. However, the function dc_rpc_call returns DCRPCER_TRNCHK, and control is returned due to an error under either of the following conditions:
When control is returned as a result of the foregoing error, take the following actions:
When a service request is addressed to the server that receives requests from socket
The server that receives requests from socket controls message congestion according to the specified values for max_socket_msg and max_socket_msglen in the user service definition. It is probable that service requests cannot be accepted if a message exceeds the defined value. In this case, the function dc_rpc_call() returns with an error, giving the return value DCRPCER_SERVER_BUSY. If this value is returned, the client UAP can sometimes reissue the service request successfully after waiting for a while.
When a chained RPC is used
If the function dc_rpc_call() which is not a transaction is called from the UAP using a chained RPC which is processed as a transaction to the same server UAP, the function dc_rpc_call() returns with an error, giving the return value DCRPCER_NOT_TRN_EXTEND.
When the online tester is used
If the online tester is in use and the function dc_rpc_call() is called from a UAP in test mode to a UAP in nontest mode or vice versa, the function dc_rpc_call() returns with an error, giving the return value DCRPCER_TESTMODE.
When the security facility is used
If the desired service is protected with the security facility when the function dc_rpc_call() is called and the client UAP which called the function does not have the access permission for the SPP, the function dc_rpc_call() returns with an error, giving the return value DCRPCER_SECCHK.
(3) Timing when the function dc_rpc_call() results in error
The following explains the timing when an error is returned to the client UAP if the SPP to which the service request is addressed terminates abnormally.
When the function dc_rpc_call() results in error due to time monitoring of the client UAP
In the following cases, the function dc_rpc_call() returns with an error, giving the return value DCRPCER_TIMED_OUT, after the time specified in the watch_time operand in the user service definition of the client UAP has elapsed:
(4) Specification for reexecuting the service request if the function dc_rpc_call() results in error
Even if the OpenTP1 to which the service request is issued is not active because it is being started or is engaged in system switching, you can have the OpenTP1 re-execute the requested search and service request transmission without treating the dc_rpc_call() function processing as an error.
To re-execute the requested search and service request transmission, specify Y in the rpc_retry operand in the system common definition. You use the rpc_retry_count and rpc_retry_interval operands to specify the re-execution count and re-execution interval, respectively, for a requested search and service request transmission. If this count value exceeds the re-execution count value specified in the system common definition, the dc_rpc_call() function returns with an error and sets one of the following status code values:
(5) When a priority is given to a service request
To specify a schedule priority for a service request, call the function dc_rpc_set_service_prio() immediately before the function dc_rpc_call(). If no schedule priority is specified, the priority of the service request is determined according to the default interpretation of the schedule service.
(6) Difference between return values DCRPCER_NO_SUCH_SERVICE_GROUP and DCRPCER_NET_DOWN
These return values are returned if the user server corresponding to the service group name is not found.
(7) Specification for returning the value DCRPCER_SERVICE_TERMINATED
You may want to determine whether the SPP that requested a service terminated abnormally before completion of processing based on a returned value other than DCRPCER_TIMED_OUT or DCRPCER_SERVICE_NOT_UP. If so, specify 00000001 in the rpc_extend_function operand of the user service definition. This specification returns DCRPCER_SERVICE_TERMINATED if the above error occurs. If 00000000 is specified in the rpc_extend_function operand, or the operand is omitted, DCRPCER_TIMED_OUT or DCRPCER_SERVICE _NOT_UP is returned rather than DCRPCER_SERVICE_TERMINATED.
(8) Relationship between error return values and synchronization point processing
The relationship between return values of the function dc_rpc_call() and synchronization point processing (commitment and rollback) is explained below. The description applies to the service request which is a transaction, rather than the service request which is not a transaction (including the case when DCRPC_TPNOTRAN is specified for flags).
When commitment is performed even though the function dc_rpc_call() returns with an error
The return value DCRPCER_TIMED_OUT may be returned due to abnormal termination of the service function which the service request is addressed, a node error, or network error. However, when the client UAP is not a transaction, the service function to which the service request is addressed may terminate normally and database may be updated.
Error return values which require rollback processing
If the function dc_rpc_call() called from a transaction returns with an error, some return values always require rollback processing for the transaction (the server UAP enters rollback_only state). In this case, rollback processing is always performed even if either of the commitment function or rollback function is used. The following return values of the function dc_rpc_call() always require rollback processing for the transaction:
(9) Notes on requesting a service
(10) When a service is requested with domain qualification
Specifying a service group name with domain qualification enables requesting an OpenTP1 service in the DNS domain. Specify the service group name suffixed by an at mark (@) and the DNS domain name for domain qualification.
Notes on requesting a service with domain qualification
Preparation for requesting a service with domain qualification
Perform the following environment setup for an RPC with domain qualification:
OpenTP1scd port-number/tcp |
Note
Assume that you want to perform a transactional RPC on an OpenTP1 system other than the domain specified in the all_node clause of the system common definition. In this case, you must ensure that the node identifiers (node_id clause of the system common definition) of all OpenTP1 systems in the local domain and remote domain are unique. In addition, all the OpenTP1 systems must be version 03-02 or later. If these conditions are not met, the transaction may not recover properly.
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.