1 /*
2  *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef WEBRTC_BASE_WINFIREWALL_H_
12 #define WEBRTC_BASE_WINFIREWALL_H_
13 
14 #ifndef _HRESULT_DEFINED
15 #define _HRESULT_DEFINED
16 typedef long HRESULT;  // Can't forward declare typedef, but don't need all win
17 #endif // !_HRESULT_DEFINED
18 
19 struct INetFwMgr;
20 struct INetFwPolicy;
21 struct INetFwProfile;
22 
23 namespace rtc {
24 
25 //////////////////////////////////////////////////////////////////////
26 // WinFirewall
27 //////////////////////////////////////////////////////////////////////
28 
29 class WinFirewall {
30  public:
31   WinFirewall();
32   ~WinFirewall();
33 
34   bool Initialize(HRESULT* result);
35   void Shutdown();
36 
37   bool Enabled() const;
38   bool QueryAuthorized(const char* filename, bool* authorized) const;
39   bool QueryAuthorizedW(const wchar_t* filename, bool* authorized) const;
40 
41   bool AddApplication(const char* filename, const char* friendly_name,
42                       bool authorized, HRESULT* result);
43   bool AddApplicationW(const wchar_t* filename, const wchar_t* friendly_name,
44                        bool authorized, HRESULT* result);
45 
46  private:
47   INetFwMgr* mgr_;
48   INetFwPolicy* policy_;
49   INetFwProfile* profile_;
50 };
51 
52 //////////////////////////////////////////////////////////////////////
53 
54 }  // namespace rtc
55 
56 #endif  // WEBRTC_BASE_WINFIREWALL_H_
57