MLIB
Loading...
Searching...
No Matches
firewall.h
Go to the documentation of this file.
1/*
2 Copyright (c) Mircea Neacsu (2014-2025) Licensed under MIT License.
3 This file is part of MLIB project. See LICENSE file for full license terms.
4*/
5
7#pragma once
8
9#if __has_include("defs.h")
10#include "defs.h"
11#endif
12
13#include "safe_winsock.h"
14
15#include <netfw.h>
16#include "errorcode.h"
17
18namespace mlib {
19
21class firewall
22{
23public:
24 firewall ();
25 ~firewall ();
26
27 bool is_enabled ();
28 bool is_port_enabled (int portnum, bool tcp);
29 bool has_port (int portnum, bool tcp);
30 bool has_app (const char* appname);
31 erc add_app (const char* appname, const char* filename);
32 erc add_port (int portnum, bool tcp, const char* name);
33 erc set_port (int portnum, bool tcp, bool enable);
34
35 static errfac& Errors ();
36 static void Errors (errfac& facility);
37
38private:
39 INetFwMgr* fwmgr;
40 INetFwPolicy* fwpolicy;
41 INetFwProfile* fwprofile;
42};
43
44extern errfac* fw_errptr;
45
46}; // namespace mlib
objects returned as a function result or thrown directly.
Definition errorcode.h:73
An error facility routes a group of errors handled in a similar manner.
Definition errorcode.h:141
Definition of mlib::erc and mlib::errfac classes.