s3: Add "code_page" to struct samu
[kai/samba.git] / source3 / include / proto.h
index e175454dae17e0f76c3d950c32344789e6742d93..83ac33ac2363504ec99a647cfb43751793bfa32e 100644 (file)
@@ -153,7 +153,7 @@ NTSTATUS make_server_info_system(TALLOC_CTX *mem_ctx,
 const struct auth_serversupplied_info *get_server_info_system(void);
 bool copy_current_user(struct current_user *dst, struct current_user *src);
 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser,
-                            fstring save_username, bool create );
+                            char **p_save_username, bool create );
 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, 
                                const char *sent_nt_username,
                                const char *domain,
@@ -334,10 +334,6 @@ bool pdb_get_dom_grp_info(const struct dom_sid *sid, struct acct_info *info);
 bool pdb_set_dom_grp_info(const struct dom_sid *sid, const struct acct_info *info);
 NTSTATUS pdb_create_builtin_alias(uint32 rid);
 
-/* The following definitions come from groupdb/mapping_ldb.c  */
-
-const struct mapping_backend *groupdb_ldb_init(void);
-
 /* The following definitions come from groupdb/mapping_tdb.c  */
 
 const struct mapping_backend *groupdb_tdb_init(void);
@@ -480,6 +476,8 @@ size_t pull_string_talloc_fn(const char *function,
                        size_t src_len,
                        int flags);
 size_t align_string(const void *base_ptr, const char *p, int flags);
+codepoint_t next_codepoint_ext(const char *str, charset_t src_charset,
+                              size_t *bytes_consumed);
 codepoint_t next_codepoint(const char *str, size_t *size);
 
 /* The following definitions come from lib/clobber.c  */
@@ -505,27 +503,6 @@ int connections_forall_read(int (*fn)(const struct connections_key *key,
                            void *private_data);
 bool connections_init(bool rw);
 
-/* The following definitions come from lib/debug.c  */
-
-void gfree_debugsyms(void);
-const char *debug_classname_from_index(int ndx);
-int debug_add_class(const char *classname);
-int debug_lookup_classname(const char *classname);
-bool debug_parse_levels(const char *params_str);
-void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data);
-void debug_init(void);
-void debug_register_msgs(struct messaging_context *msg_ctx);
-void setup_logging(const char *pname, bool interactive);
-void setup_logging_stdout( void );
-void debug_set_logfile(const char *name);
-bool reopen_logs( void );
-void force_check_log_size( void );
-bool need_to_check_log_size( void );
-void check_log_size( void );
-void dbgflush( void );
-bool dbghdrclass(int level, int cls, const char *location, const char *func);
-bool dbghdr(int level, const char *location, const char *func);
-
 /* The following definitions come from lib/display_sec.c  */
 
 char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
@@ -567,10 +544,17 @@ void pull_file_id_24(char *buf, struct file_id *id);
 bool gencache_set(const char *keystr, const char *value, time_t timeout);
 bool gencache_del(const char *keystr);
 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
+bool gencache_parse(const char *keystr,
+                   void (*parser)(time_t timeout, DATA_BLOB blob,
+                                  void *private_data),
+                   void *private_data);
 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
                            time_t *timeout, bool *was_expired);
 bool gencache_stabilize(void);
 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
+void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
+                                      time_t timeout, void *private_data),
+                           void *private_data, const char *pattern);
 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
                       void* data, const char* keystr_pattern);
 
@@ -620,13 +604,6 @@ int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
               bool is_case_sensitive);
 int gen_fnmatch(const char *pattern, const char *string);
 
-/* The following definitions come from lib/pam_errors.c  */
-
-NTSTATUS pam_to_nt_status(int pam_error);
-int nt_status_to_pam(NTSTATUS nt_status);
-NTSTATUS pam_to_nt_status(int pam_error);
-int nt_status_to_pam(NTSTATUS nt_status);
-
 /* The following definitions come from lib/pidfile.c  */
 
 pid_t pidfile_pid(const char *name);
@@ -900,6 +877,7 @@ int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
              bool fake_dir_create_times);
 int sys_ftruncate(int fd, SMB_OFF_T offset);
 int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
+int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
 SMB_OFF_T sys_ftell(FILE *fp);
@@ -908,6 +886,7 @@ int sys_open(const char *path, int oflag, mode_t mode);
 FILE *sys_fopen(const char *path, const char *type);
 void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
 SMB_STRUCT_DIR *sys_opendir(const char *name);
+SMB_STRUCT_DIR *sys_fdopendir(int fd);
 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
 long sys_telldir(SMB_STRUCT_DIR *dirp);
@@ -1197,9 +1176,6 @@ void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const c
 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
 void *talloc_zeronull(const void *context, size_t size, const char *name);
