s3-libsmb: rename cli_query_secdesc() to cli_query_secdesc_old()
[kai/samba.git] / source3 / libsmb / proto.h
index e135abe319a168c022c5e666101ff112715c09a6..7b2dc8c5831f4d52b0d58dc84b2bf58fe4ef91bb 100644 (file)
@@ -1,6 +1,14 @@
 /*
    Unix SMB/CIFS implementation.
 
+   Copyright (C) Andrew Bartlett 2001-2003
+   Copyright (C) Andrew Tridgell 1994-1998,2000-2001
+   Copyright (C) Gerald (Jerry) Carter 2004
+   Copyright (C) Jelmer Vernooij 2003
+   Copyright (C) Jeremy Allison 2001-2009,2011
+   Copyright (C) Stefan Metzmacher 2003,2009
+   Copyright (C) Volker Lendecke 2011
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
@@ -18,6 +26,8 @@
 #ifndef _LIBSMB_PROTO_H_
 #define _LIBSMB_PROTO_H_
 
+#include "ads.h"
+
 /* The following definitions come from libsmb/cliconnect.c  */
 
 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
@@ -66,26 +76,22 @@ struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
                                    struct event_context *ev,
                                    struct cli_state *cli);
 NTSTATUS cli_negprot_recv(struct tevent_req *req);
-bool cli_session_request(struct cli_state *cli,
-                        struct nmb_name *calling, struct nmb_name *called);
-NTSTATUS cli_connect(struct cli_state *cli,
-               const char *host,
-               struct sockaddr_storage *dest_ss);
+NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss,
+                       uint16_t port, int name_type, const char *myname,
+                       int signing_state, struct cli_state **pcli);
 NTSTATUS cli_start_connection(struct cli_state **output_cli,
                              const char *my_name,
                              const char *dest_host,
-                             struct sockaddr_storage *dest_ss, int port,
+                             const struct sockaddr_storage *dest_ss, int port,
                              int signing_state, int flags);
 NTSTATUS cli_full_connection(struct cli_state **output_cli,
                             const char *my_name,
                             const char *dest_host,
-                            struct sockaddr_storage *dest_ss, int port,
+                            const struct sockaddr_storage *dest_ss, int port,
                             const char *service, const char *service_type,
                             const char *user, const char *domain,
                             const char *password, int flags,
                             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,
                      const char *service, const char *pass, const char *dev,
                      uint16 *max_xmit, uint16 *tid);
@@ -107,7 +113,7 @@ NTSTATUS cli_cm_force_encryption(struct cli_state *c,
                        const char *password,
                        const char *domain,
                        const char *sharename);
-struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
+NTSTATUS cli_cm_open(TALLOC_CTX *ctx,
                                struct cli_state *referring_cli,
                                const char *server,
                                const char *share,
@@ -116,8 +122,9 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
                                bool force_encrypt,
                                int max_protocol,
                                int port,
-                               int name_type);
-void cli_cm_display(const struct cli_state *c);
+                               int name_type,
+                               struct cli_state **pcli);
+void cli_cm_display(struct cli_state *c);
 struct client_dfs_referral;
 NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
                        struct cli_state *cli,
@@ -125,13 +132,13 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
                        struct client_dfs_referral **refs,
                        size_t *num_refs,
                        size_t *consumed);
-bool cli_resolve_path(TALLOC_CTX *ctx,
-                       const char *mountpt,
-                       const struct user_auth_info *dfs_auth_info,
-                       struct cli_state *rootcli,
-                       const char *path,
-                       struct cli_state **targetcli,
-                       char **pp_targetpath);
+NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
+                         const char *mountpt,
+                         const struct user_auth_info *dfs_auth_info,
+                         struct cli_state *rootcli,
+                         const char *path,
+                         struct cli_state **targetcli,
+                         char **pp_targetpath);
 
 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
                        struct cli_state *cli,
@@ -147,26 +154,30 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
 
 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
-void cli_set_port(struct cli_state *cli, int port);
-bool cli_state_seqnum_persistent(struct cli_state *cli,
-                                uint16_t mid);
-bool cli_state_seqnum_remove(struct cli_state *cli,
-                            uint16_t mid);
-bool cli_receive_smb(struct cli_state *cli);
-bool cli_send_smb(struct cli_state *cli);
 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
-void cli_setup_packet(struct cli_state *cli);
-void cli_setup_bcc(struct cli_state *cli, void *p);
 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
