OpenTP1 Version 7 Programming Reference C Language
Create a service function (SPP)
Format
ANSI C, C++
void function-name (char *in, DCULONG *in_len, char *out, DCULONG *out_len) { Service processing } |
K&R C
void function-name (in, in_len, out, out_len) char *in; DCULONG *in_len; char *out; DCULONG *out_len; { Service processing } |
Description
The SPP service function executes a service and returns the execution results. The SPP service function is called by the function dc_rpc_call() of the client UAP. Create the service function in the above format as required.
The service function name corresponds to the entry point name of the service function. Specify this correspondence at execution environment setup for a UAP. The method of execution environment setup for a UAP is as follows:
Argument specification
The values listed below are passed as arguments to the service function. These values are specified in the function dc_rpc_call() of the client UAP.
For the service function, set the following values for arguments:
A response is sent to the service client UAP regardless of whether the service function was executed as a transaction or whether commitment or rollback processing was executed. Create a response with which the service function informs the client UAP of the occurrence of an error if necessary.
Arguments whose values are passed from the client UAP
in
The input parameter specified in the client UAP is passed.
in_len
The input parameter length specified in the client UAP is passed.
out_len
The response length specified in the client UAP is passed.
Arguments whose values are set in the UAP
out
Specify the response from the service function. Return the service function after specifying the processing results for out.
out_len
Specify the length of the actual response from the service function. Set a numeric value which is equal to or smaller than the out_len value passed from the client UAP.
Notes on service function processing
Relationship between transactions and the service function
The service function is executed as a transaction branch upon the request of a service in the following case:
In the above case, do not use the function dc_trn_begin() in the service function.
Commitment or rollback processing is ensured for all global transaction services. When the service function operating as a transaction branch issues return, the service function is assumed to request normal termination of the transaction branch.
The service function is not executed as a transaction in the following case:
To execute the service function as a transaction, use the function dc_trn_begin() and the function dc_trn_unchained_commit() from the service function at any time in order to start the transaction and acquire a synchronization point.
When no transaction attribute is specified in the user service definition, the service function cannot be executed as a transaction by using the function dc_trn_begin() from the service function.
Return value
No return value. The value specified with return() is not returned to the client UAP. OpenTP1 does not also reference any return value. Specifying -1 as a return value does not request rollback processing.
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.