EpcTools
An event based multi-threaded C++ development framework.
Classes | Public Types | Public Member Functions | List of all members
EIpFilterRule Class Reference

Represents an IPFilterRule as defined by RFC 6733. More...

#include <eip.h>

Classes

class  Established
 Represents an IPFilterRule "established" option. More...
 
class  Fragment
 Represents an IPFilterRule "frag" option. More...
 
class  IcmpTypes
 Represents an IPFilterRule "icmptypes" option. More...
 
class  IpOptions
 Represents an IPFilterRule "ipoptions" option. More...
 
class  Option
 The base class for IPFilterRule options. More...
 
class  Port
 Represents a single port or a range of ports. More...
 
class  Setup
 Represents an IPFilterRule "setup" option. More...
 
class  TcpFlags
 Represents an IPFilterRule "tcpflags" option. More...
 
class  TcpOptions
 Represents an IPFilterRule "tcpoptions" option. More...
 

Public Types

enum  Action { Action::Undefined, Action::Permit, Action::Deny }
 
enum  Direction { Direction::Undefined, Direction::In, Direction::Out }
 
enum  OptionType {
  OptionType::Undefined, OptionType::frag, OptionType::ipoptions, OptionType::tcpoptions,
  OptionType::established, OptionType::setup, OptionType::tcpflags, OptionType::icmptypes
}
 
enum  Protocol {
  Protocol::Undefined = -1, Protocol::ProtoMin = 0, Protocol::IP = 0, Protocol::HOPOPTS = 0,
  Protocol::ICMP = 1, Protocol::IGMP = 2, Protocol::GGP = 3, Protocol::IPV4 = 4,
  Protocol::IPIP = 4, Protocol::TCP = 6, Protocol::ST = 7, Protocol::EGP = 8,
  Protocol::PIGP = 9, Protocol::RCCMON = 10, Protocol::NVPII = 11, Protocol::PUP = 12,
  Protocol::ARGUS = 13, Protocol::EMCON = 14, Protocol::XNET = 15, Protocol::CHAOS = 16,
  Protocol::UDP = 17, Protocol::MUX = 18, Protocol::MEAS = 19, Protocol::HMP = 20,
  Protocol::PRM = 21, Protocol::IDP = 22, Protocol::TRUNK1 = 23, Protocol::TRUNK2 = 24,
  Protocol::LEAF1 = 25, Protocol::LEAF2 = 26, Protocol::RDP = 27, Protocol::IRTP = 28,
  Protocol::TP = 29, Protocol::BLT = 30, Protocol::NSP = 31, Protocol::INP = 32,
  Protocol::SEP = 33, Protocol::TPC = 34, Protocol::IDPR = 35, Protocol::XTP = 36,
  Protocol::DDP = 37, Protocol::CMTP = 38, Protocol::TPXX = 39, Protocol::IL = 40,
  Protocol::IPV6 = 41, Protocol::SDRP = 42, Protocol::ROUTING = 43, Protocol::FRAGMENT = 44,
  Protocol::IDRP = 45, Protocol::RSVP = 46, Protocol::GRE = 47, Protocol::MHRP = 48,
  Protocol::BHA = 49, Protocol::ESP = 50, Protocol::AH = 51, Protocol::INLSP = 52,
  Protocol::SWIPE = 53, Protocol::NHRP = 54, Protocol::ICMPV6 = 58, Protocol::NONE = 59,
  Protocol::DSTOPTS = 60, Protocol::AHIP = 61, Protocol::CFTP = 62, Protocol::HELLO = 63,
  Protocol::SATEXPAK = 64, Protocol::KRYPTOLAN = 65, Protocol::RVD = 66, Protocol::IPPC = 67,
  Protocol::ADFS = 68, Protocol::SATMON = 69, Protocol::VISA = 70, Protocol::IPCV = 71,
  Protocol::CPNX = 72, Protocol::CPHB = 73, Protocol::WSN = 74, Protocol::PVP = 75,
  Protocol::BRSATMON = 76, Protocol::ND = 77, Protocol::WBMON = 78, Protocol::WBEXPAK = 79,
  Protocol::EON = 80, Protocol::VMTP = 81, Protocol::SVMTP = 82, Protocol::VINES = 83,
  Protocol::TTP = 84, Protocol::IGP = 85, Protocol::DGP = 86, Protocol::TCF = 87,
  Protocol::IGRP = 88, Protocol::OSPFIGP = 89, Protocol::SRPC = 90, Protocol::LARP = 91,
  Protocol::MTP = 92, Protocol::AX25 = 93, Protocol::IPEIP = 94, Protocol::MICP = 95,
  Protocol::SCCSP = 96, Protocol::ETHERIP = 97, Protocol::ENCAP = 98, Protocol::APES = 99,
  Protocol::GMTP = 100, Protocol::PIM = 103, Protocol::IPCOMP = 108, Protocol::PGM = 113,
  Protocol::SCTP = 132, Protocol::DIVERT = 254, Protocol::RAW = 255, Protocol::ProtoMax = 255
}
 
