#include <wintirpc.h>
#include <reentrant.h>
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rpc/rpc.h>
#include "rpc_com.h"
#include <getpeereid.h>
Go to the source code of this file.
|
static SVCXPRT * | makefd_xprt (SOCKET, u_int, u_int) |
|
static bool_t | rendezvous_request (SVCXPRT *, struct rpc_msg *) |
|
static enum xprt_stat | rendezvous_stat (SVCXPRT *) |
|
static void | svc_vc_destroy (SVCXPRT *) |
|
static void | __svc_vc_dodestroy (SVCXPRT *) |
|
static int | read_vc (void *, void *, int) |
|
static int | write_vc (void *, void *, int) |
|
static enum xprt_stat | svc_vc_stat (SVCXPRT *) |
|
static bool_t | svc_vc_recv (SVCXPRT *, struct rpc_msg *) |
|
static bool_t | svc_vc_getargs (SVCXPRT *, xdrproc_t, void *) |
|
static bool_t | svc_vc_freeargs (SVCXPRT *, xdrproc_t, void *) |
|
static bool_t | svc_vc_reply (SVCXPRT *, struct rpc_msg *) |
|
static void | svc_vc_rendezvous_ops (SVCXPRT *) |
|
static void | svc_vc_ops (SVCXPRT *) |
|
static bool_t | svc_vc_control (SVCXPRT *xprt, const u_int rq, void *in) |
|
static bool_t | svc_vc_rendezvous_control (SVCXPRT *xprt, const u_int rq, void *in) |
|
void | __xprt_set_raddr (SVCXPRT *xprt, const struct sockaddr_storage *ss) |
|
SVCXPRT * | svc_vc_create (int fd, u_int sendsize, u_int recvsize) |
|
SVCXPRT * | svc_fd_create (SOCKET fd, u_int sendsize, u_int recvsize) |
|
static int | write_vc (void *xprtp, char *buf, int len) |
|
int | __rpc_get_local_uid (SVCXPRT *transp, uid_t *uid) |
|
bool_t | __svc_clean_idle (fd_set *fds, int timeout, bool_t cleanblock) |
|
◆ __rpc_get_local_uid()
Definition at line 783 of file svc_vc.c.
783 {
789
795 *uid = euid;
797 } else
798 return (-1);
799}
static struct sockaddr_in sa
int getpeereid(int s, uid_t *euid, gid_t *egid)
◆ __svc_clean_idle()
Definition at line 820 of file svc_vc.c.
821{
824 struct timeval tv, tdiff, tmax;
826
828 tmax.tv_sec = tmax.tv_usec = 0;
836 continue;
838 if (!cleanblock && !
cd->nonblock)
839 continue;
843 tmax = tdiff;
844 least_active = xprt;
845 }
846 continue;
847 }
848 if (tv.tv_sec -
cd->last_recv_time.tv_sec >
timeout) {
851 ncleaned++;
852 }
853 }
854 }
858 ncleaned++;
859 }
862}
#define gettimeofday(tv, tz)
#define timercmp(tvp, uvp, cmp)
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
void __xprt_unregister_unlocked(SVCXPRT *)
const struct __rpc_svcxprt::xp_ops * xp_ops
static void __svc_vc_dodestroy(SVCXPRT *)
static bool_t svc_vc_recv(SVCXPRT *, struct rpc_msg *)
#define FD_ISSET(fd, set)
Referenced by rendezvous_request(), and svc_run().
◆ __svc_vc_dodestroy()
Definition at line 407 of file svc_vc.c.
409{
412
414
418
422 } else {
423
426 }
436}
#define mem_free(ptr, bsize)
GLdouble GLdouble GLdouble r
#define XDR_DESTROY(xdrs)
Referenced by __svc_clean_idle(), and svc_vc_destroy().
◆ __xprt_set_raddr()
◆ makefd_xprt()
Definition at line 252 of file svc_vc.c.
256{
259 const char *netid;
261
263
265
267 goto done;
268 }
269
272
273 goto done;
274 }
275 memset(xprt, 0,
sizeof *xprt);
278
281 goto done;
282 }
293
295done:
296 return (xprt);
297}
int __rpc_fd2sockinfo(SOCKET fd, struct __rpc_sockinfo *sip)
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
int __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **)
struct opaque_auth xp_verf
void xprt_register(SVCXPRT *xprt)
static void svc_vc_ops(SVCXPRT *)
static int read_vc(void *, void *, int)
static int write_vc(void *, void *, int)
void xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, int *void *, int *readit, int *writeit)
Referenced by rendezvous_request(), and svc_fd_create().
◆ read_vc()
Definition at line 480 of file svc_vc.c.
484{
487 int milliseconds = 35 * 1000;
490
493
495
497
499#ifdef _WIN32
501#else
503#endif
507 else
508 goto fatal_err;
509 }
513 }
514
515 do {
516#ifndef __REACTOS__
521#else
522
525
528
530 timeout.tv_usec = milliseconds * 1000;
531
533#endif
534 case -1:
536 continue;
537
538 case 0:
539 goto fatal_err;
540
541 default:
542 break;
543 }
544#ifndef __REACTOS__
546#else
548#endif
549
550#ifdef _WIN32
552#else
554#endif
557 }
558
559fatal_err:
561 return (-1);
562}
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
GLenum GLuint GLenum GLsizei const GLchar * buf
struct timeval last_recv_time
int PASCAL FAR WSAGetLastError(void)
Referenced by makefd_xprt().
◆ rendezvous_request()
Definition at line 301 of file svc_vc.c.
304{
306#ifndef _WIN32
308#endif
316
319
321again:
326 goto again;
327#ifndef __REACTOS__
328
329
330
331
335 goto again;
336 }
337#endif
339 }
340
341
342
343
345#ifdef __REACTOS__
346 if (!newxprt)
348#endif
349
352
354
357
359 }
360
362
363 cd->recvsize =
r->recvsize;
364 cd->sendsize =
r->sendsize;
365 cd->maxrec =
r->maxrec;
366
367#ifndef _WIN32
368 if (
cd->maxrec != 0) {
374 if (
cd->recvsize >
cd->maxrec)
375 cd->recvsize =
cd->maxrec;
378 } else
380#endif
381
383
385}
GLenum const GLvoid * addr
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
bool_t __xdrrec_setnonblock(XDR *, int)
struct netbuf * __rpc_set_netbuf(struct netbuf *, const void *, size_t)
static SVCXPRT * makefd_xprt(SOCKET, u_int, u_int)
void __xprt_set_raddr(SVCXPRT *xprt, const struct sockaddr_storage *ss)
bool_t __svc_clean_idle(fd_set *fds, int timeout, bool_t cleanblock)
Referenced by svc_vc_rendezvous_ops().
◆ rendezvous_stat()
◆ svc_fd_create()
Definition at line 204 of file svc_vc.c.
208{
212
214
218
221
222 goto freedata;
223 }
225
226 goto freedata;
227 }
228
231
232 goto freedata;
233 }
235
236 goto freedata;
237 }
238
239
241
243
244freedata:
245 if (
ret->xp_ltaddr.buf !=
NULL)
246 mem_free(
ret->xp_ltaddr.buf, rep->xp_ltaddr.maxlen);
247
249}
INT WSAAPI getpeername(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Referenced by svc_tli_create().
◆ svc_vc_control()
◆ svc_vc_create()
Definition at line 146 of file svc_vc.c.
150{
156
159
160 goto cleanup_svc_vc_create;
161 }
169
170 goto cleanup_svc_vc_create;
171 }
180
183
184 goto cleanup_svc_vc_create;
185 }
186
188
189 goto cleanup_svc_vc_create;
190 }
192 return (xprt);
193cleanup_svc_vc_create:
197}
struct opaque_auth _null_auth
u_int __rpc_get_t_size(int af, int proto, int size)
static void svc_vc_rendezvous_ops(SVCXPRT *)
Referenced by svc_tli_create().
◆ svc_vc_destroy()
◆ svc_vc_freeargs()
Definition at line 689 of file svc_vc.c.
693{
695
697
698
700
702 return ((*xdr_args)(
xdrs, args_ptr));
703}
Referenced by svc_vc_ops().
◆ svc_vc_getargs()
◆ svc_vc_ops()
Definition at line 728 of file svc_vc.c.
730{
731 static struct xp_ops ops;
732 static struct xp_ops2 ops2;
734
735
736
738 if (ops.xp_recv ==
NULL) {
746 }
750}
const struct __rpc_svcxprt::xp_ops2 * xp_ops2
static void svc_vc_destroy(SVCXPRT *)
static bool_t svc_vc_freeargs(SVCXPRT *, xdrproc_t, void *)
static bool_t svc_vc_reply(SVCXPRT *, struct rpc_msg *)
static enum xprt_stat svc_vc_stat(SVCXPRT *)
static bool_t svc_vc_getargs(SVCXPRT *, xdrproc_t, void *)
static bool_t svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in)
Referenced by makefd_xprt().
◆ svc_vc_recv()
Definition at line 647 of file svc_vc.c.
650{
653
656
659
663 }
664
668 cd->x_id =
msg->rm_xid;
670 }
673}
bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
bool_t __xdrrec_getrec(XDR *, enum xprt_stat *, bool_t)
bool_t xdrrec_skiprecord(XDR *xdrs)
Referenced by __svc_clean_idle(), and svc_vc_ops().
◆ svc_vc_rendezvous_control()
Definition at line 449 of file svc_vc.c.
453{
455
459 switch (rq) {
462 break;
465 break;
466 default:
468 }
470}
#define SVCGET_CONNMAXREC
#define SVCSET_CONNMAXREC
Referenced by svc_vc_rendezvous_ops().
◆ svc_vc_rendezvous_ops()
Definition at line 753 of file svc_vc.c.
755{
756 static struct xp_ops ops;
757 static struct xp_ops2 ops2;
759
761 if (ops.xp_recv ==
NULL) {
764 ops.xp_getargs =
766 ops.xp_reply =
768 ops.xp_freeargs =
772 }
776}
static bool_t rendezvous_request(SVCXPRT *, struct rpc_msg *)
static bool_t svc_vc_rendezvous_control(SVCXPRT *xprt, const u_int rq, void *in)
static enum xprt_stat rendezvous_stat(SVCXPRT *)
bool_t(* xdrproc_t)(XDR *,...)
Referenced by svc_vc_create().
◆ svc_vc_reply()
Definition at line 706 of file svc_vc.c.
709{
713
716
719
721 msg->rm_xid =
cd->x_id;
724 return (rstat);
725}
bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
bool_t xdrrec_endofrecord(XDR *xdrs, bool_t sendnow)
Referenced by svc_vc_ops().
◆ svc_vc_stat()
Definition at line 630 of file svc_vc.c.
632{
634
636
638
644}
bool_t xdrrec_eof(XDR *xdrs)
Referenced by svc_vc_ops().
◆ write_vc() [1/2]
◆ write_vc() [2/2]
Definition at line 572 of file svc_vc.c.
581{
586#ifdef __REACTOS__
588#endif
589
592
594
597
598 for (cnt =
len; cnt > 0; cnt -=
i,
buf +=
i) {
599#ifdef _WIN32
601#else
603#endif
607 return (-1);
608 }
609 if (
cd->nonblock &&
i != cnt) {
610
611
612
613
614
615
616
618 if (tv1.tv_sec - tv0.tv_sec >= 2) {
620 return (-1);
621 }
622 }
623 }
624 }
625
627}
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
◆ svc_fd_lock