94b81818678f778bb33c528d8366518b20e250bb
[samba.git] / source4 / param / share.h
1 /* 
2    Unix SMB/CIFS implementation.
3    
4    Modular services configuration
5    
6    Copyright (C) Simo Sorce     2006
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #ifndef _SHARE_H
24 #define _SHARE_H
25
26 struct share_ops;
27
28 struct share_context {
29         const struct share_ops *ops;
30         void *priv_data;
31 };
32
33 struct share_config {
34         const char *name;
35         struct share_context *ctx;
36         void *opaque;
37 };
38
39 enum share_info_type {
40         SHARE_INFO_STRING,
41         SHARE_INFO_INT,
42         SHARE_INFO_BLOB
43 };
44
45 struct share_info {
46         enum share_info_type type;
47         const char *name;
48         void *value;
49 };
50
51 struct share_ops {
52         const char *name;
53         NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct share_context **);
54         const char *(*string_option)(struct share_config *, const char *, const char *);
55         int (*int_option)(struct share_config *, const char *, int);
56         BOOL (*bool_option)(struct share_config *, const char *, BOOL);
57         const char **(*string_list_option)(TALLOC_CTX *, struct share_config *, const char *);
58         NTSTATUS (*list_all)(TALLOC_CTX *, struct share_context *, int *, const char ***);
59         NTSTATUS (*get_config)(TALLOC_CTX *, struct share_context *, const char *, struct share_config **);
60         NTSTATUS (*create)(struct share_context *, const char *, struct share_info *, int);
61         NTSTATUS (*set)(struct share_context *, const char *, struct share_info *, int);
62         NTSTATUS (*remove)(struct share_context *, const char *);
63 };
64
65 #include "param/share_proto.h"
66
67 /* list of shares options */
68
69 #define SHARE_NAME              "name"
70 #define SHARE_PATH              "path"
71 #define SHARE_COMMENT           "comment"
72 #define SHARE_PASSWORD          "password"
73 #define SHARE_HOSTS_ALLOW       "hosts-allow"
74 #define SHARE_HOSTS_DENY        "hosts-deny"
75 #define SHARE_NTVFS_HANDLER     "ntvfs-handler"
76 #define SHARE_TYPE              "type"
77 #define SHARE_VOLUME            "volume"
78 #define SHARE_CSC_POLICY        "csc-policy"
79 #define SHARE_AVAILABLE         "available"
80 #define SHARE_BROWSEABLE        "browseable"
81 #define SHARE_MAX_CONNECTIONS   "max-connections"
82
83 /* I'd like to see the following options go away
84  * and always use EAs and SECDESCs */
85 #define SHARE_READONLY          "readonly"
86 #define SHARE_MAP_SYSTEM        "map-system"
87 #define SHARE_MAP_HIDDEN        "map-hidden"
88 #define SHARE_MAP_ARCHIVE       "map-archive"
89
90 #define SHARE_STRICT_LOCKING    "strict-locking"
91 #define SHARE_STRICT_SYNC       "strict-sync"
92 #define SHARE_MSDFS_ROOT        "msdfs-root"
93 #define SHARE_CI_FILESYSTEM     "ci-filesystem"
94
95 #define SHARE_DIR_MASK             "directory mask"
96 #define SHARE_CREATE_MASK          "create mask"
97 #define SHARE_FORCE_CREATE_MODE    "force create mode"
98 #define SHARE_FORCE_DIR_MODE       "force directory mode"
99
100 /* defaults */
101
102 #define SHARE_HOST_ALLOW_DEFAULT        NULL
103 #define SHARE_HOST_DENY_DEFAULT         NULL
104 #define SHARE_VOLUME_DEFAULT            NULL
105 #define SHARE_TYPE_DEFAULT              "DISK"  
106 #define SHARE_CSC_POLICY_DEFAULT        0
107 #define SHARE_AVAILABLE_DEFAULT         True
108 #define SHARE_BROWSEABLE_DEFAULT        True
109 #define SHARE_MAX_CONNECTIONS_DEFAULT   0
110
111 #define SHARE_DIR_MASK_DEFAULT                   0755
112 #define SHARE_CREATE_MASK_DEFAULT                0744
113 #define SHARE_FORCE_CREATE_MODE_DEFAULT          0000
114 #define SHARE_FORCE_DIR_MODE_DEFAULT             0000
115
116
117
118 /* I'd like to see the following options go away
119  * and always use EAs and SECDESCs */
120 #define SHARE_READONLY_DEFAULT          True
121 #define SHARE_MAP_SYSTEM_DEFAULT        False
122 #define SHARE_MAP_HIDDEN_DEFAULT        False
123 #define SHARE_MAP_ARCHIVE_DEFAULT       True
124
125 #define SHARE_STRICT_LOCKING_DEFAULT    True
126 #define SHARE_STRICT_SYNC_DEFAULT       False
127 #define SHARE_MSDFS_ROOT_DEFAULT        False
128 #define SHARE_CI_FILESYSTEM_DEFAULT     False
129
130 #endif /* _SHARE_H */