1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.handler.ipfilter;
17
18 import java.net.InetAddress;
19 import java.net.UnknownHostException;
20
21
22 public class IpV4SubnetFilterRule extends IpV4Subnet implements IpFilterRule {
23
24 private boolean isAllowRule = true;
25
26
27
28
29
30
31 public IpV4SubnetFilterRule(boolean allow) {
32 isAllowRule = allow;
33 }
34
35
36 public IpV4SubnetFilterRule(boolean allow, InetAddress inetAddress, int cidrNetMask) {
37 super(inetAddress, cidrNetMask);
38 isAllowRule = allow;
39 }
40
41
42 public IpV4SubnetFilterRule(boolean allow, InetAddress inetAddress, String netMask) {
43 super(inetAddress, netMask);
44 isAllowRule = allow;
45 }
46
47
48 public IpV4SubnetFilterRule(boolean allow, String netAddress) throws UnknownHostException {
49 super(netAddress);
50 isAllowRule = allow;
51 }
52
53 public boolean isAllowRule() {
54 return isAllowRule;
55 }
56
57 public boolean isDenyRule() {
58 return !isAllowRule;
59 }
60
61 }