summaryrefslogtreecommitdiff
path: root/librpc/ndr
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-18 00:35:44 +0100
committerGünther Deschner <gd@samba.org>2009-03-18 01:19:46 +0100
commit18a93e3e62f29448f34f9af84aba54eedb26fe21 (patch)
tree3adb0c0d253364543e8e1c10f6895ed1094d6483 /librpc/ndr
parentb1d4523f73afd83e0170bac653814b59c4d68b6e (diff)
downloadsamba-18a93e3e62f29448f34f9af84aba54eedb26fe21.tar.gz
samba-18a93e3e62f29448f34f9af84aba54eedb26fe21.tar.bz2
samba-18a93e3e62f29448f34f9af84aba54eedb26fe21.zip
spoolss: add ndr_push/pull_spoolss_EnumPrinterDataEx helper.
Guenther
Diffstat (limited to 'librpc/ndr')
-rw-r--r--librpc/ndr/ndr_spoolss_buf.c93
-rw-r--r--librpc/ndr/ndr_spoolss_buf.h3
2 files changed, 95 insertions, 1 deletions
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c
index 8b41a4c133..16a9b1ba4b 100644
--- a/librpc/ndr/ndr_spoolss_buf.c
+++ b/librpc/ndr/ndr_spoolss_buf.c
@@ -438,6 +438,99 @@ uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struc
}
/*
+ spoolss_EnumPrinterDataEx
+*/
+
+enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
+{
+ struct _spoolss_EnumPrinterDataEx _r;
+ if (flags & NDR_IN) {
+ _r.in.handle = r->in.handle;
+ _r.in.key_name = r->in.key_name;
+ _r.in.offered = r->in.offered;
+ NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
+ }
+ if (flags & NDR_OUT) {
+ struct ndr_push *_ndr_info;
+ _r.in.handle = r->in.handle;
+ _r.in.key_name = r->in.key_name;
+ _r.in.offered = r->in.offered;
+ _r.out.count = r->out.count;
+ _r.out.needed = r->out.needed;
+ _r.out.result = r->out.result;
+ if (r->in.offered >= *r->out.needed) {
+ struct __spoolss_EnumPrinterDataEx __r;
+ _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
+ NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
+ _ndr_info->flags= ndr->flags;
+ __r.in.count = *r->out.count;
+ __r.out.info = *r->out.info;
+ NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
+ if (r->in.offered > _ndr_info->offset) {
+ uint32_t _padding_len = r->in.offered - _ndr_info->offset;
+ NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
+ }
+ _r.out.info = ndr_push_blob(_ndr_info);
+ }
+ NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
+{
+ struct _spoolss_EnumPrinterDataEx _r;
+ if (flags & NDR_IN) {
+ _r.in.handle = r->in.handle;
+ _r.in.key_name = r->in.key_name;
+ ZERO_STRUCT(r->out);
+ NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
+ r->in.handle = _r.in.handle;
+ r->in.key_name = _r.in.key_name;
+ r->in.offered = _r.in.offered;
+ r->out.needed = _r.out.needed;
+ r->out.count = _r.out.count;
+ NDR_PULL_ALLOC(ndr, r->out.info);
+ ZERO_STRUCTP(r->out.info);
+ }
+ if (flags & NDR_OUT) {
+ _r.in.handle = r->in.handle;
+ _r.in.key_name = r->in.key_name;
+ _r.in.offered = r->in.offered;
+ _r.out.count = r->out.count;
+ _r.out.needed = r->out.needed;
+ NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.info);
+ }
+ *r->out.info = NULL;
+ r->out.needed = _r.out.needed;
+ r->out.count = _r.out.count;
+ r->out.result = _r.out.result;
+ if (_r.out.info.length) {
+ struct ndr_pull *_ndr_info;
+ NDR_PULL_ALLOC(ndr, *r->out.info);
+ _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info, ndr->iconv_convenience);
+ NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
+ _ndr_info->flags= ndr->flags;
+ if (r->in.offered != _ndr_info->data_size) {
+ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
+ "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
+ (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);
+ }
+ if (*r->out.needed <= _ndr_info->data_size) {
+ struct __spoolss_EnumPrinterDataEx __r;
+ __r.in.count = *r->out.count;
+ __r.out.info = NULL;
+ NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
+ *r->out.info = __r.out.info;
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
spoolss_GetPrinterData
*/
enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r)
diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h
index 04a84bfb62..ae3bf868f5 100644
--- a/librpc/ndr/ndr_spoolss_buf.h
+++ b/librpc/ndr/ndr_spoolss_buf.h
@@ -38,7 +38,8 @@ enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr,
enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r);
uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info);
-
+enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r);
+enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r);
enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r);
enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r);
enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r);