-struct cli_state *cli_initialise(void);
-struct cli_state *cli_initialise_ex(int signing_state);
+struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
+                                  int fd,
+                                  const char *remote_name,
+                                  int signing_state);
+bool cli_state_encryption_on(struct cli_state *cli);
 void cli_nt_pipes_close(struct cli_state *cli);
 void cli_shutdown(struct cli_state *cli);
 void cli_sockopt(struct cli_state *cli, const char *options);
+const struct sockaddr_storage *cli_state_local_sockaddr(struct cli_state *cli);
+const struct sockaddr_storage *cli_state_remote_sockaddr(struct cli_state *cli);
+const char *cli_state_remote_name(struct cli_state *cli);
+uint16_t cli_state_get_vc_num(struct cli_state *cli);
 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
+uint16_t cli_getpid(struct cli_state *cli);
+bool cli_state_has_tcon(struct cli_state *cli);
+uint16_t cli_state_get_tid(struct cli_state *cli);
+uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);
+uint16_t cli_state_get_uid(struct cli_state *cli);
+uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
                                 struct cli_state *cli, uint16_t num_echos,
@@ -192,10 +203,8 @@ int cli_errno(struct cli_state *cli);
 bool cli_is_error(struct cli_state *cli);
 bool cli_is_nt_error(struct cli_state *cli);
 bool cli_is_dos_error(struct cli_state *cli);
-NTSTATUS cli_get_nt_error(struct cli_state *cli);
-void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
-void cli_reset_error(struct cli_state *cli);
 bool cli_state_is_connected(struct cli_state *cli);
+void cli_state_disconnect(struct cli_state *cli);
 
 /* The following definitions come from libsmb/clifile.c  */
 
@@ -358,6 +367,11 @@ uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
                            size_t str_len, size_t *pconverted_size);
 uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
                              const uint8_t *bytes, size_t num_bytes);
+uint8_t *trans2_bytes_push_str(uint8_t *buf, bool ucs2,
+                              const char *str, size_t str_len,
+                              size_t *pconverted_size);
+uint8_t *trans2_bytes_push_bytes(uint8_t *buf,
+                                const uint8_t *bytes, size_t num_bytes);
 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
                                   struct event_context *ev,
                                   struct cli_state *cli, const char *fname,
@@ -387,8 +401,8 @@ NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
                      uint32_t offset, uint32_t len,
                      int timeout, unsigned char locktype);
-bool cli_lock(struct cli_state *cli, uint16_t fnum,
-             uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
+NTSTATUS cli_lock32(struct cli_state *cli, uint16_t fnum, uint32_t offset,
+                   uint32_t len, int timeout, enum brl_type lock_type);
 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
                                 struct event_context *ev,
                                 struct cli_state *cli,
@@ -397,8 +411,9 @@ struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
                                 uint64_t len);
 NTSTATUS cli_unlock_recv(struct tevent_req *req);
 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
-bool cli_lock64(struct cli_state *cli, uint16_t fnum,
-               uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
+NTSTATUS cli_lock64(struct cli_state *cli, uint16_t fnum,
+                   uint64_t offset, uint64_t len, int timeout,
+                   enum brl_type lock_type);
 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
                                 struct event_context *ev,
                                 struct cli_state *cli,
@@ -562,6 +577,35 @@ NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                         uint32_t *pnum_changes,
                         struct notify_change **pchanges);
 
+struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx,
+                                          struct event_context *ev,
+                                          struct cli_state *cli,
+                                          const char *fname,
+                                          uint32_t CreatFlags,
+                                          uint32_t DesiredAccess,
+                                          uint32_t FileAttributes,
+                                          uint32_t ShareAccess,
+                                          uint32_t CreateDisposition,
+                                          uint32_t CreateOptions,
+                                          uint8_t SecurityFlags,
+                                          struct security_descriptor *secdesc,
+                                          struct ea_struct *eas,
+                                          int num_eas);
+NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, uint16_t *fnum);
+NTSTATUS cli_nttrans_create(struct cli_state *cli,
+                           const char *fname,
+                           uint32_t CreatFlags,
+                           uint32_t DesiredAccess,
+                           uint32_t FileAttributes,
+                           uint32_t ShareAccess,
+                           uint32_t CreateDisposition,
+                           uint32_t CreateOptions,
+                           uint8_t SecurityFlags,
+                           struct security_descriptor *secdesc,
+                           struct ea_struct *eas,
+                           int num_eas,
+                           uint16_t *pfid);
+
 /* The following definitions come from libsmb/clifsinfo.c  */
 
 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
