summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-03-11 15:45:15 +0100
committerGünther Deschner <gd@samba.org>2013-03-15 12:11:02 +0100
commitcc09762cb8fd229d99d57f91f4ab7839b5c6ae80 (patch)
treef612ef24bb5da7c0ced9b2a7f4117a975581174a
parenta42527e51b97737fd7c56872bb80a7a782cdf11e (diff)
downloadsamba-cc09762cb8fd229d99d57f91f4ab7839b5c6ae80.tar.gz
samba-cc09762cb8fd229d99d57f91f4ab7839b5c6ae80.tar.bz2
samba-cc09762cb8fd229d99d57f91f4ab7839b5c6ae80.zip
ndr: Add ndr_ntprinting_string_flags() function.
It defaults to utf8string. Reviewed-by: Günther Deschner <gd@samba.org>
-rw-r--r--librpc/ndr/ndr_ntprinting.c15
-rw-r--r--librpc/ndr/ndr_ntprinting.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_ntprinting.c b/librpc/ndr/ndr_ntprinting.c
index 76b296d169..b22830fabd 100644
--- a/librpc/ndr/ndr_ntprinting.c
+++ b/librpc/ndr/ndr_ntprinting.c
@@ -22,6 +22,21 @@
#include "includes.h"
#include "../librpc/gen_ndr/ndr_ntprinting.h"
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags)
+{
+ uint32_t flags = LIBNDR_FLAG_STR_NULLTERM;
+
+ if (string_flags & LIBNDR_FLAG_STR_ASCII) {
+ flags |= LIBNDR_FLAG_STR_ASCII;
+ } else if (string_flags & LIBNDR_FLAG_STR_RAW8) {
+ flags |= LIBNDR_FLAG_STR_RAW8;
+ } else {
+ flags |= LIBNDR_FLAG_STR_UTF8;
+ }
+
+ return flags;
+}
+
_PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r)
{
uint32_t _ptr_devmode;
diff --git a/librpc/ndr/ndr_ntprinting.h b/librpc/ndr/ndr_ntprinting.h
index 8bda430438..3b6ee01460 100644
--- a/librpc/ndr/ndr_ntprinting.h
+++ b/librpc/ndr/ndr_ntprinting.h
@@ -22,4 +22,6 @@
#include "includes.h"
#include "../librpc/gen_ndr/ndr_ntprinting.h"
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags);
+
_PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r);