MongoDB  2.7.0
ntservice.h
1 /* Copyright 2009 10gen Inc.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
23 #pragma once
24 
25 #ifdef _WIN32
26 
27 #include <string>
28 #include <vector>
29 
30 #include "mongo/platform/compiler.h"
31 
32 namespace mongo {
33 
34  namespace optionenvironment {
35  class OptionSection;
36  class Environment;
37  } // namespace optionenvironment
38 
39  namespace moe = mongo::optionenvironment;
40 
41 namespace ntservice {
42  struct NtServiceDefaultStrings {
43  const wchar_t* serviceName;
44  const wchar_t* displayName;
45  const wchar_t* serviceDescription;
46  };
47 
48  typedef void (*ServiceCallback)(void);
49 
62  void configureService(
63  ServiceCallback serviceCallback,
64  const moe::Environment& params,
65  const NtServiceDefaultStrings& defaultStrings,
66  const std::vector<std::string>& disallowedOptions,
67  const std::vector<std::string>& argv);
68 
69  bool shouldStartService();
70 
79  std::vector<std::string> constructServiceArgv(const std::vector<std::string>& inputArgv);
80 
84  MONGO_COMPILER_NORETURN void startService();
85 
86  bool reportStatus(DWORD reportState, DWORD waitHint = 0);
87 
88 } // namespace ntservice
89 } // namespace mongo
90 
91 #endif // defined(_WIN32)
An Environment is a map of values that can be validated according to a set of registered constraints...
Definition: environment.h:98