@@ -586,7 +630,8 @@ struct tevent_req *cli_get_fs_attr_info_send(TALLOC_CTX *mem_ctx,
                                             struct cli_state *cli);
 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,
+NTSTATUS cli_get_fs_volume_info(struct cli_state *cli,
+                               TALLOC_CTX *mem_ctx, char **volume_name,
                                uint32 *pserial_number, time_t *pdate);
 NTSTATUS cli_get_fs_full_size_info(struct cli_state *cli,
                                   uint64_t *total_allocation_units,
@@ -653,9 +698,6 @@ struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
                                       struct cli_state *cli,
                                       uint16_t fnum, uint8_t level);
 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
-NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
-void cli_oplock_handler(struct cli_state *cli,
-                       NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
 
 /* The following definitions come from libsmb/cliprint.c  */
 
@@ -704,8 +746,9 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
                  off_t start_offset, SMB_OFF_T size, size_t window_size,
                  NTSTATUS (*sink)(char *buf, size_t n, void *priv),
                  void *priv, SMB_OFF_T *received);
-ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
-                off_t offset, size_t size);
+NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum,
+                 char *buf, off_t offset, size_t size,
+                 size_t *nread);
 NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
                      off_t offset, size_t size1, size_t *ptotal);
 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
@@ -742,24 +785,13 @@ NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
 
 /* The following definitions come from libsmb/clisecdesc.c  */
 
-struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
+struct security_descriptor *cli_query_secdesc_old(struct cli_state *cli, uint16_t fnum,
                            TALLOC_CTX *mem_ctx);
 NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
                         struct security_descriptor *sd);
 
 /* The following definitions come from libsmb/clistr.c  */
 
-size_t clistr_push_fn(struct cli_state *cli,
-                       void *dest,
-                       const char *src,
-                       int dest_len,
-                       int flags);
-size_t clistr_pull_fn(const char *inbuf,
-                       char *dest,
-                       const void *src,
-                       int dest_len,
-                       int src_len,
-                       int flags);
 size_t clistr_pull_talloc(TALLOC_CTX *ctx,
                          const char *base,
                          uint16_t flags2,
@@ -767,7 +799,6 @@ size_t clistr_pull_talloc(TALLOC_CTX *ctx,
                          const void *src,
                          int src_len,
                          int flags);
-size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
 
 /* The following definitions come from libsmb/clitrans.c  */
 
@@ -814,8 +845,6 @@ void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
 bool cli_encryption_on(struct cli_state *cli);
 void cli_free_encryption_context(struct cli_state *cli);
 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
-NTSTATUS cli_decrypt_message(struct cli_state *cli);
-NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
 
 /* The following definitions come from libsmb/clisigning.c  */
 
@@ -830,4 +859,36 @@ bool client_is_signing_allowed(struct cli_state *cli);
 bool client_is_signing_mandatory(struct cli_state *cli);
 void cli_set_signing_negotiated(struct cli_state *cli);
 
+/* The following definitions come from libsmb/reparse_symlink.c  */
+
+bool symlink_reparse_buffer_marshall(
+       const char *substitute, const char *printname, uint32_t flags,
+       TALLOC_CTX *mem_ctx, uint8_t **pdst, size_t *pdstlen);
+bool symlink_reparse_buffer_parse(
+       const uint8_t *src, size_t srclen, TALLOC_CTX *mem_ctx,
+       char **psubstitute_name, char **pprint_name, uint32_t *pflags);
+
+/* The following definitions come from libsmb/clisymlink.c  */
+
+struct tevent_req *cli_symlink_send(TALLOC_CTX *mem_ctx,
+                                   struct tevent_context *ev,
+                                   struct cli_state *cli,
+                                   const char *oldpath,
+                                   const char *newpath,
+                                   uint32_t flags);
+NTSTATUS cli_symlink_recv(struct tevent_req *req);
+NTSTATUS cli_symlink(struct cli_state *cli, const char *oldname,
+                    const char *newname, uint32_t flags);
+
+struct tevent_req *cli_readlink_send(TALLOC_CTX *mem_ctx,
+                                    struct tevent_context *ev,
+                                    struct cli_state *cli,
+                                    const char *fname);
+NTSTATUS cli_readlink_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                          char **psubstitute_name, char **pprint_name,
+                          uint32_t *pflags);
+NTSTATUS cli_readlink(struct cli_state *cli, const char *fname,
+                      TALLOC_CTX *mem_ctx, char **psubstitute_name,
+                     char **pprint_name, uint32_t *pflags);
+
 #endif /* _LIBSMB_PROTO_H_ */