| 1 |
/* eurephiafw.h -- Firewall interface struct typedef |
| 2 |
* |
| 3 |
* GPLv2 only - Copyright (C) 2008 - 2012 |
| 4 |
* David Sommerseth <[email protected]> |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU General Public License |
| 8 |
* as published by the Free Software Foundation; version 2 |
| 9 |
* of the License. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 |
* |
| 20 |
*/ |
| 21 |
|
| 22 |
/** |
| 23 |
* @file eurephiafw_struct.h |
| 24 |
* @author David Sommerseth <[email protected]> |
| 25 |
* @date 2008-11-05 |
| 26 |
* |
| 27 |
* @brief Declaraion of the constants and structs the firewall interface uses |
| 28 |
* |
| 29 |
*/ |
| 30 |
|
| 31 |
|
| 32 |
#ifndef EUREPHIAFW_STRUCT_H_ |
| 33 |
#define EUREPHIAFW_STRUCT_H_ |
| 34 |
|
| 35 |
#include <mqueue.h> |
| 36 |
#include <semaphore.h> |
| 37 |
|
| 38 |
#include <eurephia_values_struct.h> |
| 39 |
|
| 40 |
/** |
| 41 |
* Important variables for the firewall updater process. They are sent to the |
| 42 |
* firewall process during the process forking. |
| 43 |
*/ |
| 44 |
typedef struct { |
| 45 |
mqd_t msgq; /**< MQ descriptor */ |
| 46 |
sem_t *semp_worker; /**< semaphore descriptor for the firewall process */ |
| 47 |
sem_t *semp_master; /**< semaphore descriptor for the main openvpn process */ |
| 48 |
char *fw_command; /**< string (char *) with full path to the firewall update command */ |
| 49 |
void *ctx; /**< A "shadow" eurephiaCTX used for allowing shared logging */ |
| 50 |
} efw_threaddata; |
| 51 |
|
| 52 |
/** |
| 53 |
* Definition of the eurephiaFWINTF struct |
| 54 |
*/ |
| 55 |
typedef struct { |
| 56 |
efw_threaddata thrdata; /**< Process related information */ |
| 57 |
pid_t fwproc_pid; /**< Contains the PID of the firewall process */ |
| 58 |
|
| 59 |
char *fwblacklist; /**< Which fw dest. blacklisted IP addr should be registered into */ |
| 60 |
char *fwblacklist_sendto; /**< Which fw dest. blacklisted IP addr should forward their hits to */ |
| 61 |
eurephiaVALUES *blacklisted; /**< Contains all IP addresses we have blacklisted */ |
| 62 |
} eurephiaFWINTF; |
| 63 |
|
| 64 |
|
| 65 |
/** |
| 66 |
* Valid firewall modes to be passed over the POSIX MQ queue |
| 67 |
*/ |
| 68 |
typedef enum {fwADD, /**< Add a new VPN client to the firewall VPN chain */ |
| 69 |
fwDELETE, /**< Delete an existing VPN client from the firewall VPN chain */ |
| 70 |
fwBLACKLIST, /**< Blacklist an IP address */ |
| 71 |
fwFLUSH, /**< Flush the firewall VPN chain */ |
| 72 |
fwINITIALISE, /**< Initialiase the firewall VPN chain */ |
| 73 |
fwSHUTDOWN, /**< Initialiase the firewall VPN chain */ |
| 74 |
} eFWmode; |
| 75 |
|
| 76 |
|
| 77 |
/** |
| 78 |
* Update request for the firewall plug-in |
| 79 |
*/ |
| 80 |
typedef struct { |
| 81 |
eFWmode mode; /**< Defines what the update will do with the firewall (mandatory) */ |
| 82 |
char ipaddress[36]; /**< IP address to include (used by fwADD,fwDELETE and fwBLACKLIST) */ |
| 83 |
char macaddress[19]; /**< VPN MAC address (used by fwADD and fwDELETE) */ |
| 84 |
char rule_destination[66]; /**< Where this new rule will be inserted (mandatory) */ |
| 85 |
char goto_destination[66]; /**< Where matching rules should go next (used by fwBLACKLIST) */ |
| 86 |
} eFWupdateRequest; |
| 87 |
|
| 88 |
#endif /* !EUREPHIAFW_STRUCT_H_ */ |