param: move server role helpers into loadparm.h
[kai/samba-autobuild/.git] / lib / param / loadparm.h
1 /*
2    Unix SMB/CIFS implementation.
3
4    type definitions for loadparm
5
6    Copyright (C) Karl Auer 1993-1998
7
8    Largely re-written by Andrew Tridgell, September 1994
9
10    Copyright (C) Simo Sorce 2001
11    Copyright (C) Alexander Bokovoy 2002
12    Copyright (C) Stefan (metze) Metzmacher 2002
13    Copyright (C) Jim McDonough (jmcd@us.ibm.com)  2003.
14    Copyright (C) James Myers 2003 <myersjj@samba.org>
15
16    This program is free software; you can redistribute it and/or modify
17    it under the terms of the GNU General Public License as published by
18    the Free Software Foundation; either version 3 of the License, or
19    (at your option) any later version.
20
21    This program is distributed in the hope that it will be useful,
22    but WITHOUT ANY WARRANTY; without even the implied warranty of
23    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24    GNU General Public License for more details.
25
26    You should have received a copy of the GNU General Public License
27    along with this program.  If not, see <http://www.gnu.org/licenses/>.
28 */
29
30 #include "../lib/util/parmlist.h"
31
32 /* the following are used by loadparm for option lists */
33 typedef enum {
34         P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
35         P_STRING,P_USTRING,P_ENUM,P_BYTES,P_CMDLIST,P_SEP
36 } parm_type;
37
38 typedef enum {
39         P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE
40 } parm_class;
41
42 struct enum_list {
43         int value;
44         const char *name;
45 };
46
47 struct loadparm_service;
48 struct loadparm_context;
49
50 struct parm_struct {
51         const char *label;
52         parm_type type;
53         parm_class p_class;
54         offset_t offset;
55         bool (*special)(struct loadparm_context *lpcfg_ctx,
56                         int snum, const char *, char **);
57         const struct enum_list *enum_list;
58         unsigned flags;
59         union {
60                 bool bvalue;
61                 int ivalue;
62                 char *svalue;
63                 char cvalue;
64                 char **lvalue;
65         } def;
66 };
67
68 /* The following flags are used in SWAT */
69 #define FLAG_BASIC      0x0001 /* Display only in BASIC view */
70 #define FLAG_SHARE      0x0002 /* file sharing options */
71 #define FLAG_PRINT      0x0004 /* printing options */
72 #define FLAG_GLOBAL     0x0008 /* local options that should be globally settable in SWAT */
73 #define FLAG_WIZARD     0x0010 /* Parameters that the wizard will operate on */
74 #define FLAG_ADVANCED   0x0020 /* Parameters that will be visible in advanced view */
75 #define FLAG_DEVELOPER  0x0040 /* No longer used */
76 #define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
77 #define FLAG_HIDE       0x2000 /* options that should be hidden in SWAT */
78 #define FLAG_META       0x8000 /* A meta directive - not a real parameter */
79 #define FLAG_CMDLINE    0x10000 /* option has been overridden */
80 #define FLAG_DEFAULT    0x20000 /* this option was a default */
81
82 /* This defines the section name in the configuration file that will
83    refer to the special "printers" service */
84 #ifndef PRINTERS_NAME
85 #define PRINTERS_NAME "printers"
86 #endif
87
88 /* This defines the section name in the configuration file that will
89    refer to the special "homes" service */
90 #ifndef HOMES_NAME
91 #define HOMES_NAME "homes"
92 #endif
93
94 /* This defines the section name in the configuration file that will contain */
95 /* global parameters - that is, parameters relating to the whole server, not */
96 /* just services. This name is then reserved, and may not be used as a       */
97 /* a service name. It will default to "global" if not defined here.          */
98 #ifndef GLOBAL_NAME
99 #define GLOBAL_NAME "global"
100 #define GLOBAL_NAME2 "globals"
101 #endif
102
103 /* The default workgroup - usually overridden in smb.conf */
104 #ifndef DEFAULT_WORKGROUP
105 #define DEFAULT_WORKGROUP "WORKGROUP"
106 #endif
107
108 /*
109  * Default passwd chat script.
110  */
111 #ifndef DEFAULT_PASSWD_CHAT
112 #define DEFAULT_PASSWD_CHAT "*new*password* %n\\n *new*password* %n\\n *changed*"
113 #endif
114
115 /* Max number of jobs per print queue. */
116 #ifndef PRINT_MAX_JOBID
117 #define PRINT_MAX_JOBID 10000
118 #endif
119
120 #define LOADPARM_EXTRA_LOCALS                                           \
121         bool valid;                                                     \
122         int usershare;                                                  \
123         struct timespec usershare_last_mod;                             \
124         int iMaxPrintJobs;                                              \
125         char *szCopy;                                                   \
126         char *szService;                                                \
127         char *szInclude;                                                \
128         bool bWidelinks;                                                \
129         int bAvailable;                                                 \
130         struct parmlist_entry *param_opt;                               \
131         struct bitmap *copymap;                                         \
132         char dummy[3];          /* for alignment */
133
134 #include "lib/param/param_local.h"
135
136 const char* server_role_str(uint32_t role);
137 int lp_find_server_role(int server_role, int security, bool domain_logons, bool domain_master);
138 int lp_find_security(int server_role, int security);