ReactOS  0.4.14-dev-77-gd9e7c48
clnt.h File Reference
#include "clnt_stat.h"
#include <rpc/auth.h>
#include <rpc/clnt_soc.h>
Include dependency graph for clnt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rpc_err
 
struct  __rpc_client
 
struct  __rpc_client::clnt_ops
 
struct  __cb_req
 
struct  rpc_timers
 
struct  rpc_createerr
 

Macros

#define RPCB_MULTICAST_ADDR   "ff02::202"
 
#define IS_UNRECOVERABLE_RPC(s)
 
#define re_errno   ru.RE_errno
 
#define re_why   ru.RE_why
 
#define re_vers   ru.RE_vers
 
#define re_lb   ru.RE_lb
 
#define FEEDBACK_REXMIT1   1 /* first retransmit */
 
#define FEEDBACK_OK   2 /* no retransmits */
 
#define CLCR_SET_LOWVERS   3
 
#define CLCR_GET_LOWVERS   4
 
#define RPCSMALLMSGSIZE   400 /* a more reasonable packet size */
 
#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)
 
#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs)
 
#define CLNT_ABORT(rh)   ((*(rh)->cl_ops->cl_abort)(rh))
 
#define clnt_abort(rh)   ((*(rh)->cl_ops->cl_abort)(rh))
 
#define CLNT_GETERR(rh, errp)   ((*(rh)->cl_ops->cl_geterr)(rh, errp))
 
#define clnt_geterr(rh, errp)   ((*(rh)->cl_ops->cl_geterr)(rh, errp))
 
#define CLNT_FREERES(rh, xres, resp)   ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
 
#define clnt_freeres(rh, xres, resp)   ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
 
#define CLNT_CONTROL(cl, rq, in)   ((*(cl)->cl_ops->cl_control)(cl,rq,in))
 
#define clnt_control(cl, rq, in)   ((*(cl)->cl_ops->cl_control)(cl,rq,in))
 
#define CLSET_TIMEOUT   1 /* set timeout (timeval) */
 
#define CLGET_TIMEOUT   2 /* get timeout (timeval) */
 
#define CLGET_SERVER_ADDR   3 /* get server's address (sockaddr) */
 
#define CLGET_FD   6 /* get connections file descriptor */
 
#define CLGET_SVC_ADDR   7 /* get server's address (netbuf) */
 
#define CLSET_FD_CLOSE   8 /* close fd while clnt_destroy */
 
#define CLSET_FD_NCLOSE   9 /* Do not close fd while clnt_destroy */
 
#define CLGET_XID   10 /* Get xid */
 
#define CLSET_XID   11 /* Set xid */
 
#define CLGET_VERS   12 /* Get version number */
 
#define CLSET_VERS   13 /* Set version number */
 
#define CLGET_PROG   14 /* Get program number */
 
#define CLSET_PROG   15 /* Set program number */
 
#define CLSET_SVC_ADDR   16 /* get server's address (netbuf) */
 
#define CLSET_PUSH_TIMOD   17 /* push timod if not already present */
 
#define CLSET_POP_TIMOD   18 /* pop timod */
 
#define CLSET_RETRY_TIMEOUT   4 /* set retry timeout (timeval) */
 
#define CLGET_RETRY_TIMEOUT   5 /* get retry timeout (timeval) */
 
#define CLSET_ASYNC   19
 
#define CLSET_CONNECT   20 /* Use connect() for UDP. (int) */
 
#define CLNT_DESTROY(rh)   ((*(rh)->cl_ops->cl_destroy)(rh))
 
#define clnt_destroy(rh)   ((*(rh)->cl_ops->cl_destroy)(rh))
 
#define RPCTEST_PROGRAM   ((rpcprog_t)1)
 
#define RPCTEST_VERSION   ((rpcvers_t)1)
 
#define RPCTEST_NULL_PROC   ((rpcproc_t)2)
 
#define RPCTEST_NULL_BATCH_PROC   ((rpcproc_t)3)
 
#define NULLPROC   ((rpcproc_t)0)
 
#define get_rpc_createerr()   (*(__rpc_createerr()))
 
#define rpc_createerr   (*(__rpc_createerr()))
 

Typedefs

typedef struct __rpc_client CLIENT
 
typedef struct __cb_req cb_req
 

Functions

__BEGIN_DECLS CLIENTclnt_create (const char *, const rpcprog_t, const rpcvers_t, const char *)
 
CLIENTclnt_create_timed (const char *, const rpcprog_t, const rpcvers_t, const char *, const struct timeval *)
 
CLIENTclnt_create_vers (const char *, const rpcprog_t, rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *)
 
CLIENTclnt_create_vers_timed (const char *, const rpcprog_t, rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *, const struct timeval *)
 
CLIENTclnt_tp_create (const char *, const rpcprog_t, const rpcvers_t, const struct netconfig *)
 
CLIENTclnt_tp_create_timed (const char *, const rpcprog_t, const rpcvers_t, const struct netconfig *, const struct timeval *)
 
CLIENTclnt_tli_create (const SOCKET, const struct netconfig *, struct netbuf *, const rpcprog_t, const rpcvers_t, const u_int, const u_int, int(*cb_xdr)(void *, void *), int(*cb)(void *, void *, void **), void *args)
 
CLIENTclnt_vc_create (const SOCKET, const struct netbuf *, const rpcprog_t, const rpcvers_t, u_int, u_int, int(*cb_xdr)(void *, void *), int(*cb)(void *, void *, void **), void *args)
 
CLIENTclntunix_create (struct sockaddr_un *, u_long, u_long, int *, u_int, u_int)
 
CLIENTclnt_dg_create (const SOCKET, const struct netbuf *, const rpcprog_t, const rpcvers_t, const u_int, const u_int)
 
CLIENTclnt_raw_create (rpcprog_t, rpcvers_t)
 
__END_DECLS __BEGIN_DECLS void clnt_pcreateerror (const char *)
 
charclnt_spcreateerror (const char *)
 
__END_DECLS __BEGIN_DECLS void clnt_perrno (enum clnt_stat)
 
charclnt_sperrno (enum clnt_stat)
 
__END_DECLS __BEGIN_DECLS void clnt_perror (CLIENT *, const char *)
 
charclnt_sperror (CLIENT *, const char *)
 
__BEGIN_DECLS struct rpc_createerr__rpc_createerr (void)
 
__BEGIN_DECLS enum clnt_stat rpc_call (const char *, const rpcprog_t, const rpcvers_t, const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t, char *, const char *)
 
__BEGIN_DECLS enum clnt_stat rpc_broadcast (const rpcprog_t, const rpcvers_t, const rpcproc_t, const xdrproc_t, caddr_t, const xdrproc_t, caddr_t, const resultproc_t, const char *)
 
enum clnt_stat rpc_broadcast_exp (const rpcprog_t, const rpcvers_t, const rpcproc_t, const xdrproc_t, caddr_t, const xdrproc_t, caddr_t, const resultproc_t, const int, const int, const char *)
 

Variables

__END_DECLS typedef bool_t(* resultproc_t )(caddr_t,...)
 

Macro Definition Documentation

◆ CLCR_GET_LOWVERS

#define CLCR_GET_LOWVERS   4

Definition at line 177 of file clnt.h.

◆ CLCR_SET_LOWVERS

#define CLCR_SET_LOWVERS   3

Definition at line 176 of file clnt.h.

◆ CLGET_FD

#define CLGET_FD   6 /* get connections file descriptor */

Definition at line 249 of file clnt.h.

◆ CLGET_PROG

#define CLGET_PROG   14 /* Get program number */

Definition at line 257 of file clnt.h.

◆ CLGET_RETRY_TIMEOUT

#define CLGET_RETRY_TIMEOUT   5 /* get retry timeout (timeval) */

Definition at line 266 of file clnt.h.

◆ CLGET_SERVER_ADDR

#define CLGET_SERVER_ADDR   3 /* get server's address (sockaddr) */

Definition at line 248 of file clnt.h.

◆ CLGET_SVC_ADDR

#define CLGET_SVC_ADDR   7 /* get server's address (netbuf) */

Definition at line 250 of file clnt.h.

◆ CLGET_TIMEOUT

#define CLGET_TIMEOUT   2 /* get timeout (timeval) */

Definition at line 247 of file clnt.h.

◆ CLGET_VERS

#define CLGET_VERS   12 /* Get version number */

Definition at line 255 of file clnt.h.

◆ CLGET_XID

#define CLGET_XID   10 /* Get xid */

Definition at line 253 of file clnt.h.

◆ CLNT_ABORT

#define CLNT_ABORT (   rh)    ((*(rh)->cl_ops->cl_abort)(rh))

Definition at line 211 of file clnt.h.

◆ clnt_abort

#define clnt_abort (   rh)    ((*(rh)->cl_ops->cl_abort)(rh))

Definition at line 212 of file clnt.h.

◆ CLNT_CALL

#define CLNT_CALL (   rh,
  proc,
  xargs,
  argsp,
  xres,
  resp,
  secs 
)
Value:
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
argsp, xres, resp, secs))
static HANDLE proc()
Definition: pdb.c:32

Definition at line 199 of file clnt.h.

◆ clnt_call

#define clnt_call (   rh,
  proc,
  xargs,
  argsp,
  xres,
  resp,
  secs 
)
Value:
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
argsp, xres, resp, secs))
static HANDLE proc()
Definition: pdb.c:32

Definition at line 202 of file clnt.h.