-bool is_valid_policy_hnd(const struct policy_handle *hnd);
-bool policy_hnd_equal(const struct policy_handle *hnd1,
-                     const struct policy_handle *hnd2);
 const char *strip_hostname(const char *s);
 bool tevent_req_poll_ntstatus(struct tevent_req *req,
                              struct tevent_context *ev,
@@ -1342,8 +1318,6 @@ struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
                                              uint16_t port,
                                              int timeout);
 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
-bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
-                        int timeout, int *fd_index, int *fd);
 int open_udp_socket(const char *host, int port);
 const char *get_peer_name(int fd, bool force_lookup);
 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
@@ -1452,6 +1426,10 @@ char *strnrchr_m(const char *s, char c, unsigned int n);
 char *strstr_m(const char *src, const char *findstr);
 void strlower_m(char *s);
 void strupper_m(char *s);
+size_t strlen_m_ext(const char *s, const charset_t src_charset,
+                   const charset_t dst_charset);
+size_t strlen_m_ext_term(const char *s, const charset_t src_charset,
+                        const charset_t dst_charset);
 size_t strlen_m(const char *s);
 size_t strlen_m_term(const char *s);
 size_t strlen_m_term_null(const char *s);
@@ -1588,19 +1566,6 @@ void wins_srv_tags_free(char **list);
 struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
 unsigned wins_srv_count_tag(const char *tag);
 
-/* The following definitions come from librpc/ndr/util.c  */
-
-enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
-enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
-void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
-enum ndr_err_code ndr_push_file_id(struct ndr_push *ndr, int ndr_flags, const struct file_id *r);
-enum ndr_err_code ndr_pull_file_id(struct ndr_pull *ndr, int ndr_flags, struct file_id *r);
-void ndr_print_file_id(struct ndr_print *ndr, const char *name, const struct file_id *r);
-_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
-_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
-const char *ndr_errstr(enum ndr_err_code err);
-extern const struct ndr_syntax_id null_ndr_syntax_id;
-
 /* The following definitions come from libsmb/cliconnect.c  */
 
 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, 
@@ -1659,8 +1624,7 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli,
                              const char *my_name, 
                              const char *dest_host, 
                              struct sockaddr_storage *dest_ss, int port,
-                             int signing_state, int flags,
-                             bool *retry) ;
+                             int signing_state, int flags);
 NTSTATUS cli_full_connection(struct cli_state **output_cli, 
                             const char *my_name, 
                             const char *dest_host, 
@@ -1668,8 +1632,7 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli,
                             const char *service, const char *service_type,
                             const char *user, const char *domain, 
                             const char *password, int flags,
-                            int signing_state,
-                            bool *retry) ;
+                            int signing_state);
 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
                                      struct sockaddr_storage *pdest_ss);
 NTSTATUS cli_raw_tcon(struct cli_state *cli, 
@@ -1704,7 +1667,7 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
                                int port,
                                int name_type);
 void cli_cm_display(const struct cli_state *c);
-bool cli_dfs_get_referral(TALLOC_CTX *ctx,
+NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
                        struct cli_state *cli,
                        const char *path,
                        struct client_dfs_referral **refs,
@@ -1757,7 +1720,6 @@ void cli_shutdown(struct cli_state *cli);
 void cli_sockopt(struct cli_state *cli, const char *options);
 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
-bool cli_send_keepalive(struct cli_state *cli);
 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
                                 struct cli_state *cli, uint16_t num_echos,
                                 DATA_BLOB data);
@@ -1789,6 +1751,20 @@ bool cli_state_is_connected(struct cli_state *cli);
 
 /* The following definitions come from libsmb/clifile.c  */
 
+struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
+                                       struct tevent_context *ev,
+                                       struct cli_state *cli,
+                                       uint16_t level,
+                                       const char *path,
+                                       uint8_t *data,
+                                       size_t data_len);
+NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
+NTSTATUS cli_setpathinfo(struct cli_state *cli,
+                        uint16_t level,
+                        const char *path,
+                        uint8_t *data,
+                        size_t data_len);
+
 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
                                        struct event_context *ev,
                                        struct cli_state *cli,
@@ -2083,8 +2059,12 @@ NTSTATUS cli_ctemp(struct cli_state *cli,
                        uint16_t *pfnum,
                        char **out_path);
 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
-bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
-bool cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum, const char *ea_name, const char *ea_val, size_t ea_len);
+NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
+                        const char *ea_name, const char *ea_val,
+                        size_t ea_len);
+NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
+                        const char *ea_name, const char *ea_val,
+                        size_t ea_len);
 struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
                                             struct tevent_context *ev,
                                             struct cli_state *cli,
