xref: /openbsd-src/lib/libc/yp/xdr_ypresp_all.c (revision aea60bee5e9bad0aab62f480f19c2fb34c068de4)
1*aea60beeSderaadt /*	$OpenBSD: xdr_ypresp_all.c,v 1.7 2015/01/16 16:48:51 deraadt Exp $ */
218128546Sderaadt /*
318128546Sderaadt  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com>
418128546Sderaadt  * All rights reserved.
518128546Sderaadt  *
618128546Sderaadt  * Redistribution and use in source and binary forms, with or without
718128546Sderaadt  * modification, are permitted provided that the following conditions
818128546Sderaadt  * are met:
918128546Sderaadt  * 1. Redistributions of source code must retain the above copyright
1018128546Sderaadt  *    notice, this list of conditions and the following disclaimer.
1118128546Sderaadt  * 2. Redistributions in binary form must reproduce the above copyright
1218128546Sderaadt  *    notice, this list of conditions and the following disclaimer in the
1318128546Sderaadt  *    documentation and/or other materials provided with the distribution.
1418128546Sderaadt  *
1518128546Sderaadt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
1618128546Sderaadt  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1718128546Sderaadt  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818128546Sderaadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
1918128546Sderaadt  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2018128546Sderaadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2118128546Sderaadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2218128546Sderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2318128546Sderaadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2418128546Sderaadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2518128546Sderaadt  * SUCH DAMAGE.
2618128546Sderaadt  */
2718128546Sderaadt 
2818128546Sderaadt #include <sys/types.h>
2918128546Sderaadt #include <rpc/rpc.h>
3018128546Sderaadt #include <rpc/xdr.h>
3118128546Sderaadt #include <rpcsvc/yp.h>
3218128546Sderaadt 
3318128546Sderaadt bool_t
xdr_ypresp_all(XDR * xdrs,struct ypresp_all * objp)3411e5d692Sderaadt xdr_ypresp_all(XDR *xdrs, struct ypresp_all *objp)
3518128546Sderaadt {
3618128546Sderaadt 	if (!xdr_bool(xdrs, &objp->more)) {
3718128546Sderaadt 		return FALSE;
3818128546Sderaadt 	}
3918128546Sderaadt 	switch (objp->more) {
4018128546Sderaadt 	case TRUE:
4118128546Sderaadt 		return xdr_ypresp_key_val(xdrs, &objp->ypresp_all_u.val);
4218128546Sderaadt 	case FALSE:
4318128546Sderaadt 		return (TRUE);
4418128546Sderaadt 	default:
4518128546Sderaadt 		return FALSE;
4618128546Sderaadt 	}
4718128546Sderaadt 	/* NOTREACHED */
4818128546Sderaadt }
49