Use shared header file for character sets, remove old definitions from samba3 smb.h.
[amitay/samba.git] / source3 / include / smb.h
index 96cd3b7d853ce63a2e03ee5b7002c514b2ec243a..59c3c32346de3ff5f71a7c101b7b1dce3274846d 100644 (file)
@@ -149,8 +149,6 @@ typedef union unid_t {
  * smb_ucs2_t is *always* in little endian format.
  */
 
-typedef uint16 smb_ucs2_t;
-
 #ifdef WORDS_BIGENDIAN
 #define UCS2_SHIFT 8
 #else
@@ -167,10 +165,6 @@ typedef uint16 smb_ucs2_t;
 #define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\
                                ((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest))
 
-/* Large data type for manipulating uint32 unicode codepoints */
-typedef uint32 codepoint_t;
-#define INVALID_CODEPOINT ((codepoint_t)-1)
-
 /* pipe string names */
 #define PIPE_LANMAN   "\\PIPE\\LANMAN"
 
@@ -758,18 +752,19 @@ Offset  Data                      length.
 16     uint32 private_options  4
 20     uint32 time sec         4
 24     uint32 time usec        4
-28     SMB_DEV_T dev           8 bytes.
-36     SMB_INO_T inode         8 bytes
-44     unsigned long file_id   4 bytes
-48     uint32 uid              4 bytes
-52     uint16 flags            2 bytes
-54
+28     uint64 dev              8 bytes
+36     uint64 inode            8 bytes
+44     uint64 extid            8 bytes
+52     unsigned long file_id   4 bytes
+56     uint32 uid              4 bytes
+60     uint16 flags            2 bytes
+62
 
 */
 #ifdef CLUSTER_SUPPORT
-#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 58
+#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 66
 #else
-#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 54
+#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 62
 #endif
 
 struct share_mode_lock {
@@ -1620,48 +1615,43 @@ enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K};
 #define BATCH_OPLOCK_TYPE(lck) ((lck) & (unsigned int)BATCH_OPLOCK)
 #define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)LEVEL_II_OPLOCK|(unsigned int)FAKE_LEVEL_II_OPLOCK))
 
-struct inform_level2_message {
-       SMB_DEV_T dev;
-       SMB_INO_T inode;
-       uint16 mid;
-       unsigned long target_file_id;
-       unsigned long source_file_id;
-};
-
 /* kernel_oplock_message definition.
 
 struct kernel_oplock_message {
-       SMB_DEV_T dev;
-       SMB_INO_T inode;
+       uint64_t dev;
+       uint64_t inode;
+       unit64_t extid;
        unsigned long file_id;
 };
 
 Offset  Data                  length.
-0     SMB_DEV_T dev           8 bytes.
-8     SMB_INO_T inode         8 bytes
-16    unsigned long file_id   4 bytes
-20
+0     uint64_t dev            8 bytes
+8     uint64_t inode          8 bytes
+16    uint64_t extid          8 bytes
+24    unsigned long file_id   4 bytes
+28
 
 */
-#define MSG_SMB_KERNEL_BREAK_SIZE 20
+#define MSG_SMB_KERNEL_BREAK_SIZE 28
 
 /* file_renamed_message definition.
 
 struct file_renamed_message {
-       SMB_DEV_T dev;
-       SMB_INO_T inode;
+       uint64_t dev;
+       uint64_t inode;
        char names[1]; A variable area containing sharepath and filename.
 };
 
 Offset  Data                   length.
-0      SMB_DEV_T dev           8 bytes.
-8      SMB_INO_T inode         8 bytes
-16     char [] name            zero terminated namelen bytes
-minimum length == 18.
+0      uint64_t dev            8 bytes
+8      uint64_t inode          8 bytes
+16      unit64_t extid          8 bytes
+24     char [] name            zero terminated namelen bytes
+minimum length == 24.
 
 */
 
-#define MSG_FILE_RENAMED_MIN_SIZE 16
+#define MSG_FILE_RENAMED_MIN_SIZE 24
 
 /*
  * On the wire return values for oplock types.
@@ -1689,12 +1679,39 @@ enum smbd_capability {
     LEASE_CAPABILITY
 };
 
+/*
+ * Kernel oplocks capability flags.
+ */
+
+/* Level 2 oplocks are supported natively by kernel oplocks. */
+#define KOPLOCKS_LEVEL2_SUPPORTED              0x1
+
+/* The kernel notifies deferred openers when they can retry the open. */
+#define KOPLOCKS_DEFERRED_OPEN_NOTIFICATION    0x2
+
+/* The kernel notifies smbds when an oplock break times out. */
+#define KOPLOCKS_TIMEOUT_NOTIFICATION          0x4
+
+/* The kernel notifies smbds when an oplock is broken. */
+#define KOPLOCKS_OPLOCK_BROKEN_NOTIFICATION    0x8
+
 struct kernel_oplocks_ops;
 struct kernel_oplocks {
        const struct kernel_oplocks_ops *ops;
+       uint32_t flags;
        void *private_data;
 };
 
+enum level2_contention_type {
+       LEVEL2_CONTEND_ALLOC_SHRINK,
+       LEVEL2_CONTEND_ALLOC_GROW,
+       LEVEL2_CONTEND_SET_FILE_LEN,
+       LEVEL2_CONTEND_FILL_SPARSE,
+       LEVEL2_CONTEND_WRITE,
+       LEVEL2_CONTEND_WINDOWS_BRL,
+       LEVEL2_CONTEND_POSIX_BRL
+};
+
 /* if a kernel does support oplocks then a structure of the following
    typee is used to describe how to interact with the kernel */
 struct kernel_oplocks_ops {
@@ -1702,6 +1719,10 @@ struct kernel_oplocks_ops {
                           files_struct *fsp, int oplock_type);
        void (*release_oplock)(struct kernel_oplocks *ctx,
                               files_struct *fsp, int oplock_type);
+       void (*contend_level2_oplocks_begin)(files_struct *fsp,
+                                            enum level2_contention_type type);
+       void (*contend_level2_oplocks_end)(files_struct *fsp,
+                                          enum level2_contention_type type);
 };
 
 #include "smb_macros.h"
@@ -1804,18 +1825,6 @@ struct unix_error_map {
 
 #define SAFE_NETBIOS_CHARS ". -_"
 
-/* generic iconv conversion structure */
-typedef struct _smb_iconv_t {
-       size_t (*direct)(void *cd, const char **inbuf, size_t *inbytesleft,
-                        char **outbuf, size_t *outbytesleft);
-       size_t (*pull)(void *cd, const char **inbuf, size_t *inbytesleft,
-                      char **outbuf, size_t *outbytesleft);
-       size_t (*push)(void *cd, const char **inbuf, size_t *inbytesleft,
-                      char **outbuf, size_t *outbytesleft);
-       void *cd_direct, *cd_pull, *cd_push;
-       char *from_name, *to_name;
-} *smb_iconv_t;
-
 /* The maximum length of a trust account password.
    Used when we randomly create it, 15 char passwords
    exceed NT4's max password length */