SystemInterface Library Functions
You can configure the firewall during runtime using SystemInterface library functions.
Functions of the SystemInterface Library
The following functions of the SystemInterface library can be used to configure the firewall non-persistent during runtime:
Function |
Description |
---|---|
Open incoming firewall port during runtime. |
|
Close incoming firewall port during runtime. |
|
Load port rules from configuration file. If the file does not exist, a new configuration file with a default set of rules is created. If the configuration file is invalid, the default set of rules is loaded dynamically (non-persistent). |
|
Activate / deactivate the firewall. |
IF xFirstRun THEN
(* Allow incoming TCP traffic on port 8000 from anywhere to PLC ('me') *)
FC_OpenIncomingFirewallPort(i_etProtocol := ET_Protocol.TCP, i_uiPort := 8000, i_sSource := 'any', i_sDestination := 'me');
(* Remove the previously given permission *)
FC_CloseIncomingFirewallPort(i_etProtocol := ET_Protocol.TCP, i_uiPort := 8000, i_sSource := 'any', i_sDestination := 'me');
(* Load the default rules into the firewall *)
FC_LoadDefaultPortRules();
IF 0 <> FC_FirewallIsActive() THEN
(* Enable the firewall *)
FC_FirewallSetActive(i_xActive := TRUE);
END_IF
xFirstRun := FALSE;
END_IF