Next: Tutorials
Up: Contents
Previous: Interface
declarations in the
PowerRPC comes with a runtime library which provides much of the high level RPC functionalities. Here we list the ones which you may want to know about.
void pw_serv_init(void)
void pw_serv_mainloop(SVCXPRT*tcpsvc, SVCXPRT*udpsvc, int dofork, int exitidle)
void pw_serv_once(struct timeval *timeout)
Ask the server which is not started by pw_serv_mainloop() to serve pending RPC calls. If there is no pending calls, it waits for calls during the time period specified by timeout parameter.
The call returns after pending calls have been done, or timeout expires.
void pw_serv_async_enable(void)
void pw_serv_async_disable(void)
void pw_free_reference(xdrproc_t xdrfunc, void* ptr, u_int size)
Sometime, the underlying RPC mechanism allocates memory, a typical example is when an RPC function return a pointer. To free this memory, one needs to call this function. As in the following code segment,
T * pT; pT = foo() ; /* foo() is an RPC */ ... /*free it */ pw_free_reference(xdr_T, pT, sizeof(*pT);
void pw_serialize(FILE*fp, xdrproc_t xdrfunc, void* pdata, enum xdr_op op)
This function can be used to serialize/deserialize a C data structure to a file in a platform independent format. When op is XDR_ENCODE data is serialized to the file, when op is XDR_DECODE data is read from the file and the data structure is reconstructed in memory.
Tutorials