* @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)
{
@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)
{
*
*/
-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;
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)
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)
* 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);
*
*/
-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;
*
*/
-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) {
*
*/
-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;
*
*/
-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) {
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;
*
*/
-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) {
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;
[MODULE::libldb_objectguid]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = objectguid_module_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
objectguid.o
REQUIRED_SUBSYSTEMS = \
[MODULE::libldb_samldb]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = samldb_module_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
samldb.o
REQUIRED_SUBSYSTEMS = SAMDB
SUBSYSTEM = LIBLDB
INIT_FUNCTION = ldb_samba3sam_module_init
ENABLE = NO
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
samba3sam.o
#
[MODULE::libldb_proxy]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = proxy_module_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
proxy.o
#
[MODULE::libldb_rootdse]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = rootdse_module_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
rootdse.o
#
[MODULE::libldb_password_hash]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = password_hash_module_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
password_hash.o
REQUIRED_SUBSYSTEMS = \
[MODULE::libldb_kludge_acl]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = ldb_kludge_acl_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
kludge_acl.o
REQUIRED_SUBSYSTEMS = \
[MODULE::libldb_extended_dn]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = ldb_extended_dn_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
extended_dn.o
#
* 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;
* 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;
* 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;
[MODULE::libldb_asq]
INIT_FUNCTION = ldb_asq_init
SUBSYSTEM = LIBLDB
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
modules/asq.o
# End MODULE libldb_asq
[MODULE::libldb_sort]
INIT_FUNCTION = ldb_sort_init
SUBSYSTEM = LIBLDB
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
modules/sort.o
# End MODULE libldb_sort
[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
[MODULE::libldb_operational]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = ldb_operational_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
modules/operational.o
# End MODULE libldb_operational
[MODULE::libldb_objectclass]
INIT_FUNCTION = ldb_objectclass_init
SUBSYSTEM = LIBLDB
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
modules/objectclass.o
# End MODULE libldb_objectclass
[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
[MODULE::libldb_schema]
INIT_FUNCTION = ldb_schema_init
SUBSYSTEM = LIBLDB
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
modules/schema.o
# End MODULE libldb_schema
# Start MODULE libldb_ildap
[MODULE::libldb_ildap]
SUBSYSTEM = LIBLDB
-OUTPUT_TYPE = MERGEDOBJ
INIT_FUNCTION = ldb_ildap_init
OBJ_FILES = \
ldb_ildap/ldb_ildap.o
# Start MODULE libldb_map
[MODULE::libldb_map]
SUBSYSTEM = LIBLDB
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = modules/ldb_map.o
# End MODULE libldb_map
################################################
[MODULE::libldb_skel]
SUBSYSTEM = LIBLDB
INIT_FUNCTION = ldb_skel_init
-OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = modules/skel.o
# End MODULE libldb_skel
################################################
# Start MODULE libldb_sqlite3
[MODULE::libldb_sqlite3]
SUBSYSTEM = LIBLDB
-OUTPUT_TYPE = MERGEDOBJ
INIT_FUNCTION = ldb_sqlite3_init
OBJ_FILES = \
ldb_sqlite3/ldb_sqlite3.o
[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 \
/*
* 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;
.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;
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;
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;
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;
}
-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;
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;
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);
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);
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);
}
}
-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);
}
}
-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);
}
-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;
return ret;
}
-int swrap_close(int fd)
+_PUBLIC_ int swrap_close(int fd)
{
struct socket_info *si = find_socket_info(fd);
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);
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;
/**
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);
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;
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);
/**
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);
/**
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);
/**
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);
/**
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;
/**
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;
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);
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);
/**
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);
/**
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,
**/
/* this global variable determines what messages are printed */
-int DEBUGLEVEL;
+_PUBLIC_ int DEBUGLEVEL;
/* the registered mutex handlers */
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();
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;
/**
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;
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;
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",
/**
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);
/**
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();
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);
/**
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;
/**
* Write backtrace to debug log
*/
-void call_backtrace(void)
+_PUBLIC_ void call_backtrace(void)
{
#ifdef HAVE_BACKTRACE
#define BACKTRACE_STACK_SIZE 64
/**
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;
/**
setup our fault handlers
**/
-void fault_setup(const char *pname)
+_PUBLIC_ void fault_setup(const char *pname)
{
if (progname == NULL) {
progname = 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! */
*
* 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)
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;
}
/**
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];
/**
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);
/**
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) {
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);
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+_-#.,";
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) {
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) {
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;
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);
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;
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;
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! */
* 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];
/**
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;
}
/**
a gettimeofday wrapper
**/
-void GetTimeOfDay(struct timeval *tval)
+_PUBLIC_ void GetTimeOfDay(struct timeval *tval)
{
#ifdef HAVE_GETTIMEOFDAY_TZ
gettimeofday(tval,NULL);
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;
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;
/**
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 ||
/**
check if it's a null NTTIME
**/
-BOOL null_nttime(NTTIME t)
+_PUBLIC_ BOOL null_nttime(NTTIME t)
{
return t == 0 || t == (NTTIME)-1;
}
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);
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);
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;
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;
/**
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;
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)) {
/**
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];
/**
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];
/**
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) {
/**
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);
}
/**
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;
/**
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);
}
/**
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);
/**
return a zero timeval
*/
-struct timeval timeval_zero(void)
+_PUBLIC_ struct timeval timeval_zero(void)
{
struct timeval tv;
tv.tv_sec = 0;
/**
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;
}
/**
return a timeval for the current time
*/
-struct timeval timeval_current(void)
+_PUBLIC_ struct timeval timeval_current(void)
{
struct timeval tv;
GetTimeOfDay(&tv);
/**
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;
/**
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;
/**
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);
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;
/**
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;
/**
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;
/**
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);
/**
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;
/**
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;
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;
/**
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));
/**
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;
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")))
/**
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;
Check a files mod time.
**/
-time_t file_modtime(const char *fname)
+_PUBLIC_ time_t file_modtime(const char *fname)
{
struct stat st;
Check if a directory exists.
**/
-BOOL directory_exist(const char *dname)
+_PUBLIC_ BOOL directory_exist(const char *dname)
{
struct stat st;
BOOL ret;
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;
if BSD use FNDELAY
**/
-int set_blocking(int fd, BOOL set)
+_PUBLIC_ int set_blocking(int fd, BOOL set)
{
int val;
#ifdef O_NONBLOCK
Sleep for a specified number of milliseconds.
**/
-void msleep(uint_t t)
+_PUBLIC_ void msleep(uint_t t)
{
struct timeval tval;
Become a daemon, discarding the controlling terminal.
**/
-void become_daemon(BOOL Fork)
+_PUBLIC_ void become_daemon(BOOL Fork)
{
if (Fork) {
if (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);
}
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;
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;
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;
/**
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;
/**
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);
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;
}
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;
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. */
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;
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;
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)
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);
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)
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)
/**
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) {
* @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);
*
* @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) {
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;
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;
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));
* 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;
/**
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 ||
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;
/**
* 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;
/**
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;
/**
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;
/**
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;
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;
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;
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;
/**
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);
/**
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);
/**
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;
* 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;
/**
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;
*
* @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);
/**
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);
/**
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. */
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;
/**
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;
/**
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;
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;
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;
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;
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)
**/
-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;
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);
/**
* 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;
/**
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;
/**
Free a string value.
**/
-void string_free(char **s)
+_PUBLIC_ void string_free(char **s)
{
if (s) SAFE_FREE(*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);
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;
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;
/**
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 */
return NULL;
}
-char *strrchr_m(const char *s, char c)
+_PUBLIC_ char *strrchr_m(const char *s, char c)
{
char *ret = NULL;
/*
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;
/*
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;
/**
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;
/**
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;
/**
Convert a string to lower case.
**/
-void strlower_m(char *s)
+_PUBLIC_ void strlower_m(char *s)
{
char *d;
/**
Convert a string to UPPER case.
**/
-void strupper_m(char *s)
+_PUBLIC_ void strupper_m(char *s)
{
char *d;
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;
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;
Unescape a URL encoded string, in place.
**/
-void rfc1738_unescape(char *buf)
+_PUBLIC_ void rfc1738_unescape(char *buf)
{
char *p=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);
/**
* 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);
}
/**
* 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);
}
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;
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);
/**
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;
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;
/**
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 {
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 ||
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;
/**
* 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;
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;
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;
* 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;
/**
* 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;
/** 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;
/**
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 */ ;
/**
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);
/**
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;
/**
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;
/**
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;
/**
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;
/**
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;
/*
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;
* 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;
}
-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);
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;
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);
}
}
-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)
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)
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)
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)
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)
/* 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);
}
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;
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;
}
-/*
+/**
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;
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;
}
-/*
+/**
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);
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;
}
-/*
+/**
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;
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;
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;
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);
/*
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));
/*
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;
/*
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) {
}
/* 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;
/* 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;
/* 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;
/*
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;
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;
/*
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;
/*
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;
/*
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;
/*
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)
{
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) {
/*
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;
/*
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;
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)
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)
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)
/*
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)
/*
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)
/*
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;
/*
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);
}
/*
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;
/*
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));
/*
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);
}
/*
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);
/*
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));
/*
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);
}
/*
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);
/*
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);
}
/*
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);
}
/*
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;
/*
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;
/*
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;
/*
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;
/*
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;
/*
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;
/*
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;
/*
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;
}
/*
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;
}
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);
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);
}
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));
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;
/*
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;
}
/*
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;
}
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);
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);
}
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) {
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));
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;
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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 */
/*
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);
/*
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);
/*
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);
}
/*
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);
/*
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));
/*
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));
/*
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));
}
/*
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));
/*
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));
}
/*
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);
/*
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;
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
/*
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);
}
/*
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);
/*
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));
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;
/*
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);
/*
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);
/*
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;
/*
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;
}
/*
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;
}
/*
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) {
/*
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) {
/*
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;
/*
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;
/*
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;
/*
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));
/*
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;
/*
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;
/*
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;
/*
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);
}
/*
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));
/*
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));
/*
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)) {
/*
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) {
}
}
-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;
}
}
-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);
}
}
-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
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);
}
}
-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);
}
}
-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;
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) {
/*
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) {
/*
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;
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;
}