add_rule/5 is an Erlang function exported by "age_gateway" module. Creates a new rule in the firewall table. Each rule has to have a unique Port number and fields. Please take into consideration that you cannot add two rules for different protocols on the same port! The connection options can be defined only once during the rule creation. To change them you have to delete and create a new firewall rule. Let's demystify the list with firewall rules. Each rule is prohibitive by default. To change that behavior you can add one or more permissive exceptions, as follows: •incoming - Allows incoming data packets; •outgoing - Allows outgoing data packets; •sustain - The Gateway will keep alive all connections associated to the rule's port; •server - The Gateway will create a local server to accept new inbound connections. This term can be used together with sustain term if you want to create a new server automatically; •{connect, Server} - The Gateway will try to establish connection with a remote Server (designated by Host or IP). Furthermore, you can add more then one term of that kind, and the Gateway will try to establish as many connections as they are specified. This term can be used together with sustain term if you want to create client links automatically; •{owner, PID} - The Gateway will attach the specified process ID to any connection produced from the current rule, inbound or outbound. In case the term is missing, the Gateway will associate the Agent's PID as the default owner of the connections. You should use this option only if you want to create custom services. Some practice with the code sample below: > This code commands the Gateway to create sustainable local TCP/IP server at port 5538 which is capable to maintain incoming and outgoing connections. In terms of AGE's Gateway, "sustainable server" means that the Gateway will try to restore the server in case of failure. You can disable and enable this rule at any time by port 5538. |
|
|