@@ -2164,21 +2144,21 @@ NTSTATUS cli_get_fs_attr_info_recv(struct tevent_req *req, uint32_t *fs_attr);
 NTSTATUS cli_get_fs_attr_info(struct cli_state *cli, uint32_t *fs_attr);
 NTSTATUS cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name,
                                uint32 *pserial_number, time_t *pdate);
-bool cli_get_fs_full_size_info(struct cli_state *cli,
-                               uint64_t *total_allocation_units,
-                               uint64_t *caller_allocation_units,
-                               uint64_t *actual_allocation_units,
-                               uint64_t *sectors_per_allocation_unit,
-                               uint64_t *bytes_per_sector);
-bool cli_get_posix_fs_info(struct cli_state *cli,
-                           uint32 *optimal_transfer_size,
-                           uint32 *block_size,
-                           uint64_t *total_blocks,
-                           uint64_t *blocks_available,
-                           uint64_t *user_blocks_available,
-                           uint64_t *total_file_nodes,
-                           uint64_t *free_file_nodes,
-                           uint64_t *fs_identifier);
+NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
+                                  uint64_t *total_allocation_units,
+                                  uint64_t *caller_allocation_units,
+                                  uint64_t *actual_allocation_units,
+                                  uint64_t *sectors_per_allocation_unit,
+                                  uint64_t *bytes_per_sector);
+NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
+                              uint32 *optimal_transfer_size,
+                              uint32 *block_size,
+                              uint64_t *total_blocks,
+                              uint64_t *blocks_available,
+                              uint64_t *user_blocks_available,
+                              uint64_t *total_file_nodes,
+                              uint64_t *free_file_nodes,
+                              uint64_t *fs_identifier);
 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, 
                                const char *user,
                                const char *pass,
@@ -2199,11 +2179,11 @@ bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_
 /* The following definitions come from libsmb/clilist.c  */
 
 NTSTATUS cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
-                     void (*fn)(const char *, struct file_info *,
+                     NTSTATUS (*fn)(const char *, struct file_info *,
                                 const char *, void *), void *state);
 NTSTATUS cli_list_trans(struct cli_state *cli, const char *mask,
                        uint16_t attribute, int info_level,
-                       void (*fn)(const char *mnt, struct file_info *finfo,
+                       NTSTATUS (*fn)(const char *mnt, struct file_info *finfo,
                                   const char *mask, void *private_data),
                        void *private_data);
 struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
@@ -2215,7 +2195,7 @@ struct tevent_req *cli_list_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                       struct file_info **finfo, size_t *num_finfo);
 NTSTATUS cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
-                 void (*fn)(const char *, struct file_info *, const char *,
+                 NTSTATUS (*fn)(const char *, struct file_info *, const char *,
                             void *), void *state);
 
 /* The following definitions come from libsmb/climessage.c  */
@@ -2245,20 +2225,21 @@ void cli_oplock_handler(struct cli_state *cli,
 int cli_print_queue(struct cli_state *cli,
                    void (*fn)(struct print_job_info *));
 int cli_printjob_del(struct cli_state *cli, int job);
-int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
-bool cli_spl_close(struct cli_state *cli, uint16_t fnum);
 
 /* The following definitions come from libsmb/cliquota.c  */
 
 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
-bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
-bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
-bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
-bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
-bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
-void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric));
-void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric));
+NTSTATUS cli_get_user_quota(struct cli_state *cli, int quota_fnum,
+                           SMB_NTQUOTA_STRUCT *pqt);
+NTSTATUS cli_set_user_quota(struct cli_state *cli, int quota_fnum,
+                           SMB_NTQUOTA_STRUCT *pqt);
+NTSTATUS cli_list_user_quota(struct cli_state *cli, int quota_fnum,
+                            SMB_NTQUOTA_LIST **pqt_list);
+NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
+                              SMB_NTQUOTA_STRUCT *pqt);
+NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
+                              SMB_NTQUOTA_STRUCT *pqt);
 
 /* The following definitions come from libsmb/clirap.c  */
 
@@ -2291,12 +2272,12 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli,
                        time_t *write_time,
                        SMB_OFF_T *size,
                        uint16 *mode);
-bool cli_setpathinfo(struct cli_state *cli, const char *fname,
-                     time_t create_time,
-                     time_t access_time,
-                     time_t write_time,
-                     time_t change_time,
-                     uint16 mode);
+NTSTATUS cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
+                              time_t create_time,
+                              time_t access_time,
+                              time_t write_time,
+                              time_t change_time,
+                              uint16 mode);
 struct tevent_req *cli_qpathinfo2_send(TALLOC_CTX *mem_ctx,
                                       struct event_context *ev,
                                       struct cli_state *cli,
@@ -2329,13 +2310,13 @@ NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
                               struct stream_struct **pstreams);
 NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name,
                       size_t namelen);
