about summary refs log tree commit diff
path: root/nis/yp_xdr.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-07-09 13:05:42 +0000
committerUlrich Drepper <drepper@redhat.com>1999-07-09 13:05:42 +0000
commit56ad7b2ceccc199811378d9033a8fbb7bcc1cc4c (patch)
tree4597d277f006dbc38a622c81b1722b036b78770c /nis/yp_xdr.c
parent019e7a645aa33eee4cb5098dc475a303d0e0512a (diff)
downloadglibc-56ad7b2ceccc199811378d9033a8fbb7bcc1cc4c.tar.gz
glibc-56ad7b2ceccc199811378d9033a8fbb7bcc1cc4c.tar.xz
glibc-56ad7b2ceccc199811378d9033a8fbb7bcc1cc4c.zip
Update.
1999-07-09  Ulrich Drepper  <drepper@cygnus.com>

	* Versions.def (libnsl): Add GLIBC_2.2.
	* nis/Versions (libnsl) [GLIBC_2.2]: Add xdr_ypall.

1999-07-08  Cristian Gafton  <gafton@redhat.com>

	* nis/yp_xdr.c (xdr_ypall): New function.
Diffstat (limited to 'nis/yp_xdr.c')
-rw-r--r--nis/yp_xdr.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/nis/yp_xdr.c b/nis/yp_xdr.c
index f189169687..f962c4dfcc 100644
--- a/nis/yp_xdr.c
+++ b/nis/yp_xdr.c
@@ -28,6 +28,7 @@
  */
 
 #include <rpcsvc/yp.h>
+#include <rpcsvc/ypclnt.h>
 
 bool_t
 xdr_ypstat (XDR *xdrs, ypstat *objp)
@@ -298,3 +299,47 @@ xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
     return FALSE;
   return TRUE;
 }
+
+bool_t
+xdr_ypall(XDR *xdrs, struct ypall_callback *incallback)
+{
+    struct ypresp_key_val out;
+    char key[YPMAXRECORD], val[YPMAXRECORD];
+
+    /*
+     * Set up key/val struct to be used during the transaction.
+     */
+    memset(&out, 0, sizeof out);
+    out.key.keydat_val = key;
+    out.key.keydat_len = sizeof(key);
+    out.val.valdat_val = val;
+    out.val.valdat_len = sizeof(val);
+
+    for (;;) {
+	bool_t more, status;
+
+	/* Values pending? */
+	if (!xdr_bool(xdrs, &more))
+	    return FALSE;           /* can't tell! */
+	if (!more)
+	    return TRUE;            /* no more */
+
+	/* Transfer key/value pair. */
+	status = xdr_ypresp_key_val(xdrs, &out);
+
+	/*
+	 * If we succeeded, call the callback function.
+	 * The callback will return TRUE when it wants
+	 * no more values.  If we fail, indicate the
+	 * error.
+	 */
+	if (status) {
+	    if ((*incallback->foreach)(out.stat,
+				       (char *)out.key.keydat_val, out.key.keydat_len,
+				       (char *)out.val.valdat_val, out.val.valdat_len,
+				       incallback->data))
+		return TRUE;
+	} else
+	    return FALSE;
+    }
+}