svcctl: add svcctl_ConfigLevel from samba 3.
[amitay/samba.git] / source3 / include / rpc_svcctl.h
1 /* 
2    Unix SMB/CIFS implementation.
3    SMB parameters and setup
4    Copyright (C) Andrew Tridgell              1992-1997,
5    Copyright (C) Gerald (Jerry) Carter        2005
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */
22 #define _RPC_SVCCTL_H 
23
24 /* svcctl pipe */
25
26 #define SVCCTL_CLOSE_SERVICE                    0x00
27 #define SVCCTL_CONTROL_SERVICE                  0x01
28 #define SVCCTL_LOCK_SERVICE_DB                  0x03
29 #define SVCCTL_QUERY_SERVICE_SEC                0x04
30 #define SVCCTL_SET_SERVICE_SEC                  0x05
31 #define SVCCTL_QUERY_STATUS                     0x06
32 #define SVCCTL_UNLOCK_SERVICE_DB                0x08
33 #define SVCCTL_ENUM_DEPENDENT_SERVICES_W        0x0d
34 #define SVCCTL_ENUM_SERVICES_STATUS_W           0x0e
35 #define SVCCTL_OPEN_SCMANAGER_W                 0x0f
36 #define SVCCTL_OPEN_SERVICE_W                   0x10
37 #define SVCCTL_QUERY_SERVICE_CONFIG_W           0x11
38 #define SVCCTL_START_SERVICE_W                  0x13
39 #define SVCCTL_GET_DISPLAY_NAME                 0x14
40 #define SVCCTL_QUERY_SERVICE_CONFIG2_W          0x27
41 #define SVCCTL_QUERY_SERVICE_STATUSEX_W         0x28
42
43 /* ANSI versions not implemented currently 
44 #define SVCCTL_ENUM_SERVICES_STATUS_A           0x0e
45 #define SVCCTL_OPEN_SCMANAGER_A                 0x1b
46 */
47
48 /* SERVER_STATUS - type */
49
50 #define SVCCTL_TYPE_WIN32               0x00000030
51 #define SVCCTL_TYPE_DRIVER              0x0000000f
52
53 /* SERVER_STATUS - state */
54 #define SVCCTL_STATE_ACTIVE             0x00000001
55 #define SVCCTL_STATE_INACTIVE           0x00000002
56 #define SVCCTL_STATE_ALL                ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE )
57
58 /* SERVER_STATUS - CurrentState */
59
60 #define SVCCTL_STATE_UNKNOWN            0x00000000      /* only used internally to smbd */
61 #define SVCCTL_STOPPED                  0x00000001
62 #define SVCCTL_START_PENDING            0x00000002
63 #define SVCCTL_STOP_PENDING             0x00000003
64 #define SVCCTL_RUNNING                  0x00000004
65 #define SVCCTL_CONTINUE_PENDING         0x00000005
66 #define SVCCTL_PAUSE_PENDING            0x00000006
67 #define SVCCTL_PAUSED                   0x00000007
68
69 /* SERVER_STATUS - ControlAccepted */
70
71 #define SVCCTL_ACCEPT_NONE                      0x00000000
72 #define SVCCTL_ACCEPT_STOP                      0x00000001
73 #define SVCCTL_ACCEPT_PAUSE_CONTINUE            0x00000002
74 #define SVCCTL_ACCEPT_SHUTDOWN                  0x00000004
75 #define SVCCTL_ACCEPT_PARAMCHANGE               0x00000008
76 #define SVCCTL_ACCEPT_NETBINDCHANGE             0x00000010
77 #define SVCCTL_ACCEPT_HARDWAREPROFILECHANGE     0x00000020
78 #define SVCCTL_ACCEPT_POWEREVENT                0x00000040
79
80 /* SERVER_STATUS - ControlAccepted */
81 #define SVCCTL_SVC_ERROR_IGNORE                 0x00000000
82 #define SVCCTL_SVC_ERROR_NORMAL                 0x00000001
83 #define SVCCTL_SVC_ERROR_CRITICAL               0x00000002
84 #define SVCCTL_SVC_ERROR_SEVERE                 0x00000003
85
86
87 /* Service Config - values for ServiceType field*/
88
89 #define SVCCTL_KERNEL_DRVR                         0x00000001  /* doubtful we'll have these */
90 #define SVCCTL_FILE_SYSTEM_DRVR                    0x00000002  
91 #define SVCCTL_WIN32_OWN_PROC                      0x00000010
92 #define SVCCTL_WIN32_SHARED_PROC                   0x00000020
93 #define SVCCTL_WIN32_INTERACTIVE                   0x00000100 
94
95 /* Service Config - values for StartType field */
96 #define SVCCTL_BOOT_START                          0x00000000
97 #define SVCCTL_SYSTEM_START                        0x00000001
98 #define SVCCTL_AUTO_START                          0x00000002
99 #define SVCCTL_DEMAND_START                        0x00000003
100 #define SVCCTL_DISABLED                            0x00000004
101
102 #define SVC_HANDLE_IS_SCM                       0x0000001
103 #define SVC_HANDLE_IS_SERVICE                   0x0000002
104 #define SVC_HANDLE_IS_DBLOCK                    0x0000003
105
106 /* utility structures for RPCs */
107
108 /*
109  * "struct SERVICE_STATUS" comes from librpc/gen_ndr/svcctl.h
110  */
111
112 typedef struct SERVICE_STATUS SERVICE_STATUS;
113
114 typedef struct {
115         SERVICE_STATUS status;
116         uint32 process_id;
117         uint32 service_flags;
118 } SERVICE_STATUS_PROCESS;
119
120
121 typedef struct {
122         UNISTR servicename;
123         UNISTR displayname;
124         SERVICE_STATUS status;
125 } ENUM_SERVICES_STATUS;
126
127 typedef struct {
128         uint32 unknown; 
129         UNISTR description;
130 } SERVICE_DESCRIPTION;
131
132 typedef struct {
133         uint32 type;
134         uint32 delay;
135 } SC_ACTION;
136
137 typedef struct {
138         uint32 reset_period;
139         UNISTR2 *rebootmsg;     /* i have no idea if these are UNISTR2's.  I can't get a good trace */
140         UNISTR2 *command;
141         uint32  num_actions;
142         SC_ACTION *actions;
143 } SERVICE_FAILURE_ACTIONS;
144
145
146 /* rpc structures */
147
148 /**************************/
149
150 typedef struct {
151         POLICY_HND handle;
152         uint32 type;
153         uint32 state;
154         uint32 buffer_size;
155         uint32 *resume;
156 } SVCCTL_Q_ENUM_SERVICES_STATUS;
157
158 typedef struct {
159         RPC_BUFFER buffer;
160         uint32 needed;
161         uint32 returned;
162         uint32 *resume;
163         WERROR status;
164 } SVCCTL_R_ENUM_SERVICES_STATUS;
165
166 /**************************/
167
168 typedef struct {
169         POLICY_HND handle;
170         uint32 level;
171         uint32 buffer_size;
172 } SVCCTL_Q_QUERY_SERVICE_CONFIG2;
173
174 typedef struct {
175         RPC_BUFFER buffer;
176         uint32 needed;
177         WERROR status;
178 } SVCCTL_R_QUERY_SERVICE_CONFIG2;
179
180
181 /**************************/
182
183 typedef struct {
184         POLICY_HND handle;
185         uint32 level;
186         uint32 buffer_size;
187 } SVCCTL_Q_QUERY_SERVICE_STATUSEX;
188
189 typedef struct {
190         RPC_BUFFER buffer;
191         uint32 needed;
192         WERROR status;
193 } SVCCTL_R_QUERY_SERVICE_STATUSEX;
194
195 #endif /* _RPC_SVCCTL_H */
196