-bool cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
-                        uint16 *mode, SMB_OFF_T *size,
-                        struct timespec *create_time,
-                        struct timespec *access_time,
-                        struct timespec *write_time,
-                        struct timespec *change_time,
-                        SMB_INO_T *ino);
+NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
+                            uint16 *mode, SMB_OFF_T *size,
+                            struct timespec *create_time,
+                            struct timespec *access_time,
+                            struct timespec *write_time,
+                            struct timespec *change_time,
+                            SMB_INO_T *ino);
 struct tevent_req *cli_qpathinfo_basic_send(TALLOC_CTX *mem_ctx,
                                            struct event_context *ev,
                                            struct cli_state *cli,
@@ -2344,7 +2325,6 @@ NTSTATUS cli_qpathinfo_basic_recv(struct tevent_req *req,
                                  SMB_STRUCT_STAT *sbuf, uint32 *attributes);
 NTSTATUS cli_qpathinfo_basic(struct cli_state *cli, const char *name,
                             SMB_STRUCT_STAT *sbuf, uint32 *attributes);
-bool cli_qfileinfo_test(struct cli_state *cli, uint16_t fnum, int level, char **poutdata, uint32 *poutlen);
 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
 struct tevent_req *cli_qpathinfo_send(TALLOC_CTX *mem_ctx,
                                      struct tevent_context *ev,
@@ -2377,6 +2357,17 @@ struct tevent_req *cli_flush_send(TALLOC_CTX *mem_ctx,
 NTSTATUS cli_flush_recv(struct tevent_req *req);
 NTSTATUS cli_flush(TALLOC_CTX *mem_ctx, struct cli_state *cli, uint16_t fnum);
 
+struct tevent_req *cli_shadow_copy_data_send(TALLOC_CTX *mem_ctx,
+                                            struct tevent_context *ev,
+                                            struct cli_state *cli,
+                                            uint16_t fnum,
+                                            bool get_names);
+NTSTATUS cli_shadow_copy_data_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                                  char ***pnames, int *pnum_names);
+NTSTATUS cli_shadow_copy_data(TALLOC_CTX *mem_ctx, struct cli_state *cli,
+                             uint16_t fnum, bool get_names,
+                             char ***pnames, int *pnum_names);
+
 /* The following definitions come from libsmb/clirap2.c  */
 struct rap_group_info_1;
 struct rap_user_info_1;
@@ -2496,7 +2487,8 @@ NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
 
 struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
                            TALLOC_CTX *mem_ctx);
-bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, struct security_descriptor *sd);
+NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
+                        struct security_descriptor *sd);
 
 /* The following definitions come from libsmb/clispnego.c  */
 
@@ -2567,24 +2559,6 @@ size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
 
 /* The following definitions come from libsmb/clitrans.c  */
 
-bool cli_send_trans(struct cli_state *cli, int trans,
-                   const char *pipe_name,
-                   int fid, int flags,
-                   uint16 *setup, unsigned int lsetup, unsigned int msetup,
-                   const char *param, unsigned int lparam, unsigned int mparam,
-                   const char *data, unsigned int ldata, unsigned int mdata);
-bool cli_receive_trans(struct cli_state *cli,int trans,
-                              char **param, unsigned int *param_len,
-                              char **data, unsigned int *data_len);
-bool cli_send_nt_trans(struct cli_state *cli,
-                      int function,
-                      int flags,
-                      uint16 *setup, unsigned int lsetup, unsigned int msetup,
-                      char *param, unsigned int lparam, unsigned int mparam,
-                      char *data, unsigned int ldata, unsigned int mdata);
-bool cli_receive_nt_trans(struct cli_state *cli,
-                         char **param, unsigned int *param_len,
-                         char **data, unsigned int *data_len);
 struct tevent_req *cli_trans_send(
        TALLOC_CTX *mem_ctx, struct event_context *ev,
        struct cli_state *cli, uint8_t cmd,
@@ -2619,24 +2593,6 @@ NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
 void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
 void flush_negative_conn_cache_for_domain(const char *domain);
 
-/* The following definitions come from ../librpc/rpc/dcerpc_error.c  */
-
-const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
-NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code);
-
-/* The following definitions come from ../librpc/rpc/dcerpc_util.c  */
-
-void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v);
-uint16_t dcerpc_get_frag_length(const DATA_BLOB *blob);
-void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v);
-uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
-NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt,
-                                 TALLOC_CTX *mem_ctx,
-                                 DATA_BLOB *pkt_trailer,
-                                 struct dcerpc_auth *auth,
-                                 uint32_t *auth_length,
-                                 bool auth_data_only);
-
 /* The following definitions come from libsmb/dsgetdcname.c  */
 
 struct netr_DsRGetDCNameInfo;
