| 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 3 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, see <http://www.gnu.org/licenses/>. | 
|---|
| 20 | */ | 
|---|
| 21 |  | 
|---|
| 22 | #ifndef _SHARE_H | 
|---|
| 23 | #define _SHARE_H | 
|---|
| 24 |  | 
|---|
| 25 | struct share_ops; | 
|---|
| 26 |  | 
|---|
| 27 | struct share_context { | 
|---|
| 28 | const struct share_ops *ops; | 
|---|
| 29 | void *priv_data; | 
|---|
| 30 | }; | 
|---|
| 31 |  | 
|---|
| 32 | struct share_config { | 
|---|
| 33 | const char *name; | 
|---|
| 34 | struct share_context *ctx; | 
|---|
| 35 | void *opaque; | 
|---|
| 36 | }; | 
|---|
| 37 |  | 
|---|
| 38 | enum share_info_type { | 
|---|
| 39 | SHARE_INFO_STRING, | 
|---|
| 40 | SHARE_INFO_INT, | 
|---|
| 41 | SHARE_INFO_BLOB | 
|---|
| 42 | }; | 
|---|
| 43 |  | 
|---|
| 44 | struct share_info { | 
|---|
| 45 | enum share_info_type type; | 
|---|
| 46 | const char *name; | 
|---|
| 47 | void *value; | 
|---|
| 48 | }; | 
|---|
| 49 |  | 
|---|
| 50 | struct tevent_context; | 
|---|
| 51 |  | 
|---|
| 52 | struct share_ops { | 
|---|
| 53 | const char *name; | 
|---|
| 54 | NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct tevent_context *ev_ctx, | 
|---|
| 55 | struct loadparm_context *lp_ctx, | 
|---|
| 56 | struct share_context **); | 
|---|
| 57 | const char *(*string_option)(struct share_config *, const char *, const char *); | 
|---|
| 58 | int (*int_option)(struct share_config *, const char *, int); | 
|---|
| 59 | bool (*bool_option)(struct share_config *, const char *, bool); | 
|---|
| 60 | const char **(*string_list_option)(TALLOC_CTX *, struct share_config *, const char *); | 
|---|
| 61 | NTSTATUS (*list_all)(TALLOC_CTX *, struct share_context *, int *, const char ***); | 
|---|
| 62 | NTSTATUS (*get_config)(TALLOC_CTX *, struct share_context *, const char *, struct share_config **); | 
|---|
| 63 | NTSTATUS (*create)(struct share_context *, const char *, struct share_info *, int); | 
|---|
| 64 | NTSTATUS (*set)(struct share_context *, const char *, struct share_info *, int); | 
|---|
| 65 | NTSTATUS (*remove)(struct share_context *, const char *); | 
|---|
| 66 | }; | 
|---|
| 67 |  | 
|---|
| 68 | struct loadparm_context; | 
|---|
| 69 |  | 
|---|
| 70 | #include "param/share_proto.h" | 
|---|
| 71 |  | 
|---|
| 72 | /* list of shares options */ | 
|---|
| 73 |  | 
|---|
| 74 | #define SHARE_NAME              "name" | 
|---|
| 75 | #define SHARE_PATH              "path" | 
|---|
| 76 | #define SHARE_COMMENT           "comment" | 
|---|
| 77 | #define SHARE_PASSWORD          "password" | 
|---|
| 78 | #define SHARE_HOSTS_ALLOW       "hosts-allow" | 
|---|
| 79 | #define SHARE_HOSTS_DENY        "hosts-deny" | 
|---|
| 80 | #define SHARE_NTVFS_HANDLER     "ntvfs-handler" | 
|---|
| 81 | #define SHARE_TYPE              "type" | 
|---|
| 82 | #define SHARE_VOLUME            "volume" | 
|---|
| 83 | #define SHARE_CSC_POLICY        "csc-policy" | 
|---|
| 84 | #define SHARE_AVAILABLE         "available" | 
|---|
| 85 | #define SHARE_BROWSEABLE        "browseable" | 
|---|
| 86 | #define SHARE_MAX_CONNECTIONS   "max-connections" | 
|---|
| 87 |  | 
|---|
| 88 | /* I'd like to see the following options go away | 
|---|
| 89 | * and always use EAs and SECDESCs */ | 
|---|
| 90 | #define SHARE_READONLY          "readonly" | 
|---|
| 91 | #define SHARE_MAP_SYSTEM        "map-system" | 
|---|
| 92 | #define SHARE_MAP_HIDDEN        "map-hidden" | 
|---|
| 93 | #define SHARE_MAP_ARCHIVE       "map-archive" | 
|---|
| 94 |  | 
|---|
| 95 | #define SHARE_STRICT_LOCKING    "strict-locking" | 
|---|
| 96 | #define SHARE_OPLOCKS           "oplocks" | 
|---|
| 97 | #define SHARE_STRICT_SYNC       "strict-sync" | 
|---|
| 98 | #define SHARE_MSDFS_ROOT        "msdfs-root" | 
|---|
| 99 | #define SHARE_CI_FILESYSTEM     "ci-filesystem" | 
|---|
| 100 |  | 
|---|
| 101 | #define SHARE_DIR_MASK             "directory mask" | 
|---|
| 102 | #define SHARE_CREATE_MASK          "create mask" | 
|---|
| 103 | #define SHARE_FORCE_CREATE_MODE    "force create mode" | 
|---|
| 104 | #define SHARE_FORCE_DIR_MODE       "force directory mode" | 
|---|
| 105 |  | 
|---|
| 106 | /* defaults */ | 
|---|
| 107 |  | 
|---|
| 108 | #define SHARE_HOST_ALLOW_DEFAULT        NULL | 
|---|
| 109 | #define SHARE_HOST_DENY_DEFAULT         NULL | 
|---|
| 110 | #define SHARE_VOLUME_DEFAULT            NULL | 
|---|
| 111 | #define SHARE_TYPE_DEFAULT              "DISK" | 
|---|
| 112 | #define SHARE_CSC_POLICY_DEFAULT        0 | 
|---|
| 113 | #define SHARE_AVAILABLE_DEFAULT         true | 
|---|
| 114 | #define SHARE_BROWSEABLE_DEFAULT        true | 
|---|
| 115 | #define SHARE_MAX_CONNECTIONS_DEFAULT   0 | 
|---|
| 116 |  | 
|---|
| 117 | #define SHARE_DIR_MASK_DEFAULT                   0755 | 
|---|
| 118 | #define SHARE_CREATE_MASK_DEFAULT                0744 | 
|---|
| 119 | #define SHARE_FORCE_CREATE_MODE_DEFAULT          0000 | 
|---|
| 120 | #define SHARE_FORCE_DIR_MODE_DEFAULT             0000 | 
|---|
| 121 |  | 
|---|
| 122 |  | 
|---|
| 123 |  | 
|---|
| 124 | /* I'd like to see the following options go away | 
|---|
| 125 | * and always use EAs and SECDESCs */ | 
|---|
| 126 | #define SHARE_READONLY_DEFAULT          true | 
|---|
| 127 | #define SHARE_MAP_SYSTEM_DEFAULT        false | 
|---|
| 128 | #define SHARE_MAP_HIDDEN_DEFAULT        false | 
|---|
| 129 | #define SHARE_MAP_ARCHIVE_DEFAULT       true | 
|---|
| 130 |  | 
|---|
| 131 | #define SHARE_STRICT_LOCKING_DEFAULT    true | 
|---|
| 132 | #define SHARE_OPLOCKS_DEFAULT   true | 
|---|
| 133 | #define SHARE_STRICT_SYNC_DEFAULT       false | 
|---|
| 134 | #define SHARE_MSDFS_ROOT_DEFAULT        false | 
|---|
| 135 | #define SHARE_CI_FILESYSTEM_DEFAULT     false | 
|---|
| 136 |  | 
|---|
| 137 | #endif /* _SHARE_H */ | 
|---|