Add in the ability to close or open multiple ports at once, by passing

in a QVector<PortInfo> to the OpenPort and ClosePort functions,
This commit is contained in:
Luke De Mouy
2016-01-12 02:37:07 -07:00
parent aec5ce9aeb
commit 43a4274565
2 changed files with 30 additions and 0 deletions

View File

@@ -84,12 +84,30 @@ void Firewall::OpenPort(int port, QString type)
SaveOpenPorts();
}
void Firewall::OpenPort(QVector<PortInfo> ports)
{
for(PortInfo port : ports)
{
openports.append(port);
}
SaveOpenPorts();
}
void Firewall::ClosePort(int port, QString type)
{
openports.removeAll(LookUpPort(port,type));
SaveOpenPorts();
}
void Firewall::ClosePort(QVector<PortInfo> ports)
{
for(PortInfo port : ports)
{
openports.removeAll(port);
}
SaveOpenPorts();
}
QVector<PortInfo> Firewall::OpenPorts()
{
return openports;

View File

@@ -54,6 +54,12 @@ public:
*/
void OpenPort(int number, QString type);
/**
* @brief Opens a set of ports
* @param ports a vector of ports to open
*/
void OpenPort(QVector<PortInfo> ports);
/**
* @brief ClosePort closes a port
* @param number a port number between 0 and 2^16 -1
@@ -61,6 +67,12 @@ public:
*/
void ClosePort(int number, QString type);
/**
* @brief ClosePort closes a set of ports
* @param ports a vector of ports to close
*/
void ClosePort(QVector<PortInfo> ports);
/**
* @brief finds a list of ports that are open gets the info about them
* and returns them