◆ CLNT_CONTROL

#define CLNT_CONTROL (   cl,
  rq,
  in 
)    ((*(cl)->cl_ops->cl_control)(cl,rq,in))

Definition at line 240 of file clnt.h.

◆ clnt_control

#define clnt_control (   cl,
  rq,
  in 
)    ((*(cl)->cl_ops->cl_control)(cl,rq,in))

Definition at line 241 of file clnt.h.

◆ CLNT_DESTROY

#define CLNT_DESTROY (   rh)    ((*(rh)->cl_ops->cl_destroy)(rh))

Definition at line 275 of file clnt.h.

◆ clnt_destroy

#define clnt_destroy (   rh)    ((*(rh)->cl_ops->cl_destroy)(rh))

Definition at line 276 of file clnt.h.

◆ CLNT_FREERES

#define CLNT_FREERES (   rh,
  xres,
  resp 
)    ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))

Definition at line 230 of file clnt.h.

◆ clnt_freeres

#define clnt_freeres (   rh,
  xres,
  resp 
)    ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))

Definition at line 231 of file clnt.h.

◆ CLNT_GETERR

#define CLNT_GETERR (   rh,
  errp 
)    ((*(rh)->cl_ops->cl_geterr)(rh, errp))

Definition at line 219 of file clnt.h.

◆ clnt_geterr

#define clnt_geterr (   rh,
  errp 
)    ((*(rh)->cl_ops->cl_geterr)(rh, errp))

Definition at line 220 of file clnt.h.

◆ CLSET_ASYNC

#define CLSET_ASYNC   19

Definition at line 267 of file clnt.h.

◆ CLSET_CONNECT

#define CLSET_CONNECT   20 /* Use connect() for UDP. (int) */

Definition at line 268 of file clnt.h.

◆ CLSET_FD_CLOSE

#define CLSET_FD_CLOSE   8 /* close fd while clnt_destroy */

Definition at line 251 of file clnt.h.

◆ CLSET_FD_NCLOSE

#define CLSET_FD_NCLOSE   9 /* Do not close fd while clnt_destroy */

Definition at line 252 of file clnt.h.

◆ CLSET_POP_TIMOD

#define CLSET_POP_TIMOD   18 /* pop timod */

Definition at line 261 of file clnt.h.

◆ CLSET_PROG

#define CLSET_PROG   15 /* Set program number */

Definition at line 258 of file clnt.h.

◆ CLSET_PUSH_TIMOD

#define CLSET_PUSH_TIMOD   17 /* push timod if not already present */

Definition at line 260 of file clnt.h.

◆ CLSET_RETRY_TIMEOUT

#define CLSET_RETRY_TIMEOUT   4 /* set retry timeout (timeval) */

Definition at line 265 of file clnt.h.

◆ CLSET_SVC_ADDR

#define CLSET_SVC_ADDR   16 /* get server's address (netbuf) */

Definition at line 259 of file clnt.h.

◆ CLSET_TIMEOUT

#define CLSET_TIMEOUT   1 /* set timeout (timeval) */

Definition at line 246 of file clnt.h.

◆ CLSET_VERS

#define CLSET_VERS   13 /* Set version number */

Definition at line 256 of file clnt.h.

◆ CLSET_XID

#define CLSET_XID   11 /* Set xid */

Definition at line 254 of file clnt.h.

◆ FEEDBACK_OK

#define FEEDBACK_OK   2 /* no retransmits */

Definition at line 172 of file clnt.h.

◆ FEEDBACK_REXMIT1

#define FEEDBACK_REXMIT1   1 /* first retransmit */

Definition at line 171 of file clnt.h.

◆ get_rpc_createerr

#define get_rpc_createerr ( )    (*(__rpc_createerr()))

Definition at line 503 of file clnt.h.

◆ IS_UNRECOVERABLE_RPC

#define IS_UNRECOVERABLE_RPC (   s)
Value:

Definition at line 83 of file clnt.h.

◆ NULLPROC

#define NULLPROC   ((rpcproc_t)0)

Definition at line 294 of file clnt.h.

◆ re_errno

#define re_errno   ru.RE_errno

Definition at line 109 of file clnt.h.

◆ re_lb

#define re_lb   ru.RE_lb

Definition at line 112 of file clnt.h.

◆ re_vers

#define re_vers   ru.RE_vers

Definition at line 111 of file clnt.h.

◆ re_why

#define re_why   ru.RE_why

Definition at line 110 of file clnt.h.

◆ rpc_createerr

Definition at line 504 of file clnt.h.

◆ RPCB_MULTICAST_ADDR

#define RPCB_MULTICAST_ADDR   "ff02::202"

Definition at line 77 of file clnt.h.

◆ RPCSMALLMSGSIZE

#define RPCSMALLMSGSIZE   400 /* a more reasonable packet size */

Definition at line 179 of file clnt.h.

◆ RPCTEST_NULL_BATCH_PROC

#define RPCTEST_NULL_BATCH_PROC   ((rpcproc_t)3)

Definition at line 288 of file clnt.h.

◆ RPCTEST_NULL_PROC

#define RPCTEST_NULL_PROC   ((rpcproc_t)2)

Definition at line 287 of file clnt.h.

◆ RPCTEST_PROGRAM

#define RPCTEST_PROGRAM   ((rpcprog_t)1)

Definition at line 285 of file clnt.h.

◆ RPCTEST_VERSION

#define RPCTEST_VERSION   ((rpcvers_t)1)

Definition at line 286 of file clnt.h.

Typedef Documentation

◆ cb_req

◆ CLIENT

Function Documentation

◆ __rpc_createerr()

__BEGIN_DECLS struct rpc_createerr* __rpc_createerr ( void  )

Definition at line 140 of file mt_misc.c.

141 {
142  struct rpc_createerr *rce_addr;
143 
145  if (rce_key == -1)
146  rce_key = TlsAlloc(); //thr_keycreate(&rce_key, free);
148 
149  rce_addr = (struct rpc_createerr *)thr_getspecific(rce_key);
150  if (!rce_addr) {
151  rce_addr = (struct rpc_createerr *)
152  malloc(sizeof (struct rpc_createerr));
153  if (!rce_addr ||
154  thr_setspecific(rce_key, (void *) rce_addr) == 0) {
155  if (rce_addr)
156  free(rce_addr);
157  return (&rpc_createerr);
158  }
159  memset(rce_addr, 0, sizeof (struct rpc_createerr));
160  }
161  return (rce_addr);
162 }
#define thr_setspecific(k, p)
Definition: reentrant.h:146
#define free
Definition: debug_ros.c:5
thread_key_t rce_key
Definition: mt_misc.c:94
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
mutex_t tsd_lock
Definition: mt_misc.c:86
#define thr_getspecific(k)
Definition: reentrant.h:147
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1088
#define malloc
Definition: debug_ros.c:4
#define memset(x, y, z)
Definition: compat.h:39

◆ clnt_create()

__BEGIN_DECLS CLIENT* clnt_create ( const char ,
const  rpcprog_t,
const  rpcvers_t,
const char  
)

Definition at line 179 of file clnt_generic.c.

181 {
182 
183  return (clnt_create_timed(hostname, prog, vers, nettype, NULL));
184 }
CLIENT * clnt_create_timed(const char *hostname, const rpcprog_t prog, const rpcvers_t vers, const char *netclass, const struct timeval *tp)
Definition: clnt_generic.c:195
char * prog
Definition: isohybrid.c:47
char * hostname
Definition: ftp.c:88
smooth NULL
Definition: ftsmooth.c:416

Referenced by rpc_call().

◆ clnt_create_timed()

CLIENT* clnt_create_timed ( const char ,
const  rpcprog_t,
const  rpcvers_t,
const char ,
const struct timeval  
)

Definition at line 195 of file clnt_generic.c.

197 {
198  struct netconfig *nconf;
199  CLIENT *clnt = NULL;
200  void *handle;
201  enum clnt_stat save_cf_stat = RPC_SUCCESS;
202  struct rpc_err save_cf_error;
203  char nettype_array[NETIDLEN];
204  char *nettype = &nettype_array[0];
205 
206  if (netclass == NULL)
207  nettype = NULL;
208  else {
209  size_t len = strlen(netclass);
210  if (len >= sizeof (nettype_array)) {
212  return (NULL);
213  }
214  strcpy(nettype, netclass);
215  }
216 
217  if ((handle = __rpc_setconf((char *)nettype)) == NULL) {
219  return (NULL);
220  }
222  while (clnt == NULL) {
223  if ((nconf = __rpc_getconf(handle)) == NULL) {
226  break;
227  }
228 #ifdef CLNT_DEBUG
229  printf("trying netid %s\n", nconf->nc_netid);
230 #endif
231  clnt = clnt_tp_create_timed(hostname, prog, vers, nconf, tp);
232  if (clnt)
233  break;
234  else {
235  /*
236  * Since we didn't get a name-to-address
237  * translation failure here, we remember
238  * this particular error. The object of
239  * this is to enable us to return to the
240  * caller a more-specific error than the
241  * unhelpful ``Name to address translation
242  * failed'' which might well occur if we
243  * merely returned the last error (because
244  * the local loopbacks are typically the
245  * last ones in /etc/netconfig and the most
246  * likely to be unable to translate a host
247  * name). We also check for a more
248  * meaningful error than ``unknown host
249  * name'' for the same reasons.
250  */
253  save_cf_stat = rpc_createerr.cf_stat;
254  save_cf_error = rpc_createerr.cf_error;
255  }
256  }
257  }
258 
259  /*
260  * Attempt to return an error more specific than ``Name to address
261  * translation failed'' or ``unknown host name''
262  */
265  (save_cf_stat != RPC_SUCCESS)) {
266  rpc_createerr.cf_stat = save_cf_stat;
267  rpc_createerr.cf_error = save_cf_error;
268  }
270  return (clnt);
271 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * prog
Definition: isohybrid.c:47
CLIENT * clnt_tp_create_timed(const char *hostname, const rpcprog_t prog, const rpcvers_t vers, const struct netconfig *nconf, const struct timeval *tp)
Definition: clnt_generic.c:295
struct netconfig * __rpc_getconf(void *vhandle)
Definition: rpc_generic.c:348
char * hostname
Definition: ftp.c:88
smooth NULL
Definition: ftsmooth.c:416
#define NETIDLEN
Definition: clnt_generic.c:81
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2883
enum clnt_stat cf_stat
Definition: clnt.h:496
char * nc_netid
Definition: netconfig.h:11
GLenum GLsizei len
Definition: glext.h:6722
Definition: clnt.h:95
void * __rpc_setconf(char *nettype) const
Definition: rpc_generic.c:305
struct rpc_err cf_error
Definition: clnt.h:497
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
void __rpc_endconf(void *vhandle)
Definition: rpc_generic.c:425
clnt_stat
Definition: clnt_stat.h:21
#define printf
Definition: config.h:203