typedef std::vector< PortPortVec
 
typedef std::shared_ptr< OptionOptionPtr
 
typedef std::vector< OptionPtrOptionPtrVec
 

Public Member Functions

 EIpFilterRule ()
 Default constructor. More...
 
 EIpFilterRule (cpChar raw)
 Class constructor. More...
 
 EIpFilterRule (const EIpFilterRule &r)
 Copy constructor. More...
 
EIpFilterRuleoperator= (const EIpFilterRule &r)
 Assignment operator. More...
 
EIpFilterRuleoperator= (const std::string &r)
 Assignment operator. More...
 
EIpFilterRuleoperator= (cpStr r)
 Assignment operator. More...
 
const EStringoriginal () const
 The original IPFilterRule string. More...
 
const Action action () const
 Returns the action for this IPFilterRule. More...
 
const Direction direction () const
 Returns the direction for this IPFilterRule. More...
 
const Protocol protocol () const
 Returns the protocol for this IPFilterRule. More...
 
const EIpAddresssource () const
 Returns the source IP address. More...
 
const PortVecsourcePorts () const
 Returns the collection of source ports. More...
 
const EIpAddressdestination () const
 Returns the destination IP address. More...
 
const PortVecdestinationPorts () const
 Returns the collection of destination ports. More...
 
const OptionPtrVecoptions () const
 Returns a collection of options. More...
 
EIpFilterRulesetAction (Action action)
 Sets the action for this IPFilterRule. More...
 
EIpFilterRulesetDirection (Direction dir)
 Sets the direction for this IPFilterRule. More...
 
EIpFilterRulesetProtocol (Protocol proto)
 Sets the protocol for this IPFilterRule. More...
 
EIpFilterRulesetSource (const EIpAddress &src)
 Sets the source IP address for this IPFilterRule. More...
 
EIpFilterRulesetDestination (const EIpAddress &dst)
 Sets the destination IP address for this IPFilterRule. More...
 
EIpFilterRuleaddSourcePort (UShort first=0, UShort last=0)
 Sets the source port for this IPFilterRule. More...
 
EIpFilterRuleaddSourcePort (const Port &p)
 Sets the source port for this IPFilterRule. More...
 
EIpFilterRuleaddDestinationPort (UShort first=0, UShort last=0)
 Sets the destination port for this IPFilterRule. More...
 
EIpFilterRuleaddDestinationPort (const Port &p)
 Sets the destination port for this IPFilterRule. More...
 
EIpFilterRuleparse (cpChar raw)
 Parses the IPFilterRule definition. More...
 
EIpFilterRuleparse (const std::string &raw)
 Parses the IPFilterRule definition. More...
 
Void dump (cpStr padding="")
 Prints the contents of the current EIpFilterRule object to stdout. More...
 
