summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-10-18 12:18:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:00:01 -0500
commit3406ac309252fc978fcfcbf39f85d7e9483b2758 (patch)
treeddaaaa72645296db1ac95b75dee9380690d91cde /source4/librpc
parent8e8c6aef3c99931cdfe8d0bf8ca74616e0960014 (diff)
downloadsamba-3406ac309252fc978fcfcbf39f85d7e9483b2758.tar.gz
samba-3406ac309252fc978fcfcbf39f85d7e9483b2758.tar.bz2
samba-3406ac309252fc978fcfcbf39f85d7e9483b2758.zip
r3036: Add function to pull an array of structures. Abstracts away the
individual routines in ndr_spoolss_buf.c. (This used to be commit e080a2483da61ee95d21b0355471a4af13c20a81)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/ndr.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 4f6f135cd6..02eb3e95ba 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -249,6 +249,27 @@ done:
return NT_STATUS_OK;
}
+/*
+ pull a constant size array of structures
+*/
+NTSTATUS ndr_pull_struct_array(struct ndr_pull *ndr, uint32_t count,
+ size_t elsize, void **info,
+ NTSTATUS (*pull_fn)(struct ndr_pull *, int, void *))
+{
+ int i;
+ char *base;
+
+ NDR_ALLOC_N_SIZE(ndr, *info, count, elsize);
+ base = (char *)*info;
+
+ for (i = 0; i < count; i++) {
+ ndr->data += ndr->offset;
+ ndr->offset = 0;
+ NDR_CHECK(pull_fn(ndr, NDR_SCALARS|NDR_BUFFERS, &base[count * elsize]));
+ }
+
+ return NT_STATUS_OK;
+}
/*
print a generic array