From af30a32b6924b0f2b701186e435defbca2ebd1aa Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 5 Mar 2006 17:15:19 +0000 Subject: r13840: Mark some functions as public. (This used to be commit 9a188eb1f48a50d92a67a4fc2b3899b90074059a) --- source4/auth/gensec/gensec.c | 26 ++--- source4/dsdb/samdb/ldb_modules/config.mk | 8 -- source4/lib/crypto/md5.c | 6 +- source4/lib/ldb/config.mk | 12 --- source4/lib/registry/patchfile.c | 2 +- source4/lib/registry/reg_backend_rpc.c | 2 +- source4/lib/registry/reg_samba.c | 2 +- source4/lib/socket_wrapper/socket_wrapper.c | 22 ++-- source4/lib/util/capability.c | 2 +- source4/lib/util/data_blob.c | 26 ++--- source4/lib/util/debug.c | 23 ++-- source4/lib/util/fault.c | 8 +- source4/lib/util/fsusage.c | 2 +- source4/lib/util/genrand.c | 14 +-- source4/lib/util/idtree.c | 24 ++--- source4/lib/util/module.c | 13 ++- source4/lib/util/mutex.c | 2 +- source4/lib/util/pidfile.c | 2 +- source4/lib/util/time.c | 68 ++++++------ source4/lib/util/util.c | 62 +++++------ source4/lib/util/util_file.c | 21 ++-- source4/lib/util/util_sock.c | 2 +- source4/lib/util/util_str.c | 86 +++++++-------- source4/lib/util/util_strlist.c | 22 ++-- source4/libcli/composite/composite.c | 20 ++-- source4/libcli/nbt/nbtname.c | 50 ++++----- source4/librpc/ndr/ndr.c | 114 ++++++++++---------- source4/librpc/ndr/ndr_basic.c | 160 ++++++++++++++-------------- 28 files changed, 394 insertions(+), 407 deletions(-) diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c index fa05351412..1962ea6b2e 100644 --- a/source4/auth/gensec/gensec.c +++ b/source4/auth/gensec/gensec.c @@ -499,7 +499,7 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx, * @note Used by SPNEGO in particular, for the actual implementation mechanism */ -NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx, +_PUBLIC_ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx, struct gensec_security *parent, struct gensec_security **gensec_security) { @@ -522,7 +522,7 @@ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx, @param gensec_security Returned GENSEC context pointer. @note The mem_ctx is only a parent and may be NULL. */ -NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx, +_PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx, struct gensec_security **gensec_security, struct event_context *ev) { @@ -691,7 +691,7 @@ NTSTATUS gensec_start_mech_by_sasl_name(struct gensec_security *gensec_security, * */ -NTSTATUS gensec_start_mech_by_sasl_list(struct gensec_security *gensec_security, +_PUBLIC_ NTSTATUS gensec_start_mech_by_sasl_list(struct gensec_security *gensec_security, const char **sasl_names) { NTSTATUS nt_status; @@ -811,7 +811,7 @@ size_t gensec_sig_size(struct gensec_security *gensec_security, size_t data_size return gensec_security->ops->sig_size(gensec_security, data_size); } -NTSTATUS gensec_wrap(struct gensec_security *gensec_security, +_PUBLIC_ NTSTATUS gensec_wrap(struct gensec_security *gensec_security, TALLOC_CTX *mem_ctx, const DATA_BLOB *in, DATA_BLOB *out) @@ -822,7 +822,7 @@ NTSTATUS gensec_wrap(struct gensec_security *gensec_security, return gensec_security->ops->wrap(gensec_security, mem_ctx, in, out); } -NTSTATUS gensec_unwrap(struct gensec_security *gensec_security, +_PUBLIC_ NTSTATUS gensec_unwrap(struct gensec_security *gensec_security, TALLOC_CTX *mem_ctx, const DATA_BLOB *in, DATA_BLOB *out) @@ -876,7 +876,7 @@ NTSTATUS gensec_session_info(struct gensec_security *gensec_security, * or NT_STATUS_OK if the user is authenticated. */ -NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, +_PUBLIC_ NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, const DATA_BLOB in, DATA_BLOB *out) { return gensec_security->ops->update(gensec_security, out_mem_ctx, in, out); @@ -887,7 +887,7 @@ NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_CTX *out_ * */ -void gensec_want_feature(struct gensec_security *gensec_security, +_PUBLIC_ void gensec_want_feature(struct gensec_security *gensec_security, uint32_t feature) { gensec_security->want_features |= feature; @@ -898,7 +898,7 @@ void gensec_want_feature(struct gensec_security *gensec_security, * */ -BOOL gensec_have_feature(struct gensec_security *gensec_security, +_PUBLIC_ BOOL gensec_have_feature(struct gensec_security *gensec_security, uint32_t feature) { if (!gensec_security->ops->have_feature) { @@ -917,7 +917,7 @@ BOOL gensec_have_feature(struct gensec_security *gensec_security, * */ -NTSTATUS gensec_set_credentials(struct gensec_security *gensec_security, struct cli_credentials *credentials) +_PUBLIC_ NTSTATUS gensec_set_credentials(struct gensec_security *gensec_security, struct cli_credentials *credentials) { gensec_security->credentials = talloc_reference(gensec_security, credentials); return NT_STATUS_OK; @@ -941,7 +941,7 @@ struct cli_credentials *gensec_get_credentials(struct gensec_security *gensec_se * */ -NTSTATUS gensec_set_target_service(struct gensec_security *gensec_security, const char *service) +_PUBLIC_ NTSTATUS gensec_set_target_service(struct gensec_security *gensec_security, const char *service) { gensec_security->target.service = talloc_strdup(gensec_security, service); if (!gensec_security->target.service) { @@ -950,7 +950,7 @@ NTSTATUS gensec_set_target_service(struct gensec_security *gensec_security, cons return NT_STATUS_OK; } -const char *gensec_get_target_service(struct gensec_security *gensec_security) +_PUBLIC_ const char *gensec_get_target_service(struct gensec_security *gensec_security) { if (gensec_security->target.service) { return gensec_security->target.service; @@ -964,7 +964,7 @@ const char *gensec_get_target_service(struct gensec_security *gensec_security) * */ -NTSTATUS gensec_set_target_hostname(struct gensec_security *gensec_security, const char *hostname) +_PUBLIC_ NTSTATUS gensec_set_target_hostname(struct gensec_security *gensec_security, const char *hostname) { gensec_security->target.hostname = talloc_strdup(gensec_security, hostname); if (!gensec_security->target.hostname) { @@ -973,7 +973,7 @@ NTSTATUS gensec_set_target_hostname(struct gensec_security *gensec_security, con return NT_STATUS_OK; } -const char *gensec_get_target_hostname(struct gensec_security *gensec_security) +_PUBLIC_ const char *gensec_get_target_hostname(struct gensec_security *gensec_security) { if (gensec_security->target.hostname) { return gensec_security->target.hostname; diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk index e14b9bfecf..8eedc5a983 100644 --- a/source4/dsdb/samdb/ldb_modules/config.mk +++ b/source4/dsdb/samdb/ldb_modules/config.mk @@ -3,7 +3,6 @@ [MODULE::libldb_objectguid] SUBSYSTEM = LIBLDB INIT_FUNCTION = objectguid_module_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ objectguid.o REQUIRED_SUBSYSTEMS = \ @@ -16,7 +15,6 @@ REQUIRED_SUBSYSTEMS = \ [MODULE::libldb_samldb] SUBSYSTEM = LIBLDB INIT_FUNCTION = samldb_module_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ samldb.o REQUIRED_SUBSYSTEMS = SAMDB @@ -30,7 +28,6 @@ REQUIRED_SUBSYSTEMS = SAMDB SUBSYSTEM = LIBLDB INIT_FUNCTION = ldb_samba3sam_module_init ENABLE = NO -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ samba3sam.o # @@ -42,7 +39,6 @@ OBJ_FILES = \ [MODULE::libldb_proxy] SUBSYSTEM = LIBLDB INIT_FUNCTION = proxy_module_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ proxy.o # @@ -55,7 +51,6 @@ OBJ_FILES = \ [MODULE::libldb_rootdse] SUBSYSTEM = LIBLDB INIT_FUNCTION = rootdse_module_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ rootdse.o # @@ -67,7 +62,6 @@ OBJ_FILES = \ [MODULE::libldb_password_hash] SUBSYSTEM = LIBLDB INIT_FUNCTION = password_hash_module_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ password_hash.o REQUIRED_SUBSYSTEMS = \ @@ -81,7 +75,6 @@ REQUIRED_SUBSYSTEMS = \ [MODULE::libldb_kludge_acl] SUBSYSTEM = LIBLDB INIT_FUNCTION = ldb_kludge_acl_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ kludge_acl.o REQUIRED_SUBSYSTEMS = \ @@ -95,7 +88,6 @@ REQUIRED_SUBSYSTEMS = \ [MODULE::libldb_extended_dn] SUBSYSTEM = LIBLDB INIT_FUNCTION = ldb_extended_dn_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ extended_dn.o # diff --git a/source4/lib/crypto/md5.c b/source4/lib/crypto/md5.c index f59b35a0b8..b607e93842 100644 --- a/source4/lib/crypto/md5.c +++ b/source4/lib/crypto/md5.c @@ -43,7 +43,7 @@ static void byteReverse(uint8_t *buf, uint_t longs) * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ -void MD5Init(struct MD5Context *ctx) +_PUBLIC_ void MD5Init(struct MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; @@ -58,7 +58,7 @@ void MD5Init(struct MD5Context *ctx) * Update context to reflect the concatenation of another buffer full * of bytes. */ -void MD5Update(struct MD5Context *ctx, const uint8_t *buf, uint_t len) +_PUBLIC_ void MD5Update(struct MD5Context *ctx, const uint8_t *buf, uint_t len) { register uint32_t t; @@ -106,7 +106,7 @@ void MD5Update(struct MD5Context *ctx, const uint8_t *buf, uint_t len) * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ -void MD5Final(uint8_t digest[16], struct MD5Context *ctx) +_PUBLIC_ void MD5Final(uint8_t digest[16], struct MD5Context *ctx) { uint_t count; uint8_t *p; diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index fe7b03251d..3d40760d2c 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -3,7 +3,6 @@ [MODULE::libldb_asq] INIT_FUNCTION = ldb_asq_init SUBSYSTEM = LIBLDB -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ modules/asq.o # End MODULE libldb_asq @@ -14,7 +13,6 @@ OBJ_FILES = \ [MODULE::libldb_sort] INIT_FUNCTION = ldb_sort_init SUBSYSTEM = LIBLDB -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ modules/sort.o # End MODULE libldb_sort @@ -25,7 +23,6 @@ OBJ_FILES = \ [MODULE::libldb_paged_results] INIT_FUNCTION = ldb_paged_results_init SUBSYSTEM = LIBLDB -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ modules/paged_results.o # End MODULE libldb_paged_results @@ -36,7 +33,6 @@ OBJ_FILES = \ [MODULE::libldb_operational] SUBSYSTEM = LIBLDB INIT_FUNCTION = ldb_operational_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ modules/operational.o # End MODULE libldb_operational @@ -47,7 +43,6 @@ OBJ_FILES = \ [MODULE::libldb_objectclass] INIT_FUNCTION = ldb_objectclass_init SUBSYSTEM = LIBLDB -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ modules/objectclass.o # End MODULE libldb_objectclass @@ -58,7 +53,6 @@ OBJ_FILES = \ [MODULE::libldb_rdn_name] SUBSYSTEM = LIBLDB INIT_FUNCTION = ldb_rdn_name_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ modules/rdn_name.o # End MODULE libldb_rdn_name @@ -69,7 +63,6 @@ OBJ_FILES = \ [MODULE::libldb_schema] INIT_FUNCTION = ldb_schema_init SUBSYSTEM = LIBLDB -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ modules/schema.o # End MODULE libldb_schema @@ -79,7 +72,6 @@ OBJ_FILES = \ # Start MODULE libldb_ildap [MODULE::libldb_ildap] SUBSYSTEM = LIBLDB -OUTPUT_TYPE = MERGEDOBJ INIT_FUNCTION = ldb_ildap_init OBJ_FILES = \ ldb_ildap/ldb_ildap.o @@ -93,7 +85,6 @@ NOPROTO = YES # Start MODULE libldb_map [MODULE::libldb_map] SUBSYSTEM = LIBLDB -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = modules/ldb_map.o # End MODULE libldb_map ################################################ @@ -103,7 +94,6 @@ OBJ_FILES = modules/ldb_map.o [MODULE::libldb_skel] SUBSYSTEM = LIBLDB INIT_FUNCTION = ldb_skel_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = modules/skel.o # End MODULE libldb_skel ################################################ @@ -112,7 +102,6 @@ OBJ_FILES = modules/skel.o # Start MODULE libldb_sqlite3 [MODULE::libldb_sqlite3] SUBSYSTEM = LIBLDB -OUTPUT_TYPE = MERGEDOBJ INIT_FUNCTION = ldb_sqlite3_init OBJ_FILES = \ ldb_sqlite3/ldb_sqlite3.o @@ -127,7 +116,6 @@ NOPROTO = YES [MODULE::libldb_tdb] SUBSYSTEM = LIBLDB INIT_FUNCTION = ldb_tdb_init -OUTPUT_TYPE = MERGEDOBJ OBJ_FILES = \ ldb_tdb/ldb_tdb.o \ ldb_tdb/ldb_search.o \ diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index e498c296ae..9a7a8e586f 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -250,7 +250,7 @@ _PUBLIC_ WERROR reg_diff_save(const struct reg_diff *diff, const char *filename) /* * Load diff file */ -struct reg_diff *reg_diff_load(TALLOC_CTX *ctx, const char *fn) +_PUBLIC_ struct reg_diff *reg_diff_load(TALLOC_CTX *ctx, const char *fn) { struct reg_diff *diff; int fd; diff --git a/source4/lib/registry/reg_backend_rpc.c b/source4/lib/registry/reg_backend_rpc.c index 32ecbec6c6..0fda6c64cc 100644 --- a/source4/lib/registry/reg_backend_rpc.c +++ b/source4/lib/registry/reg_backend_rpc.c @@ -356,7 +356,7 @@ static struct hive_operations reg_backend_rpc = { .num_values = rpc_num_values, }; -WERROR reg_open_remote(struct registry_context **ctx, struct cli_credentials *credentials, +WERROR _PUBLIC_ reg_open_remote(struct registry_context **ctx, struct cli_credentials *credentials, const char *location, struct event_context *ev) { NTSTATUS status; diff --git a/source4/lib/registry/reg_samba.c b/source4/lib/registry/reg_samba.c index 6341a1c4ee..61d4bb2c4a 100644 --- a/source4/lib/registry/reg_samba.c +++ b/source4/lib/registry/reg_samba.c @@ -63,7 +63,7 @@ static WERROR reg_samba_get_predef (struct registry_context *ctx, uint32_t hkey, return error; } -WERROR reg_open_local (struct registry_context **ctx) +_PUBLIC_ WERROR reg_open_local (struct registry_context **ctx) { *ctx = talloc(NULL, struct registry_context); (*ctx)->get_predefined_key = reg_samba_get_predef; diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c index a2ca07b083..f28343d6c4 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.c +++ b/source4/lib/socket_wrapper/socket_wrapper.c @@ -398,7 +398,7 @@ static int sockaddr_convert_from_un(const struct socket_info *si, return -1; } -int swrap_socket(int domain, int type, int protocol) +_PUBLIC_ int swrap_socket(int domain, int type, int protocol) { struct socket_info *si; int fd; @@ -423,7 +423,7 @@ int swrap_socket(int domain, int type, int protocol) return si->fd; } -int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen) +_PUBLIC_ int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen) { struct socket_info *parent_si, *child_si; int fd; @@ -537,7 +537,7 @@ static int swrap_auto_bind(struct socket_info *si) } -int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen) +_PUBLIC_ int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen) { int ret; struct sockaddr_un un_addr; @@ -573,7 +573,7 @@ int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen) return ret; } -int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen) +_PUBLIC_ int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen) { int ret; struct sockaddr_un un_addr; @@ -601,7 +601,7 @@ int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen) return ret; } -int swrap_getpeername(int s, struct sockaddr *name, socklen_t *addrlen) +_PUBLIC_ int swrap_getpeername(int s, struct sockaddr *name, socklen_t *addrlen) { struct socket_info *si = find_socket_info(s); @@ -621,7 +621,7 @@ int swrap_getpeername(int s, struct sockaddr *name, socklen_t *addrlen) return 0; } -int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen) +_PUBLIC_ int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen) { struct socket_info *si = find_socket_info(s); @@ -635,7 +635,7 @@ int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen) return 0; } -int swrap_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen) +_PUBLIC_ int swrap_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen) { struct socket_info *si = find_socket_info(s); @@ -656,7 +656,7 @@ int swrap_getsockopt(int s, int level, int optname, void *optval, socklen_t *opt } } -int swrap_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) +_PUBLIC_ int swrap_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) { struct socket_info *si = find_socket_info(s); @@ -683,7 +683,7 @@ int swrap_setsockopt(int s, int level, int optname, const void *optval, so } } -ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) +_PUBLIC_ ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) { struct sockaddr_un un_addr; socklen_t un_addrlen = sizeof(un_addr); @@ -709,7 +709,7 @@ ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr } -ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) +_PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) { struct sockaddr_un un_addr; int ret; @@ -759,7 +759,7 @@ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const str return ret; } -int swrap_close(int fd) +_PUBLIC_ int swrap_close(int fd) { struct socket_info *si = find_socket_info(fd); diff --git a/source4/lib/util/capability.c b/source4/lib/util/capability.c index ae08fab533..0062bb5cd6 100644 --- a/source4/lib/util/capability.c +++ b/source4/lib/util/capability.c @@ -107,7 +107,7 @@ static BOOL set_inherited_process_capability( uint32_t cap_flag, BOOL enable ) Gain the oplock capability from the kernel if possible. ****************************************************************************/ -void oplock_set_capability(BOOL this_process, BOOL inherit) +_PUBLIC_ void oplock_set_capability(BOOL this_process, BOOL inherit) { #if HAVE_KERNEL_OPLOCKS_IRIX set_process_capability(KERNEL_OPLOCK_CAPABILITY,this_process); diff --git a/source4/lib/util/data_blob.c b/source4/lib/util/data_blob.c index dfcfaa41ea..c1513a1d78 100644 --- a/source4/lib/util/data_blob.c +++ b/source4/lib/util/data_blob.c @@ -30,7 +30,7 @@ construct a data blob, must be freed with data_blob_free() you can pass NULL for p and get a blank data blob **/ -DATA_BLOB data_blob_named(const void *p, size_t length, const char *name) +_PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *name) { DATA_BLOB ret; @@ -56,7 +56,7 @@ DATA_BLOB data_blob_named(const void *p, size_t length, const char *name) /** construct a data blob, using supplied TALLOC_CTX **/ -DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, size_t length, const char *name) +_PUBLIC_ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, size_t length, const char *name) { DATA_BLOB ret = data_blob_named(p, length, name); @@ -71,7 +71,7 @@ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, size_t leng reference a data blob, to the supplied TALLOC_CTX. Returns a NULL DATA_BLOB on failure **/ -DATA_BLOB data_blob_talloc_reference(TALLOC_CTX *mem_ctx, DATA_BLOB *blob) +_PUBLIC_ DATA_BLOB data_blob_talloc_reference(TALLOC_CTX *mem_ctx, DATA_BLOB *blob) { DATA_BLOB ret = *blob; @@ -88,7 +88,7 @@ DATA_BLOB data_blob_talloc_reference(TALLOC_CTX *mem_ctx, DATA_BLOB *blob) use this sparingly as it initialises data - better to initialise yourself if you want specific data in the blob **/ -DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length) +_PUBLIC_ DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length) { DATA_BLOB blob = data_blob_talloc(mem_ctx, NULL, length); data_blob_clear(&blob); @@ -98,7 +98,7 @@ DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length) /** free a data blob **/ -void data_blob_free(DATA_BLOB *d) +_PUBLIC_ void data_blob_free(DATA_BLOB *d) { if (d) { talloc_free(d->data); @@ -110,7 +110,7 @@ void data_blob_free(DATA_BLOB *d) /** clear a DATA_BLOB's contents **/ -void data_blob_clear(DATA_BLOB *d) +_PUBLIC_ void data_blob_clear(DATA_BLOB *d) { if (d->data) { memset(d->data, 0, d->length); @@ -120,7 +120,7 @@ void data_blob_clear(DATA_BLOB *d) /** free a data blob and clear its contents **/ -void data_blob_clear_free(DATA_BLOB *d) +_PUBLIC_ void data_blob_clear_free(DATA_BLOB *d) { data_blob_clear(d); data_blob_free(d); @@ -130,7 +130,7 @@ void data_blob_clear_free(DATA_BLOB *d) /** check if two data blobs are equal **/ -BOOL data_blob_equal(const DATA_BLOB *d1, const DATA_BLOB *d2) +_PUBLIC_ BOOL data_blob_equal(const DATA_BLOB *d1, const DATA_BLOB *d2) { if (d1->length != d2->length) { return False; @@ -150,7 +150,7 @@ BOOL data_blob_equal(const DATA_BLOB *d1, const DATA_BLOB *d2) /** print the data_blob as hex string **/ -char *data_blob_hex_string(TALLOC_CTX *mem_ctx, DATA_BLOB *blob) +_PUBLIC_ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, DATA_BLOB *blob) { int i; char *hex_string; @@ -170,7 +170,7 @@ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, DATA_BLOB *blob) useful for constructing data blobs in test suites, while avoiding const warnings **/ -DATA_BLOB data_blob_string_const(const char *str) +_PUBLIC_ DATA_BLOB data_blob_string_const(const char *str) { DATA_BLOB blob; blob.data = discard_const(str); @@ -178,7 +178,7 @@ DATA_BLOB data_blob_string_const(const char *str) return blob; } -DATA_BLOB data_blob_const(const void *p, size_t length) +_PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length) { DATA_BLOB blob; blob.data = discard_const(p); @@ -190,7 +190,7 @@ DATA_BLOB data_blob_const(const void *p, size_t length) /** realloc a data_blob **/ -NTSTATUS data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length) +_PUBLIC_ NTSTATUS data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length) { blob->data = talloc_realloc_size(mem_ctx, blob->data, length); NT_STATUS_HAVE_NO_MEMORY(blob->data); @@ -201,7 +201,7 @@ NTSTATUS data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length) /** append some data to a data blob **/ -NTSTATUS data_blob_append(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, +_PUBLIC_ NTSTATUS data_blob_append(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const void *p, size_t length) { blob->data = talloc_realloc_size(mem_ctx, blob->data, diff --git a/source4/lib/util/debug.c b/source4/lib/util/debug.c index 4cf7c21641..1c5bb25753 100644 --- a/source4/lib/util/debug.c +++ b/source4/lib/util/debug.c @@ -30,7 +30,7 @@ **/ /* this global variable determines what messages are printed */ -int DEBUGLEVEL; +_PUBLIC_ int DEBUGLEVEL; /* the registered mutex handlers */ @@ -68,7 +68,7 @@ static void log_timestring(int level, const char *location, const char *func) the backend for debug messages. Note that the DEBUG() macro has already ensured that the log level has been met before this is called */ -void do_debug_header(int level, const char *location, const char *func) +_PUBLIC_ void do_debug_header(int level, const char *location, const char *func) { log_timestring(level, location, func); log_task_id(); @@ -78,7 +78,7 @@ void do_debug_header(int level, const char *location, const char *func) the backend for debug messages. Note that the DEBUG() macro has already ensured that the log level has been met before this is called */ -void do_debug(const char *format, ...) _PRINTF_ATTRIBUTE(1,2) +_PUBLIC_ void do_debug(const char *format, ...) _PRINTF_ATTRIBUTE(1,2) { va_list ap; char *s = NULL; @@ -101,7 +101,7 @@ void do_debug(const char *format, ...) _PRINTF_ATTRIBUTE(1,2) /** reopen the log file (usually called because the log file name might have changed) */ -void reopen_logs(void) +_PUBLIC_ void reopen_logs(void) { const char *logfile = lp_logfile(); char *fname = NULL; @@ -147,7 +147,7 @@ void reopen_logs(void) control the name of the logfile and whether logging will be to stdout, stderr or a file */ -void setup_logging(const char *prog_name, enum debug_logtype new_logtype) +_PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype) { if (state.logtype < new_logtype) { state.logtype = new_logtype; @@ -162,7 +162,7 @@ void setup_logging(const char *prog_name, enum debug_logtype new_logtype) return a string constant containing n tabs no more than 10 tabs are returned */ -const char *do_debug_tab(uint_t n) +_PUBLIC_ const char *do_debug_tab(uint_t n) { const char *tabs[] = {"", "\t", "\t\t", "\t\t\t", "\t\t\t\t", "\t\t\t\t\t", "\t\t\t\t\t\t", "\t\t\t\t\t\t\t", "\t\t\t\t\t\t\t\t", @@ -174,7 +174,7 @@ const char *do_debug_tab(uint_t n) /** log suspicious usage - print comments and backtrace */ -void log_suspicious_usage(const char *from, const char *info) +_PUBLIC_ void log_suspicious_usage(const char *from, const char *info) { if (debug_handlers.ops.log_suspicious_usage) { debug_handlers.ops.log_suspicious_usage(from, info); @@ -185,15 +185,14 @@ void log_suspicious_usage(const char *from, const char *info) /** print suspicious usage - print comments and backtrace */ - -void print_suspicious_usage(const char* from, const char* info) +_PUBLIC_ void print_suspicious_usage(const char* from, const char* info) { if (debug_handlers.ops.print_suspicious_usage) { debug_handlers.ops.print_suspicious_usage(from, info); } } -uint32_t get_task_id(void) +_PUBLIC_ uint32_t get_task_id(void) { if (debug_handlers.ops.get_task_id) { return debug_handlers.ops.get_task_id(); @@ -201,7 +200,7 @@ uint32_t get_task_id(void) return getpid(); } -void log_task_id(void) +_PUBLIC_ void log_task_id(void) { if (debug_handlers.ops.log_task_id) { debug_handlers.ops.log_task_id(state.fd); @@ -211,7 +210,7 @@ void log_task_id(void) /** register a set of debug handlers. */ -void register_debug_handlers(const char *name, struct debug_ops *ops) +_PUBLIC_ void register_debug_handlers(const char *name, struct debug_ops *ops) { debug_handlers.name = name; debug_handlers.ops = *ops; diff --git a/source4/lib/util/fault.c b/source4/lib/util/fault.c index abe3f141ce..ff44b8a292 100644 --- a/source4/lib/util/fault.c +++ b/source4/lib/util/fault.c @@ -46,7 +46,7 @@ static const char *progname; /** * Write backtrace to debug log */ -void call_backtrace(void) +_PUBLIC_ void call_backtrace(void) { #ifdef HAVE_BACKTRACE #define BACKTRACE_STACK_SIZE 64 @@ -112,7 +112,7 @@ void call_backtrace(void) /** Something really nasty happened - panic ! **/ -void smb_panic(const char *why) +_PUBLIC_ void smb_panic(const char *why) { const char *cmd = lp_panic_action(); int result; @@ -181,7 +181,7 @@ static void sig_fault(int sig) /** setup our fault handlers **/ -void fault_setup(const char *pname) +_PUBLIC_ void fault_setup(const char *pname) { if (progname == NULL) { progname = pname; @@ -204,7 +204,7 @@ void fault_setup(const char *pname) register a fault handler. Should only be called once in the execution of smbd. */ -BOOL register_fault_handler(const char *name, void (*fault_handler)(int sig)) +_PUBLIC_ BOOL register_fault_handler(const char *name, void (*fault_handler)(int sig)) { if (fault_handlers.name != NULL) { /* it's already registered! */ diff --git a/source4/lib/util/fsusage.c b/source4/lib/util/fsusage.c index dde9c61eb3..96b5ee4f59 100644 --- a/source4/lib/util/fsusage.c +++ b/source4/lib/util/fsusage.c @@ -47,7 +47,7 @@ static uint64_t adjust_blocks(uint64_t blocks, uint64_t fromsize, uint64_t tosiz * * results are returned in *dfree and *dsize, in 512 byte units */ -int sys_fsusage(const char *path, uint64_t *dfree, uint64_t *dsize) +_PUBLIC_ int sys_fsusage(const char *path, uint64_t *dfree, uint64_t *dsize) { #ifdef STAT_STATFS3_OSF1 #define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_fsize, (uint64_t)512) diff --git a/source4/lib/util/genrand.c b/source4/lib/util/genrand.c index a264ac4e31..f2b038f161 100644 --- a/source4/lib/util/genrand.c +++ b/source4/lib/util/genrand.c @@ -40,13 +40,13 @@ static void (*reseed_callback)(int *newseed); Copy any user given reseed data. **/ -void set_rand_reseed_callback(void (*fn)(int *)) +_PUBLIC_ void set_rand_reseed_callback(void (*fn)(int *)) { reseed_callback = fn; set_need_random_reseed(); } -void set_need_random_reseed(void) +_PUBLIC_ void set_need_random_reseed(void) { done_reseed = False; } @@ -204,7 +204,7 @@ static int do_reseed(BOOL use_fd, int fd) /** Interface to the (hopefully) good crypto random number generator. **/ -void generate_random_buffer(uint8_t *out, int len) +_PUBLIC_ void generate_random_buffer(uint8_t *out, int len) { static int urand_fd = -1; unsigned char md4_buf[64]; @@ -250,7 +250,7 @@ void generate_random_buffer(uint8_t *out, int len) /** generate a single random uint32_t **/ -uint32_t generate_random(void) +_PUBLIC_ uint32_t generate_random(void) { uint8_t v[4]; generate_random_buffer(v, 4); @@ -261,7 +261,7 @@ uint32_t generate_random(void) /** very basic password quality checker **/ -BOOL check_password_quality(const char *s) +_PUBLIC_ BOOL check_password_quality(const char *s) { int has_digit=0, has_capital=0, has_lower=0; while (*s) { @@ -282,7 +282,7 @@ BOOL check_password_quality(const char *s) Use the random number generator to generate a random string. **/ -char *generate_random_str_list(TALLOC_CTX *mem_ctx, size_t len, const char *list) +_PUBLIC_ char *generate_random_str_list(TALLOC_CTX *mem_ctx, size_t len, const char *list) { size_t i; size_t list_len = strlen(list); @@ -299,7 +299,7 @@ char *generate_random_str_list(TALLOC_CTX *mem_ctx, size_t len, const char *list return retstr; } -char *generate_random_str(TALLOC_CTX *mem_ctx, size_t len) +_PUBLIC_ char *generate_random_str(TALLOC_CTX *mem_ctx, size_t len) { char *retstr; const char *c_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_-#.,"; diff --git a/source4/lib/util/idtree.c b/source4/lib/util/idtree.c index 1ccf6d5e81..d29c3b8fbd 100644 --- a/source4/lib/util/idtree.c +++ b/source4/lib/util/idtree.c @@ -310,21 +310,21 @@ static int _idr_remove(struct idr_context *idp, int id) this is the public interface **************************************************************************/ -/* +/** initialise a idr tree. The context return value must be passed to all subsequent idr calls. To destroy the idr tree use talloc_free() on this context */ -struct idr_context *idr_init(TALLOC_CTX *mem_ctx) +_PUBLIC_ struct idr_context *idr_init(TALLOC_CTX *mem_ctx) { return talloc_zero(mem_ctx, struct idr_context); } -/* +/** allocate the next available id, and assign 'ptr' into its slot. you can retrieve later this pointer using idr_find() */ -int idr_get_new(struct idr_context *idp, void *ptr, int limit) +_PUBLIC_ int idr_get_new(struct idr_context *idp, void *ptr, int limit) { int ret = idr_get_new_above_int(idp, ptr, 0); if (ret > limit) { @@ -334,11 +334,11 @@ int idr_get_new(struct idr_context *idp, void *ptr, int limit) return ret; } -/* +/** allocate a new id, giving the first available value greater than or equal to the given starting id */ -int idr_get_new_above(struct idr_context *idp, void *ptr, int starting_id, int limit) +_PUBLIC_ int idr_get_new_above(struct idr_context *idp, void *ptr, int starting_id, int limit) { int ret = idr_get_new_above_int(idp, ptr, starting_id); if (ret > limit) { @@ -348,10 +348,10 @@ int idr_get_new_above(struct idr_context *idp, void *ptr, int starting_id, int l return ret; } -/* +/** allocate a new id randomly in the given range */ -int idr_get_new_random(struct idr_context *idp, void *ptr, int limit) +_PUBLIC_ int idr_get_new_random(struct idr_context *idp, void *ptr, int limit) { int id; @@ -366,18 +366,18 @@ int idr_get_new_random(struct idr_context *idp, void *ptr, int limit) return id; } -/* +/** find a pointer value previously set with idr_get_new given an id */ -void *idr_find(struct idr_context *idp, int id) +_PUBLIC_ void *idr_find(struct idr_context *idp, int id) { return _idr_find(idp, id); } -/* +/** remove an id from the idr tree */ -int idr_remove(struct idr_context *idp, int id) +_PUBLIC_ int idr_remove(struct idr_context *idp, int id) { int ret; ret = _idr_remove((struct idr_context *)idp, id); diff --git a/source4/lib/util/module.c b/source4/lib/util/module.c index ad8afe2b16..ef72551570 100644 --- a/source4/lib/util/module.c +++ b/source4/lib/util/module.c @@ -56,7 +56,11 @@ static void *load_module(TALLOC_CTX *mem_ctx, const char *dir, const char *name) return init_fn; } -init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path) +/** + * Obtain list of init functions from the modules in the specified + * directory + */ +_PUBLIC_ init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path) { DIR *dir; struct dirent *entry; @@ -88,7 +92,12 @@ init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path) return ret; } -BOOL run_init_functions(NTSTATUS (**fns) (void)) +/** + * Run the specified init functions. + * + * @return True if all functions ran successfully, False otherwise + */ +_PUBLIC_ BOOL run_init_functions(NTSTATUS (**fns) (void)) { int i; BOOL ret; diff --git a/source4/lib/util/mutex.c b/source4/lib/util/mutex.c index 79c281ff0c..3b64f4929b 100644 --- a/source4/lib/util/mutex.c +++ b/source4/lib/util/mutex.c @@ -39,7 +39,7 @@ static struct { register a set of mutex/rwlock handlers. Should only be called once in the execution of smbd. */ -BOOL register_mutex_handlers(const char *name, struct mutex_ops *ops) +_PUBLIC_ BOOL register_mutex_handlers(const char *name, struct mutex_ops *ops) { if (mutex_handlers.name != NULL) { /* it's already registered! */ diff --git a/source4/lib/util/pidfile.c b/source4/lib/util/pidfile.c index 7f56fa5641..1a46e6e70c 100644 --- a/source4/lib/util/pidfile.c +++ b/source4/lib/util/pidfile.c @@ -36,7 +36,7 @@ * return the pid in a pidfile. return 0 if the process (or pidfile) * does not exist */ -pid_t pidfile_pid(const char *name) +_PUBLIC_ pid_t pidfile_pid(const char *name) { int fd; char pidstr[20]; diff --git a/source4/lib/util/time.c b/source4/lib/util/time.c index a56175cda9..4897d2fa95 100644 --- a/source4/lib/util/time.c +++ b/source4/lib/util/time.c @@ -45,7 +45,7 @@ /** External access to time_t_min and time_t_max. **/ -time_t get_time_t_max(void) +_PUBLIC_ time_t get_time_t_max(void) { return TIME_T_MAX; } @@ -53,7 +53,7 @@ time_t get_time_t_max(void) /** a gettimeofday wrapper **/ -void GetTimeOfDay(struct timeval *tval) +_PUBLIC_ void GetTimeOfDay(struct timeval *tval) { #ifdef HAVE_GETTIMEOFDAY_TZ gettimeofday(tval,NULL); @@ -69,7 +69,7 @@ void GetTimeOfDay(struct timeval *tval) interpret an 8 byte "filetime" structure to a time_t It's originally in "100ns units since jan 1st 1601" **/ -time_t nt_time_to_unix(NTTIME nt) +_PUBLIC_ time_t nt_time_to_unix(NTTIME nt) { if (nt == 0) { return 0; @@ -93,7 +93,7 @@ time_t nt_time_to_unix(NTTIME nt) put a 8 byte filetime from a time_t This takes GMT as input **/ -void unix_to_nt_time(NTTIME *nt, time_t t) +_PUBLIC_ void unix_to_nt_time(NTTIME *nt, time_t t) { uint64_t t2; @@ -117,7 +117,7 @@ void unix_to_nt_time(NTTIME *nt, time_t t) /** check if it's a null unix time **/ -BOOL null_time(time_t t) +_PUBLIC_ BOOL null_time(time_t t) { return t == 0 || t == (time_t)0xFFFFFFFF || @@ -128,7 +128,7 @@ BOOL null_time(time_t t) /** check if it's a null NTTIME **/ -BOOL null_nttime(NTTIME t) +_PUBLIC_ BOOL null_nttime(NTTIME t) { return t == 0 || t == (NTTIME)-1; } @@ -185,7 +185,7 @@ static uint32_t make_dos_date(time_t unixdate, int zone_offset) put a dos date into a buffer (time/date format) This takes GMT time and puts local time in the buffer **/ -void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset) +_PUBLIC_ void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset) { uint32_t x = make_dos_date(unixdate, zone_offset); SIVAL(buf,offset,x); @@ -195,7 +195,7 @@ void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset) put a dos date into a buffer (date/time format) This takes GMT time and puts local time in the buffer **/ -void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset) +_PUBLIC_ void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset) { uint32_t x; x = make_dos_date(unixdate, zone_offset); @@ -208,7 +208,7 @@ put a dos 32 bit "unix like" date into a buffer. This routine takes GMT and converts it to LOCAL time before putting it (most SMBs assume localtime for this sort of date) **/ -void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset) +_PUBLIC_ void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset) { if (!null_time(unixdate)) { unixdate -= zone_offset; @@ -238,7 +238,7 @@ static void interpret_dos_date(uint32_t date,int *year,int *month,int *day,int * create a unix date (int GMT) from a dos date (which is actually in localtime) **/ -time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset) +_PUBLIC_ time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset) { uint32_t dos_date=0; struct tm t; @@ -262,7 +262,7 @@ time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset) /** like make_unix_date() but the words are reversed **/ -time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset) +_PUBLIC_ time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset) { uint32_t x,x2; @@ -277,7 +277,7 @@ time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset) create a unix GMT date from a dos date in 32 bit "unix like" format these generally arrive as localtimes, with corresponding DST **/ -time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset) +_PUBLIC_ time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset) { time_t t = (time_t)IVAL(date_ptr,0); if (!null_time(t)) { @@ -290,7 +290,7 @@ time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset) /** return a HTTP/1.0 time string **/ -char *http_timestring(TALLOC_CTX *mem_ctx, time_t t) +_PUBLIC_ char *http_timestring(TALLOC_CTX *mem_ctx, time_t t) { char *buf; char tempTime[60]; @@ -316,7 +316,7 @@ char *http_timestring(TALLOC_CTX *mem_ctx, time_t t) /** Return the date and time as a string **/ -char *timestring(TALLOC_CTX *mem_ctx, time_t t) +_PUBLIC_ char *timestring(TALLOC_CTX *mem_ctx, time_t t) { char *TimeBuf; char tempTime[80]; @@ -346,7 +346,7 @@ char *timestring(TALLOC_CTX *mem_ctx, time_t t) /** return a talloced string representing a NTTIME for human consumption */ -const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt) +_PUBLIC_ const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt) { time_t t; if (nt == 0) { @@ -360,7 +360,7 @@ const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt) /** put a NTTIME into a packet */ -void push_nttime(uint8_t *base, uint16_t offset, NTTIME t) +_PUBLIC_ void push_nttime(uint8_t *base, uint16_t offset, NTTIME t) { SBVAL(base, offset, t); } @@ -368,7 +368,7 @@ void push_nttime(uint8_t *base, uint16_t offset, NTTIME t) /** pull a NTTIME from a packet */ -NTTIME pull_nttime(uint8_t *base, uint16_t offset) +_PUBLIC_ NTTIME pull_nttime(uint8_t *base, uint16_t offset) { NTTIME ret = BVAL(base, offset); return ret; @@ -377,7 +377,7 @@ NTTIME pull_nttime(uint8_t *base, uint16_t offset) /** parse a nttime as a large integer in a string and return a NTTIME */ -NTTIME nttime_from_string(const char *s) +_PUBLIC_ NTTIME nttime_from_string(const char *s) { return strtoull(s, NULL, 0); } @@ -385,7 +385,7 @@ NTTIME nttime_from_string(const char *s) /** return (tv1 - tv2) in microseconds */ -int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2) +_PUBLIC_ int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2) { int64_t sec_diff = tv1->tv_sec - tv2->tv_sec; return (sec_diff * 1000000) + (int64_t)(tv1->tv_usec - tv2->tv_usec); @@ -395,7 +395,7 @@ int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2) /** return a zero timeval */ -struct timeval timeval_zero(void) +_PUBLIC_ struct timeval timeval_zero(void) { struct timeval tv; tv.tv_sec = 0; @@ -406,7 +406,7 @@ struct timeval timeval_zero(void) /** return True if a timeval is zero */ -BOOL timeval_is_zero(const struct timeval *tv) +_PUBLIC_ BOOL timeval_is_zero(const struct timeval *tv) { return tv->tv_sec == 0 && tv->tv_usec == 0; } @@ -414,7 +414,7 @@ BOOL timeval_is_zero(const struct timeval *tv) /** return a timeval for the current time */ -struct timeval timeval_current(void) +_PUBLIC_ struct timeval timeval_current(void) { struct timeval tv; GetTimeOfDay(&tv); @@ -424,7 +424,7 @@ struct timeval timeval_current(void) /** return a timeval struct with the given elements */ -struct timeval timeval_set(uint32_t secs, uint32_t usecs) +_PUBLIC_ struct timeval timeval_set(uint32_t secs, uint32_t usecs) { struct timeval tv; tv.tv_sec = secs; @@ -436,7 +436,7 @@ struct timeval timeval_set(uint32_t secs, uint32_t usecs) /** return a timeval ofs microseconds after tv */ -struct timeval timeval_add(const struct timeval *tv, +_PUBLIC_ struct timeval timeval_add(const struct timeval *tv, uint32_t secs, uint32_t usecs) { struct timeval tv2 = *tv; @@ -460,7 +460,7 @@ struct timeval timeval_sum(const struct timeval *tv1, /** return a timeval secs/usecs into the future */ -struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs) +_PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs) { struct timeval tv = timeval_current(); return timeval_add(&tv, secs, usecs); @@ -472,7 +472,7 @@ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs) Return 0 if tv1 == tv2 Return 1 if tv1 > tv2 */ -int timeval_compare(const struct timeval *tv1, const struct timeval *tv2) +_PUBLIC_ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2) { if (tv1->tv_sec > tv2->tv_sec) return 1; if (tv1->tv_sec < tv2->tv_sec) return -1; @@ -484,7 +484,7 @@ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2) /** return True if a timer is in the past */ -BOOL timeval_expired(const struct timeval *tv) +_PUBLIC_ BOOL timeval_expired(const struct timeval *tv) { struct timeval tv2 = timeval_current(); if (tv2.tv_sec > tv->tv_sec) return True; @@ -495,7 +495,7 @@ BOOL timeval_expired(const struct timeval *tv) /** return the number of seconds elapsed between two times */ -double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2) +_PUBLIC_ double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2) { return (tv2->tv_sec - tv1->tv_sec) + (tv2->tv_usec - tv1->tv_usec)*1.0e-6; @@ -504,7 +504,7 @@ double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2) /** return the number of seconds elapsed since a given time */ -double timeval_elapsed(const struct timeval *tv) +_PUBLIC_ double timeval_elapsed(const struct timeval *tv) { struct timeval tv2 = timeval_current(); return timeval_elapsed2(tv, &tv2); @@ -513,7 +513,7 @@ double timeval_elapsed(const struct timeval *tv) /** return the lesser of two timevals */ -struct timeval timeval_min(const struct timeval *tv1, +_PUBLIC_ struct timeval timeval_min(const struct timeval *tv1, const struct timeval *tv2) { if (tv1->tv_sec < tv2->tv_sec) return *tv1; @@ -525,7 +525,7 @@ struct timeval timeval_min(const struct timeval *tv1, /** return the greater of two timevals */ -struct timeval timeval_max(const struct timeval *tv1, +_PUBLIC_ struct timeval timeval_max(const struct timeval *tv1, const struct timeval *tv2) { if (tv1->tv_sec > tv2->tv_sec) return *tv1; @@ -539,7 +539,7 @@ struct timeval timeval_max(const struct timeval *tv1, if tv1 comes after tv2, then return a zero timeval (this is *tv2 - *tv1) */ -struct timeval timeval_until(const struct timeval *tv1, +_PUBLIC_ struct timeval timeval_until(const struct timeval *tv1, const struct timeval *tv2) { struct timeval t; @@ -560,7 +560,7 @@ struct timeval timeval_until(const struct timeval *tv1, /** convert a timeval to a NTTIME */ -NTTIME timeval_to_nttime(const struct timeval *tv) +_PUBLIC_ NTTIME timeval_to_nttime(const struct timeval *tv) { return 10*(tv->tv_usec + ((TIME_FIXUP_CONSTANT + (uint64_t)tv->tv_sec) * 1000000)); @@ -587,7 +587,7 @@ static int tm_diff(struct tm *a, struct tm *b) /** return the UTC offset in seconds west of UTC, or 0 if it cannot be determined */ -int get_time_zone(time_t t) +_PUBLIC_ int get_time_zone(time_t t) { struct tm *tm = gmtime(&t); struct tm tm_utc; diff --git a/source4/lib/util/util.c b/source4/lib/util/util.c index 074dc000fb..81084878b5 100644 --- a/source4/lib/util/util.c +++ b/source4/lib/util/util.c @@ -37,7 +37,7 @@ Find a suitable temporary directory. The result should be copied immediately as it may be overwritten by a subsequent call. **/ -const char *tmpdir(void) +_PUBLIC_ const char *tmpdir(void) { char *p; if ((p = getenv("TMPDIR"))) @@ -49,7 +49,7 @@ const char *tmpdir(void) /** Check if a file exists - call vfs_file_exist for samba files. **/ -BOOL file_exist(const char *fname) +_PUBLIC_ BOOL file_exist(const char *fname) { struct stat st; @@ -64,7 +64,7 @@ BOOL file_exist(const char *fname) Check a files mod time. **/ -time_t file_modtime(const char *fname) +_PUBLIC_ time_t file_modtime(const char *fname) { struct stat st; @@ -78,7 +78,7 @@ time_t file_modtime(const char *fname) Check if a directory exists. **/ -BOOL directory_exist(const char *dname) +_PUBLIC_ BOOL directory_exist(const char *dname) { struct stat st; BOOL ret; @@ -93,7 +93,7 @@ BOOL directory_exist(const char *dname) return ret; } -BOOL directory_create_or_exist(const char *dname, uid_t uid, +_PUBLIC_ BOOL directory_create_or_exist(const char *dname, uid_t uid, mode_t dir_perms) { mode_t old_umask; @@ -179,7 +179,7 @@ static void close_low_fds(BOOL stderr_too) if BSD use FNDELAY **/ -int set_blocking(int fd, BOOL set) +_PUBLIC_ int set_blocking(int fd, BOOL set) { int val; #ifdef O_NONBLOCK @@ -207,7 +207,7 @@ int set_blocking(int fd, BOOL set) Sleep for a specified number of milliseconds. **/ -void msleep(uint_t t) +_PUBLIC_ void msleep(uint_t t) { struct timeval tval; @@ -222,7 +222,7 @@ void msleep(uint_t t) Become a daemon, discarding the controlling terminal. **/ -void become_daemon(BOOL Fork) +_PUBLIC_ void become_daemon(BOOL Fork) { if (Fork) { if (fork()) { @@ -255,7 +255,7 @@ void become_daemon(BOOL Fork) Exists only because we need to pass a function pointer somewhere --SSS **/ -void safe_free(void *p) +_PUBLIC_ void safe_free(void *p) { SAFE_FREE(p); } @@ -265,7 +265,7 @@ void safe_free(void *p) see if a string matches either our primary or one of our secondary netbios aliases. do a case insensitive match */ -BOOL is_myname(const char *name) +_PUBLIC_ BOOL is_myname(const char *name) { const char **aliases; int i; @@ -289,7 +289,7 @@ BOOL is_myname(const char *name) Get my own name, return in malloc'ed storage. **/ -char* get_myname(void) +_PUBLIC_ char* get_myname(void) { char *hostname; const int host_name_max = 255; @@ -320,7 +320,7 @@ char* get_myname(void) Return true if a string could be a pure IP address. **/ -BOOL is_ipaddress(const char *str) +_PUBLIC_ BOOL is_ipaddress(const char *str) { BOOL pure_address = True; int i; @@ -338,7 +338,7 @@ BOOL is_ipaddress(const char *str) /** Interpret an internet address or name into an IP address in 4 byte form. **/ -uint32_t interpret_addr(const char *str) +_PUBLIC_ uint32_t interpret_addr(const char *str) { struct hostent *hp; uint32_t res; @@ -383,7 +383,7 @@ uint32_t interpret_addr(const char *str) /** A convenient addition to interpret_addr(). **/ -struct ipv4_addr interpret_addr2(const char *str) +_PUBLIC_ struct ipv4_addr interpret_addr2(const char *str) { struct ipv4_addr ret; uint32_t a = interpret_addr(str); @@ -395,7 +395,7 @@ struct ipv4_addr interpret_addr2(const char *str) Check if an IP is the 0.0.0.0. **/ -BOOL is_zero_ip(struct ipv4_addr ip) +_PUBLIC_ BOOL is_zero_ip(struct ipv4_addr ip) { return ip.addr == 0; } @@ -404,7 +404,7 @@ BOOL is_zero_ip(struct ipv4_addr ip) Are two IPs on the same subnet? **/ -BOOL same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask) +_PUBLIC_ BOOL same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask) { uint32_t net1,net2,nmask; @@ -420,7 +420,7 @@ BOOL same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask) Check if a process exists. Does this work on all unixes? **/ -BOOL process_exists(pid_t pid) +_PUBLIC_ BOOL process_exists(pid_t pid) { /* Doing kill with a non-positive pid causes messages to be * sent to places we don't want. */ @@ -433,7 +433,7 @@ BOOL process_exists(pid_t pid) is dealt with in posix.c **/ -BOOL fcntl_lock(int fd, int op, off_t offset, off_t count, int type) +_PUBLIC_ BOOL fcntl_lock(int fd, int op, off_t offset, off_t count, int type) { struct flock lock; int ret; @@ -486,7 +486,7 @@ static void print_asc(int level, const uint8_t *buf,int len) DEBUGADD(level,("%c", isprint(buf[i])?buf[i]:'.')); } -void dump_data(int level, const uint8_t *buf,int len) +_PUBLIC_ void dump_data(int level, const uint8_t *buf,int len) { int i=0; if (len<=0) return; @@ -522,7 +522,7 @@ void dump_data(int level, const uint8_t *buf,int len) malloc that aborts with smb_panic on fail or zero size. **/ -void *smb_xmalloc(size_t size) +_PUBLIC_ void *smb_xmalloc(size_t size) { void *p; if (size == 0) @@ -536,7 +536,7 @@ void *smb_xmalloc(size_t size) Memdup with smb_panic on fail. **/ -void *smb_xmemdup(const void *p, size_t size) +_PUBLIC_ void *smb_xmemdup(const void *p, size_t size) { void *p2; p2 = smb_xmalloc(size); @@ -548,7 +548,7 @@ void *smb_xmemdup(const void *p, size_t size) strdup that aborts on malloc fail. **/ -char *smb_xstrdup(const char *s) +_PUBLIC_ char *smb_xstrdup(const char *s) { char *s1 = strdup(s); if (!s1) @@ -561,7 +561,7 @@ char *smb_xstrdup(const char *s) Like strdup but for memory. **/ -void *memdup(const void *p, size_t size) +_PUBLIC_ void *memdup(const void *p, size_t size) { void *p2; if (size == 0) @@ -576,7 +576,7 @@ void *memdup(const void *p, size_t size) /** A useful function for returning a path in the Samba lock directory. **/ -char *lock_path(TALLOC_CTX* mem_ctx, const char *name) +_PUBLIC_ char *lock_path(TALLOC_CTX* mem_ctx, const char *name) { char *fname, *dname; if (name == NULL) { @@ -631,7 +631,7 @@ static char *pid_path(TALLOC_CTX* mem_ctx, const char *name) * @retval Pointer to a talloc'ed string containing the full path. **/ -char *lib_path(TALLOC_CTX* mem_ctx, const char *name) +_PUBLIC_ char *lib_path(TALLOC_CTX* mem_ctx, const char *name) { char *fname; fname = talloc_asprintf(mem_ctx, "%s/%s", dyn_LIBDIR, name); @@ -646,7 +646,7 @@ char *lib_path(TALLOC_CTX* mem_ctx, const char *name) * * @retval Pointer to a talloc'ed string containing the full path. **/ -char *private_path(TALLOC_CTX* mem_ctx, const char *name) +_PUBLIC_ char *private_path(TALLOC_CTX* mem_ctx, const char *name) { char *fname; if (name == NULL) { @@ -664,7 +664,7 @@ char *private_path(TALLOC_CTX* mem_ctx, const char *name) for smbd go. If NULL is passed for name then return the directory path itself */ -char *smbd_tmp_path(TALLOC_CTX *mem_ctx, const char *name) +_PUBLIC_ char *smbd_tmp_path(TALLOC_CTX *mem_ctx, const char *name) { char *fname, *dname; @@ -688,7 +688,7 @@ static char *modules_path(TALLOC_CTX* mem_ctx, const char *name) return talloc_asprintf(mem_ctx, "%s/%s", dyn_MODULESDIR, name); } -init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, const char *subsystem) +_PUBLIC_ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, const char *subsystem) { char *path = modules_path(mem_ctx, subsystem); init_module_fn *ret; @@ -700,7 +700,7 @@ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, const char *subsystem) return ret; } -void dump_data_pw(const char *msg, const uint8_t * data, size_t len) +_PUBLIC_ void dump_data_pw(const char *msg, const uint8_t * data, size_t len) { #ifdef DEBUG_PASSWORD DEBUG(11, ("%s", msg)); @@ -716,7 +716,7 @@ void dump_data_pw(const char *msg, const uint8_t * data, size_t len) * see if a range of memory is all zero. A NULL pointer is considered * to be all zero */ -BOOL all_zero(const uint8_t *ptr, uint_t size) +_PUBLIC_ BOOL all_zero(const uint8_t *ptr, uint_t size) { int i; if (!ptr) return True; @@ -729,7 +729,7 @@ BOOL all_zero(const uint8_t *ptr, uint_t size) /** realloc an array, checking for integer overflow in the array size */ -void *realloc_array(void *ptr, size_t el_size, unsigned count) +_PUBLIC_ void *realloc_array(void *ptr, size_t el_size, unsigned count) { #define MAX_MALLOC_SIZE 0x7fffffff if (count == 0 || diff --git a/source4/lib/util/util_file.c b/source4/lib/util/util_file.c index 5e55b81873..430472f25a 100644 --- a/source4/lib/util/util_file.c +++ b/source4/lib/util/util_file.c @@ -34,7 +34,7 @@ read a line from a file with possible \ continuation chars. Blanks at the start or end of a line are stripped. The string will be allocated if s2 is NULL **/ -char *fgets_slash(char *s2,int maxlen,XFILE *f) +_PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f) { char *s=s2; int len = 0; @@ -106,7 +106,7 @@ char *fgets_slash(char *s2,int maxlen,XFILE *f) /** * Read one line (data until next newline or eof) and allocate it */ -char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint) +_PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint) { char *data = NULL; ssize_t alloc_size = 0, offset = 0, ret; @@ -156,8 +156,7 @@ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint) /** load a file into memory from a fd. **/ - -char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx) +_PUBLIC_ char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx) { struct stat sbuf; char *p; @@ -181,7 +180,7 @@ char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx) /** load a file into memory **/ -char *file_load(const char *fname, size_t *size, TALLOC_CTX *mem_ctx) +_PUBLIC_ char *file_load(const char *fname, size_t *size, TALLOC_CTX *mem_ctx) { int fd; char *p; @@ -202,7 +201,7 @@ char *file_load(const char *fname, size_t *size, TALLOC_CTX *mem_ctx) /** mmap (if possible) or read a file **/ -void *map_file(const char *fname, size_t size) +_PUBLIC_ void *map_file(const char *fname, size_t size) { size_t s2 = 0; void *p = NULL; @@ -278,7 +277,7 @@ static char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX * load a file into memory and return an array of pointers to lines in the file must be freed with talloc_free(). **/ -char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx) +_PUBLIC_ char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx) { char *p; char **lines; @@ -299,7 +298,7 @@ load a fd into memory and return an array of pointers to lines in the file must be freed with talloc_free(). If convert is true calls unix_to_dos on the list. **/ -char **fd_lines_load(int fd, int *numlines, TALLOC_CTX *mem_ctx) +_PUBLIC_ char **fd_lines_load(int fd, int *numlines, TALLOC_CTX *mem_ctx) { char *p; char **lines; @@ -320,7 +319,7 @@ char **fd_lines_load(int fd, int *numlines, TALLOC_CTX *mem_ctx) take a list of lines and modify them to produce a list where \ continues a line **/ -void file_lines_slashcont(char **lines) +_PUBLIC_ void file_lines_slashcont(char **lines) { int i, j; @@ -342,7 +341,7 @@ void file_lines_slashcont(char **lines) /** save a lump of data into a file. Mostly used for debugging */ -BOOL file_save(const char *fname, const void *packet, size_t length) +_PUBLIC_ BOOL file_save(const char *fname, const void *packet, size_t length) { int fd; fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0644); @@ -359,7 +358,7 @@ BOOL file_save(const char *fname, const void *packet, size_t length) /** see if a file exists */ -BOOL file_exists(const char *path) +_PUBLIC_ BOOL file_exists(const char *path) { struct stat st; return (stat(path, &st) == 0); diff --git a/source4/lib/util/util_sock.c b/source4/lib/util/util_sock.c index e3913f56a9..0a4380faf4 100644 --- a/source4/lib/util/util_sock.c +++ b/source4/lib/util/util_sock.c @@ -75,7 +75,7 @@ static const struct { /** Set user socket options. **/ -void set_socket_options(int fd, const char *options) +_PUBLIC_ void set_socket_options(int fd, const char *options) { const char **options_list = str_list_make(NULL, options, " \t,"); int j; diff --git a/source4/lib/util/util_str.c b/source4/lib/util/util_str.c index 11a95731de..ef6abd6e83 100644 --- a/source4/lib/util/util_str.c +++ b/source4/lib/util/util_str.c @@ -40,7 +40,7 @@ * Based on a routine by GJC@VILLAGE.COM. * Extensively modified by Andrew.Tridgell@anu.edu.au **/ -BOOL next_token(const char **ptr,char *buff, const char *sep, size_t bufsize) +_PUBLIC_ BOOL next_token(const char **ptr,char *buff, const char *sep, size_t bufsize) { const char *s; BOOL quoted; @@ -82,7 +82,7 @@ BOOL next_token(const char **ptr,char *buff, const char *sep, size_t bufsize) /** Case insensitive string compararison **/ -int strcasecmp_m(const char *s1, const char *s2) +_PUBLIC_ int strcasecmp_m(const char *s1, const char *s2) { codepoint_t c1=0, c2=0; size_t size1, size2; @@ -117,7 +117,7 @@ int strcasecmp_m(const char *s1, const char *s2) * * @note The comparison is case-insensitive. **/ -BOOL strequal(const char *s1, const char *s2) +_PUBLIC_ BOOL strequal(const char *s1, const char *s2) { if (s1 == s2) return(True); @@ -130,7 +130,7 @@ BOOL strequal(const char *s1, const char *s2) /** Compare 2 strings (case sensitive). **/ -BOOL strcsequal(const char *s1,const char *s2) +_PUBLIC_ BOOL strcsequal(const char *s1,const char *s2) { if (s1 == s2) return(True); @@ -144,7 +144,7 @@ BOOL strcsequal(const char *s1,const char *s2) /** Do a case-insensitive, whitespace-ignoring string compare. **/ -int strwicmp(const char *psz1, const char *psz2) +_PUBLIC_ int strwicmp(const char *psz1, const char *psz2) { /* if BOTH strings are NULL, return TRUE, if ONE is NULL return */ /* appropriate value. */ @@ -175,7 +175,7 @@ int strwicmp(const char *psz1, const char *psz2) String replace. NOTE: oldc and newc must be 7 bit characters **/ -void string_replace(char *s, char oldc, char newc) +_PUBLIC_ void string_replace(char *s, char oldc, char newc) { while (*s) { size_t size; @@ -190,7 +190,7 @@ void string_replace(char *s, char oldc, char newc) /** Trim the specified elements off the front and back of a string. **/ -BOOL trim_string(char *s,const char *front,const char *back) +_PUBLIC_ BOOL trim_string(char *s,const char *front,const char *back) { BOOL ret = False; size_t front_len; @@ -229,7 +229,7 @@ BOOL trim_string(char *s,const char *front,const char *back) /** Find the number of 'c' chars in a string **/ -size_t count_chars(const char *s, char c) +_PUBLIC_ size_t count_chars(const char *s, char c) { size_t count = 0; @@ -247,7 +247,7 @@ size_t count_chars(const char *s, char c) Safe string copy into a known length string. maxlength does not include the terminating zero. **/ -char *safe_strcpy(char *dest,const char *src, size_t maxlength) +_PUBLIC_ char *safe_strcpy(char *dest,const char *src, size_t maxlength) { size_t len; @@ -289,7 +289,7 @@ char *safe_strcpy(char *dest,const char *src, size_t maxlength) Safe string cat into a string. maxlength does not include the terminating zero. **/ -char *safe_strcat(char *dest, const char *src, size_t maxlength) +_PUBLIC_ char *safe_strcat(char *dest, const char *src, size_t maxlength) { size_t src_len, dest_len; @@ -331,7 +331,7 @@ char *safe_strcat(char *dest, const char *src, size_t maxlength) characters. Don't change it ! **/ -char *alpha_strcpy(char *dest, const char *src, const char *other_safe_chars, size_t maxlength) +_PUBLIC_ char *alpha_strcpy(char *dest, const char *src, const char *other_safe_chars, size_t maxlength) { size_t len, i; @@ -375,7 +375,7 @@ char *alpha_strcpy(char *dest, const char *src, const char *other_safe_chars, si The variable n should always be one less than the available size. **/ -char *StrnCpy(char *dest,const char *src,size_t n) +_PUBLIC_ char *StrnCpy(char *dest,const char *src,size_t n) { char *d = dest; if (!dest) @@ -401,7 +401,7 @@ char *StrnCpy(char *dest,const char *src,size_t n) **/ -size_t strhex_to_str(char *p, size_t len, const char *strhex) +_PUBLIC_ size_t strhex_to_str(char *p, size_t len, const char *strhex) { size_t i; size_t num_chars = 0; @@ -436,7 +436,7 @@ size_t strhex_to_str(char *p, size_t len, const char *strhex) return num_chars; } -DATA_BLOB strhex_to_data_blob(const char *strhex) +_PUBLIC_ DATA_BLOB strhex_to_data_blob(const char *strhex) { DATA_BLOB ret_blob = data_blob(NULL, strlen(strhex)/2+1); @@ -451,7 +451,7 @@ DATA_BLOB strhex_to_data_blob(const char *strhex) /** * Routine to print a buffer as HEX digits, into an allocated string. */ -void hex_encode(const unsigned char *buff_in, size_t len, char **out_hex_buffer) +_PUBLIC_ void hex_encode(const unsigned char *buff_in, size_t len, char **out_hex_buffer) { int i; char *hex_buffer; @@ -466,7 +466,7 @@ void hex_encode(const unsigned char *buff_in, size_t len, char **out_hex_buffer) /** Check if a string is part of a list. **/ -BOOL in_list(const char *s, const char *list, BOOL casesensitive) +_PUBLIC_ BOOL in_list(const char *s, const char *list, BOOL casesensitive) { pstring tok; const char *p=list; @@ -504,7 +504,7 @@ static BOOL string_init(char **dest,const char *src) /** Free a string value. **/ -void string_free(char **s) +_PUBLIC_ void string_free(char **s) { if (s) SAFE_FREE(*s); } @@ -513,7 +513,7 @@ void string_free(char **s) Set a string value, deallocating any existing space, and allocing the space for the string **/ -BOOL string_set(char **dest, const char *src) +_PUBLIC_ BOOL string_set(char **dest, const char *src) { string_free(dest); return string_init(dest,src); @@ -531,7 +531,7 @@ BOOL string_set(char **dest, const char *src) use of len==0 which was for no length checks to be done. **/ -void string_sub(char *s,const char *pattern, const char *insert, size_t len) +_PUBLIC_ void string_sub(char *s,const char *pattern, const char *insert, size_t len) { char *p; ssize_t ls,lp,li, i; @@ -585,7 +585,7 @@ void string_sub(char *s,const char *pattern, const char *insert, size_t len) use of len==0 which was for no length checks to be done. **/ -void all_string_sub(char *s,const char *pattern,const char *insert, size_t len) +_PUBLIC_ void all_string_sub(char *s,const char *pattern,const char *insert, size_t len) { char *p; ssize_t ls,lp,li; @@ -623,7 +623,7 @@ void all_string_sub(char *s,const char *pattern,const char *insert, size_t len) /** Strchr and strrchr_m are a bit complex on general multi-byte strings. **/ -char *strchr_m(const char *s, char c) +_PUBLIC_ char *strchr_m(const char *s, char c) { /* characters below 0x3F are guaranteed to not appear in non-initial position in multi-byte charsets */ @@ -643,7 +643,7 @@ char *strchr_m(const char *s, char c) return NULL; } -char *strrchr_m(const char *s, char c) +_PUBLIC_ char *strrchr_m(const char *s, char c) { char *ret = NULL; @@ -668,7 +668,7 @@ char *strrchr_m(const char *s, char c) /* return True if any (multi-byte) character is lower case */ -BOOL strhaslower(const char *string) +_PUBLIC_ BOOL strhaslower(const char *string) { while (*string) { size_t c_size; @@ -691,7 +691,7 @@ BOOL strhaslower(const char *string) /* return True if any (multi-byte) character is upper case */ -BOOL strhasupper(const char *string) +_PUBLIC_ BOOL strhasupper(const char *string) { while (*string) { size_t c_size; @@ -714,7 +714,7 @@ BOOL strhasupper(const char *string) /** Convert a string to lower case, allocated with talloc **/ -char *strlower_talloc(TALLOC_CTX *ctx, const char *src) +_PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) { size_t size=0; char *dest; @@ -749,7 +749,7 @@ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) /** Convert a string to UPPER case, allocated with talloc **/ -char *strupper_talloc(TALLOC_CTX *ctx, const char *src) +_PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) { size_t size=0; char *dest; @@ -788,7 +788,7 @@ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) /** Convert a string to lower case. **/ -void strlower_m(char *s) +_PUBLIC_ void strlower_m(char *s) { char *d; @@ -824,7 +824,7 @@ void strlower_m(char *s) /** Convert a string to UPPER case. **/ -void strupper_m(char *s) +_PUBLIC_ void strupper_m(char *s) { char *d; @@ -862,7 +862,7 @@ void strupper_m(char *s) be the same as the number of bytes in a string for single byte strings, but will be different for multibyte. **/ -size_t strlen_m(const char *s) +_PUBLIC_ size_t strlen_m(const char *s) { size_t count = 0; @@ -897,7 +897,7 @@ size_t strlen_m(const char *s) Work out the number of multibyte chars in a string, including the NULL terminator. **/ -size_t strlen_m_term(const char *s) +_PUBLIC_ size_t strlen_m_term(const char *s) { if (!s) { return 0; @@ -910,7 +910,7 @@ size_t strlen_m_term(const char *s) Unescape a URL encoded string, in place. **/ -void rfc1738_unescape(char *buf) +_PUBLIC_ void rfc1738_unescape(char *buf) { char *p=buf; @@ -949,7 +949,7 @@ void rfc1738_unescape(char *buf) /** * Decode a base64 string into a DATA_BLOB - simple and slow algorithm **/ -DATA_BLOB base64_decode_data_blob(TALLOC_CTX *mem_ctx, const char *s) +_PUBLIC_ DATA_BLOB base64_decode_data_blob(TALLOC_CTX *mem_ctx, const char *s) { DATA_BLOB ret = data_blob_talloc(mem_ctx, s, strlen(s)+1); ret.length = ldb_base64_decode((char *)ret.data); @@ -959,7 +959,7 @@ DATA_BLOB base64_decode_data_blob(TALLOC_CTX *mem_ctx, const char *s) /** * Decode a base64 string in-place - wrapper for the above **/ -void base64_decode_inplace(char *s) +_PUBLIC_ void base64_decode_inplace(char *s) { ldb_base64_decode(s); } @@ -967,7 +967,7 @@ void base64_decode_inplace(char *s) /** * Encode a base64 string into a talloc()ed string caller to free. **/ -char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data) +_PUBLIC_ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data) { return ldb_base64_encode(mem_ctx, (const char *)data.data, data.length); } @@ -987,7 +987,7 @@ size_t valgrind_strlen(const char *s) format a string into length-prefixed dotted domain format, as used in NBT and in some ADS structures **/ -const char *str_format_nbt_domain(TALLOC_CTX *mem_ctx, const char *s) +_PUBLIC_ const char *str_format_nbt_domain(TALLOC_CTX *mem_ctx, const char *s) { char *ret; int i; @@ -1016,7 +1016,7 @@ const char *str_format_nbt_domain(TALLOC_CTX *mem_ctx, const char *s) return ret; } -BOOL add_string_to_array(TALLOC_CTX *mem_ctx, +_PUBLIC_ BOOL add_string_to_array(TALLOC_CTX *mem_ctx, const char *str, const char ***strings, int *num) { char *dup_str = talloc_strdup(mem_ctx, str); @@ -1039,7 +1039,7 @@ BOOL add_string_to_array(TALLOC_CTX *mem_ctx, /** varient of strcmp() that handles NULL ptrs **/ -int strcmp_safe(const char *s1, const char *s2) +_PUBLIC_ int strcmp_safe(const char *s1, const char *s2) { if (s1 == s2) { return 0; @@ -1056,7 +1056,7 @@ return the number of bytes occupied by a buffer in ASCII format the result includes the null termination limited by 'n' bytes **/ -size_t ascii_len_n(const char *src, size_t n) +_PUBLIC_ size_t ascii_len_n(const char *src, size_t n) { size_t len; @@ -1072,7 +1072,7 @@ size_t ascii_len_n(const char *src, size_t n) /** Return a string representing a CIFS attribute for a file. **/ -char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib) +_PUBLIC_ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib) { int i, len; const struct { @@ -1119,7 +1119,7 @@ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib) represent a boolean. **/ -BOOL set_boolean(const char *boolean_string, BOOL *boolean) +_PUBLIC_ BOOL set_boolean(const char *boolean_string, BOOL *boolean) { if (strwicmp(boolean_string, "yes") == 0 || strwicmp(boolean_string, "true") == 0 || @@ -1137,7 +1137,7 @@ BOOL set_boolean(const char *boolean_string, BOOL *boolean) return False; } -BOOL conv_str_bool(const char * str, BOOL * val) +_PUBLIC_ BOOL conv_str_bool(const char * str, BOOL * val) { char * end = NULL; long lval; @@ -1158,7 +1158,7 @@ BOOL conv_str_bool(const char * str, BOOL * val) /** * Convert a size specification like 16K into an integral number of bytes. **/ -BOOL conv_str_size(const char * str, uint64_t * val) +_PUBLIC_ BOOL conv_str_size(const char * str, uint64_t * val) { char * end = NULL; unsigned long long lval; @@ -1192,7 +1192,7 @@ BOOL conv_str_size(const char * str, uint64_t * val) return True; } -BOOL conv_str_u64(const char * str, uint64_t * val) +_PUBLIC_ BOOL conv_str_u64(const char * str, uint64_t * val) { char * end = NULL; unsigned long long lval; diff --git a/source4/lib/util/util_strlist.c b/source4/lib/util/util_strlist.c index e3d5126029..48ddbde9e1 100644 --- a/source4/lib/util/util_strlist.c +++ b/source4/lib/util/util_strlist.c @@ -31,7 +31,7 @@ separator list. The separator list must contain characters less than or equal to 0x2f for this to work correctly on multi-byte strings */ -const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep) +_PUBLIC_ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep) { int num_elements = 0; const char **ret = NULL; @@ -81,7 +81,7 @@ const char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char * * Entries are seperated by spaces and can be enclosed by quotes. * Does NOT support escaping */ -const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep) +_PUBLIC_ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const char *sep) { int num_elements = 0; const char **ret = NULL; @@ -140,7 +140,7 @@ const char **str_list_make_shell(TALLOC_CTX *mem_ctx, const char *string, const /** * join a list back to one string */ -char *str_list_join(TALLOC_CTX *mem_ctx, const char **list, char seperator) +_PUBLIC_ char *str_list_join(TALLOC_CTX *mem_ctx, const char **list, char seperator) { char *ret = NULL; int i; @@ -159,7 +159,7 @@ char *str_list_join(TALLOC_CTX *mem_ctx, const char **list, char seperator) /** join a list back to one (shell-like) string; entries * seperated by spaces, using quotes where necessary */ -char *str_list_join_shell(TALLOC_CTX *mem_ctx, const char **list, char sep) +_PUBLIC_ char *str_list_join_shell(TALLOC_CTX *mem_ctx, const char **list, char sep) { char *ret = NULL; int i; @@ -185,7 +185,7 @@ char *str_list_join_shell(TALLOC_CTX *mem_ctx, const char **list, char sep) /** return the number of elements in a string list */ -size_t str_list_length(const char **list) +_PUBLIC_ size_t str_list_length(const char **list) { size_t ret; for (ret=0;list && list[ret];ret++) /* noop */ ; @@ -196,7 +196,7 @@ size_t str_list_length(const char **list) /** copy a string list */ -const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list) +_PUBLIC_ const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list) { int i; const char **ret = talloc_array(mem_ctx, const char *, str_list_length(list)+1); @@ -216,7 +216,7 @@ const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list) /** Return true if all the elements of the list match exactly. */ -BOOL str_list_equal(const char **list1, const char **list2) +_PUBLIC_ BOOL str_list_equal(const char **list1, const char **list2) { int i; @@ -239,7 +239,7 @@ BOOL str_list_equal(const char **list1, const char **list2) /** add an entry to a string list */ -const char **str_list_add(const char **list, const char *s) +_PUBLIC_ const char **str_list_add(const char **list, const char *s) { size_t len = str_list_length(list); const char **ret; @@ -258,7 +258,7 @@ const char **str_list_add(const char **list, const char *s) /** remove an entry from a string list */ -void str_list_remove(const char **list, const char *s) +_PUBLIC_ void str_list_remove(const char **list, const char *s) { int i; @@ -276,7 +276,7 @@ void str_list_remove(const char **list, const char *s) /** return True if a string is in a list */ -BOOL str_list_check(const char **list, const char *s) +_PUBLIC_ BOOL str_list_check(const char **list, const char *s) { int i; @@ -289,7 +289,7 @@ BOOL str_list_check(const char **list, const char *s) /** return True if a string is in a list, case insensitively */ -BOOL str_list_check_ci(const char **list, const char *s) +_PUBLIC_ BOOL str_list_check_ci(const char **list, const char *s) { int i; diff --git a/source4/libcli/composite/composite.c b/source4/libcli/composite/composite.c index 33b5b77c06..d0d2bc3886 100644 --- a/source4/libcli/composite/composite.c +++ b/source4/libcli/composite/composite.c @@ -30,7 +30,7 @@ /* block until a composite function has completed, then return the status */ -NTSTATUS composite_wait(struct composite_context *c) +_PUBLIC_ NTSTATUS composite_wait(struct composite_context *c) { if (c == NULL) return NT_STATUS_NO_MEMORY; @@ -50,7 +50,7 @@ NTSTATUS composite_wait(struct composite_context *c) * Some composite helpers that are handy if you write larger composite * functions. */ -BOOL composite_is_ok(struct composite_context *ctx) +_PUBLIC_ BOOL composite_is_ok(struct composite_context *ctx) { if (NT_STATUS_IS_OK(ctx->status)) { return True; @@ -85,7 +85,7 @@ static void composite_trigger(struct event_context *ev, struct timed_event *te, } -void composite_error(struct composite_context *ctx, NTSTATUS status) +_PUBLIC_ void composite_error(struct composite_context *ctx, NTSTATUS status) { if (!ctx->used_wait && !ctx->async.fn) { event_add_timed(ctx->event_ctx, ctx, timeval_zero(), composite_trigger, ctx); @@ -94,7 +94,7 @@ void composite_error(struct composite_context *ctx, NTSTATUS status) SMB_ASSERT(!composite_is_ok(ctx)); } -BOOL composite_nomem(const void *p, struct composite_context *ctx) +_PUBLIC_ BOOL composite_nomem(const void *p, struct composite_context *ctx) { if (p != NULL) { return False; @@ -103,7 +103,7 @@ BOOL composite_nomem(const void *p, struct composite_context *ctx) return True; } -void composite_done(struct composite_context *ctx) +_PUBLIC_ void composite_done(struct composite_context *ctx) { if (!ctx->used_wait && !ctx->async.fn) { event_add_timed(ctx->event_ctx, ctx, timeval_zero(), composite_trigger, ctx); @@ -114,7 +114,7 @@ void composite_done(struct composite_context *ctx) } } -void composite_continue(struct composite_context *ctx, +_PUBLIC_ void composite_continue(struct composite_context *ctx, struct composite_context *new_ctx, void (*continuation)(struct composite_context *), void *private_data) @@ -124,7 +124,7 @@ void composite_continue(struct composite_context *ctx, new_ctx->async.private_data = private_data; } -void composite_continue_rpc(struct composite_context *ctx, +_PUBLIC_ void composite_continue_rpc(struct composite_context *ctx, struct rpc_request *new_req, void (*continuation)(struct rpc_request *), void *private_data) @@ -134,7 +134,7 @@ void composite_continue_rpc(struct composite_context *ctx, new_req->async.private = private_data; } -void composite_continue_irpc(struct composite_context *ctx, +_PUBLIC_ void composite_continue_irpc(struct composite_context *ctx, struct irpc_request *new_req, void (*continuation)(struct irpc_request *), void *private_data) @@ -144,7 +144,7 @@ void composite_continue_irpc(struct composite_context *ctx, new_req->async.private = private_data; } -void composite_continue_smb(struct composite_context *ctx, +_PUBLIC_ void composite_continue_smb(struct composite_context *ctx, struct smbcli_request *new_req, void (*continuation)(struct smbcli_request *), void *private_data) @@ -154,7 +154,7 @@ void composite_continue_smb(struct composite_context *ctx, new_req->async.private = private_data; } -void composite_continue_nbt(struct composite_context *ctx, +_PUBLIC_ void composite_continue_nbt(struct composite_context *ctx, struct nbt_name_request *new_req, void (*continuation)(struct nbt_name_request *), void *private_data) diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c index c6fc18f55a..25fd669789 100644 --- a/source4/libcli/nbt/nbtname.c +++ b/source4/libcli/nbt/nbtname.c @@ -32,10 +32,10 @@ /* don't allow an unlimited number of name components */ #define MAX_COMPONENTS 10 -/* +/** print a nbt string */ -void ndr_print_nbt_string(struct ndr_print *ndr, const char *name, const char *s) +_PUBLIC_ void ndr_print_nbt_string(struct ndr_print *ndr, const char *name, const char *s) { ndr_print_string(ndr, name, s); } @@ -88,10 +88,10 @@ static NTSTATUS ndr_pull_component(struct ndr_pull *ndr, uint8_t **component, return NT_STATUS_BAD_NETWORK_NAME; } -/* +/** pull a nbt_string from the wire */ -NTSTATUS ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s) +_PUBLIC_ NTSTATUS ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s) { NTSTATUS status; uint32_t offset = ndr->offset; @@ -132,10 +132,10 @@ NTSTATUS ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s return NT_STATUS_OK; } -/* +/** push a nbt string to the wire */ -NTSTATUS ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s) +_PUBLIC_ NTSTATUS ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s) { if (!(ndr_flags & NDR_SCALARS)) { return NT_STATUS_OK; @@ -274,10 +274,10 @@ static uint8_t *compress_name(TALLOC_CTX *mem_ctx, } -/* +/** pull a nbt name from the wire */ -NTSTATUS ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r) +_PUBLIC_ NTSTATUS ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r) { NTSTATUS status; uint8_t *scope; @@ -320,10 +320,10 @@ NTSTATUS ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name return NT_STATUS_OK; } -/* +/** push a nbt name to the wire */ -NTSTATUS ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r) +_PUBLIC_ NTSTATUS ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r) { uint8_t *cname, *fullname; NTSTATUS status; @@ -349,10 +349,10 @@ NTSTATUS ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt } -/* +/** copy a nbt name structure */ -NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname) +_PUBLIC_ NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname) { *newname = *name; newname->name = talloc_strdup(mem_ctx, newname->name); @@ -364,33 +364,33 @@ NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_nam return NT_STATUS_OK; } -/* +/** push a nbt name into a blob */ -NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name) +_PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name) { return ndr_push_struct_blob(blob, mem_ctx, name, (ndr_push_flags_fn_t)ndr_push_nbt_name); } -/* +/** pull a nbt name from a blob */ -NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name) +_PUBLIC_ NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name) { return ndr_pull_struct_blob(blob, mem_ctx, name, (ndr_pull_flags_fn_t)ndr_pull_nbt_name); } -/* +/** choose a name to use when calling a server in a NBT session request. we use heuristics to see if the name we have been given is a IP address, or a too-long name. If it is then use *SMBSERVER, or a truncated name */ -void nbt_choose_called_name(TALLOC_CTX *mem_ctx, +_PUBLIC_ void nbt_choose_called_name(TALLOC_CTX *mem_ctx, struct nbt_name *n, const char *name, int type) { n->scope = NULL; @@ -450,10 +450,10 @@ static const char *nbt_hex_encode(TALLOC_CTX *mem_ctx, const char *s) } -/* +/** form a string for a NBT name */ -char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name) +_PUBLIC_ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name) { TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); char *ret; @@ -471,10 +471,10 @@ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name) return ret; } -/* +/** pull a nbt name, WINS Replication uses another on wire format for nbt name */ -NTSTATUS ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name **_r) +_PUBLIC_ NTSTATUS ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name **_r) { struct nbt_name *r; uint8_t *namebuf; @@ -532,10 +532,10 @@ NTSTATUS ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt return NT_STATUS_OK; } -/* +/** push a nbt name, WINS Replication uses another on wire format for nbt name */ -NTSTATUS ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r) +_PUBLIC_ NTSTATUS ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r) { uint8_t *namebuf; uint32_t namebuf_len; @@ -587,7 +587,7 @@ NTSTATUS ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const stru return NT_STATUS_OK; } -void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r) +_PUBLIC_ void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r) { char *s = nbt_name_string(ndr, r); ndr_print_string(ndr, name, s); diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index a7f34ec002..1f626df13b 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -46,7 +46,7 @@ const struct dcerpc_syntax_id ndr64_transfer_syntax = { /* work out the number of bytes needed to align on a n byte boundary */ -size_t ndr_align_size(uint32_t offset, size_t n) +_PUBLIC_ size_t ndr_align_size(uint32_t offset, size_t n) { if ((offset & (n-1)) == 0) return 0; return n - (offset & (n-1)); @@ -55,7 +55,7 @@ size_t ndr_align_size(uint32_t offset, size_t n) /* initialise a ndr parse structure from a data blob */ -struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx) +_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { struct ndr_pull *ndr; @@ -72,7 +72,7 @@ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx) /* advance by 'size' bytes */ -NTSTATUS ndr_pull_advance(struct ndr_pull *ndr, uint32_t size) +_PUBLIC_ NTSTATUS ndr_pull_advance(struct ndr_pull *ndr, uint32_t size) { ndr->offset += size; if (ndr->offset > ndr->data_size) { @@ -98,14 +98,14 @@ static NTSTATUS ndr_pull_set_offset(struct ndr_pull *ndr, uint32_t ofs) } /* save the offset/size of the current ndr state */ -void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save) +_PUBLIC_ void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save) { save->offset = ndr->offset; save->data_size = ndr->data_size; } /* restore the size/offset of a ndr structure */ -void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save) +_PUBLIC_ void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save) { ndr->offset = save->offset; ndr->data_size = save->data_size; @@ -113,7 +113,7 @@ void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save) /* create a ndr_push structure, ready for some marshalling */ -struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx) +_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx) { struct ndr_push *ndr; @@ -134,20 +134,20 @@ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx) /* create a ndr_push structure, ready for some marshalling */ -struct ndr_push *ndr_push_init(void) +_PUBLIC_ struct ndr_push *ndr_push_init(void) { return ndr_push_init_ctx(NULL); } /* free a ndr_push structure */ -void ndr_push_free(struct ndr_push *ndr) +_PUBLIC_ void ndr_push_free(struct ndr_push *ndr) { talloc_free(ndr); } /* return a DATA_BLOB structure for the current ndr_push marshalled data */ -DATA_BLOB ndr_push_blob(struct ndr_push *ndr) +_PUBLIC_ DATA_BLOB ndr_push_blob(struct ndr_push *ndr) { DATA_BLOB blob; blob.data = ndr->data; @@ -162,7 +162,7 @@ DATA_BLOB ndr_push_blob(struct ndr_push *ndr) /* expand the available space in the buffer to 'size' */ -NTSTATUS ndr_push_expand(struct ndr_push *ndr, uint32_t size) +_PUBLIC_ NTSTATUS ndr_push_expand(struct ndr_push *ndr, uint32_t size) { if (ndr->alloc_size > size) { return NT_STATUS_OK; @@ -181,7 +181,7 @@ NTSTATUS ndr_push_expand(struct ndr_push *ndr, uint32_t size) return NT_STATUS_OK; } -void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3) +_PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3) { va_list ap; char *s = NULL; @@ -217,7 +217,7 @@ static void ndr_print_string_helper(struct ndr_print *ndr, const char *format, . /* a useful helper function for printing idl structures via DEBUG() */ -void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr) +_PUBLIC_ void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr) { struct ndr_print *ndr; @@ -233,7 +233,7 @@ void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr) /* a useful helper function for printing idl unions via DEBUG() */ -void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr) +_PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr) { struct ndr_print *ndr; @@ -250,7 +250,7 @@ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, /* a useful helper function for printing idl function calls via DEBUG() */ -void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr) +_PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr) { struct ndr_print *ndr; @@ -267,7 +267,7 @@ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int fla /* a useful helper function for printing idl function calls to a string */ -char *ndr_print_function_string(TALLOC_CTX *mem_ctx, +_PUBLIC_ char *ndr_print_function_string(TALLOC_CTX *mem_ctx, ndr_print_function_t fn, const char *name, int flags, void *ptr) { @@ -290,7 +290,7 @@ failed: return ret; } -void ndr_set_flags(uint32_t *pflags, uint32_t new_flags) +_PUBLIC_ void ndr_set_flags(uint32_t *pflags, uint32_t new_flags) { /* the big/little endian flags are inter-dependent */ if (new_flags & LIBNDR_FLAG_LITTLE_ENDIAN) { @@ -330,7 +330,7 @@ static NTSTATUS ndr_map_error(enum ndr_err_code err) /* return and possibly log an NDR error */ -NTSTATUS ndr_pull_error(struct ndr_pull *ndr, +_PUBLIC_ NTSTATUS ndr_pull_error(struct ndr_pull *ndr, enum ndr_err_code err, const char *format, ...) _PRINTF_ATTRIBUTE(3,4) { char *s=NULL; @@ -350,7 +350,7 @@ NTSTATUS ndr_pull_error(struct ndr_pull *ndr, /* return and possibly log an NDR error */ -NTSTATUS ndr_push_error(struct ndr_push *ndr, enum ndr_err_code err, const char *format, ...) _PRINTF_ATTRIBUTE(3,4) +_PUBLIC_ NTSTATUS ndr_push_error(struct ndr_push *ndr, enum ndr_err_code err, const char *format, ...) _PRINTF_ATTRIBUTE(3,4) { char *s=NULL; va_list ap; @@ -370,7 +370,7 @@ NTSTATUS ndr_push_error(struct ndr_push *ndr, enum ndr_err_code err, const char handle subcontext buffers, which in midl land are user-marshalled, but we use magic in pidl to make them easier to cope with */ -NTSTATUS ndr_pull_subcontext_start(struct ndr_pull *ndr, +_PUBLIC_ NTSTATUS ndr_pull_subcontext_start(struct ndr_pull *ndr, struct ndr_pull **_subndr, size_t header_size, ssize_t size_is) @@ -429,7 +429,7 @@ NTSTATUS ndr_pull_subcontext_start(struct ndr_pull *ndr, return NT_STATUS_OK; } -NTSTATUS ndr_pull_subcontext_end(struct ndr_pull *ndr, +_PUBLIC_ NTSTATUS ndr_pull_subcontext_end(struct ndr_pull *ndr, struct ndr_pull *subndr, size_t header_size, ssize_t size_is) @@ -446,7 +446,7 @@ NTSTATUS ndr_pull_subcontext_end(struct ndr_pull *ndr, return NT_STATUS_OK; } -NTSTATUS ndr_push_subcontext_start(struct ndr_push *ndr, +_PUBLIC_ NTSTATUS ndr_push_subcontext_start(struct ndr_push *ndr, struct ndr_push **_subndr, size_t header_size, ssize_t size_is) @@ -464,7 +464,7 @@ NTSTATUS ndr_push_subcontext_start(struct ndr_push *ndr, /* push a subcontext header */ -NTSTATUS ndr_push_subcontext_end(struct ndr_push *ndr, +_PUBLIC_ NTSTATUS ndr_push_subcontext_end(struct ndr_push *ndr, struct ndr_push *subndr, size_t header_size, ssize_t size_is) @@ -503,7 +503,7 @@ NTSTATUS ndr_push_subcontext_end(struct ndr_push *ndr, /* store a token in the ndr context, for later retrieval */ -NTSTATUS ndr_token_store(TALLOC_CTX *mem_ctx, +_PUBLIC_ NTSTATUS ndr_token_store(TALLOC_CTX *mem_ctx, struct ndr_token_list **list, const void *key, uint32_t value) @@ -522,7 +522,7 @@ NTSTATUS ndr_token_store(TALLOC_CTX *mem_ctx, /* retrieve a token from a ndr context, using cmp_fn to match the tokens */ -NTSTATUS ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, +_PUBLIC_ NTSTATUS ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, comparison_fn_t _cmp_fn, BOOL _remove_tok) { struct ndr_token_list *tok; @@ -543,7 +543,7 @@ found: /* retrieve a token from a ndr context */ -NTSTATUS ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v) +_PUBLIC_ NTSTATUS ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v) { return ndr_token_retrieve_cmp_fn(list, key, v, NULL, True); } @@ -551,7 +551,7 @@ NTSTATUS ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint3 /* peek at but don't removed a token from a ndr context */ -uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key) +_PUBLIC_ uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key) { NTSTATUS status; uint32_t v; @@ -563,7 +563,7 @@ uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key) /* pull an array size field and add it to the array_size_list token list */ -NTSTATUS ndr_pull_array_size(struct ndr_pull *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_pull_array_size(struct ndr_pull *ndr, const void *p) { uint32_t size; NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &size)); @@ -573,7 +573,7 @@ NTSTATUS ndr_pull_array_size(struct ndr_pull *ndr, const void *p) /* get the stored array size field */ -uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p) +_PUBLIC_ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p) { return ndr_token_peek(&ndr->array_size_list, p); } @@ -581,7 +581,7 @@ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p) /* check the stored array size field */ -NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size) +_PUBLIC_ NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size) { uint32_t stored; stored = ndr_token_peek(&ndr->array_size_list, p); @@ -596,7 +596,7 @@ NTSTATUS ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size) /* pull an array length field and add it to the array_length_list token list */ -NTSTATUS ndr_pull_array_length(struct ndr_pull *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_pull_array_length(struct ndr_pull *ndr, const void *p) { uint32_t length, offset; NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &offset)); @@ -611,7 +611,7 @@ NTSTATUS ndr_pull_array_length(struct ndr_pull *ndr, const void *p) /* get the stored array length field */ -uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p) +_PUBLIC_ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p) { return ndr_token_peek(&ndr->array_length_list, p); } @@ -619,7 +619,7 @@ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p) /* check the stored array length field */ -NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length) +_PUBLIC_ NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length) { uint32_t stored; stored = ndr_token_peek(&ndr->array_length_list, p); @@ -634,17 +634,17 @@ NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length) /* store a switch value */ -NTSTATUS ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val) +_PUBLIC_ NTSTATUS ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val) { return ndr_token_store(ndr, &ndr->switch_list, p, val); } -NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val) +_PUBLIC_ NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val) { return ndr_token_store(ndr, &ndr->switch_list, p, val); } -NTSTATUS ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val) +_PUBLIC_ NTSTATUS ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val) { return ndr_token_store(ndr, &ndr->switch_list, p, val); } @@ -652,17 +652,17 @@ NTSTATUS ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32 /* retrieve a switch value */ -uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p) +_PUBLIC_ uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p) { return ndr_token_peek(&ndr->switch_list, p); } -uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p) +_PUBLIC_ uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p) { return ndr_token_peek(&ndr->switch_list, p); } -uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p) +_PUBLIC_ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p) { return ndr_token_peek(&ndr->switch_list, p); } @@ -670,7 +670,7 @@ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p) /* pull a struct from a blob using NDR */ -NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; @@ -684,7 +684,7 @@ NTSTATUS ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void * /* pull a struct from a blob using NDR - failing if all bytes are not consumed */ -NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; @@ -705,7 +705,7 @@ NTSTATUS ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, vo /* pull a union from a blob using NDR, given the union discriminator */ -NTSTATUS ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ NTSTATUS ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; @@ -727,7 +727,7 @@ NTSTATUS ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p /* push a struct to a blob using NDR */ -NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, +_PUBLIC_ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn) { NTSTATUS status; @@ -749,7 +749,7 @@ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void * /* push a union to a blob using NDR */ -NTSTATUS ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ NTSTATUS ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn) { NTSTATUS status; @@ -772,7 +772,7 @@ NTSTATUS ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, /* generic ndr_size_*() handler for structures */ -size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) +_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) { struct ndr_push *ndr; NTSTATUS status; @@ -796,7 +796,7 @@ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) /* generic ndr_size_*() handler for unions */ -size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push) +_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push) { struct ndr_push *ndr; NTSTATUS status; @@ -821,7 +821,7 @@ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_f /* get the current base for relative pointers for the push */ -uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr) +_PUBLIC_ uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr) { return ndr->relative_base_offset; } @@ -829,7 +829,7 @@ uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr) /* restore the old base for relative pointers for the push */ -void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset) +_PUBLIC_ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset) { ndr->relative_base_offset = offset; } @@ -838,7 +838,7 @@ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset setup the current base for relative pointers for the push called in the NDR_SCALAR stage */ -NTSTATUS ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset) +_PUBLIC_ NTSTATUS ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset) { ndr->relative_base_offset = offset; return ndr_token_store(ndr, &ndr->relative_base_list, p, offset); @@ -848,7 +848,7 @@ NTSTATUS ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void * setup the current base for relative pointers for the push called in the NDR_BUFFERS stage */ -NTSTATUS ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p) { return ndr_token_retrieve(&ndr->relative_base_list, p, &ndr->relative_base_offset); } @@ -857,7 +857,7 @@ NTSTATUS ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void * push a relative object - stage1 this is called during SCALARS processing */ -NTSTATUS ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p) { if (p == NULL) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); @@ -872,7 +872,7 @@ NTSTATUS ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p) push a relative object - stage2 this is called during buffers processing */ -NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p) { struct ndr_push_save save; uint32_t ptr_offset = 0xFFFFFFFF; @@ -900,7 +900,7 @@ NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p) /* get the current base for relative pointers for the pull */ -uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr) +_PUBLIC_ uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr) { return ndr->relative_base_offset; } @@ -908,7 +908,7 @@ uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr) /* restore the old base for relative pointers for the pull */ -void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset) +_PUBLIC_ void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset) { ndr->relative_base_offset = offset; } @@ -917,7 +917,7 @@ void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset setup the current base for relative pointers for the pull called in the NDR_SCALAR stage */ -NTSTATUS ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset) +_PUBLIC_ NTSTATUS ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset) { ndr->relative_base_offset = offset; return ndr_token_store(ndr, &ndr->relative_base_list, p, offset); @@ -927,7 +927,7 @@ NTSTATUS ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void * setup the current base for relative pointers for the pull called in the NDR_BUFFERS stage */ -NTSTATUS ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p) { return ndr_token_retrieve(&ndr->relative_base_list, p, &ndr->relative_base_offset); } @@ -936,7 +936,7 @@ NTSTATUS ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void * pull a relative object - stage1 called during SCALARS processing */ -NTSTATUS ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset) +_PUBLIC_ NTSTATUS ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset) { rel_offset += ndr->relative_base_offset; if (rel_offset > ndr->data_size) { @@ -951,7 +951,7 @@ NTSTATUS ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t re pull a relative object - stage2 called during BUFFERS processing */ -NTSTATUS ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p) { uint32_t rel_offset; NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &rel_offset)); diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index ccc1c8a016..000a0c3498 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -36,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; @@ -58,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); @@ -69,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); @@ -80,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); @@ -92,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); @@ -104,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); @@ -116,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); @@ -128,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) { NTSTATUS status; status = ndr_pull_uint32(ndr, NDR_SCALARS, v); @@ -141,7 +141,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 */ @@ -152,7 +152,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); @@ -165,7 +165,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); @@ -178,7 +178,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); } @@ -186,7 +186,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); @@ -195,7 +195,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)); @@ -209,7 +209,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)); @@ -220,12 +220,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)); } @@ -233,7 +233,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)); @@ -244,12 +244,12 @@ 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, win_errstr(r)); } @@ -257,7 +257,7 @@ void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR 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); @@ -268,7 +268,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; @@ -279,7 +279,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); @@ -290,7 +290,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); @@ -301,7 +301,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); @@ -313,7 +313,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); @@ -325,7 +325,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); @@ -337,7 +337,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); @@ -349,7 +349,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); @@ -362,7 +362,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); @@ -375,7 +375,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); } @@ -383,7 +383,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); @@ -392,7 +392,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)); @@ -402,13 +402,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; @@ -417,7 +417,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); @@ -428,7 +428,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); @@ -439,7 +439,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; @@ -450,7 +450,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; } @@ -458,7 +458,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; } @@ -466,7 +466,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) { @@ -480,7 +480,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_sptr_ptr(struct ndr_push *ndr, const void *p) +_PUBLIC_ NTSTATUS ndr_push_sptr_ptr(struct ndr_push *ndr, const void *p) { uint32_t ptr = 0; if (p) { @@ -493,7 +493,7 @@ NTSTATUS ndr_push_sptr_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, const void *p) +_PUBLIC_ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p) { if (p == NULL) { return NT_STATUS_INVALID_PARAMETER_MIX; @@ -505,7 +505,7 @@ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p) /* 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; @@ -514,7 +514,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; @@ -523,7 +523,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)); @@ -533,7 +533,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; @@ -543,7 +543,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; @@ -552,7 +552,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; @@ -561,7 +561,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); } @@ -569,7 +569,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)); @@ -581,7 +581,7 @@ NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t) /* 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 ipv4_addr in; NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.addr)); @@ -594,7 +594,7 @@ 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(address)) { @@ -610,19 +610,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, uint_t value) { if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) { @@ -632,7 +632,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, uint_t flag, uint_t value) +_PUBLIC_ void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint_t flag, uint_t value) { /* this is an attempt to support multi-bit bitmap masks */ value &= flag; @@ -648,62 +648,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); } -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); } -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); @@ -712,12 +712,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 @@ -725,12 +725,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); @@ -739,7 +739,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); @@ -748,12 +748,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; @@ -781,7 +781,7 @@ 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); if (r.length) { @@ -793,7 +793,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) { @@ -815,7 +815,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; @@ -841,7 +841,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) { return ret + data->length; } -- cgit