Referenced by clnt_create(), and clnt_create_vers_timed().

◆ clnt_create_vers()

CLIENT* clnt_create_vers ( const char ,
const  rpcprog_t,
rpcvers_t ,
const  rpcvers_t,
const  rpcvers_t,
const char  
)

Definition at line 94 of file clnt_generic.c.

96 {
97 
98  return (clnt_create_vers_timed(hostname, prog, vers_out, vers_low,
99  vers_high, nettype, NULL));
100 }
char * prog
Definition: isohybrid.c:47
char * hostname
Definition: ftp.c:88
smooth NULL
Definition: ftsmooth.c:416
CLIENT * clnt_create_vers_timed(const char *hostname, const rpcprog_t prog, rpcvers_t *vers_out, const rpcvers_t vers_low_in, const rpcvers_t vers_high_in, const char *nettype, const struct timeval *tp)
Definition: clnt_generic.c:109

◆ clnt_create_vers_timed()

CLIENT* clnt_create_vers_timed ( const char ,
const  rpcprog_t,
rpcvers_t ,
const  rpcvers_t,
const  rpcvers_t,
const char ,
const struct timeval  
)

Definition at line 109 of file clnt_generic.c.

112 {
113  CLIENT *clnt;
114  struct timeval to;
115  enum clnt_stat rpc_stat;
116  struct rpc_err rpcerr;
117  rpcvers_t vers_high = vers_high_in;
118  rpcvers_t vers_low = vers_low_in;
119 
120  clnt = clnt_create_timed(hostname, prog, vers_high, nettype, tp);
121  if (clnt == NULL) {
122  return (NULL);
123  }
124  to.tv_sec = 10;
125  to.tv_usec = 0;
126  rpc_stat = clnt_call(clnt, NULLPROC, (xdrproc_t)xdr_void,
127  (char *)NULL, (xdrproc_t)xdr_void, (char *)NULL, to);
128  if (rpc_stat == RPC_SUCCESS) {
129  *vers_out = vers_high;
130  return (clnt);
131  }
132  while (rpc_stat == RPC_PROGVERSMISMATCH && vers_high > vers_low) {
133  unsigned int minvers, maxvers;
134 
135  clnt_geterr(clnt, &rpcerr);
136  minvers = rpcerr.re_vers.low;
137  maxvers = rpcerr.re_vers.high;
138  if (maxvers < vers_high)
139  vers_high = maxvers;
140  else
141  vers_high--;
142  if (minvers > vers_low)
143  vers_low = minvers;
144  if (vers_low > vers_high) {
145  goto error;
146  }
147  CLNT_CONTROL(clnt, CLSET_VERS, (char *)&vers_high);
148  rpc_stat = clnt_call(clnt, NULLPROC, (xdrproc_t)xdr_void,
149  (char *)NULL, (xdrproc_t)xdr_void,
150  (char *)NULL, to);
151  if (rpc_stat == RPC_SUCCESS) {
152  *vers_out = vers_high;
153  return (clnt);
154  }
155  }
156  clnt_geterr(clnt, &rpcerr);
157 
158 error:
159  rpc_createerr.cf_stat = rpc_stat;
160  rpc_createerr.cf_error = rpcerr;
161  clnt_destroy(clnt);
162  return (NULL);
163 }
#define clnt_geterr(rh, errp)
Definition: clnt.h:220
u_int32_t rpcvers_t
Definition: types.h:105
#define error(str)
Definition: mkdosfs.c:1605
CLIENT * clnt_create_timed(const char *hostname, const rpcprog_t prog, const rpcvers_t vers, const char *netclass, const struct timeval *tp)
Definition: clnt_generic.c:195
char * prog
Definition: isohybrid.c:47
char * hostname
Definition: ftp.c:88
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144
smooth NULL
Definition: ftsmooth.c:416
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2883
#define NULLPROC
Definition: clnt.h:294
enum clnt_stat cf_stat
Definition: clnt.h:496
bool_t xdr_void(void)
Definition: xdr.c:92
Definition: clnt.h:95
#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs)
Definition: clnt.h:202
#define CLSET_VERS
Definition: clnt.h:256
struct rpc_err cf_error
Definition: clnt.h:497
#define CLNT_CONTROL(cl, rq, in)
Definition: clnt.h:240
#define clnt_destroy(rh)
Definition: clnt.h:276
clnt_stat
Definition: clnt_stat.h:21

Referenced by clnt_create_vers().

◆ clnt_dg_create()

CLIENT* clnt_dg_create ( const  SOCKET,
const struct netbuf ,
const  rpcprog_t,
const  rpcvers_t,
const  u_int,
const  u_int 
)

Definition at line 154 of file clnt_dg.c.

