ReactOS  0.4.12-dev-918-g6c6e7b8
svc_dg.c
Go to the documentation of this file.
1 
2 /*
3  * Copyright (c) 2009, Sun Microsystems, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  * - Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * - Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * - Neither the name of Sun Microsystems, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /*
31  * Copyright (c) 1986-1991 by Sun Microsystems Inc.
32  */
33 
34 //#include <sys/cdefs.h>
35 
36 /*
37  * svc_dg.c, Server side for connectionless RPC.
38  *
39  * Does some caching in the hopes of achieving execute-at-most-once semantics.
40  */
41 #include <wintirpc.h>
42 //#include <pthread.h>
43 #include <reentrant.h>
44 #include <sys/types.h>
45 //#include <sys/socket.h>
46 #include <rpc/rpc.h>
47 #include <rpc/svc_dg.h>
48 #include <errno.h>
49 //#include <unistd.h>
50 #include <stdio.h>
51 #include <stdlib.h>
52 #include <string.h>
53 #ifdef RPC_CACHE_DEBUG
54 #include <netconfig.h>
55 #include <netdir.h>
56 #endif
57 //#include <err.h>
58 
59 #include "rpc_com.h"
60 
61 #define su_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2))
62 #define rpc_buffer(xprt) ((xprt)->xp_p1)
63 
64 #ifndef MAX
65 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
66 #endif
67 
68 static void svc_dg_ops(SVCXPRT *);
69 static enum xprt_stat svc_dg_stat(SVCXPRT *);
70 static bool_t svc_dg_recv(SVCXPRT *, struct rpc_msg *);
71 static bool_t svc_dg_reply(SVCXPRT *, struct rpc_msg *);
72 static bool_t svc_dg_getargs(SVCXPRT *, xdrproc_t, void *);
73 static bool_t svc_dg_freeargs(SVCXPRT *, xdrproc_t, void *);
74 static void svc_dg_destroy(SVCXPRT *);
75 static bool_t svc_dg_control(SVCXPRT *, const u_int, void *);
76 static int cache_get(SVCXPRT *, struct rpc_msg *, char **, size_t *);
77 static void cache_set(SVCXPRT *, size_t);
79 
80 /*
81  * Usage:
82  * xprt = svc_dg_create(sock, sendsize, recvsize);
83  * Does other connectionless specific initializations.
84  * Once *xprt is initialized, it is registered.
85  * see (svc.h, xprt_register). If recvsize or sendsize are 0 suitable
86  * system defaults are chosen.
87  * The routines returns NULL if a problem occurred.
88  */
89 static const char svc_dg_str[] = "svc_dg_create: %s";
90 static const char svc_dg_err1[] = "could not get transport information";
91 static const char svc_dg_err2[] = " transport does not support data transfer";
92 static const char __no_mem_str[] = "out of memory";
93 
94 SVCXPRT *
95 svc_dg_create(fd, sendsize, recvsize)
96  int fd;
97  u_int sendsize;
98  u_int recvsize;
99 {
100  SVCXPRT *xprt;
101  struct svc_dg_data *su = NULL;
102  struct __rpc_sockinfo si;
103  struct sockaddr_storage ss;
104  socklen_t slen;
105 
106  if (!__rpc_fd2sockinfo(fd, &si)) {
107  // XXX warnx(svc_dg_str, svc_dg_err1);
108  return (NULL);
109  }
110  /*
111  * Find the receive and the send size
112  */
113  sendsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsize);
114  recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
115  if ((sendsize == 0) || (recvsize == 0)) {
116  // XXX warnx(svc_dg_str, svc_dg_err2);
117  return (NULL);
118  }
119 
120  xprt = mem_alloc(sizeof (SVCXPRT));
121  if (xprt == NULL)
122  goto freedata;
123  memset(xprt, 0, sizeof (SVCXPRT));
124 
125  su = mem_alloc(sizeof (*su));
126  if (su == NULL)
127  goto freedata;
128  su->su_iosz = ((MAX(sendsize, recvsize) + 3) / 4) * 4;
129  if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL)
130  goto freedata;
131  xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
132  XDR_DECODE);
133  su->su_cache = NULL;
134  xprt->xp_fd = fd;
135  xprt->xp_p2 = su;
136  xprt->xp_verf.oa_base = su->su_verfbody;
137  svc_dg_ops(xprt);
138  xprt->xp_rtaddr.maxlen = sizeof (struct sockaddr_storage);
139 
140  slen = sizeof ss;
141  if (getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR)
142  goto freedata;
143  __rpc_set_netbuf(&xprt->xp_ltaddr, &ss, slen);
144 
145  xprt_register(xprt);
146  return (xprt);
147 freedata:
148  // XXX (void) warnx(svc_dg_str, __no_mem_str);
149  if (xprt) {
150  if (su)
151  (void) mem_free(su, sizeof (*su));
152  (void) mem_free(xprt, sizeof (SVCXPRT));
153  }
154  return (NULL);
155 }
156 
157 /*ARGSUSED*/
158 static enum xprt_stat
160  SVCXPRT *xprt;
161 {
162  return (XPRT_IDLE);
163 }
164 
165 static bool_t
167  SVCXPRT *xprt;
168  struct rpc_msg *msg;
169 {
170  struct svc_dg_data *su = su_data(xprt);
171  XDR *xdrs = &(su->su_xdrs);
172  char *reply;
173  struct sockaddr_storage ss;
174  socklen_t alen;
175  size_t replylen;
176  ssize_t rlen;
177 
178 again:
179  alen = sizeof (struct sockaddr_storage);
180  rlen = recvfrom(xprt->xp_fd, rpc_buffer(xprt), su->su_iosz, 0,
181  (struct sockaddr *)(void *)&ss, &alen);
182  if (rlen == -1 && errno == EINTR)
183  goto again;
184  if (rlen == -1 || (rlen < (ssize_t)(4 * sizeof (u_int32_t))))
185  return (FALSE);
186  __rpc_set_netbuf(&xprt->xp_rtaddr, &ss, alen);
187 
188  __xprt_set_raddr(xprt, &ss);
189  xdrs->x_op = XDR_DECODE;
190  XDR_SETPOS(xdrs, 0);
191  if (! xdr_callmsg(xdrs, msg)) {
192  return (FALSE);
193  }
194  su->su_xid = msg->rm_xid;
195  if (su->su_cache != NULL) {
196  if (cache_get(xprt, msg, &reply, &replylen)) {
197  (void)sendto(xprt->xp_fd, reply, replylen, 0,
198  (struct sockaddr *)(void *)&ss, alen);
199  return (FALSE);
200  }
201  }
202  return (TRUE);
203 }
204 
205 static bool_t
207  SVCXPRT *xprt;
208  struct rpc_msg *msg;
209 {
210  struct svc_dg_data *su = su_data(xprt);
211  XDR *xdrs = &(su->su_xdrs);
212  bool_t stat = FALSE;
213  size_t slen;
214 
215  xdrs->x_op = XDR_ENCODE;
216  XDR_SETPOS(xdrs, 0);
217  msg->rm_xid = su->su_xid;
218  if (xdr_replymsg(xdrs, msg)) {
219  slen = XDR_GETPOS(xdrs);
220  if (sendto(xprt->xp_fd, rpc_buffer(xprt), slen, 0,
221  (struct sockaddr *)xprt->xp_rtaddr.buf,
222  (socklen_t)xprt->xp_rtaddr.len) == (ssize_t) slen) {
223  stat = TRUE;
224  if (su->su_cache)
225  cache_set(xprt, slen);
226  }
227  }
228  return (stat);
229 }
230 
231 static bool_t
232 svc_dg_getargs(xprt, xdr_args, args_ptr)
233  SVCXPRT *xprt;
234  xdrproc_t xdr_args;
235  void *args_ptr;
236 {
237  return (*xdr_args)(&(su_data(xprt)->su_xdrs), args_ptr);
238 }
239 
240 static bool_t
241 svc_dg_freeargs(xprt, xdr_args, args_ptr)
242  SVCXPRT *xprt;
243  xdrproc_t xdr_args;
244  void *args_ptr;
245 {
246  XDR *xdrs = &(su_data(xprt)->su_xdrs);
247 
248  xdrs->x_op = XDR_FREE;
249  return (*xdr_args)(xdrs, args_ptr);
250 }
251 
252 static void
254  SVCXPRT *xprt;
255 {
256  struct svc_dg_data *su = su_data(xprt);
257 
258  xprt_unregister(xprt);
259  if (xprt->xp_fd != -1)
260  (void)closesocket(xprt->xp_fd);
261  XDR_DESTROY(&(su->su_xdrs));
262  (void) mem_free(rpc_buffer(xprt), su->su_iosz);
263  (void) mem_free(su, sizeof (*su));
264  if (xprt->xp_rtaddr.buf)
265  (void) mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen);
266  if (xprt->xp_ltaddr.buf)
267  (void) mem_free(xprt->xp_ltaddr.buf, xprt->xp_ltaddr.maxlen);
268  if (xprt->xp_tp)
269  (void) free(xprt->xp_tp);
270  (void) mem_free(xprt, sizeof (SVCXPRT));
271 }
272 
273 static bool_t
274 /*ARGSUSED*/
275 svc_dg_control(xprt, rq, in)
276  SVCXPRT *xprt;
277  const u_int rq;
278  void *in;
279 {
280  return (FALSE);
281 }
282 
283 static void
285  SVCXPRT *xprt;
286 {
287  static struct xp_ops ops;
288  static struct xp_ops2 ops2;
289  extern mutex_t ops_lock;
290 
291 /* VARIABLES PROTECTED BY ops_lock: ops */
292 
294  if (ops.xp_recv == NULL) {
295  ops.xp_recv = svc_dg_recv;
296  ops.xp_stat = svc_dg_stat;
297  ops.xp_getargs = svc_dg_getargs;
298  ops.xp_reply = svc_dg_reply;
299  ops.xp_freeargs = svc_dg_freeargs;
300  ops.xp_destroy = svc_dg_destroy;
301  ops2.xp_control = svc_dg_control;
302  }
303  xprt->xp_ops = &ops;
304  xprt->xp_ops2 = &ops2;
306 }
307 
308 /* The CACHING COMPONENT */
309 
310 /*
311  * Could have been a separate file, but some part of it depends upon the
312  * private structure of the client handle.
313  *
314  * Fifo cache for cl server
315  * Copies pointers to reply buffers into fifo cache
316  * Buffers are sent again if retransmissions are detected.
317  */
318 
319 #define SPARSENESS 4 /* 75% sparse */
320 
321 #define ALLOC(type, size) \
322  (type *) mem_alloc((sizeof (type) * (size)))
323 
324 #define MEMZERO(addr, type, size) \
325  (void) memset((void *) (addr), 0, sizeof (type) * (int) (size))
326 
327 #define FREE(addr, type, size) \
328  mem_free((addr), (sizeof (type) * (size)))
329 
330 /*
331  * An entry in the cache
332  */
333 typedef struct cache_node *cache_ptr;
334 struct cache_node {
335  /*
336  * Index into cache is xid, proc, vers, prog and address
337  */
343  /*
344  * The cached reply and length
345  */
346  char *cache_reply;
348  /*
349  * Next node on the list, if there is a collision
350  */
352 };
353 
354 /*
355  * The entire cache
356  */
357 struct cl_cache {
358  u_int uc_size; /* size of cache */
359  cache_ptr *uc_entries; /* hash table of entries in cache */
360  cache_ptr *uc_fifo; /* fifo list of entries in cache */
361  u_int uc_nextvictim; /* points to next victim in fifo list */
362  rpcprog_t uc_prog; /* saved program number */
363  rpcvers_t uc_vers; /* saved version number */
364  rpcproc_t uc_proc; /* saved procedure number */
365 };
366 
367 
368 /*
369  * the hashing function
370  */
371 #define CACHE_LOC(transp, xid) \
372  (xid % (SPARSENESS * ((struct cl_cache *) \
373  su_data(transp)->su_cache)->uc_size))
374 
375 extern mutex_t dupreq_lock;
376 
377 /*
378  * Enable use of the cache. Returns 1 on success, 0 on failure.
379  * Note: there is no disable.
380  */
381 static const char cache_enable_str[] = "svc_enablecache: %s %s";
382 static const char alloc_err[] = "could not allocate cache ";
383 static const char enable_err[] = "cache already enabled";
384 
385 int
387  SVCXPRT *transp;
388  u_int size;
389 {
390  struct svc_dg_data *su = su_data(transp);
391  struct cl_cache *uc;
392 
394  if (su->su_cache != NULL) {
395  // XXX (void) warnx(cache_enable_str, enable_err, " ");
397  return (0);
398  }
399  uc = ALLOC(struct cl_cache, 1);
400  if (uc == NULL) {
401  // XXX warnx(cache_enable_str, alloc_err, " ");
403  return (0);
404  }
405  uc->uc_size = size;
406  uc->uc_nextvictim = 0;
408  if (uc->uc_entries == NULL) {
409  // XXX warnx(cache_enable_str, alloc_err, "data");
410  FREE(uc, struct cl_cache, 1);
412  return (0);
413  }
415  uc->uc_fifo = ALLOC(cache_ptr, size);
416  if (uc->uc_fifo == NULL) {
417  // XXX warnx(cache_enable_str, alloc_err, "fifo");
419  FREE(uc, struct cl_cache, 1);
421  return (0);
422  }
423  MEMZERO(uc->uc_fifo, cache_ptr, size);
424  su->su_cache = (char *)(void *)uc;
426  return (1);
427 }
428 
429 /*
430  * Set an entry in the cache. It assumes that the uc entry is set from
431  * the earlier call to cache_get() for the same procedure. This will always
432  * happen because cache_get() is calle by svc_dg_recv and cache_set() is called
433  * by svc_dg_reply(). All this hoopla because the right RPC parameters are
434  * not available at svc_dg_reply time.
435  */
436 
437 static const char cache_set_str[] = "cache_set: %s";
438 static const char cache_set_err1[] = "victim not found";
439 static const char cache_set_err2[] = "victim alloc failed";
440 static const char cache_set_err3[] = "could not allocate new rpc buffer";
441 
442 static void
443 cache_set(xprt, replylen)
444  SVCXPRT *xprt;
445  size_t replylen;
446 {
447  cache_ptr victim;
448  cache_ptr *vicp;
449  struct svc_dg_data *su = su_data(xprt);
450  struct cl_cache *uc = (struct cl_cache *) su->su_cache;
451  u_int loc;
452  char *newbuf;
453 #ifdef RPC_CACHE_DEBUG
454  struct netconfig *nconf;
455  char *uaddr;
456 #endif
457 
459  /*
460  * Find space for the new entry, either by
461  * reusing an old entry, or by mallocing a new one
462  */
463  victim = uc->uc_fifo[uc->uc_nextvictim];
464  if (victim != NULL) {
465  loc = CACHE_LOC(xprt, victim->cache_xid);
466  for (vicp = &uc->uc_entries[loc];
467  *vicp != NULL && *vicp != victim;
468  vicp = &(*vicp)->cache_next)
469  ;
470  if (*vicp == NULL) {
471  // XXX warnx(cache_set_str, cache_set_err1);
473  return;
474  }
475  *vicp = victim->cache_next; /* remove from cache */
476  newbuf = victim->cache_reply;
477  } else {
478  victim = ALLOC(struct cache_node, 1);
479  if (victim == NULL) {
480  // XXX warnx(cache_set_str, cache_set_err2);
482  return;
483  }
484  newbuf = mem_alloc(su->su_iosz);
485  if (newbuf == NULL) {
486  // XXX warnx(cache_set_str, cache_set_err3);
487  FREE(victim, struct cache_node, 1);
489  return;
490  }
491  }
492 
493  /*
494  * Store it away
495  */
496 #ifdef RPC_CACHE_DEBUG
497  if (nconf = getnetconfigent(xprt->xp_netid)) {
498  uaddr = taddr2uaddr(nconf, &xprt->xp_rtaddr);
499  freenetconfigent(nconf);
500  printf(
501  "cache set for xid= %x prog=%d vers=%d proc=%d for rmtaddr=%s\n",
502  su->su_xid, uc->uc_prog, uc->uc_vers,
503  uc->uc_proc, uaddr);
504  free(uaddr);
505  }
506 #endif
507  victim->cache_replylen = replylen;
508  victim->cache_reply = rpc_buffer(xprt);
509  rpc_buffer(xprt) = newbuf;
510  xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt),
511  su->su_iosz, XDR_ENCODE);
512  victim->cache_xid = su->su_xid;
513  victim->cache_proc = uc->uc_proc;
514  victim->cache_vers = uc->uc_vers;
515  victim->cache_prog = uc->uc_prog;
516  victim->cache_addr = xprt->xp_rtaddr;
517  victim->cache_addr.buf = ALLOC(char, xprt->xp_rtaddr.len);
518  (void) memcpy(victim->cache_addr.buf, xprt->xp_rtaddr.buf,
519  (size_t)xprt->xp_rtaddr.len);
520  loc = CACHE_LOC(xprt, victim->cache_xid);
521  victim->cache_next = uc->uc_entries[loc];
522  uc->uc_entries[loc] = victim;
523  uc->uc_fifo[uc->uc_nextvictim++] = victim;
524  uc->uc_nextvictim %= uc->uc_size;
526 }
527 
528 /*
529  * Try to get an entry from the cache
530  * return 1 if found, 0 if not found and set the stage for cache_set()
531  */
532 static int
533 cache_get(xprt, msg, replyp, replylenp)
534  SVCXPRT *xprt;
535  struct rpc_msg *msg;
536  char **replyp;
537  size_t *replylenp;
538 {
539  u_int loc;
540  cache_ptr ent;
541  struct svc_dg_data *su = su_data(xprt);
542  struct cl_cache *uc = (struct cl_cache *) su->su_cache;
543 #ifdef RPC_CACHE_DEBUG
544  struct netconfig *nconf;
545  char *uaddr;
546 #endif
547 
549  loc = CACHE_LOC(xprt, su->su_xid);
550  for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next) {
551  if (ent->cache_xid == su->su_xid &&
552  ent->cache_proc == msg->rm_call.cb_proc &&
553  ent->cache_vers == msg->rm_call.cb_vers &&
554  ent->cache_prog == msg->rm_call.cb_prog &&
555  ent->cache_addr.len == xprt->xp_rtaddr.len &&
556  (memcmp(ent->cache_addr.buf, xprt->xp_rtaddr.buf,
557  xprt->xp_rtaddr.len) == 0)) {
558 #ifdef RPC_CACHE_DEBUG
559  if (nconf = getnetconfigent(xprt->xp_netid)) {
560  uaddr = taddr2uaddr(nconf, &xprt->xp_rtaddr);
561  freenetconfigent(nconf);
562  printf(
563  "cache entry found for xid=%x prog=%d vers=%d proc=%d for rmtaddr=%s\n",
564  su->su_xid, msg->rm_call.cb_prog,
565  msg->rm_call.cb_vers,
566  msg->rm_call.cb_proc, uaddr);
567  free(uaddr);
568  }
569 #endif
570  *replyp = ent->cache_reply;
571  *replylenp = ent->cache_replylen;
573  return (1);
574  }
575  }
576  /*
577  * Failed to find entry
578  * Remember a few things so we can do a set later
579  */
580  uc->uc_proc = msg->rm_call.cb_proc;
581  uc->uc_vers = msg->rm_call.cb_vers;
582  uc->uc_prog = msg->rm_call.cb_prog;
584  return (0);
585 }
u_int __rpc_get_t_size(int af, int proto, int size)
Definition: rpc_generic.c:139
#define SOCKET_ERROR
Definition: winsock.h:333
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
static const char cache_set_str[]
Definition: svc_dg.c:437
mutex_t dupreq_lock
Definition: mt_misc.c:59
u_int32_t rpcproc_t
Definition: types.h:106
rpcprog_t cache_prog
Definition: svc_dg.c:341
#define CACHE_LOC(transp, xid)
Definition: svc_dg.c:371
#define TRUE
Definition: types.h:120
xprt_stat
Definition: svc.h:81
static void cache_set(SVCXPRT *, size_t)
Definition: svc_dg.c:443
#define XDR_GETPOS(xdrs)
Definition: xdr.h:199
static int cache_get(SVCXPRT *, struct rpc_msg *, char **, size_t *)
Definition: svc_dg.c:533
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
u_int32_t cache_xid
Definition: svc_dg.c:338
u_int32_t rpcvers_t
Definition: types.h:105
mutex_t ops_lock
Definition: mt_misc.c:71
ADDRESS_FAMILY si_af
Definition: types.h:165
int si_proto
Definition: types.h:166
static const char __no_mem_str[]
Definition: svc_dg.c:92
int32_t bool_t
Definition: types.h:101
static bool_t svc_dg_freeargs(SVCXPRT *, xdrproc_t, void *)
Definition: svc_dg.c:241
static void svc_dg_destroy(SVCXPRT *)
Definition: svc_dg.c:253
#define free
Definition: debug_ros.c:5
#define EINTR
Definition: acclib.h:80
SVCXPRT * svc_dg_create(int fd, u_int sendsize, u_int recvsize)
Definition: svc_dg.c:95
size_t su_iosz
Definition: svc_dg.h:43
static bool_t svc_dg_recv(SVCXPRT *, struct rpc_msg *)
Definition: svc_dg.c:166
static int fd
Definition: io.c:51
static bool_t svc_dg_getargs(SVCXPRT *, xdrproc_t, void *)
Definition: svc_dg.c:232
Definition: svc.h:84
#define MEMZERO(addr, type, size)
Definition: svc_dg.c:324
int errno
void xprt_unregister(SVCXPRT *xprt)
Definition: svc.c:128
cache_ptr * uc_entries
Definition: svc_dg.c:359
Definition: xdr.h:103
static const char cache_set_err2[]
Definition: svc_dg.c:439
#define SPARSENESS
Definition: svc_dg.c:319
#define mutex_lock(m)
Definition: reentrant.h:128
cache_ptr cache_next
Definition: svc_dg.c:351
#define mutex_unlock(m)
Definition: reentrant.h:129
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144
#define ALLOC(type, size)
Definition: svc_dg.c:321
#define mem_alloc(bsize)
Definition: types.h:123
int __rpc_fd2sockinfo(SOCKET fd, struct __rpc_sockinfo *sip)
Definition: rpc_generic.c:481
#define closesocket
Definition: main.c:39
cache_ptr * uc_fifo
Definition: svc_dg.c:360
int svc_dg_enablecache(SVCXPRT *, u_int)
Definition: svc_dg.c:386
static void svc_dg_ops(SVCXPRT *)
Definition: svc_dg.c:284
void freenetconfigent(struct netconfig *netconfigp)
Definition: getnetconfig.c:530
static const char alloc_err[]
Definition: svc_dg.c:382
#define MAX(a, b)
Definition: svc_dg.c:65
char * xp_tp
Definition: svc.h:117
struct cache_node * cache_ptr
Definition: svc_dg.c:333
smooth NULL
Definition: ftsmooth.c:416
struct netconfig * getnetconfigent(char *netid) const
Definition: getnetconfig.c:432
rpcproc_t uc_proc
Definition: svc_dg.c:364
char * cache_reply
Definition: svc_dg.c:346
struct netbuf xp_ltaddr
Definition: svc.h:119
static bool_t svc_dg_control(SVCXPRT *, const u_int, void *)
Definition: svc_dg.c:275
const struct __rpc_svcxprt::xp_ops * xp_ops
bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
Definition: rpc_callmsg.c:50
#define FREE(addr, type, size)
Definition: svc_dg.c:327
static const char cache_set_err3[]
Definition: svc_dg.c:440
GLsizeiptr size
Definition: glext.h:5919
SOCKET xp_fd
Definition: svc.h:91
void xprt_register(SVCXPRT *xprt)
Definition: svc.c:97
void * su_cache
Definition: svc_dg.h:47
static const char svc_dg_str[]
Definition: svc_dg.c:89
enum xdr_op x_op
Definition: xdr.h:104
int socklen_t
Definition: tcp.c:35
u_int32_t rpcprog_t
Definition: types.h:104
struct netbuf * __rpc_set_netbuf(struct netbuf *, const void *, size_t)
Definition: rpc_generic.c:951
u_int uc_size
Definition: svc_dg.c:358
static const char svc_dg_err2[]
Definition: svc_dg.c:91
char su_verfbody[MAX_AUTH_BYTES]
Definition: svc_dg.h:46
rpcproc_t cache_proc
Definition: svc_dg.c:339
void * xp_p2
Definition: svc.h:124
Definition: xdr.h:85
void __xprt_set_raddr(SVCXPRT *, const struct sockaddr_storage *)
Definition: svc_vc.c:111
Definition: stat.h:55
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
u_int32_t su_xid
Definition: svc_dg.h:44
unsigned int u_int32_t
Definition: rosdhcp.h:35
int ssize_t
Definition: rosdhcp.h:48
struct netbuf cache_addr
Definition: svc_dg.c:342
size_t cache_replylen
Definition: svc_dg.c:347
#define XDR_SETPOS(xdrs, pos)
Definition: xdr.h:204
static const char cache_enable_str[]
Definition: svc_dg.c:381
GLuint in
Definition: glext.h:9616
struct netbuf xp_rtaddr
Definition: svc.h:120
static enum xprt_stat svc_dg_stat(SVCXPRT *)
Definition: svc_dg.c:159
UINT32 u_int
Definition: types.h:82
XDR su_xdrs
Definition: svc_dg.h:45
rpcprog_t uc_prog
Definition: svc_dg.c:362
rpcvers_t uc_vers
Definition: svc_dg.c:363
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)
Definition: xdr_mem.c:94
rpcvers_t cache_vers
Definition: svc_dg.c:340
#define su_data(xprt)
Definition: svc_dg.c:61
#define rpc_buffer(xprt)
Definition: svc_dg.c:62
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
static const char cache_set_err1[]
Definition: svc_dg.c:438
Definition: xdr.h:87
struct opaque_auth xp_verf
Definition: svc.h:121
u_int uc_nextvictim
Definition: svc_dg.c:361
Definition: xdr.h:86
#define mem_free(ptr, bsize)
Definition: types.h:124
static const char enable_err[]
Definition: svc_dg.c:383
static const char svc_dg_err1[]
Definition: svc_dg.c:90
char * taddr2uaddr(const struct netconfig *nconf, const struct netbuf *nbuf)
Definition: rpc_generic.c:609
#define ss
Definition: i386-dis.c:432
Definition: module.h:446
#define memset(x, y, z)
Definition: compat.h:39
static bool_t svc_dg_reply(SVCXPRT *, struct rpc_msg *)
Definition: svc_dg.c:206
char * xp_netid
Definition: svc.h:118
bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
Definition: rpc_prot.c:188
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213
#define XDR_DESTROY(xdrs)
Definition: xdr.h:214
#define printf
Definition: config.h:203
const struct __rpc_svcxprt::xp_ops2 * xp_ops2