Renesas REJ10J1822-0101 Computer Hardware User Manual


 
Section 6 Definitions of Server Functions
Rev. 1.01 Mar. 17, 2008 Page 77 of 128
REJ10J1822-0101
Example 8
Specification of a server function
int func(struct INF *inf, struct ST *ptr);
ptr points to an array for output and inf indicates other input information, including a type-int
member count, which indicates the number of elements in the array pointed to by ptr. The return
value indicates the number of elements to be output.
Definition of the server function
int ret = func([IN PTR]struct INF *inf, [OUT ARY]struct ST *ptr,
[COUNT
]inf->count, [COUNT]ret );
(3) When the input/output keyword selected for ARY is INOUT
In this case, a parameter specification that includes ARY must be followed by two definitions of
COUNT to indicate the number of elements in the array.
<parameter including ARY>,<definition of first COUNT>,
<definition of second COUNT>
The first COUNT is the COUNT keyword followed by an expression that specifies the number of
elements in the array to be passed from the client to the server.
The second COUNT is the COUNT keyword followed by an expression that specifies the number
of elements in the array to be actually output by the server. This value must be less than or equal
to that specified for the first COUNT.
RPCGEN creates client-stub code that makes an RPC call after setting the size of an input IOVEC
structure by using an expression of the kind specified in figure 6.6. RPCGEN also creates server-
stub code that makes a server-function call before setting the size of an output IOVEC structure by
using an expression of the kind specified in figure 6.7. This must be taken into account in defining
the first and second COUNT. For example, an expression for the first COUNT must not contain
any variables that hold the return value of a function. Figures 6.6 and 6.7 show the code for
example 8 (without SVR_AUTH) of the examples introduced following the figures.