@@ -2687,26 +2643,39 @@ bool saf_store( const char *domain, const char *servername );
 bool saf_join_store( const char *domain, const char *servername );
 bool saf_delete( const char *domain );
 char *saf_fetch( const char *domain );
-NODE_STATUS_STRUCT *node_status_query(int fd,
-                                       struct nmb_name *name,
-                                       const struct sockaddr_storage *to_ss,
-                                       int *num_names,
-                                       struct node_status_extra *extra);
+struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
+                                         struct tevent_context *ev,
+                                         struct nmb_name *name,
+                                         const struct sockaddr_storage *addr);
+NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                               struct node_status **pnode_status,
+                               int *pnum_names,
+                               struct node_status_extra *extra);
+NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
+                          const struct sockaddr_storage *addr,
+                          struct node_status **pnode_status,
+                          int *pnum_names,
+                          struct node_status_extra *extra);
 bool name_status_find(const char *q_name,
                        int q_type,
                        int type,
                        const struct sockaddr_storage *to_ss,
                        fstring name);
 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
-struct sockaddr_storage *name_query(int fd,
-                       const char *name,
-                       int name_type,
-                       bool bcast,
-                       bool recurse,
-                       const struct sockaddr_storage *to_ss,
-                       int *count,
-                       int *flags,
-                       bool *timed_out);
+struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
+                                  struct tevent_context *ev,
+                                  const char *name, int name_type,
+                                  bool bcast, bool recurse,
+                                  const struct sockaddr_storage *addr);
+NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                        struct sockaddr_storage **addrs, int *num_addrs,
+                        uint8_t *flags);
+NTSTATUS name_query(const char *name, int name_type,
+                   bool bcast, bool recurse,
+                   const struct sockaddr_storage *to_ss,
+                   TALLOC_CTX *mem_ctx,
+                   struct sockaddr_storage **addrs,
+                   int *num_addrs, uint8_t *flags);
 NTSTATUS name_resolve_bcast(const char *name,
                        int name_type,
                        struct ip_service **return_iplist,
@@ -2756,6 +2725,7 @@ void put_name(char *dest, const char *name, int pad, unsigned int name_type);
 char *nmb_namestr(const struct nmb_name *n);
 struct packet_struct *copy_packet(struct packet_struct *packet);
 void free_packet(struct packet_struct *packet);
+int packet_trn_id(struct packet_struct *p);
 struct packet_struct *parse_packet(char *buf,int length,
                                   enum packet_type packet_type,
                                   struct in_addr ip,
@@ -2766,13 +2736,10 @@ bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
 bool send_packet(struct packet_struct *p);
 struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
-struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id);
-struct packet_struct *receive_dgram_packet(int fd, int t,
-               const char *mailslot_name);
 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
 void sort_query_replies(char *data, int n, struct in_addr ip);
-char *name_mangle(TALLOC_CTX *mem_ctx, char *In, char name_type);
+char *name_mangle(TALLOC_CTX *mem_ctx, const char *In, char name_type);
 int name_extract(unsigned char *buf,size_t buf_len, unsigned int ofs, fstring name);
 int name_len(unsigned char *s1, size_t buf_len);
 
@@ -2820,7 +2787,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
 
 bool netsamlogon_cache_init(void);
 bool netsamlogon_cache_shutdown(void);
-void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3);
+void netsamlogon_clear_cached_user(const struct dom_sid *user_sid);
 bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3);
 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid);
 bool netsamlogon_cache_have(const struct dom_sid *user_sid);
@@ -2910,10 +2877,27 @@ NTSTATUS change_trust_account_password( const char *domain, const char *remote_m
 
 /* The following definitions come from libsmb/unexpected.c  */
 
-void unexpected_packet(struct packet_struct *p);
-void clear_unexpected(time_t t);
-struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
+struct nb_packet_server;
+struct nb_packet_reader;
+
+NTSTATUS nb_packet_server_create(TALLOC_CTX *mem_ctx,
+                                struct tevent_context *ev,
+                                int max_clients,
+                                struct nb_packet_server **presult);
+void nb_packet_dispatch(struct nb_packet_server *server,
+                       struct packet_struct *p);
+struct tevent_req *nb_packet_reader_send(TALLOC_CTX *mem_ctx,
+                                        struct tevent_context *ev,
+                                        enum packet_type type,
+                                        int trn_id,
                                         const char *mailslot_name);
+NTSTATUS nb_packet_reader_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                              struct nb_packet_reader **preader);
+struct tevent_req *nb_packet_read_send(TALLOC_CTX *mem_ctx,
+                                      struct tevent_context *ev,
+                                      struct nb_packet_reader *reader);
+NTSTATUS nb_packet_read_recv(struct tevent_req *req,
+                            struct packet_struct **ppacket);
 
 /* The following definitions come from locking/brlock.c  */
 