EString final ()
 Reconstructs the string version of the IPFilterRule based on the parsed data. More...
 
EIpFilterRulesetOriginal (cpChar orig)
 Sets the original string value. More...
 
EIpFilterRulesetOriginal (const EString &orig)
 
EIpFilterRulesetOriginal (const std::string &orig)
 

Detailed Description

Represents an IPFilterRule as defined by RFC 6733.

Member Typedef Documentation

typedef std::shared_ptr<Option> EIpFilterRule::OptionPtr
typedef std::vector<OptionPtr> EIpFilterRule::OptionPtrVec
typedef std::vector<Port> EIpFilterRule::PortVec

Member Enumeration Documentation

enum EIpFilterRule::Action
strong
Enumerator
Undefined 
Permit 
Deny 
Enumerator
Undefined 
In 
Out 
Enumerator
Undefined 
frag 
ipoptions 
tcpoptions 
established 
setup 
tcpflags 
icmptypes 
Enumerator
Undefined 
ProtoMin 
IP 
HOPOPTS 
ICMP 
IGMP 
GGP 
IPV4 
IPIP 
TCP 
ST 
EGP 
PIGP 
RCCMON 
NVPII 
PUP 
ARGUS 
EMCON 
XNET 
CHAOS 
UDP 
MUX 
MEAS 
HMP 
PRM 
IDP 
TRUNK1 
TRUNK2 
LEAF1 
LEAF2 
RDP 
IRTP 
TP 
BLT 
NSP 
INP 
SEP 
TPC 
IDPR 
XTP 
DDP 
CMTP 
TPXX 
IL 
IPV6 
SDRP 
ROUTING 
FRAGMENT 
IDRP 
RSVP 
GRE 
MHRP 
BHA 
ESP 
AH 
INLSP 
SWIPE 
NHRP 
ICMPV6 
NONE 
DSTOPTS 
AHIP 
CFTP 
HELLO 
SATEXPAK 
KRYPTOLAN 
RVD 
IPPC 
ADFS 
SATMON 
VISA 
IPCV 
CPNX 
CPHB 
WSN 
PVP 
BRSATMON 
ND 
WBMON 
WBEXPAK 
EON 
VMTP 
SVMTP 
VINES 
TTP 
IGP 
DGP 
TCF 
IGRP 
OSPFIGP 
SRPC 
LARP 
MTP 
AX25 
IPEIP 
MICP 
SCCSP 
ETHERIP 
ENCAP 
APES 
GMTP 
PIM 
IPCOMP 
PGM 
SCTP 
DIVERT 
RAW 
ProtoMax 

Constructor & Destructor Documentation

EIpFilterRule::EIpFilterRule ( )
inline

Default constructor.

EIpFilterRule::EIpFilterRule ( cpChar  raw)
inline

Class constructor.

Parameters
rawa null terminated string of the IPFilterRule definition.
EIpFilterRule::EIpFilterRule ( const EIpFilterRule r)
inline

Copy constructor.

Parameters
rthe EIpFilterRule object to copy.

Member Function Documentation

const Action EIpFilterRule::action ( ) const
inline

Returns the action for this IPFilterRule.

EIpFilterRule& EIpFilterRule::addDestinationPort ( UShort  first = 0,
UShort  last = 0 
)
inline

Sets the destination port for this IPFilterRule.

Parameters
firstthe starting destination port for this IPFilterRule.
lastthe ending destination port for this IPFilterRule.
Returns
a reference to this object.
EIpFilterRule& EIpFilterRule::addDestinationPort ( const Port p)
inline

Sets the destination port for this IPFilterRule.

Parameters
pthe destination Port object to copy.
Returns
a reference to this object.
EIpFilterRule& EIpFilterRule::addSourcePort ( UShort  first = 0,
UShort  last = 0 
)
inline

Sets the source port for this IPFilterRule.

