diff options
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r-- | source4/librpc/ndr/ndr_misc.c | 31 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_string.c | 40 |
2 files changed, 38 insertions, 33 deletions
diff --git a/source4/librpc/ndr/ndr_misc.c b/source4/librpc/ndr/ndr_misc.c index 189d2afffb..5cffd33b46 100644 --- a/source4/librpc/ndr/ndr_misc.c +++ b/source4/librpc/ndr/ndr_misc.c @@ -26,7 +26,7 @@ #include "includes.h" #include "system/network.h" -void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip) +_PUBLIC_ void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip) { struct ipv4_addr ip; @@ -35,10 +35,10 @@ void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct i ndr->print(ndr, "%-25s: %s", name, sys_inet_ntoa(ip)); } -/* +/** build a GUID from a string */ -NTSTATUS GUID_from_string(const char *s, struct GUID *guid) +_PUBLIC_ NTSTATUS GUID_from_string(const char *s, struct GUID *guid) { NTSTATUS status = NT_STATUS_INVALID_PARAMETER; uint32_t time_low; @@ -79,7 +79,9 @@ NTSTATUS GUID_from_string(const char *s, struct GUID *guid) return NT_STATUS_OK; } -/* generate a random GUID */ +/** + * generate a random GUID + */ struct GUID GUID_random(void) { struct GUID guid; @@ -91,8 +93,10 @@ struct GUID GUID_random(void) return guid; } -/* generate a random GUID */ -struct GUID GUID_zero(void) +/** + * generate an empty GUID + */ +_PUBLIC_ struct GUID GUID_zero(void) { struct GUID guid; @@ -101,7 +105,7 @@ struct GUID GUID_zero(void) return guid; } -BOOL GUID_all_zero(const struct GUID *u) +_PUBLIC_ BOOL GUID_all_zero(const struct GUID *u) { if (u->time_low != 0 || u->time_mid != 0 || @@ -114,7 +118,7 @@ BOOL GUID_all_zero(const struct GUID *u) return True; } -BOOL GUID_equal(const struct GUID *u1, const struct GUID *u2) +_PUBLIC_ BOOL GUID_equal(const struct GUID *u1, const struct GUID *u2) { if (u1->time_low != u2->time_low || u1->time_mid != u2->time_mid || @@ -127,10 +131,10 @@ BOOL GUID_equal(const struct GUID *u1, const struct GUID *u2) return True; } -/* +/** its useful to be able to display these in debugging messages */ -char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid) +_PUBLIC_ char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid) { return talloc_asprintf(mem_ctx, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", @@ -143,7 +147,7 @@ char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid) guid->node[4], guid->node[5]); } -char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid) +_PUBLIC_ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid) { char *ret, *s = GUID_string(mem_ctx, guid); ret = talloc_asprintf(mem_ctx, "{%s}", s); @@ -151,13 +155,12 @@ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid) return ret; } - -void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid) +_PUBLIC_ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid) { ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); } -BOOL policy_handle_empty(struct policy_handle *h) +_PUBLIC_ BOOL policy_handle_empty(struct policy_handle *h) { return (h->handle_type == 0 && GUID_all_zero(&h->uuid)); } diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index 9eb26c2c83..164c6d4a03 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -22,10 +22,10 @@ #include "includes.h" -/* +/** pull a general string from the wire */ -NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s) +_PUBLIC_ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s) { char *as=NULL; uint32_t len1, ofs, len2; @@ -281,10 +281,10 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s) } -/* +/** push a general string onto the wire */ -NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s) +_PUBLIC_ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s) { ssize_t s_len, c_len, d_len; int ret; @@ -461,10 +461,10 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s) return NT_STATUS_OK; } -/* +/** push a general string onto the wire */ -size_t ndr_string_array_size(struct ndr_push *ndr, const char *s) +_PUBLIC_ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s) { size_t c_len; unsigned flags = ndr->flags; @@ -497,7 +497,7 @@ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s) return c_len; } -void ndr_print_string(struct ndr_print *ndr, const char *name, const char *s) +_PUBLIC_ void ndr_print_string(struct ndr_print *ndr, const char *name, const char *s) { if (s) { ndr->print(ndr, "%-25s: '%s'", name, s); @@ -506,17 +506,17 @@ void ndr_print_string(struct ndr_print *ndr, const char *name, const char *s) } } -uint32_t ndr_size_string(int ret, const char * const* string, int flags) +_PUBLIC_ uint32_t ndr_size_string(int ret, const char * const* string, int flags) { /* FIXME: Is this correct for all strings ? */ if(!(*string)) return ret; return ret+strlen(*string)+1; } -/* +/** pull a general string array from the wire */ -NTSTATUS ndr_pull_string_array(struct ndr_pull *ndr, int ndr_flags, const char ***_a) +_PUBLIC_ NTSTATUS ndr_pull_string_array(struct ndr_pull *ndr, int ndr_flags, const char ***_a) { const char **a = *_a; uint32_t count; @@ -549,10 +549,10 @@ NTSTATUS ndr_pull_string_array(struct ndr_pull *ndr, int ndr_flags, const char * return NT_STATUS_OK; } -/* +/** push a general string array onto the wire */ -NTSTATUS ndr_push_string_array(struct ndr_push *ndr, int ndr_flags, const char **a) +_PUBLIC_ NTSTATUS ndr_push_string_array(struct ndr_push *ndr, int ndr_flags, const char **a) { uint32_t count; @@ -569,7 +569,7 @@ NTSTATUS ndr_push_string_array(struct ndr_push *ndr, int ndr_flags, const char * return NT_STATUS_OK; } -void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a) +_PUBLIC_ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a) { uint32_t count; uint32_t i; @@ -589,8 +589,10 @@ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char ndr->depth--; } -/* Return number of elements in a string including the last (zeroed) element */ -uint32_t ndr_string_length(const void *_var, uint32_t element_size) +/** + * Return number of elements in a string including the last (zeroed) element + */ +_PUBLIC_ uint32_t ndr_string_length(const void *_var, uint32_t element_size) { uint32_t i; uint8_t zero[4] = {0,0,0,0}; @@ -601,7 +603,7 @@ uint32_t ndr_string_length(const void *_var, uint32_t element_size) return i+1; } -NTSTATUS ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size) +_PUBLIC_ NTSTATUS ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size) { uint32_t i; struct ndr_pull_save save_offset; @@ -623,7 +625,7 @@ NTSTATUS ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint3 return NT_STATUS_OK; } -NTSTATUS ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, int chset) +_PUBLIC_ NTSTATUS ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, int chset) { int ret; if (length == 0) { @@ -647,7 +649,7 @@ NTSTATUS ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, return NT_STATUS_OK; } -NTSTATUS ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, int chset) +_PUBLIC_ NTSTATUS ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, int chset) { ssize_t ret, required; @@ -673,7 +675,7 @@ NTSTATUS ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, } /* Return number of elements in a string in the specified charset */ -uint32_t ndr_charset_length(const void *var, int chset) +_PUBLIC_ uint32_t ndr_charset_length(const void *var, int chset) { /* FIXME: Treat special chars special here, taking chset into account */ /* Also include 0 byte */ |