@@ -3044,8 +3028,11 @@ struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
 bool rename_share_filename(struct messaging_context *msg_ctx,
                        struct share_mode_lock *lck,
                        const char *servicepath,
+                       uint32_t orig_name_hash,
+                       uint32_t new_name_hash,
                        const struct smb_filename *smb_fname);
 void get_file_infos(struct file_id id,
+                   uint32_t name_hash,
                    bool *delete_on_close,
                    struct timespec *write_time);
 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
@@ -3062,9 +3049,13 @@ void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid,
 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
-void set_delete_on_close_token(struct share_mode_lock *lck, const UNIX_USER_TOKEN *tok);
-void set_delete_on_close_lck(struct share_mode_lock *lck, bool delete_on_close, const UNIX_USER_TOKEN *tok);
+const UNIX_USER_TOKEN *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
+void set_delete_on_close_lck(files_struct *fsp,
+                       struct share_mode_lock *lck,
+                       bool delete_on_close,
+                       const UNIX_USER_TOKEN *tok);
 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const UNIX_USER_TOKEN *tok);
+bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
 bool set_write_time(struct file_id fileid, struct timespec write_time);
 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
@@ -3202,6 +3193,7 @@ bool lp_winbind_offline_logon(void);
 bool lp_winbind_normalize_names(void);
 bool lp_winbind_rpc_only(void);
 bool lp_create_krb5_conf(void);
+int lp_winbind_max_domain_connections(void);
 const char *lp_idmap_backend(void);
 bool lp_idmap_read_only(void);
 int lp_idmap_cache_time(void);
@@ -3289,6 +3281,8 @@ bool lp_use_mmap(void);
 bool lp_unix_extensions(void);
 bool lp_use_spnego(void);
 bool lp_client_use_spnego(void);
+bool lp_client_use_spnego_principal(void);
+bool lp_send_spnego_principal(void);
 bool lp_hostname_lookups(void);
 bool lp_change_notify(const struct share_params *p );
 bool lp_kernel_change_notify(const struct share_params *p );
@@ -3332,6 +3326,7 @@ int lp_config_backend(void);
 int lp_smb2_max_read(void);
 int lp_smb2_max_write(void);
 int lp_smb2_max_trans(void);
+int lp_smb2_max_credits(void);
 char *lp_preexec(int );
 char *lp_postexec(int );
 char *lp_rootpreexec(int );
@@ -3426,6 +3421,7 @@ bool lp_dos_filetimes(int );
 bool lp_dos_filetime_resolution(int );
 bool lp_fake_dir_create_times(int);
 bool lp_async_smb_echo_handler(void);
+bool lp_multicast_dns_register(void);
 bool lp_blocking_locks(int );
 bool lp_inherit_perms(int );
 bool lp_inherit_acls(int );
@@ -3739,6 +3735,8 @@ const char *pdb_get_comment(const struct samu *sampass);
 const char *pdb_get_munged_dial(const struct samu *sampass);
 uint16_t pdb_get_bad_password_count(const struct samu *sampass);
 uint16_t pdb_get_logon_count(const struct samu *sampass);
+uint16_t pdb_get_country_code(const struct samu *sampass);
+uint16_t pdb_get_code_page(const struct samu *sampass);
 uint32_t pdb_get_unknown_6(const struct samu *sampass);
 void *pdb_get_backend_private_data(const struct samu *sampass, const struct pdb_methods *my_methods);
 bool pdb_set_acct_ctrl(struct samu *sampass, uint32_t acct_ctrl, enum pdb_value_state flag);
