Exemplo n.º 1
0
 protected FirewallRule(FireWallChains chain, string networkInterface, Protocols protocol, ICMPTypes?icmpType, IPAddress source, IPAddress sourceNetworkMask,
                        FirewallPort sourcePort, IPAddress destination, IPAddress destinationNetworkMask, FirewallPort destinationPort,
                        ConnectionStateTypes[] connectionStates, string note)
 {
     _chain                  = chain;
     _interface              = networkInterface;
     _protocol               = protocol;
     _sourceIP               = source;
     _sourceNetworkMask      = sourceNetworkMask;
     _sourcePort             = sourcePort;
     _destinationIP          = destination;
     _destinationNetworkMask = destinationNetworkMask;
     _destinationPort        = destinationPort;
     _connectionStates       = connectionStates;
     _icmpType               = icmpType;
     _note = note;
     if (protocol != Protocols.icmp && _icmpType.HasValue)
     {
         throw new Exception("Unable to produce a firewall rule with an ICMP type unless ICMP is the protocol specified.");
     }
     if (protocol == Protocols.udp && _connectionStates != null)
     {
         throw new Exception("Unable to produce a firewall rule with udp protocol type and Connection States specified since udp is stateless.");
     }
 }
Exemplo n.º 2
0
 protected FirewallRule(FireWallChains chain, string networkInterface, Protocols protocol, ICMPTypes? icmpType, IPAddress source, IPAddress sourceNetworkMask,
     FirewallPort sourcePort, IPAddress destination, IPAddress destinationNetworkMask, FirewallPort destinationPort,
     ConnectionStateTypes[] connectionStates,string note)
 {
     _chain = chain;
     _interface = networkInterface;
     _protocol = protocol;
     _sourceIP = source;
     _sourceNetworkMask = sourceNetworkMask;
     _sourcePort = sourcePort;
     _destinationIP = destination;
     _destinationNetworkMask = destinationNetworkMask;
     _destinationPort = destinationPort;
     _connectionStates = connectionStates;
     _icmpType = icmpType;
     _note = note;
     if (protocol != Protocols.icmp && _icmpType.HasValue)
         throw new Exception("Unable to produce a firewall rule with an ICMP type unless ICMP is the protocol specified.");
     if (protocol == Protocols.udp && _connectionStates != null)
         throw new Exception("Unable to produce a firewall rule with udp protocol type and Connection States specified since udp is stateless.");
 }