ReactOS 0.4.15-dev-7934-g1dc8d80
pmap_rmt.c File Reference
#include <wintirpc.h>
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
#include <rpc/pmap_rmt.h>
Include dependency graph for pmap_rmt.c:

Go to the source code of this file.

Functions

enum clnt_stat pmap_rmtcall (struct sockaddr_in *addr, u_long prog, u_long vers, u_long proc, xdrproc_t xdrargs, caddr_t argsp, xdrproc_t xdrres, caddr_t resp, struct timeval tout, u_long *port_ptr)
 
bool_t xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap)
 
bool_t xdr_rmtcallres (XDR *xdrs, struct rmtcallres *crp)
 

Variables

static const struct timeval timeout = { 3, 0 }
 

Function Documentation

◆ pmap_rmtcall()

enum clnt_stat pmap_rmtcall ( struct sockaddr_in addr,
u_long  prog,
u_long  vers,
u_long  proc,
xdrproc_t  xdrargs,
caddr_t  argsp,
xdrproc_t  xdrres,
caddr_t  resp,
struct timeval  tout,
u_long port_ptr 
)

Definition at line 73 of file pmap_rmt.c.

81{
82 int sock = -1;
84 struct rmtcallargs a;
85 struct rmtcallres r;
86 enum clnt_stat stat;
87
88 assert(addr != NULL);
90
91 addr->sin_port = htons(PMAPPORT);
93 if (client != NULL) {
94 a.prog = prog;
95 a.vers = vers;
96 a.proc = proc;
97 a.args_ptr = argsp;
98 a.xdr_args = xdrargs;
99 r.port_ptr = port_ptr;
100 r.results_ptr = resp;
101 r.xdr_results = xdrres;
104 &r, tout);
106 } else {
108 }
109 addr->sin_port = 0;
110 return (stat);
111}
#define stat
Definition: acwin.h:99
#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)
Definition: clnt.h:199
#define CLNT_DESTROY(rh)
Definition: clnt.h:275
__END_DECLS __BEGIN_DECLS CLIENT * clntudp_create(struct sockaddr_in *, u_long, u_long, struct timeval, int *)
clnt_stat
Definition: clnt_stat.h:21
@ RPC_FAILED
Definition: clnt_stat.h:68
#define NULL
Definition: types.h:112
u_int32_t rpcproc_t
Definition: types.h:106
#define assert(x)
Definition: debug.h:53
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum const GLvoid * addr
Definition: glext.h:9621
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
char * prog
Definition: isohybrid.c:47
#define htons(x)
Definition: module.h:215
static HANDLE proc()
Definition: pdb.c:34
#define PMAPPROC_CALLIT
Definition: pmap_prot.h:86
#define PMAPPORT
Definition: pmap_prot.h:76
#define PMAPVERS
Definition: pmap_prot.h:78
#define PMAPPROG
Definition: pmap_prot.h:77
bool_t xdr_rmtcallres(XDR *xdrs, struct rmtcallres *crp)
Definition: pmap_rmt.c:153
bool_t xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap)
Definition: pmap_rmt.c:119
static FILE * client
Definition: client.c:41
u_long * port_ptr
Definition: pmap_rmt.h:53
Definition: tcpcore.h:1455
Definition: stat.h:55
Definition: dhcpd.h:245
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144

◆ xdr_rmtcall_args()

bool_t xdr_rmtcall_args ( XDR xdrs,
struct rmtcallargs cap 
)

Definition at line 119 of file pmap_rmt.c.

122{
123 u_int lenposition, argposition, position;
124
125 assert(xdrs != NULL);
126 assert(cap != NULL);
127
128 if (xdr_u_long(xdrs, &(cap->prog)) &&
129 xdr_u_long(xdrs, &(cap->vers)) &&
130 xdr_u_long(xdrs, &(cap->proc))) {
131 lenposition = XDR_GETPOS(xdrs);
132 if (! xdr_u_long(xdrs, &(cap->arglen)))
133 return (FALSE);
134 argposition = XDR_GETPOS(xdrs);
135 if (! (*(cap->xdr_args))(xdrs, cap->args_ptr))
136 return (FALSE);
137 position = XDR_GETPOS(xdrs);
138 cap->arglen = (u_long)position - (u_long)argposition;
139 XDR_SETPOS(xdrs, lenposition);
140 if (! xdr_u_long(xdrs, &(cap->arglen)))
141 return (FALSE);
142 XDR_SETPOS(xdrs, position);
143 return (TRUE);
144 }
145 return (FALSE);
146}
bool_t xdr_u_long(XDR *xdrs, u_long *ulp)
Definition: xdr.c:186
UINT32 u_int
Definition: types.h:82
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned long u_long
Definition: linux.h:269
GLenum cap
Definition: glext.h:9639
#define XDR_SETPOS(xdrs, pos)
Definition: xdr.h:204
#define XDR_GETPOS(xdrs)
Definition: xdr.h:199

Referenced by rpc_broadcast_exp().

◆ xdr_rmtcallres()

bool_t xdr_rmtcallres ( XDR xdrs,
struct rmtcallres crp 
)

Definition at line 153 of file pmap_rmt.c.

156{
157 caddr_t port_ptr;
158
159 assert(xdrs != NULL);
160 assert(crp != NULL);
161
162 port_ptr = (caddr_t)(void *)crp->port_ptr;
163 if (xdr_reference(xdrs, &port_ptr, sizeof (u_long),
164 (xdrproc_t)xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) {
165 crp->port_ptr = (u_long *)(void *)port_ptr;
166 return ((*(crp->xdr_results))(xdrs, crp->results_ptr));
167 }
168 return (FALSE);
169}
#define caddr_t
Definition: ftp.c:24
char * caddr_t
Definition: rosdhcp.h:36
caddr_t results_ptr
Definition: pmap_rmt.h:55
u_long resultslen
Definition: pmap_rmt.h:54
xdrproc_t xdr_results
Definition: pmap_rmt.h:56
bool_t xdr_reference(XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc)
Definition: xdr_reference.c:62

Referenced by rpc_broadcast_exp().

Variable Documentation

◆ timeout

const struct timeval timeout = { 3, 0 }
static

Definition at line 63 of file pmap_rmt.c.