ReactOS 0.4.16-dev-340-g0540c21
pmap_prot2.c File Reference
#include <wintirpc.h>
#include <assert.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/pmap_prot.h>
Include dependency graph for pmap_prot2.c:

Go to the source code of this file.

Functions

bool_t xdr_pmaplist (XDR *xdrs, struct pmaplist **rp)
 
bool_t xdr_pmaplist_ptr (XDR *xdrs, struct pmaplist *rp)
 

Function Documentation

◆ xdr_pmaplist()

bool_t xdr_pmaplist ( XDR xdrs,
struct pmaplist **  rp 
)

Definition at line 83 of file pmap_prot2.c.

86{
87 /*
88 * more_elements is pre-computed in case the direction is
89 * XDR_ENCODE or XDR_FREE. more_elements is overwritten by
90 * xdr_bool when the direction is XDR_DECODE.
91 */
92 bool_t more_elements;
93 int freeing;
94 struct pmaplist **next = NULL; /* pacify gcc */
95
96 assert(xdrs != NULL);
97 assert(rp != NULL);
98
99 freeing = (xdrs->x_op == XDR_FREE);
100
101 for (;;) {
102 more_elements = (bool_t)(*rp != NULL);
103 if (! xdr_bool(xdrs, &more_elements))
104 return (FALSE);
105 if (! more_elements)
106 return (TRUE); /* we are done */
107 /*
108 * the unfortunate side effect of non-recursion is that in
109 * the case of freeing we must remember the next object
110 * before we free the current object ...
111 */
112 if (freeing)
113 next = &((*rp)->pml_next);
114 if (! xdr_reference(xdrs, (caddr_t *)rp,
115 (u_int)sizeof(struct pmaplist), (xdrproc_t)xdr_pmap))
116 return (FALSE);
117 rp = (freeing) ? next : &((*rp)->pml_next);
118 }
119}
bool_t xdr_bool(XDR *xdrs, bool_t *bp)
Definition: xdr.c:428
UINT32 u_int
Definition: types.h:82
#define NULL
Definition: types.h:112
int32_t bool_t
Definition: types.h:101
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define assert(x)
Definition: debug.h:53
bool_t xdr_pmap(XDR *xdrs, struct pmap *regs)
Definition: pmap_prot.c:45
static unsigned __int64 next
Definition: rand_nt.c:6
char * caddr_t
Definition: rosdhcp.h:36
enum xdr_op x_op
Definition: xdr.h:104
@ XDR_FREE
Definition: xdr.h:87
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144
bool_t xdr_reference(XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc)
Definition: xdr_reference.c:62

Referenced by pmap_getmaps(), and xdr_pmaplist_ptr().

◆ xdr_pmaplist_ptr()

bool_t xdr_pmaplist_ptr ( XDR xdrs,
struct pmaplist rp 
)

Definition at line 127 of file pmap_prot2.c.

130{
131 return xdr_pmaplist(xdrs, (struct pmaplist **)(void *)rp);
132}
bool_t xdr_pmaplist(XDR *xdrs, struct pmaplist **rp)
Definition: pmap_prot2.c:83