161 {
162  CLIENT *cl = NULL; /* client handle */
163  struct cu_data *cu = NULL; /* private data */
164  struct timeval now;
165  struct rpc_msg call_msg;
166 #ifndef _WIN32
167  sigset_t mask;
168  sigset_t newmask;
169 #else
170  /* XXX Need Windows signal/event stuff here XXX */
171 #endif
172  struct __rpc_sockinfo si;
173  u_long one = 1;
174 
175 #ifndef _WIN32
176  sigfillset(&newmask);
177  thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
178 #else
179  /* XXX Need Windows signal/event stuff here XXX */
180 #endif
182  if (dg_fd_locks == (int *) NULL) {
183  int cv_allocsz;
184  size_t fd_allocsz;
185  int dtbsize = __rpc_dtbsize();
186 
187  fd_allocsz = dtbsize * sizeof (int);
188  dg_fd_locks = (int *) mem_alloc(fd_allocsz);
189  if (dg_fd_locks == (int *) NULL) {
191 // thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
192  goto err1;
193  } else
194  memset(dg_fd_locks, 0, fd_allocsz);
195 
196  cv_allocsz = dtbsize * sizeof (cond_t);
197  dg_cv = (cond_t *) mem_alloc(cv_allocsz);
198  if (dg_cv == (cond_t *) NULL) {
199  mem_free(dg_fd_locks, fd_allocsz);
200  dg_fd_locks = (int *) NULL;
202 // thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
203  goto err1;
204  } else {
205  int i;
206 
207  for (i = 0; i < dtbsize; i++)
208  cond_init(&dg_cv[i], 0, (void *) 0);
209  }
210  }
211 
213 // thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
214 
215  if (svcaddr == NULL) {
217  return (NULL);
218  }
219 
220  if (!__rpc_fd2sockinfo(fd, &si)) {
222  rpc_createerr.cf_error.re_errno = 0;
223  return (NULL);
224  }
225  /*
226  * Find the receive and the send size
227  */
228  sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz);
229  recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz);
230  if ((sendsz == 0) || (recvsz == 0)) {
231  rpc_createerr.cf_stat = RPC_TLIERROR; /* XXX */
232  rpc_createerr.cf_error.re_errno = 0;
233  return (NULL);
234  }
235 
236  if ((cl = mem_alloc(sizeof (CLIENT))) == NULL)
237  goto err1;
238  /*
239  * Should be multiple of 4 for XDR.
240  */
241  sendsz = ((sendsz + 3) / 4) * 4;
242  recvsz = ((recvsz + 3) / 4) * 4;
243  cu = mem_alloc(sizeof (*cu) + sendsz + recvsz);
244  if (cu == NULL)
245  goto err1;
246  (void) memcpy(&cu->cu_raddr, svcaddr->buf, (size_t)svcaddr->len);
247  cu->cu_rlen = svcaddr->len;
248  cu->cu_outbuf = &cu->cu_inbuf[recvsz];
249  /* Other values can also be set through clnt_control() */
250  cu->cu_wait.tv_sec = 15; /* heuristically chosen */
251  cu->cu_wait.tv_usec = 0;
252  cu->cu_total.tv_sec = -1;
253  cu->cu_total.tv_usec = -1;
254  cu->cu_sendsz = sendsz;
255  cu->cu_recvsz = recvsz;
256  cu->cu_async = FALSE;
257  cu->cu_connect = FALSE;
258  cu->cu_connected = FALSE;
259  (void) gettimeofday(&now, NULL);
260 // call_msg.rm_xid = __RPC_GETXID(&now);
261 
262  call_msg.rm_xid = ((u_int32_t)_getpid() ^ (u_int32_t)(&now)->tv_sec ^ (u_int32_t)(&now)->tv_usec);
263  call_msg.rm_call.cb_prog = program;
264  call_msg.rm_call.cb_vers = version;
265  xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, sendsz, XDR_ENCODE);
266  if (! xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) {
268  rpc_createerr.cf_error.re_errno = 0;
269  goto err2;
270  }
271  cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
272 
273  /* XXX fvdl - do we still want this? */
274 #if 0
275  (void)bindresvport_sa(fd, (struct sockaddr *)svcaddr->buf);
276 #endif
277 #ifdef IP_RECVERR
278  {
279  int on = 1;
280  setsockopt(fd, SOL_IP, IP_RECVERR, &on, sizeof(on));
281  }
282 #endif
284  /*
285  * By default, closeit is always FALSE. It is users responsibility
286  * to do a close on it, else the user may use clnt_control
287  * to let clnt_destroy do it for him/her.
288  */
289  cu->cu_closeit = FALSE;
290  cu->cu_fd = fd;
291  cl->cl_ops = clnt_dg_ops();
292  cl->cl_private = (caddr_t)(void *)cu;
293  cl->cl_auth = authnone_create();
294  cl->cl_tp = NULL;
295  cl->cl_netid = NULL;
296 
297  return (cl);
298 err1:
299  //warnx(mem_err_clnt_dg);
301  rpc_createerr.cf_error.re_errno = errno;
302 err2:
303  if (cl) {
304  mem_free(cl, sizeof (CLIENT));
305  if (cu)
306  mem_free(cu, sizeof (*cu) + sendsz + recvsz);
307  }
308  return (NULL);
309 }
u_int __rpc_get_t_size(int af, int proto, int size)
Definition: rpc_generic.c:139
u_int cu_xdrpos
Definition: clnt_dg.c:129
static int * dg_fd_locks
Definition: clnt_dg.c:91
int __rpc_dtbsize(void)
Definition: rpc_generic.c:110
#define XDR_GETPOS(xdrs)
Definition: xdr.h:199
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
unsigned long u_long
Definition: linux.h:269
#define cond_t
Definition: reentrant.h:120
int cu_connected
Definition: clnt_dg.c:135
static int fd
Definition: io.c:51
int cu_rlen
Definition: clnt_dg.c:124
SOCKET cu_fd
Definition: clnt_dg.c:121
int errno
#define cond_init(c, a, p)
Definition: reentrant.h:132
static cond_t * dg_cv
Definition: clnt_dg.c:93
XDR cu_outxdrs
Definition: clnt_dg.c:128
int cu_connect
Definition: clnt_dg.c:134
#define mutex_lock(m)
Definition: reentrant.h:128
int cu_async
Definition: clnt_dg.c:133
static double one
Definition: j0_y0.c:80
#define mutex_unlock(m)
Definition: reentrant.h:129
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define mem_alloc(bsize)
Definition: types.h:123
GLenum GLint GLuint mask
Definition: glext.h:6028
int __rpc_fd2sockinfo(SOCKET fd, struct __rpc_sockinfo *sip)
Definition: rpc_generic.c:481
time_t now
Definition: finger.c:65
_CRTIMP int __cdecl _getpid(void)
Definition: procid.c:7
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
Definition: sockctrl.c:421
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
#define ioctlsocket
Definition: main.c:40
AUTH * cl_auth
Definition: clnt.h:122
char * cl_tp
Definition: clnt.h:144
char cu_inbuf[1]
Definition: clnt_dg.c:136
struct timeval cu_total
Definition: clnt_dg.c:126
char * cu_outbuf
Definition: clnt_dg.c:131
u_int cu_recvsz
Definition: clnt_dg.c:132
struct sockaddr_storage cu_raddr
Definition: clnt_dg.c:123
enum clnt_stat cf_stat
Definition: clnt.h:496
#define thr_sigsetmask(f, n, o)
Definition: reentrant.h:148
u_int cu_sendsz
Definition: clnt_dg.c:130
Definition: xdr.h:85
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define FIONBIO
Definition: winsock.h:149
mutex_t clnt_fd_lock
Definition: mt_misc.c:50
static struct clnt_ops * clnt_dg_ops(void)
Definition: clnt_dg.c:823
char * cl_netid
Definition: clnt.h:143
#define caddr_t
Definition: ftp.c:24
GLuint program
Definition: glext.h:6723
bool_t cu_closeit
Definition: clnt_dg.c:122
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)
Definition: xdr_mem.c:94
AUTH * authnone_create()
Definition: auth_none.c:100
struct rpc_err cf_error
Definition: clnt.h:497
#define mem_free(ptr, bsize)
Definition: types.h:124
struct timeval cu_wait
Definition: clnt_dg.c:125
#define u_int32_t
Definition: icmp.c:103
void * cl_private
Definition: clnt.h:142
int bindresvport_sa(SOCKET sd, struct sockaddr *sa)
Definition: bindresvport.c:161
struct __rpc_client::clnt_ops * cl_ops
bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg)
Definition: rpc_prot.c:257
#define memset(x, y, z)
Definition: compat.h:39
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by clnt_tli_create().

◆ clnt_pcreateerror()

__END_DECLS __BEGIN_DECLS void clnt_pcreateerror ( const char )

◆ clnt_perrno()

__END_DECLS __BEGIN_DECLS void clnt_perrno ( enum  clnt_stat)

Definition at line 231 of file clnt_perror.c.

233 {
234  (void) fprintf(stderr, "%s\n", clnt_sperrno(num));
235 }
char * clnt_sperrno(enum clnt_stat stat)
Definition: clnt_perror.c:218
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLuint GLuint num
Definition: glext.h:9618
FILE * stderr

◆ clnt_perror()

__END_DECLS __BEGIN_DECLS void clnt_perror ( CLIENT ,
const char  
)

Definition at line 181 of file clnt_perror.c.

184 {
185 
186  if (rpch == NULL || s == NULL)
187  return;
188 
189  (void) fprintf(stderr, "%s\n", clnt_sperror(rpch,s));
190 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
char * clnt_sperror(CLIENT *rpch, const char *s)
Definition: clnt_perror.c:67
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
FILE * stderr

Referenced by pmap_getmaps().

◆ clnt_raw_create()

CLIENT* clnt_raw_create ( rpcprog_t  ,
rpcvers_t   
)

Definition at line 81 of file clnt_raw.c.

84 {
85  struct clntraw_private *clp;
86  struct rpc_msg call_msg;
87  XDR *xdrs;
88  CLIENT *client;
89 
91  clp = clntraw_private;
92  if (clp == NULL) {
93  clp = (struct clntraw_private *)calloc(1, sizeof (*clp));
94  if (clp == NULL) {
96  return NULL;
97  }
98  if (__rpc_rawcombuf == NULL)
100  (char *)calloc(UDPMSGSIZE, sizeof (char));
101  clp->_raw_buf = __rpc_rawcombuf;
102  clntraw_private = clp;
103  }
104  xdrs = &clp->xdr_stream;
105  client = &clp->client_object;
106  /*
107  * pre-serialize the static part of the call msg and stash it away
108  */
109  call_msg.rm_direction = CALL;
110  call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
111  /* XXX: prog and vers have been long historically :-( */
112  call_msg.rm_call.cb_prog = (u_int32_t)prog;
113  call_msg.rm_call.cb_vers = (u_int32_t)vers;
115  if (! xdr_callhdr(xdrs, &call_msg))
116  //warnx("clntraw_create - Fatal header serialization error.");
117  clp->mcnt = XDR_GETPOS(xdrs);
118  XDR_DESTROY(xdrs);
119 
120  /*
121  * Set xdrmem for client/server shared buffer
122  */
124 
125  /*
126  * create client handle
127  */
128  client->cl_ops = clnt_raw_ops();
129  client->cl_auth = authnone_create();
131  return (client);
132 }
#define XDR_GETPOS(xdrs)
Definition: xdr.h:199
Definition: rpc_msg.h:78
#define MCALL_MSG_SIZE
Definition: clnt_raw.c:52
static struct clnt_ops * clnt_raw_ops(void)
Definition: clnt_raw.c:288
char * prog
Definition: isohybrid.c:47
mutex_t clntraw_lock
Definition: mt_misc.c:53
static struct clntraw_private * clntraw_private
Definition: xdr.h:103
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
smooth NULL
Definition: ftsmooth.c:416
static FILE * client
Definition: client.c:41
CLIENT client_object
Definition: clnt_raw.c:58
char * __rpc_rawcombuf
Definition: svc_raw.c:73
Definition: xdr.h:85
#define RPC_MSG_VERSION
Definition: rpc_msg.h:66
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)
Definition: xdr_mem.c:94
AUTH * authnone_create()
Definition: auth_none.c:100
char mashl_callmsg[MCALL_MSG_SIZE]
Definition: clnt_raw.c:63
Definition: xdr.h:87
#define calloc
Definition: rosglue.h:14
#define u_int32_t
Definition: icmp.c:103
#define UDPMSGSIZE
Definition: svc_raw.c:49
union clntraw_private::@174 u
bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg)
Definition: rpc_prot.c:257
#define XDR_DESTROY(xdrs)
Definition: xdr.h:214
char * _raw_buf
Definition: clnt_raw.c:60

