summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-12-12 06:26:34 +0000
committerTim Potter <tpot@samba.org>2003-12-12 06:26:34 +0000
commitd68d1558f7b6344a14774ce49ebc5da210a5b261 (patch)
tree964c47743121cb47d2a9671ad4def284b8b335b3 /source4/librpc/ndr
parentfece5b7abae880f839b662aa1ac590f4a997c95e (diff)
downloadsamba-d68d1558f7b6344a14774ce49ebc5da210a5b261.tar.gz
samba-d68d1558f7b6344a14774ce49ebc5da210a5b261.tar.bz2
samba-d68d1558f7b6344a14774ce49ebc5da210a5b261.zip
Added routines for arrays of uint16s.
(This used to be commit 370512f6644507ed0457de71ab5a50207e00e750)
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/ndr_basic.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 0300bdd3fb..3b5aea60ca 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -279,6 +279,21 @@ NTSTATUS ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const char *d
}
/*
+ push an array of uint16
+*/
+NTSTATUS ndr_push_array_uint16(struct ndr_push *ndr, int ndr_flags, const uint16 *data, uint32 n)
+{
+ int i;
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NT_STATUS_OK;
+ }
+ for (i=0;i<n;i++) {
+ NDR_CHECK(ndr_push_uint16(ndr, data[i]));
+ }
+ return NT_STATUS_OK;
+}
+
+/*
push an array of uint32
*/
NTSTATUS ndr_push_array_uint32(struct ndr_push *ndr, int ndr_flags, const uint32 *data, uint32 n)
@@ -702,6 +717,24 @@ void ndr_print_array_uint32(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
+void ndr_print_array_uint16(struct ndr_print *ndr, const char *name,
+ const uint16 *data, uint32 count)
+{
+ int i;
+
+ ndr->print(ndr, "%s: ARRAY(%d)", name, count);
+ ndr->depth++;
+ for (i=0;i<count;i++) {
+ char *idx=NULL;
+ asprintf(&idx, "[%d]", i);
+ if (idx) {
+ ndr_print_uint16(ndr, idx, data[i]);
+ free(idx);
+ }
+ }
+ ndr->depth--;
+}
+
void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
const uint8 *data, uint32 count)
{