ReactOS  0.4.14-dev-376-gaedba84
svc_raw.c File Reference
#include <wintirpc.h>
#include <reentrant.h>
#include <rpc/rpc.h>
#include <sys/types.h>
#include <rpc/raw.h>
#include <stdlib.h>
Include dependency graph for svc_raw.c:

Go to the source code of this file.

Classes

struct  svc_raw_private
 

Macros

#define UDPMSGSIZE   8800
 

Functions

static enum xprt_stat svc_raw_stat (SVCXPRT *)
 
static bool_t svc_raw_recv (SVCXPRT *, struct rpc_msg *)
 
static bool_t svc_raw_reply (SVCXPRT *, struct rpc_msg *)
 
static bool_t svc_raw_getargs (SVCXPRT *, xdrproc_t, void *)
 
static bool_t svc_raw_freeargs (SVCXPRT *, xdrproc_t, void *)
 
static void svc_raw_destroy (SVCXPRT *)
 
static void svc_raw_ops (SVCXPRT *)
 
static bool_t svc_raw_control (SVCXPRT *, const u_int, void *)
 
SVCXPRTsvc_raw_create ()
 

Variables

static struct svc_raw_privatesvc_raw_private
 
mutex_t svcraw_lock
 
char__rpc_rawcombuf = NULL
 

Macro Definition Documentation

◆ UDPMSGSIZE

#define UDPMSGSIZE   8800

Definition at line 49 of file svc_raw.c.

Function Documentation

◆ svc_raw_control()

static bool_t svc_raw_control ( SVCXPRT xprt,
const u_int  rq,
void in 
)
static

Definition at line 217 of file svc_raw.c.

221 {
222  return (FALSE);
223 }

Referenced by svc_raw_ops().

◆ svc_raw_create()

SVCXPRT* svc_raw_create ( void  )

Definition at line 76 of file svc_raw.c.

77 {
78  struct svc_raw_private *srp;
79 /* VARIABLES PROTECTED BY svcraw_lock: svc_raw_private, srp */
80 
82  srp = svc_raw_private;
83  if (srp == NULL) {
84  srp = (struct svc_raw_private *)calloc(1, sizeof (*srp));
85  if (srp == NULL) {
87  return (NULL);
88  }
89  if (__rpc_rawcombuf == NULL)
90  __rpc_rawcombuf = calloc(UDPMSGSIZE, sizeof (char));
91  srp->raw_buf = __rpc_rawcombuf; /* Share it with the client */
92  svc_raw_private = srp;
93  }
94  srp->server.xp_fd = FD_SETSIZE;
95  srp->server.xp_port = 0;
96  srp->server.xp_p3 = NULL;
97  svc_raw_ops(&srp->server);
98  srp->server.xp_verf.oa_base = srp->verf_body;
100  xprt_register(&srp->server);
102  return (&srp->server);
103 }
XDR xdr_stream
Definition: svc_raw.c:58
u_short xp_port
Definition: svc.h:92
static void svc_raw_ops(SVCXPRT *)
Definition: svc_raw.c:226
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
static struct svc_raw_private * svc_raw_private
smooth NULL
Definition: ftsmooth.c:416
mutex_t svcraw_lock
Definition: mt_misc.c:83
#define FD_SETSIZE
Definition: winsock.h:50
SOCKET xp_fd
Definition: svc.h:91
void xprt_register(SVCXPRT *xprt)
Definition: svc.c:97
char * raw_buf
Definition: svc_raw.c:56
char * __rpc_rawcombuf
Definition: svc_raw.c:73
SVCXPRT server
Definition: svc_raw.c:57
char verf_body[MAX_AUTH_BYTES]
Definition: svc_raw.c:59
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)
Definition: xdr_mem.c:94
#define calloc
Definition: rosglue.h:14
struct opaque_auth xp_verf
Definition: svc.h:121
Definition: xdr.h:86
void * xp_p3
Definition: svc.h:125
#define UDPMSGSIZE
Definition: svc_raw.c:49

◆ svc_raw_destroy()

static void svc_raw_destroy ( SVCXPRT xprt)
static

Definition at line 210 of file svc_raw.c.

212 {
213 }

Referenced by svc_raw_ops().

◆ svc_raw_freeargs()

static bool_t svc_raw_freeargs ( SVCXPRT xprt,
xdrproc_t  xdr_args,
void args_ptr 
)
static

Definition at line 187 of file svc_raw.c.

191 {
192  struct svc_raw_private *srp;
193  XDR *xdrs;
194 
196  srp = svc_raw_private;
197  if (srp == NULL) {
199  return (FALSE);
200  }
202 
203  xdrs = &srp->xdr_stream;
204  xdrs->x_op = XDR_FREE;
205  return (*xdr_args)(xdrs, args_ptr);
206 }
XDR xdr_stream
Definition: svc_raw.c:58
Definition: xdr.h:103
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
static struct svc_raw_private * svc_raw_private
smooth NULL
Definition: ftsmooth.c:416
mutex_t svcraw_lock
Definition: mt_misc.c:83
enum xdr_op x_op
Definition: xdr.h:104
Definition: xdr.h:87

Referenced by svc_raw_ops().

◆ svc_raw_getargs()

static bool_t svc_raw_getargs ( SVCXPRT xprt,
xdrproc_t  xdr_args,
void args_ptr 
)
static

Definition at line 168 of file svc_raw.c.

