net.floodlightcontroller.firewall
Class FirewallRule
java.lang.Object
net.floodlightcontroller.firewall.FirewallRule
- All Implemented Interfaces:
- java.lang.Comparable<FirewallRule>
public class FirewallRule
- extends java.lang.Object
- implements java.lang.Comparable<FirewallRule>
Method Summary |
int |
compareTo(FirewallRule rule)
Comparison method for Collections.sort method |
int |
genID()
Generates a unique ID for the instance |
int |
hashCode()
|
boolean |
isSameAs(FirewallRule r)
Determines if this instance matches an existing rule instance |
boolean |
matchesFlow(long switchDpid,
int inPort,
Ethernet packet,
NonWildcardsPair nonWildcards)
Matches this rule to a given flow - incoming packet |
protected boolean |
matchIPAddress(int rulePrefix,
int ruleBits,
int packetAddress)
Determines if rule's CIDR address matches IP address of the packet |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
ruleid
public int ruleid
dpid
public long dpid
in_port
public short in_port
dl_src
public long dl_src
dl_dst
public long dl_dst
dl_type
public short dl_type
nw_src_prefix
public int nw_src_prefix
nw_src_maskbits
public int nw_src_maskbits
nw_dst_prefix
public int nw_dst_prefix
nw_dst_maskbits
public int nw_dst_maskbits
nw_proto
public short nw_proto
tp_src
public short tp_src
tp_dst
public short tp_dst
wildcard_dpid
public boolean wildcard_dpid
wildcard_in_port
public boolean wildcard_in_port
wildcard_dl_src
public boolean wildcard_dl_src
wildcard_dl_dst
public boolean wildcard_dl_dst
wildcard_dl_type
public boolean wildcard_dl_type
wildcard_nw_src
public boolean wildcard_nw_src
wildcard_nw_dst
public boolean wildcard_nw_dst
wildcard_nw_proto
public boolean wildcard_nw_proto
wildcard_tp_src
public boolean wildcard_tp_src
wildcard_tp_dst
public boolean wildcard_tp_dst
priority
public int priority
action
public FirewallRule.FirewallAction action
FirewallRule
public FirewallRule()
genID
public int genID()
- Generates a unique ID for the instance
- Returns:
- int representing the unique id
compareTo
public int compareTo(FirewallRule rule)
- Comparison method for Collections.sort method
- Specified by:
compareTo
in interface java.lang.Comparable<FirewallRule>
- Parameters:
rule
- the rule to compare with
- Returns:
- number representing the result of comparison 0 if equal negative
if less than 'rule' greater than zero if greater priority rule
than 'rule'
isSameAs
public boolean isSameAs(FirewallRule r)
- Determines if this instance matches an existing rule instance
- Parameters:
r
- : the FirewallRule instance to compare with
- Returns:
- boolean: true if a match is found
matchesFlow
public boolean matchesFlow(long switchDpid,
int inPort,
Ethernet packet,
NonWildcardsPair nonWildcards)
- Matches this rule to a given flow - incoming packet
- Parameters:
switchDpid
- the Id of the connected switchinPort
- the switch port where the packet originated frompacket
- the Ethernet packet that arrives at the switchwildcards
- the pair of wildcards (allow and deny) given by Firewall
module that is used by the Firewall module's matchWithRule
method to derive wildcards for the decision to be taken
- Returns:
- true if the rule matches the given packet-in, false otherwise
matchIPAddress
protected boolean matchIPAddress(int rulePrefix,
int ruleBits,
int packetAddress)
- Determines if rule's CIDR address matches IP address of the packet
- Parameters:
rulePrefix
- prefix part of the CIDR addressruleBits
- the size of mask of the CIDR addresspacketAddress
- the IP address of the incoming packet to match with
- Returns:
- true if CIDR address matches the packet's IP address, false
otherwise
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object