Purpose
Frees data that was allocated by the Remote Procedure Call/eXternal Data Representation (RPC/XDR) system.
Library
C Library (libc.a)
Syntax
Description
The clnt_freeres macro frees data allocated by the RPC/XDR system. This data was allocated when the RPC/XDR system decoded the results of an RPC call.
Parameters
Item | Description |
---|---|
clnt | Points to the structure of the client handle. |
outproc | Specifies the XDR subroutine that describes the results in simple decoding primitives. |
out | Specifies the address where the results are placed. |
Purpose
Frees data that was allocated by the Remote Procedure Call/eXternal Data Representation (RPC/XDR) system.
Library
Network Services Library (libnsl.a)
Syntax
#include <rpc/rpc.h>
bool_t clnt_freeres (clnt, outproc, out)
CLIENT *clnt;
xdrpoc_t outproc;
caddr_t out;
Description
The clnt_freeres macro frees data allocated by the RPC/XDR system. This data is allocated when the RPC/XDR system decoded the results of an RPC call. You must specify the address of the results along with the procedure to decode it.
Parameters
Item | Description |
---|---|
clnt | Points to the structure of the client handle. |
outproc | Specifies the XDR subroutine that describes the results in simple decoding primitives. |
out | Specifies the address where the results are placed. |
Return Values
Item | Description |
---|---|
1 | successful |
0 | unsuccessful |
Examples
#include <stdlib.h>
#include <rpc/rpc.h>
#include <sys/types.h>
#include <sys/select.h>
int main()
{
rpcprog_t PROGNUM = 0x3fffffffL;
rpcvers_t PROGVER = 0x1L;
rpcproc_t procnum 0x1L;
CLIENT *clnt;
enum clnt_stat stat;
struct timeval timeout = {25,0};
char *nettype = "tcp";
char hostname[255] ; /* The Remote Host */
struct arguments{
unsigned int size;
char *data;
};
struct arguments input_arguments ;
struct arguments output_results ;
if ((clnt=clnt_create(hostname, PROGNUM, PROGVER, nettype))==NULL)
{
fprintf(stderr,"clnt_create() subroutine failed");
exit(1);
}
stat = clnt_call(clnt, procnum, (xdrproc_t)xdr_array,
(char *)&input_arguments, (xdrproc_t)xdr_array,
(char *)&output_results, timeout);
if(!clnt_freeres(clnt, (xdrproc_t)xdr_array,(caddr_t )&output_results))
{
fprintf(stderr,"clnt_freeres failed");
}
/* Destroy client handle in the end */
clnt_destroy(clnt);
return 0;
}