172 {
173  struct svc_raw_private *srp;
174 
176  srp = svc_raw_private;
177  if (srp == NULL) {
179  return (FALSE);
180  }
182  return (*xdr_args)(&srp->xdr_stream, args_ptr);
183 }
XDR xdr_stream
Definition: svc_raw.c:58
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
static struct svc_raw_private * svc_raw_private
smooth NULL
Definition: ftsmooth.c:416
mutex_t svcraw_lock
Definition: mt_misc.c:83

Referenced by svc_raw_ops().

◆ svc_raw_ops()

static void svc_raw_ops ( SVCXPRT xprt)
static

Definition at line 226 of file svc_raw.c.

228 {
229  static struct xp_ops ops;
230  static struct xp_ops2 ops2;
231  extern mutex_t ops_lock;
232 
233 /* VARIABLES PROTECTED BY ops_lock: ops */
234 
236  if (ops.xp_recv == NULL) {
237  ops.xp_recv = svc_raw_recv;
238  ops.xp_stat = svc_raw_stat;
239  ops.xp_getargs = svc_raw_getargs;
240  ops.xp_reply = svc_raw_reply;
241  ops.xp_freeargs = svc_raw_freeargs;
242  ops.xp_destroy = svc_raw_destroy;
243  ops2.xp_control = svc_raw_control;
244  }
245  xprt->xp_ops = &ops;
246  xprt->xp_ops2 = &ops2;
248 }
mutex_t ops_lock
Definition: mt_misc.c:71
static void svc_raw_destroy(SVCXPRT *)
Definition: svc_raw.c:210
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
smooth NULL
Definition: ftsmooth.c:416
const struct __rpc_svcxprt::xp_ops * xp_ops
static bool_t svc_raw_control(SVCXPRT *, const u_int, void *)
Definition: svc_raw.c:217
static bool_t svc_raw_getargs(SVCXPRT *, xdrproc_t, void *)
Definition: svc_raw.c:168
static bool_t svc_raw_reply(SVCXPRT *, struct rpc_msg *)
Definition: svc_raw.c:141
static bool_t svc_raw_recv(SVCXPRT *, struct rpc_msg *)
Definition: svc_raw.c:115
static bool_t svc_raw_freeargs(SVCXPRT *, xdrproc_t, void *)
Definition: svc_raw.c:187
Definition: module.h:446
static enum xprt_stat svc_raw_stat(SVCXPRT *)
Definition: svc_raw.c:107
const struct __rpc_svcxprt::xp_ops2 * xp_ops2

Referenced by svc_raw_create().

◆ svc_raw_recv()

static bool_t svc_raw_recv ( SVCXPRT xprt,
struct rpc_msg msg 
)
static

Definition at line 115 of file svc_raw.c.

118 {
119  struct svc_raw_private *srp;
120  XDR *xdrs;
121 
123  srp = svc_raw_private;
124  if (srp == NULL) {
126  return (FALSE);
127  }
129 
130  xdrs = &srp->xdr_stream;
131  xdrs->x_op = XDR_DECODE;
132  (void) XDR_SETPOS(xdrs, 0);
133  if (! xdr_callmsg(xdrs, msg)) {
134  return (FALSE);
135  }
136  return (TRUE);
137 }
XDR xdr_stream
Definition: svc_raw.c:58
#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
Definition: xdr.h:103
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
static struct svc_raw_private * svc_raw_private
smooth NULL
Definition: ftsmooth.c:416
mutex_t svcraw_lock
Definition: mt_misc.c:83
bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
Definition: rpc_callmsg.c:50
enum xdr_op x_op
Definition: xdr.h:104
#define XDR_SETPOS(xdrs, pos)
Definition: xdr.h:204
#define msg(x)
Definition: auth_time.c:54
Definition: xdr.h:86

Referenced by svc_raw_ops().

◆ svc_raw_reply()

static bool_t svc_raw_reply ( SVCXPRT xprt,
struct rpc_msg msg 
)
static

Definition at line 141 of file svc_raw.c.

144 {
145  struct svc_raw_private *srp;
146  XDR *xdrs;
147 
149  srp = svc_raw_private;
150  if (srp == NULL) {
152  return (FALSE);
153  }
155 
156  xdrs = &srp->xdr_stream;
157  xdrs->x_op = XDR_ENCODE;
158  (void) XDR_SETPOS(xdrs, 0);
159  if (! xdr_replymsg(xdrs, msg)) {
160  return (FALSE);
161  }
162  (void) XDR_GETPOS(xdrs); /* called just for overhead */
163  return (TRUE);
164 }
XDR xdr_stream
Definition: svc_raw.c:58
#define TRUE
Definition: types.h:120
#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
Definition: xdr.h:103
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
static struct svc_raw_private * svc_raw_private
smooth NULL
Definition: ftsmooth.c:416
mutex_t svcraw_lock
Definition: mt_misc.c:83
enum xdr_op x_op
Definition: xdr.h:104
Definition: xdr.h:85
#define XDR_SETPOS(xdrs, pos)
Definition: xdr.h:204
#define msg(x)
Definition: auth_time.c:54
bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
Definition: rpc_prot.c:188

Referenced by svc_raw_ops().

◆ svc_raw_stat()

static enum xprt_stat svc_raw_stat ( SVCXPRT xprt)
static

Definition at line 107 of file svc_raw.c.

109 {
110  return (XPRT_IDLE);
111 }
Definition: svc.h:84

Referenced by svc_raw_ops().

Variable Documentation

◆ __rpc_rawcombuf

char* __rpc_rawcombuf = NULL

Definition at line 73 of file svc_raw.c.

Referenced by clnt_raw_create(), and svc_raw_create().

◆ svc_raw_private

◆ svcraw_lock

mutex_t svcraw_lock