◆ clnt_spcreateerror()

char* clnt_spcreateerror ( const char )

◆ clnt_sperrno()

char* clnt_sperrno ( enum  clnt_stat)

Definition at line 218 of file clnt_perror.c.

220 {
221  unsigned int errnum = stat;
222 
223  if (errnum < (sizeof(rpc_errlist)/sizeof(rpc_errlist[0])))
224  /* LINTED interface problem */
225  return (char *)rpc_errlist[errnum];
226 
227  return ("RPC: (unknown error code)");
228 }
static const char *const rpc_errlist[]
Definition: clnt_perror.c:192
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345

Referenced by clnt_perrno(), clnt_spcreateerror(), and clnt_sperror().

◆ clnt_sperror()

char* clnt_sperror ( CLIENT ,
const char  
)

Definition at line 67 of file clnt_perror.c.

70 {
71  struct rpc_err e;
72  char *err;
73  char *str;
74  char *strstart;
75  size_t len, i;
76 
77  if (rpch == NULL || s == NULL)
78  return(0);
79 
80  str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
81  if (str == 0)
82  return (0);
84  strstart = str;
85  CLNT_GETERR(rpch, &e);
86 
87  if (snprintf(str, len, "%s: ", s) > 0) {
88  i = strlen(str);
89  str += i;
90  len -= i;
91  }
92 
93  (void)strncpy(str, clnt_sperrno(e.re_status), len - 1);
94  i = strlen(str);
95  str += i;
96  len -= i;
97 
98  switch (e.re_status) {
99  case RPC_SUCCESS:
100  case RPC_CANTENCODEARGS:
101  case RPC_CANTDECODERES:
102  case RPC_TIMEDOUT:
103  case RPC_PROGUNAVAIL:
104  case RPC_PROCUNAVAIL:
105  case RPC_CANTDECODEARGS:
106  case RPC_SYSTEMERROR:
107  case RPC_UNKNOWNHOST:
108  case RPC_UNKNOWNPROTO:
109  case RPC_PMAPFAILURE:
111  case RPC_FAILED:
112  break;
113 
114  case RPC_CANTSEND:
115  case RPC_CANTRECV:
116  snprintf(str, len, "; errno = %s", strerror(e.re_errno));
117  i = strlen(str);
118  if (i > 0) {
119  str += i;
120  len -= i;
121  }
122  break;
123 
124  case RPC_VERSMISMATCH:
125  snprintf(str, len, "; low version = %u, high version = %u",
126  e.re_vers.low, e.re_vers.high);
127  i = strlen(str);
128  if (i > 0) {
129  str += i;
130  len -= i;
131  }
132  break;
133 
134  case RPC_AUTHERROR:
135  err = auth_errmsg(e.re_why);
136  snprintf(str, len, "; why = ");
137  i = strlen(str);
138  if (i > 0) {
139  str += i;
140  len -= i;
141  }
142  if (err != NULL) {
143  snprintf(str, len, "%s",err);
144  } else {
145  snprintf(str, len,
146  "(unknown authentication error - %d)",
147  (int) e.re_why);
148  }
149  i = strlen(str);
150  if (i > 0) {
151  str += i;
152  len -= i;
153  }
154  break;
155 
157  snprintf(str, len, "; low version = %u, high version = %u",
158  e.re_vers.low, e.re_vers.high);
159  i = strlen(str);
160  if (i > 0) {
161  str += i;
162  len -= i;
163  }
164  break;
165 
166  default: /* unknown */
167  snprintf(str, len, "; s1 = %u, s2 = %u",
168  e.re_lb.s1, e.re_lb.s2);
169  i = strlen(str);
170  if (i > 0) {
171  str += i;
172  len -= i;
173  }
174  break;
175  }
176  strstart[CLNT_PERROR_BUFLEN-1] = '\0';
177  return(strstart) ;
178 }
#define RPC_PMAPFAILURE
Definition: clnt_stat.h:57
char * clnt_sperrno(enum clnt_stat stat)
Definition: clnt_perror.c:218
#define CLNT_PERROR_BUFLEN
Definition: clnt_perror.c:52
#define CLNT_GETERR(rh, errp)
Definition: clnt.h:219
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define snprintf
Definition: wintirpc.h:48
const char * strerror(int err)
Definition: compat_str.c:23
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define e
Definition: ke_i.h:82
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
static char * auth_errmsg(enum auth_stat)
Definition: clnt_perror.c:329
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
#define err(...)
Definition: clnt.h:95
static char * _buf(void)
Definition: clnt_perror.c:55

Referenced by clnt_perror().

◆ clnt_tli_create()

CLIENT* clnt_tli_create ( const  SOCKET,
const struct netconfig ,
struct netbuf ,
const  rpcprog_t,
const  rpcvers_t,
const  u_int,
const  u_int,
int(*)(void *, void *)  cb_xdr,
int(*)(void *, void *, void **)  cb,
void args 
)

Definition at line 347 of file clnt_generic.c.

353 {
354  CLIENT *cl; /* client handle */
355  bool_t madefd = FALSE; /* whether fd opened here */
356  long servtype;
357  BOOL one = TRUE;
358  struct __rpc_sockinfo si;
359  extern int __rpc_minfd;
360  SOCKET fd = fd_in;
361 
362  if (fd == RPC_ANYFD) {
363  if (nconf == NULL) {
365  return (NULL);
366  }
367 
368  fd = __rpc_nconf2fd(nconf);
369 
370  if (fd == INVALID_SOCKET)
371  goto err;
372 #if 0
373  if (fd < __rpc_minfd)
374  fd = __rpc_raise_fd(fd);
375 #endif
376  madefd = TRUE;
377  servtype = nconf->nc_semantics;
378  bindresvport(fd, NULL);
379  if (!__rpc_fd2sockinfo(fd, &si))
380  goto err;
381  } else {
382  if (!__rpc_fd2sockinfo(fd, &si))
383  goto err;
384  servtype = __rpc_socktype2seman(si.si_socktype);
385  if (servtype == -1) {
387  return (NULL);
388  }
389  }
390 
391  if (si.si_af != ((struct sockaddr *)svcaddr->buf)->sa_family) {
393  goto err1;
394  }
395 
396  switch (servtype) {
397  case NC_TPI_COTS:
398  cl = clnt_vc_create(fd, svcaddr, prog, vers, sendsz, recvsz,
399  callback_xdr, callback_function, callback_args);
400  break;
401  case NC_TPI_COTS_ORD:
402  if (nconf &&
403  ((strcmp(nconf->nc_protofmly, "inet") == 0) ||
404  (strcmp(nconf->nc_protofmly, "inet6") == 0))) {
405  setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const char *)&one,
406  sizeof (one));
407  }
408  cl = clnt_vc_create(fd, svcaddr, prog, vers, sendsz, recvsz,
409  callback_xdr, callback_function, callback_args);
410  break;
411  case NC_TPI_CLTS:
412  cl = clnt_dg_create(fd, svcaddr, prog, vers, sendsz, recvsz);
413  break;
414  default:
415  goto err;
416  }
417 
418  if (cl == NULL)
419  goto err1; /* borrow errors from clnt_dg/vc creates */
420  if (nconf) {
421  cl->cl_netid = strdup(nconf->nc_netid);
422  cl->cl_tp = strdup(nconf->nc_device);
423  } else {
424  cl->cl_netid = "";
425  cl->cl_tp = "";
426  }
427  if (madefd) {
429 /* (void) CLNT_CONTROL(cl, CLSET_POP_TIMOD, NULL); */
430  };
431 
432  return (cl);
433 
434 err:
436  rpc_createerr.cf_error.re_errno = errno;
437 err1: if (madefd)
438  (void)closesocket(fd);
439  return (NULL);
440 }
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int32_t bool_t
Definition: types.h:101
#define NC_TPI_CLTS
Definition: netconfig.h:30
char * prog
Definition: isohybrid.c:47
#define RPC_ANYFD
Definition: svc.h:328
int __rpc_socktype2seman(int)
Definition: rpc_generic.c:859
static int fd
Definition: io.c:51
int errno
#define CLSET_FD_CLOSE
Definition: clnt.h:251
static double one
Definition: j0_y0.c:80
#define TCP_NODELAY
Definition: tcpdef.h:117
int __rpc_fd2sockinfo(SOCKET fd, struct __rpc_sockinfo *sip)
Definition: rpc_generic.c:481
#define closesocket
Definition: main.c:39
unsigned int BOOL
Definition: ntddk_ex.h:94
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
#define NC_TPI_COTS_ORD
Definition: netconfig.h:32
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
Definition: sockctrl.c:421
int bindresvport(SOCKET sd, struct sockaddr_in *sin)
Definition: bindresvport.c:53
smooth NULL
Definition: ftsmooth.c:416
char * cl_tp
Definition: clnt.h:144
#define INVALID_SOCKET
Definition: winsock.h:332
enum clnt_stat cf_stat
Definition: clnt.h:496
#define NC_TPI_COTS
Definition: netconfig.h:31
CLIENT * clnt_vc_create(int fd, const struct netbuf *raddr, const rpcprog_t prog, const rpcvers_t vers, u_int sendsz, u_int recvsz, int *cb_xdr, int *cb_fn, void *cb_args)
Definition: clnt_vc.c:324
#define err(...)
SOCKET __rpc_nconf2fd(const struct netconfig *nconf)
Definition: rpc_generic.c:562
char * cl_netid
Definition: clnt.h:143
struct rpc_err cf_error
Definition: clnt.h:497
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CLIENT * clnt_dg_create(SOCKET fd, const struct netbuf *svcaddr, rpcprog_t program, rpcvers_t version, u_int sendsz, u_int recvsz)
Definition: clnt_dg.c:154
UINT_PTR SOCKET
Definition: winsock.h:47
#define CLNT_CONTROL(cl, rq, in)
Definition: clnt.h:240