Parameters
firstthe starting source port for this IPFilterRule.
lastthe ending source port for this IPFilterRule.
Returns
a reference to this object.
EIpFilterRule& EIpFilterRule::addSourcePort ( const Port p)
inline

Sets the source port for this IPFilterRule.

Parameters
pthe source Port object to copy.
Returns
a reference to this object.
const EIpAddress& EIpFilterRule::destination ( ) const
inline

Returns the destination IP address.

const PortVec& EIpFilterRule::destinationPorts ( ) const
inline

Returns the collection of destination ports.

const Direction EIpFilterRule::direction ( ) const
inline

Returns the direction for this IPFilterRule.

Void EIpFilterRule::dump ( cpStr  padding = "")

Prints the contents of the current EIpFilterRule object to stdout.

Parameters
paddingprepends the "padding" string to each line output.
EString EIpFilterRule::final ( )

Reconstructs the string version of the IPFilterRule based on the parsed data.

Returns
the string version of the IPFilterRule.
EIpFilterRule& EIpFilterRule::operator= ( const EIpFilterRule r)
inline

Assignment operator.

Parameters
rthe EIpFilterRule object to copy.
EIpFilterRule& EIpFilterRule::operator= ( const std::string &  r)
inline

Assignment operator.

Parameters
ra string object containing the IPFilterRule definition to parse.
EIpFilterRule& EIpFilterRule::operator= ( cpStr  r)
inline

Assignment operator.

Parameters
ra NULL terminated string containing the IPFilterRule definition to parse.
const OptionPtrVec& EIpFilterRule::options ( ) const
inline

Returns a collection of options.

const EString& EIpFilterRule::original ( ) const
inline

The original IPFilterRule string.

EIpFilterRule& EIpFilterRule::parse ( cpChar  raw)
inline

Parses the IPFilterRule definition.

Parameters
rawthe NULL terminated string to parse.
Returns
a reference to this object.
EIpFilterRule & EIpFilterRule::parse ( const std::string &  raw)

Parses the IPFilterRule definition.

Parameters
rawthe string object containing the IPFilterRule definition.
Returns
a reference to this object.
const Protocol EIpFilterRule::protocol ( ) const
inline

Returns the protocol for this IPFilterRule.

EIpFilterRule& EIpFilterRule::setAction ( Action  action)
inline

Sets the action for this IPFilterRule.

Parameters
actionthe action for this IPFilterRule.
Returns
a reference to this object.
EIpFilterRule& EIpFilterRule::setDestination ( const EIpAddress dst)
inline

Sets the destination IP address for this IPFilterRule.

Parameters
dstthe destination IP address for this IPFilterRule.
Returns
a reference to this object.
EIpFilterRule& EIpFilterRule::setDirection ( Direction  dir)
inline

Sets the direction for this IPFilterRule.

Parameters
dirthe direction for this IPFilterRule.
Returns
a reference to this object.
EIpFilterRule& EIpFilterRule::setOriginal ( cpChar  orig)
inline

Sets the original string value.

Parameters
origthe original string value.
Returns
a reference to this object.
EIpFilterRule& EIpFilterRule::setOriginal ( const EString orig)
inline
EIpFilterRule& EIpFilterRule::setOriginal ( const std::string &  orig)
inline
EIpFilterRule& EIpFilterRule::setProtocol ( Protocol  proto)
inline

Sets the protocol for this IPFilterRule.

Parameters
protothe protocol for this IPFilterRule.
Returns
a reference to this object.
EIpFilterRule& EIpFilterRule::setSource ( const EIpAddress src)
inline

Sets the source IP address for this IPFilterRule.

Parameters
srcthe source IP address for this IPFilterRule.
Returns
a reference to this object.
const EIpAddress& EIpFilterRule::source ( ) const
inline

Returns the source IP address.

const PortVec& EIpFilterRule::sourcePorts ( ) const
inline

Returns the collection of source ports.


The documentation for this class was generated from the following files: