r18986: Add some more GPO download helper functions.
[sfrench/samba-autobuild/.git] / source / include / gpo.h
1 /* 
2  *  Unix SMB/CIFS implementation.
3  *  Group Policy Object Support
4  *  Copyright (C) Guenther Deschner 2005
5  *  
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20
21
22 enum GPO_LINK_TYPE {
23         GP_LINK_UNKOWN  = 0,
24         GP_LINK_MACHINE = 1,
25         GP_LINK_SITE    = 2,
26         GP_LINK_DOMAIN  = 3,
27         GP_LINK_OU      = 4
28 };
29
30 /* GPO_OPTIONS */
31 #define GPO_FLAG_DISABLE        0x00000001
32 #define GPO_FLAG_FORCE          0x00000002
33
34 /* GPO_LIST_FLAGS */
35 #define GPO_LIST_FLAG_MACHINE   0x00000001
36 #define GPO_LIST_FLAG_SITEONLY  0x00000002
37
38 #define GPO_VERSION_USER(x) (x >> 16)
39 #define GPO_VERSION_MACHINE(x) (x & 0xffff)
40
41 struct GROUP_POLICY_OBJECT {
42         uint32 options; /* GPFLAGS_* */ 
43         uint32 version;
44         const char *ds_path;
45         const char *file_sys_path;
46         const char *display_name;
47         const char *name;
48         const char *link;
49         uint32 link_type; /* GPO_LINK_TYPE */
50         const char *user_extensions;
51         const char *machine_extensions;
52         struct GROUP_POLICY_OBJECT *next, *prev;
53 };
54
55 /* the following is seen on the DS (see adssearch.pl for details) */
56
57 /* the type field in a 'gPLink', the same as GPO_FLAG ? */
58 #define GPO_LINK_OPT_NONE       0x00000000
59 #define GPO_LINK_OPT_DISABLED   0x00000001
60 #define GPO_LINK_OPT_ENFORCED   0x00000002
61
62 /* GPO_LINK_OPT_ENFORCED takes precedence over GPOPTIONS_BLOCK_INHERITANCE */
63
64 /* 'gPOptions', maybe a bitmask as well */
65 enum GPO_INHERIT {
66         GPOPTIONS_INHERIT               = 0,
67         GPOPTIONS_BLOCK_INHERITANCE     = 1
68 };
69
70 /* 'flags' in a 'groupPolicyContainer' object */
71 #define GPFLAGS_ALL_ENABLED                     0x00000000
72 #define GPFLAGS_USER_SETTINGS_DISABLED          0x00000001
73 #define GPFLAGS_MACHINE_SETTINGS_DISABLED       0x00000002
74 #define GPFLAGS_ALL_DISABLED (GPFLAGS_USER_SETTINGS_DISABLED | \
75                               GPFLAGS_MACHINE_SETTINGS_DISABLED)
76
77 struct GP_LINK {
78         const char *gp_link;    /* raw link name */
79         uint32 gp_opts;         /* inheritance options GPO_INHERIT */
80         uint32 num_links;       /* number of links */
81         char **link_names;      /* array of parsed link names */
82         uint32 *link_opts;      /* array of parsed link opts GPO_LINK_OPT_* */
83 };
84
85 struct GP_EXT {
86         const char *gp_extension;       /* raw extension name */
87         uint32 num_exts;
88         char **extensions;
89         char **extensions_guid;
90         char **snapins;
91         char **snapins_guid;
92 };
93
94 #define GPO_CACHE_DIR "gpo_cache"
95 #define GPT_INI "GPT.INI"