diff options
Diffstat (limited to 'source3/librpc/ndr/ndr_basic.c')
-rw-r--r-- | source3/librpc/ndr/ndr_basic.c | 175 |
1 files changed, 90 insertions, 85 deletions
diff --git a/source3/librpc/ndr/ndr_basic.c b/source3/librpc/ndr/ndr_basic.c index 5377ed3dd3..b406791a27 100644 --- a/source3/librpc/ndr/ndr_basic.c +++ b/source3/librpc/ndr/ndr_basic.c @@ -20,6 +20,8 @@ */ #include "includes.h" +#include "system/network.h" +#include "librpc/ndr/libndr.h" #define NDR_SVAL(ndr, ofs) (NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs)) #define NDR_IVAL(ndr, ofs) (NDR_BE(ndr)?RIVAL(ndr->data,ofs):IVAL(ndr->data,ofs)) @@ -34,7 +36,7 @@ these could also indicate that real structure elements have been mistaken for padding in the IDL */ -void ndr_check_padding(struct ndr_pull *ndr, size_t n) +_PUBLIC_ void ndr_check_padding(struct ndr_pull *ndr, size_t n) { size_t ofs2 = (ndr->offset + (n-1)) & ~(n-1); int i; @@ -56,7 +58,7 @@ void ndr_check_padding(struct ndr_pull *ndr, size_t n) /* parse a int8_t */ -NTSTATUS ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v) +_PUBLIC_ NTSTATUS ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v) { NDR_PULL_NEED_BYTES(ndr, 1); *v = (int8_t)CVAL(ndr->data, ndr->offset); @@ -67,7 +69,7 @@ NTSTATUS ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v) /* parse a uint8_t */ -NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v) +_PUBLIC_ NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v) { NDR_PULL_NEED_BYTES(ndr, 1); *v = CVAL(ndr->data, ndr->offset); @@ -78,7 +80,7 @@ NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v) /* parse a int16_t */ -NTSTATUS ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v) +_PUBLIC_ NTSTATUS ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v) { NDR_PULL_ALIGN(ndr, 2); NDR_PULL_NEED_BYTES(ndr, 2); @@ -90,7 +92,7 @@ NTSTATUS ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v) /* parse a uint16_t */ -NTSTATUS ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v) +_PUBLIC_ NTSTATUS ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v) { NDR_PULL_ALIGN(ndr, 2); NDR_PULL_NEED_BYTES(ndr, 2); @@ -102,7 +104,7 @@ NTSTATUS ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v) /* parse a int32_t */ -NTSTATUS ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v) +_PUBLIC_ NTSTATUS ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v) { NDR_PULL_ALIGN(ndr, 4); NDR_PULL_NEED_BYTES(ndr, 4); @@ -114,7 +116,7 @@ NTSTATUS ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v) /* parse a uint32_t */ -NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v) +_PUBLIC_ NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v) { NDR_PULL_ALIGN(ndr, 4); NDR_PULL_NEED_BYTES(ndr, 4); @@ -126,7 +128,7 @@ NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v) /* parse a pointer referent identifier */ -NTSTATUS ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v) +_PUBLIC_ NTSTATUS ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v) { NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, v)); if (*v != 0) { @@ -138,7 +140,7 @@ NTSTATUS ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v) /* parse a ref pointer referent identifier */ -NTSTATUS ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v) +_PUBLIC_ NTSTATUS ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v) { NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, v)); /* ref pointers always point to data */ @@ -149,7 +151,7 @@ NTSTATUS ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v) /* parse a udlong */ -NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) +_PUBLIC_ NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) { NDR_PULL_ALIGN(ndr, 4); NDR_PULL_NEED_BYTES(ndr, 8); @@ -162,7 +164,7 @@ NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) /* parse a udlongr */ -NTSTATUS ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) +_PUBLIC_ NTSTATUS ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) { NDR_PULL_ALIGN(ndr, 4); NDR_PULL_NEED_BYTES(ndr, 8); @@ -175,7 +177,7 @@ NTSTATUS ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) /* parse a dlong */ -NTSTATUS ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v) +_PUBLIC_ NTSTATUS ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v) { return ndr_pull_udlong(ndr, ndr_flags, (uint64_t *)v); } @@ -183,7 +185,7 @@ NTSTATUS ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v) /* parse a hyper */ -NTSTATUS ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) +_PUBLIC_ NTSTATUS ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) { NDR_PULL_ALIGN(ndr, 8); return ndr_pull_udlong(ndr, ndr_flags, v); @@ -192,7 +194,7 @@ NTSTATUS ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) /* parse a pointer */ -NTSTATUS ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v) +_PUBLIC_ NTSTATUS ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v) { intptr_t h; NDR_PULL_ALIGN(ndr, sizeof(h)); @@ -206,7 +208,7 @@ NTSTATUS ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v) /* pull a NTSTATUS */ -NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status) +_PUBLIC_ NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status) { uint32_t v; NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); @@ -217,12 +219,12 @@ NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status /* push a NTSTATUS */ -NTSTATUS ndr_push_NTSTATUS(struct ndr_push *ndr, int ndr_flags, NTSTATUS status) +_PUBLIC_ NTSTATUS ndr_push_NTSTATUS(struct ndr_push *ndr, int ndr_flags, NTSTATUS status) { return ndr_push_uint32(ndr, ndr_flags, NT_STATUS_V(status)); } -void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS r) +_PUBLIC_ void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS r) { ndr->print(ndr, "%-25s: %s", name, nt_errstr(r)); } @@ -230,7 +232,7 @@ void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS r) /* pull a WERROR */ -NTSTATUS ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status) +_PUBLIC_ NTSTATUS ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status) { uint32_t v; NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); @@ -241,20 +243,20 @@ NTSTATUS ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status) /* push a WERROR */ -NTSTATUS ndr_push_WERROR(struct ndr_push *ndr, int ndr_flags, WERROR status) +_PUBLIC_ NTSTATUS ndr_push_WERROR(struct ndr_push *ndr, int ndr_flags, WERROR status) { return ndr_push_uint32(ndr, NDR_SCALARS, W_ERROR_V(status)); } -void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR r) +_PUBLIC_ void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR r) { - ndr->print(ndr, "%-25s: %s", name, dos_errstr(r)); + ndr->print(ndr, "%-25s: %s", name, win_errstr(r)); } /* parse a set of bytes */ -NTSTATUS ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n) +_PUBLIC_ NTSTATUS ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n) { NDR_PULL_NEED_BYTES(ndr, n); memcpy(data, ndr->data + ndr->offset, n); @@ -265,7 +267,7 @@ NTSTATUS ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n) /* pull an array of uint8 */ -NTSTATUS ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n) +_PUBLIC_ NTSTATUS ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n) { if (!(ndr_flags & NDR_SCALARS)) { return NT_STATUS_OK; @@ -276,7 +278,7 @@ NTSTATUS ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data /* push a int8_t */ -NTSTATUS ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v) +_PUBLIC_ NTSTATUS ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v) { NDR_PUSH_NEED_BYTES(ndr, 1); SCVAL(ndr->data, ndr->offset, (uint8_t)v); @@ -287,7 +289,7 @@ NTSTATUS ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v) /* push a uint8_t */ -NTSTATUS ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v) +_PUBLIC_ NTSTATUS ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v) { NDR_PUSH_NEED_BYTES(ndr, 1); SCVAL(ndr->data, ndr->offset, v); @@ -298,7 +300,7 @@ NTSTATUS ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v) /* push a int16_t */ -NTSTATUS ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v) +_PUBLIC_ NTSTATUS ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v) { NDR_PUSH_ALIGN(ndr, 2); NDR_PUSH_NEED_BYTES(ndr, 2); @@ -310,7 +312,7 @@ NTSTATUS ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v) /* push a uint16_t */ -NTSTATUS ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v) +_PUBLIC_ NTSTATUS ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v) { NDR_PUSH_ALIGN(ndr, 2); NDR_PUSH_NEED_BYTES(ndr, 2); @@ -322,7 +324,7 @@ NTSTATUS ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v) /* push a int32_t */ -NTSTATUS ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v) +_PUBLIC_ NTSTATUS ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v) { NDR_PUSH_ALIGN(ndr, 4); NDR_PUSH_NEED_BYTES(ndr, 4); @@ -334,7 +336,7 @@ NTSTATUS ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v) /* push a uint32_t */ -NTSTATUS ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v) +_PUBLIC_ NTSTATUS ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v) { NDR_PUSH_ALIGN(ndr, 4); NDR_PUSH_NEED_BYTES(ndr, 4); @@ -346,7 +348,7 @@ NTSTATUS ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v) /* push a udlong */ -NTSTATUS ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v) +_PUBLIC_ NTSTATUS ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v) { NDR_PUSH_ALIGN(ndr, 4); NDR_PUSH_NEED_BYTES(ndr, 8); @@ -359,7 +361,7 @@ NTSTATUS ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v) /* push a udlongr */ -NTSTATUS ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v) +_PUBLIC_ NTSTATUS ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v) { NDR_PUSH_ALIGN(ndr, 4); NDR_PUSH_NEED_BYTES(ndr, 8); @@ -372,7 +374,7 @@ NTSTATUS ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v) /* push a dlong */ -NTSTATUS ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v) +_PUBLIC_ NTSTATUS ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v) { return ndr_push_udlong(ndr, NDR_SCALARS, (uint64_t)v); } @@ -380,7 +382,7 @@ NTSTATUS ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v) /* push a hyper */ -NTSTATUS ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v) +_PUBLIC_ NTSTATUS ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v) { NDR_PUSH_ALIGN(ndr, 8); return ndr_push_udlong(ndr, NDR_SCALARS, v); @@ -389,7 +391,7 @@ NTSTATUS ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v) /* push a pointer */ -NTSTATUS ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v) +_PUBLIC_ NTSTATUS ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v) { intptr_t h = (intptr_t)v; NDR_PUSH_ALIGN(ndr, sizeof(h)); @@ -399,13 +401,13 @@ NTSTATUS ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v) return NT_STATUS_OK; } -NTSTATUS ndr_push_align(struct ndr_push *ndr, size_t size) +_PUBLIC_ NTSTATUS ndr_push_align(struct ndr_push *ndr, size_t size) { NDR_PUSH_ALIGN(ndr, size); return NT_STATUS_OK; } -NTSTATUS ndr_pull_align(struct ndr_pull *ndr, size_t size) +_PUBLIC_ NTSTATUS ndr_pull_align(struct ndr_pull *ndr, size_t size) { NDR_PULL_ALIGN(ndr, size); return NT_STATUS_OK; @@ -414,7 +416,7 @@ NTSTATUS ndr_pull_align(struct ndr_pull *ndr, size_t size) /* push some bytes */ -NTSTATUS ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n) +_PUBLIC_ NTSTATUS ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n) { NDR_PUSH_NEED_BYTES(ndr, n); memcpy(ndr->data + ndr->offset, data, n); @@ -425,7 +427,7 @@ NTSTATUS ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n) /* push some zero bytes */ -NTSTATUS ndr_push_zero(struct ndr_push *ndr, uint32_t n) +_PUBLIC_ NTSTATUS ndr_push_zero(struct ndr_push *ndr, uint32_t n) { NDR_PUSH_NEED_BYTES(ndr, n); memset(ndr->data + ndr->offset, 0, n); @@ -436,7 +438,7 @@ NTSTATUS ndr_push_zero(struct ndr_push *ndr, uint32_t n) /* push an array of uint8 */ -NTSTATUS ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n) +_PUBLIC_ NTSTATUS ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n) { if (!(ndr_flags & NDR_SCALARS)) { return NT_STATUS_OK; @@ -447,7 +449,7 @@ NTSTATUS ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t /* save the current position */ -void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save) +_PUBLIC_ void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save) { save->offset = ndr->offset; } @@ -455,7 +457,7 @@ void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save) /* restore the position */ -void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save *save) +_PUBLIC_ void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save *save) { ndr->offset = save->offset; } @@ -463,7 +465,7 @@ void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save *save) /* push a unique non-zero value if a pointer is non-NULL, otherwise 0 */ -NTSTATUS ndr_push_unique_ptr(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_unique_ptr(struct ndr_push *ndr, const void *p) { uint32_t ptr = 0; if (p) { @@ -477,7 +479,7 @@ NTSTATUS ndr_push_unique_ptr(struct ndr_push *ndr, const void *p) /* push a 'simple' full non-zero value if a pointer is non-NULL, otherwise 0 */ -NTSTATUS ndr_push_full_ptr(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_full_ptr(struct ndr_push *ndr, const void *p) { uint32_t ptr = 0; if (p) { @@ -495,15 +497,16 @@ NTSTATUS ndr_push_full_ptr(struct ndr_push *ndr, const void *p) /* push always a 0, if a pointer is NULL it's a fatal error */ -NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr) +_PUBLIC_ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr) { return ndr_push_uint32(ndr, NDR_SCALARS, 0xAEF1AEF1); } + /* push a NTTIME */ -NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t) +_PUBLIC_ NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t) { NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, t)); return NT_STATUS_OK; @@ -512,7 +515,7 @@ NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t) /* pull a NTTIME */ -NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) +_PUBLIC_ NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) { NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, t)); return NT_STATUS_OK; @@ -521,7 +524,7 @@ NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) /* push a NTTIME */ -NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t) +_PUBLIC_ NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t) { t /= 10000000; NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t)); @@ -531,7 +534,7 @@ NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t) /* pull a NTTIME_1sec */ -NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) +_PUBLIC_ NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) { NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t)); (*t) *= 10000000; @@ -541,7 +544,7 @@ NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) /* pull a NTTIME_hyper */ -NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) +_PUBLIC_ NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) { NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t)); return NT_STATUS_OK; @@ -550,7 +553,7 @@ NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t) /* push a NTTIME_hyper */ -NTSTATUS ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t) +_PUBLIC_ NTSTATUS ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t) { NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t)); return NT_STATUS_OK; @@ -559,7 +562,7 @@ NTSTATUS ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t) /* push a time_t */ -NTSTATUS ndr_push_time_t(struct ndr_push *ndr, int ndr_flags, time_t t) +_PUBLIC_ NTSTATUS ndr_push_time_t(struct ndr_push *ndr, int ndr_flags, time_t t) { return ndr_push_uint32(ndr, ndr_flags, t); } @@ -567,7 +570,7 @@ NTSTATUS ndr_push_time_t(struct ndr_push *ndr, int ndr_flags, time_t t) /* pull a time_t */ -NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t) +_PUBLIC_ NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t) { uint32_t tt; NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &tt)); @@ -575,10 +578,11 @@ NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t) return NT_STATUS_OK; } + /* pull a ipv4address */ -NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address) +_PUBLIC_ NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address) { struct in_addr in; NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.s_addr)); @@ -591,10 +595,10 @@ NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char ** /* push a ipv4address */ -NTSTATUS ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *address) +_PUBLIC_ NTSTATUS ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *address) { uint32_t addr; - if (!is_ipaddress_v4(address)) { + if (!is_ipaddress(address)) { return ndr_push_error(ndr, NDR_ERR_IPV4ADDRESS, "Invalid IPv4 address: '%s'", address); @@ -607,18 +611,19 @@ NTSTATUS ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *a /* print a ipv4address */ -void ndr_print_ipv4address(struct ndr_print *ndr, const char *name, +_PUBLIC_ void ndr_print_ipv4address(struct ndr_print *ndr, const char *name, const char *address) { ndr->print(ndr, "%-25s: %s", name, address); } -void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type) + +_PUBLIC_ void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type) { ndr->print(ndr, "%s: struct %s", name, type); } -void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type, +_PUBLIC_ void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type, const char *val, uint32_t value) { if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) { @@ -628,7 +633,7 @@ void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type, } } -void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value) +_PUBLIC_ void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value) { /* this is an attempt to support multi-bit bitmap masks */ value &= flag; @@ -644,62 +649,62 @@ void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_ } } -void ndr_print_int8(struct ndr_print *ndr, const char *name, int8_t v) +_PUBLIC_ void ndr_print_int8(struct ndr_print *ndr, const char *name, int8_t v) { ndr->print(ndr, "%-25s: %d", name, v); } -void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v) +_PUBLIC_ void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v) { ndr->print(ndr, "%-25s: 0x%02x (%u)", name, v, v); } -void ndr_print_int16(struct ndr_print *ndr, const char *name, int16_t v) +_PUBLIC_ void ndr_print_int16(struct ndr_print *ndr, const char *name, int16_t v) { ndr->print(ndr, "%-25s: %d", name, v); } -void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t v) +_PUBLIC_ void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t v) { ndr->print(ndr, "%-25s: 0x%04x (%u)", name, v, v); } -void ndr_print_int32(struct ndr_print *ndr, const char *name, int32_t v) +_PUBLIC_ void ndr_print_int32(struct ndr_print *ndr, const char *name, int32_t v) { ndr->print(ndr, "%-25s: %d", name, v); } -void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t v) +_PUBLIC_ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t v) { ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v); } -void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v) +_PUBLIC_ void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v) { - ndr->print(ndr, "%-25s: 0x%016llx (%llu)", name, v, v); + ndr->print(ndr, "%-25s: 0x%016llx (%llu)", name, (unsigned long long)v, (unsigned long long)v); } -void ndr_print_udlongr(struct ndr_print *ndr, const char *name, uint64_t v) +_PUBLIC_ void ndr_print_udlongr(struct ndr_print *ndr, const char *name, uint64_t v) { ndr_print_udlong(ndr, name, v); } -void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v) +_PUBLIC_ void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v) { - ndr->print(ndr, "%-25s: 0x%016llx (%lld)", name, v, v); + ndr->print(ndr, "%-25s: 0x%016llx (%lld)", name, (unsigned long long)v, (long long)v); } -void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v) +_PUBLIC_ void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v) { ndr_print_dlong(ndr, name, v); } -void ndr_print_pointer(struct ndr_print *ndr, const char *name, void *v) +_PUBLIC_ void ndr_print_pointer(struct ndr_print *ndr, const char *name, void *v) { ndr->print(ndr, "%-25s: %p", name, v); } -void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p) +_PUBLIC_ void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p) { if (p) { ndr->print(ndr, "%-25s: *", name); @@ -708,12 +713,12 @@ void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p) } } -void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t) +_PUBLIC_ void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t) { ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr, t)); } -void ndr_print_NTTIME_1sec(struct ndr_print *ndr, const char *name, NTTIME t) +_PUBLIC_ void ndr_print_NTTIME_1sec(struct ndr_print *ndr, const char *name, NTTIME t) { /* this is a standard NTTIME here * as it's already converted in the pull/push code @@ -721,12 +726,12 @@ void ndr_print_NTTIME_1sec(struct ndr_print *ndr, const char *name, NTTIME t) ndr_print_NTTIME(ndr, name, t); } -void ndr_print_NTTIME_hyper(struct ndr_print *ndr, const char *name, NTTIME t) +_PUBLIC_ void ndr_print_NTTIME_hyper(struct ndr_print *ndr, const char *name, NTTIME t) { ndr_print_NTTIME(ndr, name, t); } -void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t) +_PUBLIC_ void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t) { if (t == (time_t)-1 || t == 0) { ndr->print(ndr, "%-25s: (time_t)%d", name, (int)t); @@ -735,7 +740,7 @@ void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t) } } -void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type) +_PUBLIC_ void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type) { if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) { ndr->print(ndr, "%-25s: union %s(case 0x%X)", name, type, level); @@ -744,12 +749,12 @@ void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const c } } -void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level) +_PUBLIC_ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level) { ndr->print(ndr, "UNKNOWN LEVEL %u", level); } -void ndr_print_array_uint8(struct ndr_print *ndr, const char *name, +_PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name, const uint8_t *data, uint32_t count) { int i; @@ -777,9 +782,9 @@ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name, ndr->depth--; } -void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r) +_PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r) { - ndr->print(ndr, "%-25s: DATA_BLOB length=%u", name, r.length); + ndr->print(ndr, "%-25s: DATA_BLOB length=%u", name, (unsigned)r.length); if (r.length) { dump_data(10, r.data, r.length); } @@ -789,7 +794,7 @@ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r) /* push a DATA_BLOB onto the wire. */ -NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob) +_PUBLIC_ NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob) { if (ndr->flags & LIBNDR_ALIGN_FLAGS) { if (ndr->flags & LIBNDR_FLAG_ALIGN2) { @@ -811,7 +816,7 @@ NTSTATUS ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob) /* pull a DATA_BLOB from the wire. */ -NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob) +_PUBLIC_ NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob) { uint32_t length = 0; @@ -837,7 +842,7 @@ NTSTATUS ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob return NT_STATUS_OK; } -uint32_t ndr_size_DATA_BLOB(int ret, const DATA_BLOB *data, int flags) +_PUBLIC_ uint32_t ndr_size_DATA_BLOB(int ret, const DATA_BLOB *data, int flags) { if (!data) return ret; return ret + data->length; |