@@ -3773,6 +3771,10 @@ bool pdb_set_pw_history(struct samu *sampass, const uint8_t *pwd, uint32_t histo
 bool pdb_set_plaintext_pw_only(struct samu *sampass, const char *password, enum pdb_value_state flag);
 bool pdb_set_bad_password_count(struct samu *sampass, uint16_t bad_password_count, enum pdb_value_state flag);
 bool pdb_set_logon_count(struct samu *sampass, uint16_t logon_count, enum pdb_value_state flag);
+bool pdb_set_country_code(struct samu *sampass, uint16_t country_code,
+                         enum pdb_value_state flag);
+bool pdb_set_code_page(struct samu *sampass, uint16_t code_page,
+                      enum pdb_value_state flag);
 bool pdb_set_unknown_6(struct samu *sampass, uint32_t unkn, enum pdb_value_state flag);
 bool pdb_set_hours(struct samu *sampass, const uint8_t *hours, enum pdb_value_state flag);
 bool pdb_set_backend_private_data(struct samu *sampass, void *private_data, 
@@ -4018,7 +4020,9 @@ void notify_printer_sepfile(struct tevent_context *ev,
 /* The following definitions come from printing/pcap.c  */
 
 void pcap_cache_reload(struct tevent_context *ev,
-                      struct messaging_context *msg_ctx);
+                      struct messaging_context *msg_ctx,
+                      void (*post_cache_fill_fn)(struct tevent_context *,
+                                                 struct messaging_context *));
 bool pcap_printername_ok(const char *printername);
 
 /* The following definitions come from printing/printing.c  */
@@ -4080,6 +4084,7 @@ NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
 NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
                               const struct ndr_syntax_id *abstract_syntax,
                               struct rpc_pipe_client **presult);
+struct dcerpc_binding_handle *rpccli_bh_create(struct rpc_pipe_client *c);
 struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
                                              const struct ndr_syntax_id *syntax,
                                              struct client_address *client_id,
@@ -4223,10 +4228,8 @@ NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
 
 /* The following definitions come from rpc_client/rpc_transport_tstream.c  */
 NTSTATUS rpc_transport_tstream_init(TALLOC_CTX *mem_ctx,
-                               struct tstream_context *npipe,
-                               struct tevent_queue *read_queue,
-                               struct tevent_queue *write_queue,
-                                struct rpc_cli_transport **presult);
+                               struct tstream_context **stream,
+                               struct rpc_cli_transport **presult);
 
 /* The following definitions come from rpc_server/srv_eventlog_nt.c  */
 
@@ -4336,6 +4339,7 @@ char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
 /* The following definitions come from rpc_server/srv_svcctl_nt.c  */
 
 bool init_service_op_table( void );
+bool shutdown_service_op_table(void);
 
 /* The following definitions come from rpcclient/cmd_dfs.c  */
 
@@ -4376,18 +4380,6 @@ bool init_service_op_table( void );
 /* The following definitions come from rpcclient/rpcclient.c  */
 
 
-/* The following definitions come from services/services_db.c  */
-
-void svcctl_init_keys( void );
-struct security_descriptor *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, struct security_token *token );
-bool svcctl_set_secdesc(const char *name, struct security_descriptor *sec_desc,
-                       struct security_token *token);
-const char *svcctl_get_string_value(TALLOC_CTX *ctx, const char *key_name,
-                                   const char *value_name,
-                                   struct security_token *token);
-const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, struct security_token *token );
-const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, struct security_token *token );
-
 /* The following definitions come from services/svc_netlogon.c  */
 
 
@@ -4417,7 +4409,8 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
 NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
                                struct smb_request *smbreq,
                                files_struct *fsp,
-                               char *inbuf,
+                               TALLOC_CTX *ctx,
+                               DATA_BLOB *preadbuf,
                                SMB_OFF_T startpos,
                                size_t smb_maxcnt);
 NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
@@ -4531,9 +4524,10 @@ void dptr_closecnum(connection_struct *conn);
 void dptr_idlecnum(connection_struct *conn);
 void dptr_closepath(struct smbd_server_connection *sconn,
                    char *path,uint16 spid);
-NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, bool expect_close,uint16 spid,
+NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
+               const char *path, bool old_handle, bool expect_close,uint16 spid,
                const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
-int dptr_CloseDir(struct dptr_struct *dptr);
+void dptr_CloseDir(files_struct *fsp);
 void dptr_SeekDir(struct dptr_struct *dptr, long offset);
 long dptr_TellDir(struct dptr_struct *dptr);
 bool dptr_has_wild(struct dptr_struct *dptr);
@@ -4600,6 +4594,9 @@ int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
 uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
 int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
                     uint32 dosmode, const char *parent_dir, bool newfile);
+NTSTATUS file_set_sparse(connection_struct *conn,
+                        struct files_struct *fsp,
+                        bool sparse);
 int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
                struct smb_file_time *ft);
 bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
@@ -4731,6 +4728,8 @@ files_struct *file_fsp(struct smb_request *req, uint16 fid);
 NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
                      uint32 access_mask, uint32 share_access,
                      uint32 create_options, files_struct *to);
+NTSTATUS file_name_hash(connection_struct *conn,
+                       const char *name, uint32_t *p_name_hash);
 NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
                           const struct smb_filename *smb_fname_in);
 
@@ -4783,7 +4782,7 @@ const struct mangle_fns *posix_mangle_init(void);
 
 /* The following definitions come from auth/user_util.c  */
 
-bool map_username(fstring user);
+bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out);
 
 /* The following definitions come from auth/user_krb5.c  */
 struct PAC_LOGON_INFO;
@@ -4993,10 +4992,9 @@ bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
                                 uint32_t *pprivate_flags);
 void remove_deferred_open_entry(struct file_id id, uint64_t mid,
                                struct server_id pid);
-NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
+NTSTATUS open_file_fchmod(connection_struct *conn,
                          struct smb_filename *smb_fname,
                          files_struct **result);