Referenced by clnt_tp_create_timed(), get_client_for_netaddr(), and getclnthandle().

◆ clnt_tp_create()

CLIENT* clnt_tp_create ( const char ,
const  rpcprog_t,
const  rpcvers_t,
const struct netconfig  
)

Definition at line 282 of file clnt_generic.c.

284 {
285  return (clnt_tp_create_timed(hostname, prog, vers, nconf, NULL));
286 }
char * prog
Definition: isohybrid.c:47
CLIENT * clnt_tp_create_timed(const char *hostname, const rpcprog_t prog, const rpcvers_t vers, const struct netconfig *nconf, const struct timeval *tp)
Definition: clnt_generic.c:295
char * hostname
Definition: ftp.c:88
smooth NULL
Definition: ftsmooth.c:416

Referenced by _des_crypt_call(), and getkeyserv_handle().

◆ clnt_tp_create_timed()

CLIENT* clnt_tp_create_timed ( const char ,
const  rpcprog_t,
const  rpcvers_t,
const struct netconfig ,
const struct timeval  
)

Definition at line 295 of file clnt_generic.c.

297 {
298  struct netbuf *svcaddr; /* servers address */
299  CLIENT *cl = NULL; /* client handle */
300 
301  if (nconf == NULL) {
303  return (NULL);
304  }
305 
306  /*
307  * Get the address of the server
308  */
309  if ((svcaddr = __rpcb_findaddr_timed(prog, vers,
310  (struct netconfig *)nconf, (char *)hostname,
311  &cl, (struct timeval *)tp)) == NULL) {
312  /* appropriate error number is set by rpcbind libraries */
313  return (NULL);
314  }
315  if (cl == NULL) {
316  cl = clnt_tli_create(RPC_ANYFD, nconf, svcaddr,
317  prog, vers, 0, 0, NULL, NULL, NULL);
318  } else {
319  /* Reuse the CLIENT handle and change the appropriate fields */
320  if (CLNT_CONTROL(cl, CLSET_SVC_ADDR, (void *)svcaddr) == TRUE) {
321  if (cl->cl_netid == NULL)
322  cl->cl_netid = strdup(nconf->nc_netid);
323  if (cl->cl_tp == NULL)
324  cl->cl_tp = strdup(nconf->nc_device);
325  (void) CLNT_CONTROL(cl, CLSET_PROG, (void *)&prog);
326  (void) CLNT_CONTROL(cl, CLSET_VERS, (void *)&vers);
327  } else {
328  CLNT_DESTROY(cl);
329  cl = clnt_tli_create(RPC_ANYFD, nconf, svcaddr,
330  prog, vers, 0, 0, NULL, NULL, NULL);
331  }
332  }
333  free(svcaddr->buf);
334  free(svcaddr);
335  return (cl);
336 }
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define CLSET_SVC_ADDR
Definition: clnt.h:259
struct netbuf * __rpcb_findaddr_timed(rpcprog_t, rpcvers_t, const struct netconfig *, const char *host, CLIENT **clpp, struct timeval *tp)
Definition: rpcb_clnt.c:709
char * prog
Definition: isohybrid.c:47
#define RPC_ANYFD
Definition: svc.h:328
#define free
Definition: debug_ros.c:5
char * hostname
Definition: ftp.c:88
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
smooth NULL
Definition: ftsmooth.c:416
char * cl_tp
Definition: clnt.h:144
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2883
#define CLSET_PROG
Definition: clnt.h:258
enum clnt_stat cf_stat
Definition: clnt.h:496
char * nc_netid
Definition: netconfig.h:11
CLIENT * clnt_tli_create(const SOCKET fd_in, const struct netconfig *nconf, struct netbuf *svcaddr, const rpcprog_t prog, const rpcvers_t vers, const uint sendsz, const uint recvsz, int(*callback_xdr)(void *, void *), int(*callback_function)(void *, void *, void **), void *callback_args)
Definition: clnt_generic.c:347
char * nc_device
Definition: netconfig.h:16
char * cl_netid
Definition: clnt.h:143
#define CLNT_DESTROY(rh)
Definition: clnt.h:275
#define CLSET_VERS
Definition: clnt.h:256
Definition: types.h:144
#define CLNT_CONTROL(cl, rq, in)
Definition: clnt.h:240

Referenced by clnt_create_timed(), and clnt_tp_create().

◆ clnt_vc_create()

CLIENT* clnt_vc_create ( const  SOCKET,
const struct netbuf ,
const  rpcprog_t,
const  rpcvers_t,
u_int  ,
u_int  ,
int(*)(void *, void *)  cb_xdr,
int(*)(void *, void *, void **)  cb,
void args 
)

◆ clntunix_create()

CLIENT* clntunix_create ( struct sockaddr_un ,
u_long  ,
u_long  ,
int ,
u_int  ,
u_int   
)

◆ rpc_broadcast()

__BEGIN_DECLS enum clnt_stat rpc_broadcast ( const  rpcprog_t,
const  rpcvers_t,
const  rpcproc_t,
const  xdrproc_t,
caddr_t  ,
const  xdrproc_t,
caddr_t  ,
const  resultproc_t,
const char  
)

Definition at line 687 of file clnt_bcast.c.

698 {
699  enum clnt_stat dummy;
700 
701  dummy = rpc_broadcast_exp(prog, vers, proc, xargs, argsp,
702  xresults, resultsp, eachresult,
703  INITTIME, WAITTIME, nettype);
704  return (dummy);
705 }
char * prog
Definition: isohybrid.c:47
#define INITTIME
Definition: clnt_bcast.c:76
static HANDLE proc()
Definition: pdb.c:32
enum clnt_stat rpc_broadcast_exp(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc, xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults, caddr_t resultsp, resultproc_t eachresult, int inittime, int waittime, const char *nettype)
Definition: clnt_bcast.c:264
unsigned char dummy
Definition: maze.c:118
#define WAITTIME
Definition: clnt_bcast.c:77
clnt_stat
Definition: clnt_stat.h:21

◆ rpc_broadcast_exp()

enum clnt_stat rpc_broadcast_exp ( const  rpcprog_t,
const  rpcvers_t,
const  rpcproc_t,
const  xdrproc_t,
caddr_t  ,
const  xdrproc_t,
caddr_t  ,
const  resultproc_t,
const int  ,
const int  ,
const char  
)

Definition at line 264 of file clnt_bcast.c.

