xorp

FirewallEntry Class Reference

Firewall Table Entry. More...

#include <firewall_entry.hh>

List of all members.

Public Types

enum  Action {
  ACTION_MIN = 0x00, ACTION_ANY = 0x00, ACTION_NONE = 0x01, ACTION_PASS = 0x02,
  ACTION_DROP = 0x03, ACTION_REJECT = 0x04, ACTION_MAX = 0x05, ACTION_INVALID = 0xff
}
enum  {
  RULE_NUMBER_DEFAULT = 0, IP_PROTOCOL_MIN = 0, IP_PROTOCOL_MAX = 255, IP_PROTOCOL_ANY = 0,
  PORT_MIN = 0, PORT_MAX = 65535
}

Public Member Functions

 FirewallEntry (int family)
 FirewallEntry (uint32_t rule_number, const string &ifname, const string &vifname, const IPvXNet &src_network, const IPvXNet &dst_network, uint8_t ip_protocol, uint16_t src_port_begin, uint16_t src_port_end, uint16_t dst_port_begin, uint16_t dst_port_end, FirewallEntry::Action action)
bool is_ipv4 () const
 Test whether this is an IPv4 entry.
bool is_ipv6 () const
 Test whether this is an IPv6 entry.
uint32_t rule_number () const
const string & ifname () const
const string & vifname () const
const IPvXNetsrc_network () const
const IPvXNetdst_network () const
uint8_t ip_protocol () const
uint32_t src_port_begin () const
uint32_t src_port_end () const
uint32_t dst_port_begin () const
uint32_t dst_port_end () const
FirewallEntry::Action action () const
void zero ()
 Reset all members.
bool match (const FirewallEntry &other) const
 Comparison function for an exact match with the entry.
string str () const

Static Public Member Functions

static string action2str (FirewallEntry::Action action)
 Convert firewall entry action value to a string representation.
static FirewallEntry::Action str2action (const string &name)
 Convert string representation to a firewall entry action value.

Private Attributes

uint32_t _rule_number
string _ifname
string _vifname
IPvXNet _src_network
IPvXNet _dst_network
uint8_t _ip_protocol
uint16_t _src_port_begin
uint32_t _src_port_end
uint32_t _dst_port_begin
uint32_t _dst_port_end
FirewallEntry::Action _action

Detailed Description

Firewall Table Entry.

Representation of a firewall table entry.


Member Function Documentation

string FirewallEntry::action2str ( FirewallEntry::Action  action) [static]

Convert firewall entry action value to a string representation.

Parameters:
actionthe action to convert.
Returns:
the string representation of the action value.
bool FirewallEntry::is_ipv4 ( ) const [inline]

Test whether this is an IPv4 entry.

Returns:
true if this is an IPv4 entry, otherwise false.
bool FirewallEntry::is_ipv6 ( ) const [inline]

Test whether this is an IPv6 entry.

Returns:
true if this is an IPv6 entry, otherwise false.
bool FirewallEntry::match ( const FirewallEntry other) const [inline]

Comparison function for an exact match with the entry.

Note that the action is masked off in the comparison, and only the rule-match part of the tuple is evaluated.

Returns:
true if the rule-match portion of the entry is matched, otherwise false.
string FirewallEntry::str ( ) const [inline]
Returns:
a string representation of the entry.
FirewallEntry::Action FirewallEntry::str2action ( const string &  name) [static]

Convert string representation to a firewall entry action value.

Parameters:
namethe name of the action. It is one of the following keywords: "none", "pass", "drop", "reject".
Returns:
the firewall entry action value if the name is valid, otherwise ACTION_INVALID.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations