summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/ndr/ndr_misc.c24
-rw-r--r--source4/librpc/ndr/ndr_misc.h6
2 files changed, 30 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_misc.c b/source4/librpc/ndr/ndr_misc.c
index cdd6652068..08ec44c0b0 100644
--- a/source4/librpc/ndr/ndr_misc.c
+++ b/source4/librpc/ndr/ndr_misc.c
@@ -43,3 +43,27 @@ NTSTATUS ndr_push_policy_handle(struct ndr_push *ndr,
NDR_CHECK(ndr_push_bytes(ndr, r->data, 20));
return NT_STATUS_OK;
}
+
+
+/*
+ push a buffer of bytes
+*/
+NTSTATUS ndr_push_uint8_buf(struct ndr_push *ndr, int ndr_flags,
+ struct uint8_buf *buf)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, buf->size));
+ NDR_CHECK(ndr_push_bytes(ndr, buf->data, buf->size));
+ return NT_STATUS_OK;
+}
+
+/*
+ pull a buffer of bytes
+*/
+NTSTATUS ndr_pull_uint8_buf(struct ndr_pull *ndr, int ndr_flags,
+ struct uint8_buf *buf)
+{
+ NDR_CHECK(ndr_pull_uint32(ndr, &buf->size));
+ NDR_ALLOC_SIZE(ndr, buf->data, buf->size);
+ NDR_CHECK(ndr_pull_bytes(ndr, buf->data, buf->size));
+ return NT_STATUS_OK;
+}
diff --git a/source4/librpc/ndr/ndr_misc.h b/source4/librpc/ndr/ndr_misc.h
index cc3576b3e8..1621bf6e05 100644
--- a/source4/librpc/ndr/ndr_misc.h
+++ b/source4/librpc/ndr/ndr_misc.h
@@ -24,3 +24,9 @@
struct policy_handle {
char data[20];
};
+
+/* A buffer of uint8s */
+struct uint8_buf {
+ uint32 size;
+ uint8 *data;
+};