diff options
author | wpaul <wpaul@FreeBSD.org> | 1995-04-02 01:02:17 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1995-04-02 01:02:17 +0000 |
commit | d1bfae93533bd884c0fa46603a958e9b0dd407d4 (patch) | |
tree | 13f96d16f4a94671fbbd575aa9b399c40794b396 /lib/libc/yp | |
parent | cb1457c9ad35fcc7447bb49fb91fbe9eeb7553e7 (diff) | |
download | FreeBSD-src-d1bfae93533bd884c0fa46603a958e9b0dd407d4.zip FreeBSD-src-d1bfae93533bd884c0fa46603a958e9b0dd407d4.tar.gz |
Add some missing xdr functions needed for server-side implementations.
(This is to help me reduce yppush a bit: it has its own copy of yp_xdr.c
right now, but I can get rid of it now that this stuff is here.)
Diffstat (limited to 'lib/libc/yp')
-rw-r--r-- | lib/libc/yp/xdryp.c | 117 |
1 files changed, 116 insertions, 1 deletions
diff --git a/lib/libc/yp/xdryp.c b/lib/libc/yp/xdryp.c index ba2d8d0..7acdf44 100644 --- a/lib/libc/yp/xdryp.c +++ b/lib/libc/yp/xdryp.c @@ -28,13 +28,15 @@ */ #ifndef LINT -static char *rcsid = "$Id: xdryp.c,v 1.1 1993/11/01 23:56:28 paul Exp $"; +static char *rcsid = "$Id: xdryp.c,v 1.1 1994/08/07 23:04:54 wollman Exp $"; #endif #include <sys/param.h> #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> +#include <string.h> +#include <stdlib.h> #include <ctype.h> #include <rpc/rpc.h> #include <rpc/xdr.h> @@ -51,6 +53,30 @@ struct ypresp_all { } ypresp_all_u; }; +enum ypxfrstat { + YPXFR_SUCC = 1, + YPXFR_AGE = 2, + YPXFR_NOMAP = -1, + YPXFR_NODOM = -2, + YPXFR_RSRC = -3, + YPXFR_RPC = -4, + YPXFR_MADDR = -5, + YPXFR_YPERR = -6, + YPXFR_BADARGS = -7, + YPXFR_DBM = -8, + YPXFR_FILE = -9, + YPXFR_SKEW = -10, + YPXFR_CLEAR = -11, + YPXFR_FORCE = -12, + YPXFR_XFRERR = -13, + YPXFR_REFUSED = -14, +}; + +struct ypresp_xfr { + u_int transid; + enum ypxfrstat xfrstat; +}; + bool_t xdr_domainname(xdrs, objp) XDR *xdrs; @@ -392,3 +418,92 @@ struct ypresp_order *objp; } return (TRUE); } + +bool_t +xdr_ypxfrstat(xdrs, objp) +XDR *xdrs; +enum ypxfrstat *objp; +{ + if (!xdr_enum(xdrs, (enum_t *)objp)) { + return (FALSE); + } + return (TRUE); +} + +bool_t +xdr_ypresp_xfr(xdrs, objp) +XDR *xdrs; +struct ypresp_xfr *objp; +{ + if (!xdr_u_int(xdrs, &objp->transid)) { + return (FALSE); + } + if (!xdr_ypxfrstat(xdrs, &objp->xfrstat)) { + return (FALSE); + } + return (TRUE); +} + +bool_t +xdr_ypmap_parms(xdrs, objp) +XDR *xdrs; +struct ypmap_parms *objp; +{ + if (!xdr_domainname(xdrs, &objp->domain)) { + return (FALSE); + } + if (!xdr_mapname(xdrs, &objp->map)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->ordernum)) { + return (FALSE); + } + if (!xdr_peername(xdrs, &objp->owner)) { + return (FALSE); + } +} + +bool_t +xdr_ypreq_xfr(xdrs, objp) +XDR *xdrs; +struct ypreq_xfr *objp; +{ + if (!xdr_ypmap_parms(xdrs, &objp->map_parms)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->transid)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->proto)) { + return (FALSE); + } + if (!xdr_u_short(xdrs, &objp->port)) { + return (FALSE); + } + return (TRUE); +} + +bool_t +xdr_yppush_status(xdrs, objp) +XDR *xdrs; +enum yppush_status *objp; +{ + if (!xdr_enum(xdrs, (enum_t *)objp)) { + return (FALSE); + } + return (TRUE); +} + +bool_t +xdr_yppushresp_xfr(xdrs, objp) +XDR *xdrs; +struct yppushresp_xfr *objp; +{ + if (!xdr_u_long(xdrs, &objp->transid)) { + return (FALSE); + } + if (!xdr_yppush_status(xdrs, &objp->status)) { + return (FALSE); + } + return (TRUE); +} |