1 #ifndef WINDOWS_FIREWALL_CLASS
2 #define WINDOWS_FIREWALL_CLASS
4 /*****************************************************************************\
6 * Name : windows firewall wrapper *
7 * Author : Chris Koeritz *
9 *******************************************************************************
10 * Copyright (c) 2009-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
20 #include <basis/astring.h>
22 class windows_firewall
25 // adds a firewall hole for an executable called "program_name" (which should
26 // be the full path) using a rule called "exception_name". the description
27 // for the firewall exception should be in "hole_description" (and it's only
28 // used on vista or server 2008 or later).
29 // in this and the other methods, a zero return indicates success. any other
30 // return indicates a failure.
31 static int poke_firewall_hole(const astring &program_name,
32 const astring &exception_name, const astring &hole_description);
34 // this version will open an exception for a port rather than a program.
35 static int poke_firewall_hole(int port_number,
36 const astring &exception_name, const astring &hole_description,
37 const astring &protocol);
39 // removes a previously poked firewall hole for an application.
40 static int remove_firewall_hole(const astring &program_name,
41 const astring &exception_name);
43 // removes a previously poked exception for a port.
44 static int remove_firewall_hole(int port_number,
45 const astring &exception_name, const astring &protocol);