277 {
278  enum clnt_stat stat = RPC_SUCCESS; /* Return status */
279  XDR xdr_stream; /* XDR stream */
280  XDR *xdrs = &xdr_stream;
281  struct rpc_msg msg; /* RPC message */
282  struct timeval t;
283  char *outbuf = NULL; /* Broadcast msg buffer */
284  char *inbuf = NULL; /* Reply buf */
285  int inlen;
286  u_int maxbufsize = 0;
287  AUTH *sys_auth = authunix_create_default();
288  int i;
289  void *handle;
290  char uaddress[1024]; /* A self imposed limit */
291  char *uaddrp = uaddress;
292  int pmap_reply_flag; /* reply recvd from PORTMAP */
293  /* An array of all the suitable broadcast transports */
294  struct {
295  int fd; /* File descriptor */
296  int af;
297  int proto;
298  struct netconfig *nconf; /* Netconfig structure */
299  u_int asize; /* Size of the addr buf */
300  u_int dsize; /* Size of the data buf */
301  struct sockaddr_storage raddr; /* Remote address */
302  broadlist_t nal;
303  } fdlist[MAXBCAST];
304  struct pollfd pfd[MAXBCAST];
305  size_t fdlistno = 0;
306  struct r_rpcb_rmtcallargs barg; /* Remote arguments */
307  struct r_rpcb_rmtcallres bres; /* Remote results */
308  size_t outlen;
309  struct netconfig *nconf;
310  int msec;
311  int pollretval;
312  int fds_found;
313 
314 #ifdef PORTMAP
315  size_t outlen_pmap = 0;
316  u_long port; /* Remote port number */
317  int pmap_flag = 0; /* UDP exists ? */
318  char *outbuf_pmap = NULL;
319  struct rmtcallargs barg_pmap; /* Remote arguments */
320  struct rmtcallres bres_pmap; /* Remote results */
321  u_int udpbufsz = 0;
322 #endif /* PORTMAP */
323 
324  if (sys_auth == NULL) {
325  return (RPC_SYSTEMERROR);
326  }
327  /*
328  * initialization: create a fd, a broadcast address, and send the
329  * request on the broadcast transport.
330  * Listen on all of them and on replies, call the user supplied
331  * function.
332  */
333 
334  if (nettype == NULL)
335  nettype = "datagram_n";
336  if ((handle = __rpc_setconf(nettype)) == NULL) {
337  return (RPC_UNKNOWNPROTO);
338  }
339  while ((nconf = __rpc_getconf(handle)) != NULL) {
340  int fd;
341  struct __rpc_sockinfo si;
342 
343  if (nconf->nc_semantics != NC_TPI_CLTS)
344  continue;
345  if (fdlistno >= MAXBCAST)
346  break; /* No more slots available */
347  if (!__rpc_nconf2sockinfo(nconf, &si))
348  continue;
349 
350  TAILQ_INIT(&fdlist[fdlistno].nal);
351  if (__rpc_getbroadifs(si.si_af, si.si_proto, si.si_socktype,
352  &fdlist[fdlistno].nal) == 0)
353  continue;
354 
355  fd = socket(si.si_af, si.si_socktype, si.si_proto);
356  if (fd == INVALID_SOCKET) {
357  stat = RPC_CANTSEND;
358  continue;
359  }
360  fdlist[fdlistno].af = si.si_af;
361  fdlist[fdlistno].proto = si.si_proto;
362  fdlist[fdlistno].fd = fd;
363  fdlist[fdlistno].nconf = nconf;
364  fdlist[fdlistno].asize = __rpc_get_a_size(si.si_af);
365  pfd[fdlistno].events = POLLIN | POLLPRI |
367  pfd[fdlistno].fd = fdlist[fdlistno].fd = fd;
368  fdlist[fdlistno].dsize = __rpc_get_t_size(si.si_af, si.si_proto,
369  0);
370 
371  if (maxbufsize <= fdlist[fdlistno].dsize)
372  maxbufsize = fdlist[fdlistno].dsize;
373 
374 #ifdef PORTMAP
375  if (si.si_af == AF_INET && si.si_proto == IPPROTO_UDP) {
376  udpbufsz = fdlist[fdlistno].dsize;
377  if ((outbuf_pmap = malloc(udpbufsz)) == NULL) {
378  closesocket(fd);
380  goto done_broad;
381  }
382  pmap_flag = 1;
383  }
384 #endif /* PORTMAP */
385  fdlistno++;
386  }
387 
388  if (fdlistno == 0) {
389  if (stat == RPC_SUCCESS)
391  goto done_broad;
392  }
393  if (maxbufsize == 0) {
394  if (stat == RPC_SUCCESS)
395  stat = RPC_CANTSEND;
396  goto done_broad;
397  }
398  inbuf = malloc(maxbufsize);
399  outbuf = malloc(maxbufsize);
400  if ((inbuf == NULL) || (outbuf == NULL)) {
402  goto done_broad;
403  }
404 
405  /* Serialize all the arguments which have to be sent */
406  (void) gettimeofday(&t, NULL);
407  msg.rm_xid = __RPC_GETXID(&t);
408  msg.rm_direction = CALL;
409  msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
410  msg.rm_call.cb_prog = RPCBPROG;
411  msg.rm_call.cb_vers = RPCBVERS;
412  msg.rm_call.cb_proc = RPCBPROC_CALLIT;
413  barg.prog = prog;
414  barg.vers = vers;
415  barg.proc = proc;
416  barg.args.args_val = argsp;
417  barg.xdr_args = xargs;
418  bres.addr = uaddrp;
419  bres.results.results_val = resultsp;
420  bres.xdr_res = xresults;
421  msg.rm_call.cb_cred = sys_auth->ah_cred;
422  msg.rm_call.cb_verf = sys_auth->ah_verf;
423  xdrmem_create(xdrs, outbuf, maxbufsize, XDR_ENCODE);
424  if ((!xdr_callmsg(xdrs, &msg)) ||
425  (!xdr_rpcb_rmtcallargs(xdrs,
426  (struct rpcb_rmtcallargs *)(void *)&barg))) {
428  goto done_broad;
429  }
430  outlen = xdr_getpos(xdrs);
431  xdr_destroy(xdrs);
432 
433 #ifdef PORTMAP
434  /* Prepare the packet for version 2 PORTMAP */
435  if (pmap_flag) {
436  msg.rm_xid++; /* One way to distinguish */
437  msg.rm_call.cb_prog = PMAPPROG;
438  msg.rm_call.cb_vers = PMAPVERS;
439  msg.rm_call.cb_proc = PMAPPROC_CALLIT;
440  barg_pmap.prog = prog;
441  barg_pmap.vers = vers;
442  barg_pmap.proc = proc;
443  barg_pmap.args_ptr = argsp;
444  barg_pmap.xdr_args = xargs;
445  bres_pmap.port_ptr = &port;
446  bres_pmap.xdr_results = xresults;
447  bres_pmap.results_ptr = resultsp;
448  xdrmem_create(xdrs, outbuf_pmap, udpbufsz, XDR_ENCODE);
449  if ((! xdr_callmsg(xdrs, &msg)) ||
450  (! xdr_rmtcall_args(xdrs, &barg_pmap))) {
452  goto done_broad;
453  }
454  outlen_pmap = xdr_getpos(xdrs);
455  xdr_destroy(xdrs);
456  }
457 #endif /* PORTMAP */
458 
459  /*
460  * Basic loop: broadcast the packets to transports which
461  * support data packets of size such that one can encode
462  * all the arguments.
463  * Wait a while for response(s).
464  * The response timeout grows larger per iteration.
465  */
466  for (msec = inittime; msec <= waittime; msec += msec) {
467  struct broadif *bip;
468 
469  /* Broadcast all the packets now */
470  for (i = 0; i < fdlistno; i++) {
471  if (fdlist[i].dsize < outlen) {
472  stat = RPC_CANTSEND;
473  continue;
474  }
475  for (bip = TAILQ_FIRST(&fdlist[i].nal); bip != NULL;
476  bip = TAILQ_NEXT(bip, link)) {
477  void *addr;
478 
479  addr = &bip->broadaddr;
480 
481  __rpc_broadenable(fdlist[i].af, fdlist[i].fd,
482  bip);
483 
484  /*
485  * Only use version 3 if lowvers is not set
486  */
487 
488  if (!__rpc_lowvers)
489  if (sendto(fdlist[i].fd, outbuf,
490  outlen, 0, (struct sockaddr*)addr,
491  (size_t)fdlist[i].asize) !=
492  outlen) {
493 #ifdef RPC_DEBUG
494  perror("sendto");
495 #endif
496  warnx("clnt_bcast: cannot send"
497  "broadcast packet");
498  stat = RPC_CANTSEND;
499  continue;
500  };
501 #ifdef RPC_DEBUG
502  if (!__rpc_lowvers)
503  fprintf(stderr, "Broadcast packet sent "
504  "for %s\n",
505  fdlist[i].nconf->nc_netid);
506 #endif
507 #ifdef PORTMAP
508  /*
509  * Send the version 2 packet also
510  * for UDP/IP
511  */
512  if (pmap_flag &&
513  fdlist[i].proto == IPPROTO_UDP) {
514  if (sendto(fdlist[i].fd, outbuf_pmap,
515  outlen_pmap, 0, addr,
516  (size_t)fdlist[i].asize) !=
517  outlen_pmap) {
518  warnx("clnt_bcast: "
519  "Cannot send broadcast packet");
520  stat = RPC_CANTSEND;
521  continue;
522  }
523  }
524 #ifdef RPC_DEBUG
525  fprintf(stderr, "PMAP Broadcast packet "
526  "sent for %s\n",
527  fdlist[i].nconf->nc_netid);
528 #endif
529 #endif /* PORTMAP */
530  }
531  /* End for sending all packets on this transport */
532  } /* End for sending on all transports */
533 
534  if (eachresult == NULL) {
535  stat = RPC_SUCCESS;
536  goto done_broad;
537  }
538 
539  /*
540  * Get all the replies from these broadcast requests
541  */
542  recv_again:
543 
544  switch (pollretval = poll(pfd, fdlistno, msec)) {
545  case 0: /* timed out */
546  stat = RPC_TIMEDOUT;
547  continue;
548  case -1: /* some kind of error - we ignore it */
549  goto recv_again;
550  } /* end of poll results switch */
551 
552  for (i = fds_found = 0;
553  i < fdlistno && fds_found < pollretval; i++) {
554  bool_t done = FALSE;
555 
556  if (pfd[i].revents == 0)
557  continue;
558  else if (pfd[i].revents & POLLNVAL) {
559  /*
560  * Something bad has happened to this descri-
561  * ptor. We can cause _poll() to ignore
562  * it simply by using a negative fd. We do that
563  * rather than compacting the pfd[] and fdlist[]
564  * arrays.
565  */
566  pfd[i].fd = -1;
567  fds_found++;
568  continue;
569  } else
570  fds_found++;
571 #ifdef RPC_DEBUG
572  fprintf(stderr, "response for %s\n",
573  fdlist[i].nconf->nc_netid);
574 #endif
575  try_again:
576  inlen = recvfrom(fdlist[i].fd, inbuf, fdlist[i].dsize,
577  0, (struct sockaddr *)(void *)&fdlist[i].raddr,
578  &fdlist[i].asize);
579  if (inlen < 0) {
580  if (errno == EINTR)
581  goto try_again;
582  warnx("clnt_bcast: Cannot receive reply to "
583  "broadcast");
584  stat = RPC_CANTRECV;
585  continue;
586  }
587  if (inlen < sizeof (u_int32_t))
588  continue; /* Drop that and go ahead */
589  /*
590  * see if reply transaction id matches sent id.
591  * If so, decode the results. If return id is xid + 1
592  * it was a PORTMAP reply
593  */
594  if (*((u_int32_t *)(void *)(inbuf)) ==
595  *((u_int32_t *)(void *)(outbuf))) {
596  pmap_reply_flag = 0;
597  msg.acpted_rply.ar_verf = _null_auth;
598  msg.acpted_rply.ar_results.where =
599  (caddr_t)(void *)&bres;
600  msg.acpted_rply.ar_results.proc =
602 #ifdef PORTMAP
603  } else if (pmap_flag &&
604  *((u_int32_t *)(void *)(inbuf)) ==
605  *((u_int32_t *)(void *)(outbuf_pmap))) {
606  pmap_reply_flag = 1;
607  msg.acpted_rply.ar_verf = _null_auth;
608  msg.acpted_rply.ar_results.where =
609  (caddr_t)(void *)&bres_pmap;
610  msg.acpted_rply.ar_results.proc =
612 #endif /* PORTMAP */
613  } else
614  continue;
615  xdrmem_create(xdrs, inbuf, (u_int)inlen, XDR_DECODE);
616  if (xdr_replymsg(xdrs, &msg)) {
617  if ((msg.rm_reply.rp_stat == MSG_ACCEPTED) &&
618  (msg.acpted_rply.ar_stat == SUCCESS)) {
619  struct netbuf *np;
620 #ifdef PORTMAP
621  struct netbuf taddr;
622  struct sockaddr_in sin;
623 
624  if (pmap_flag && pmap_reply_flag) {
625  memcpy(&sin, &fdlist[i].raddr, sizeof(sin));
626  sin.sin_port = htons((u_short)port);
627  memcpy(&fdlist[i].raddr, &sin, sizeof(sin));
628  taddr.len = taddr.maxlen =
629  sizeof(fdlist[i].raddr);
630  taddr.buf = &fdlist[i].raddr;
631  done = (*eachresult)(resultsp,
632  &taddr, fdlist[i].nconf);
633  } else {
634 #endif /* PORTMAP */
635 #ifdef RPC_DEBUG
636  fprintf(stderr, "uaddr %s\n",
637  uaddrp);
638 #endif
639  np = uaddr2taddr(
640  fdlist[i].nconf, uaddrp);
641  done = (*eachresult)(resultsp,
642  np, fdlist[i].nconf);
643  free(np);
644 #ifdef PORTMAP
645  }
646 #endif /* PORTMAP */
647  }
648  /* otherwise, we just ignore the errors ... */
649  }
650  /* else some kind of deserialization problem ... */
651 
652  xdrs->x_op = XDR_FREE;
653  msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void;
654  (void) xdr_replymsg(xdrs, &msg);
655  (void) (*xresults)(xdrs, resultsp);
656  XDR_DESTROY(xdrs);
657  if (done) {
658  stat = RPC_SUCCESS;
659  goto done_broad;
660  } else {
661  goto recv_again;
662  }
663  } /* The recv for loop */
664  } /* The giant for loop */
665 
666 done_broad:
667  if (inbuf)
668  (void) free(inbuf);
669  if (outbuf)
670  (void) free(outbuf);
671 #ifdef PORTMAP
672  if (outbuf_pmap)
673  (void) free(outbuf_pmap);
674 #endif /* PORTMAP */
675  for (i = 0; i < fdlistno; i++) {
676  (void)closesocket(fdlist[i].fd);
677  __rpc_freebroadifs(&fdlist[i].nal);
678  }
679  AUTH_DESTROY(sys_auth);
681 
682  return (stat);
683 }
#define xdr_getpos(xdrs)
Definition: xdr.h:201
u_int __rpc_get_t_size(int af, int proto, int size)
Definition: rpc_generic.c:139
#define TAILQ_INIT(head)
Definition: queue.h:348
INT WSAAPI recvfrom(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags, OUT LPSOCKADDR from, IN OUT INT FAR *fromlen)
Definition: recv.c:87
struct sockaddr_storage broadaddr
Definition: clnt_bcast.c:141
#define PMAPPROG
Definition: pmap_prot.h:77
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
unsigned long u_long
Definition: linux.h:269
Definition: rpc_msg.h:78
int __rpc_broadenable(int af, int s, struct broadif *bip)
Definition: clnt_bcast.c:244
int32_t bool_t
Definition: types.h:101
#define NC_TPI_CLTS
Definition: netconfig.h:30
char * prog
Definition: isohybrid.c:47
#define free
Definition: debug_ros.c:5
#define EINTR
Definition: acclib.h:80
#define POLLRDBAND
Definition: clnt_bcast.c:83
GLdouble GLdouble t
Definition: gl.h:2047
#define PMAPPROC_CALLIT
Definition: pmap_prot.h:86
Definition: auth.h:205
#define warnx(...)
static int fd
Definition: io.c:51
static HANDLE proc()
Definition: pdb.c:32
struct netconfig * __rpc_getconf(void *vhandle)
Definition: rpc_generic.c:348
#define TAILQ_FIRST(head)
Definition: clnt_bcast.c:136
int errno
#define xdr_destroy(xdrs)
Definition: xdr.h:217
Definition: xdr.h:103
bool_t xdr_rmtcallres(XDR *xdrs, struct rmtcallres *crp)
Definition: pmap_rmt.c:153
AUTH * authunix_create_default()
Definition: auth_unix.c:198
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct opaque_auth _null_auth
void __rpc_freebroadifs(broadlist_t *list)
Definition: clnt_bcast.c:229
#define closesocket
Definition: main.c:39
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define RPCBPROG
Definition: rpcb_prot.h:626
smooth NULL
Definition: ftsmooth.c:416
struct netbuf * uaddr2taddr(const struct netconfig *nconf, const char *uaddr)
Definition: rpc_generic.c:619
#define PMAPVERS
Definition: pmap_prot.h:78
bool_t xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap)
Definition: pmap_rmt.c:119
bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
Definition: rpc_callmsg.c:50
bool_t xdr_rpcb_rmtcallres(XDR *xdrs, struct rpcb_rmtcallres *p)
Definition: rpcb_prot.c:322
#define POLLRDNORM
Definition: clnt_bcast.c:80
#define INVALID_SOCKET
Definition: winsock.h:332
struct opaque_auth ah_verf
Definition: auth.h:207
int poll(struct pollfd *ufds, int nfds, int timeout)
Definition: adnstest.c:68
enum xdr_op x_op
Definition: xdr.h:104
#define POLLIN
Definition: linux.h:1853
char * nc_netid
Definition: netconfig.h:11
Definition: linux.h:1867
bool_t xdr_rpcb_rmtcallargs(XDR *xdrs, struct rpcb_rmtcallargs *p)
Definition: rpcb_prot.c:270
#define POLLPRI
Definition: linux.h:1854
unsigned short u_short
Definition: types.h:81
uchar inbuf[M_BLOCK]
Definition: unzcrash.c:40
int __rpc_lowvers
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67
GLenum const GLvoid * addr
Definition: glext.h:9621
#define RPCBVERS
Definition: rpcb_prot.h:627
Definition: xdr.h:85
Definition: stat.h:55
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int u_int32_t
Definition: rosdhcp.h:35
#define TAILQ_NEXT(elm, field)
Definition: clnt_bcast.c:134
#define POLLNVAL
Definition: linux.h:1858
bool_t xdr_void(void)
Definition: xdr.c:92
#define RPC_MSG_VERSION
Definition: rpc_msg.h:66
void * __rpc_setconf(char *nettype) const
Definition: rpc_generic.c:305
#define caddr_t
Definition: ftp.c:24
UINT32 u_int
Definition: types.h:82
#define __RPC_GETXID(now)
Definition: rpc_com.h:58
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)
Definition: xdr_mem.c:94
INT WSAAPI sendto(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags, IN CONST struct sockaddr *to, IN INT tolen)
Definition: send.c:82
Definition: types.h:144
#define msg(x)
Definition: auth_time.c:54
Definition: xdr.h:87
struct opaque_auth ah_cred
Definition: auth.h:206
Definition: xdr.h:86
FILE * stderr
#define AF_INET
Definition: tcpip.h:117
#define malloc
Definition: debug_ros.c:4
void __rpc_endconf(void *vhandle)
Definition: rpc_generic.c:425
#define MAXBCAST
Definition: clnt_bcast.c:75
int __rpc_nconf2sockinfo(const struct netconfig *nconf, struct __rpc_sockinfo *sip)
Definition: rpc_generic.c:540
const WCHAR * link
Definition: db.cpp:988
unsigned long nc_semantics
Definition: netconfig.h:12
#define AUTH_DESTROY(auth)
Definition: auth.h:257
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
#define htons(x)
Definition: module.h:213
USHORT port
Definition: uri.c:227
bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
Definition: rpc_prot.c:188
__BEGIN_DECLS u_int __rpc_get_a_size(int)
Definition: rpc_generic.c:172
#define XDR_DESTROY(xdrs)
Definition: xdr.h:214
clnt_stat
Definition: clnt_stat.h:21
uchar outbuf[M_BLOCK_OUT]
Definition: unzcrash.c:41
#define RPCBPROC_CALLIT
Definition: rpcb_prot.h:694

Referenced by rpc_broadcast().

◆ rpc_call()

__BEGIN_DECLS enum clnt_stat rpc_call ( const char ,
const  rpcprog_t,
const  rpcvers_t,
const  rpcproc_t,
const  xdrproc_t,
const char ,
const  xdrproc_t,
char ,
const char  
)

Variable Documentation

◆ resultproc_t

__END_DECLS typedef bool_t(* resultproc_t) (caddr_t,...)

Definition at line 570 of file clnt.h.