-NTSTATUS close_file_fchmod(struct smb_request *req, files_struct *fsp);
 NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
                          struct smb_filename *smb_dname);
 void msg_file_was_renamed(struct messaging_context *msg,
@@ -5087,8 +5085,8 @@ void add_session_user(struct smbd_server_connection *sconn, const char *user);
 void add_session_workgroup(struct smbd_server_connection *sconn,
                           const char *workgroup);
 const char *get_session_workgroup(struct smbd_server_connection *sconn);
-bool user_in_netgroup(const char *user, const char *ngname);
-bool user_in_list(const char *user,const char **list);
+bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname);
+bool user_in_list(TALLOC_CTX *ctx, const char *user,const char **list);
 bool authorise_login(struct smbd_server_connection *sconn,
                     int snum, fstring user, DATA_BLOB password,
                     bool *guest);
@@ -5117,8 +5115,7 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
                           struct security_descriptor **ppdesc);
 NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
                          uint32_t security_info, struct security_descriptor **ppdesc);
-int try_chown(connection_struct *conn, struct smb_filename *smb_fname,
-             uid_t uid, gid_t gid);
+NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
 NTSTATUS append_parent_acl(files_struct *fsp,
                                const struct security_descriptor *pcsd,
                                struct security_descriptor **pp_new_sd);
@@ -5250,6 +5247,11 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
                          uint32 dirtype, struct smb_filename *smb_fname,
                          bool has_wild);
 void reply_unlink(struct smb_request *req);
+ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, size_t nread);
+void sendfile_short_send(files_struct *fsp,
+                               ssize_t nread,
+                               size_t headersize,
+                               size_t smb_maxcnt);
 void reply_readbraw(struct smb_request *req);
 void reply_lockread(struct smb_request *req);
 void reply_read(struct smb_request *req);
@@ -5349,9 +5351,12 @@ void server_messaging_context_free(void);
 struct event_context *smbd_event_context(void);
 struct messaging_context *smbd_messaging_context(void);
 struct memcache *smbd_memcache(void);
-void reload_printers(struct messaging_context *msg_ctx);
+void reload_printers(struct tevent_context *ev,
+                    struct messaging_context *msg_ctx);
 bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
                     bool test);
+void reload_pcap_change_notify(struct tevent_context *ev,
+                              struct messaging_context *msg_ctx);
 void exit_server(const char *const explanation);
 void exit_server_cleanly(const char *const explanation);
 void exit_server_fault(void);
@@ -5362,7 +5367,7 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
 void load_registry_shares(void);
 int add_home_service(const char *service, const char *username, const char *homedir);
-int find_service(fstring service);
+int find_service(TALLOC_CTX *ctx, const char *service, char **p_service_out);
 connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
                                        int snum, user_struct *vuser,
                                        DATA_BLOB password,
@@ -5544,6 +5549,7 @@ ssize_t vfs_pwrite_data(struct smb_request *req,
                        SMB_OFF_T offset);
 int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
 int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len);
+int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len);
 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len);
 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n);
 const char *vfs_readdirname(connection_struct *conn, void *p,
@@ -5556,6 +5562,7 @@ int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
                        SMB_STRUCT_STAT *psbuf);
 NTSTATUS vfs_stat_fsp(files_struct *fsp);
+NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid);
 
 /* The following definitions come from utils/passwd_util.c  */
 
@@ -5589,6 +5596,41 @@ struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
                               void *private_data);
 int fncall_recv(struct tevent_req *req, int *perr);
 
+struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
+                                       struct tevent_context *ev,
+                                       const struct sockaddr_storage *addr,
+                                       uint16_t port,
+                                       const char *called_name,
+                                       int called_type,
+                                       const char *calling_name,
+                                       int calling_type);
+NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
+                             uint16_t *ret_port);
+NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
+                        const char *called_name, int called_type,
+                        const char *calling_name, int calling_type,
+                        int *pfd, uint16_t *ret_port);
+
+struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
+                                           struct tevent_context *ev,
+                                           const struct sockaddr_storage *addrs,
+                                           const char **called_names,
+                                           int *called_types,
+                                           const char **calling_names,
+                                           int *calling_types,
+                                           size_t num_addrs, uint16_t port);
+NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
+                                 size_t *chosen_index, uint16_t *chosen_port);
+NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
+                            const char **called_names,
+                            int *called_types,
+                            const char **calling_names,
+                            int *calling_types,
+                            size_t num_addrs,
+                            uint16_t port,
+                            int *pfd, size_t *chosen_index,
+                            uint16_t *chosen_port);
+
 /* The following definitions come from rpc_server/srv_samr_nt.c */
 NTSTATUS access_check_object( struct security_descriptor *psd, struct security_token *token,
                              enum sec_privilege needed_priv_1, enum sec_privilege needed_priv_2,