A Discrete-Event Network Simulator
API
ipcs-classifier-record.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007,2008, 2009 INRIA, UDcast
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19  *
20  */
21 
22 #ifndef IPCS_CLASSIFIER_RECORD_H
23 #define IPCS_CLASSIFIER_RECORD_H
24 
25 #include <stdint.h>
26 #include "ns3/ipv4-address.h"
27 #include "wimax-tlv.h"
28 
29 namespace ns3 {
30 
36 {
37 public:
54  IpcsClassifierRecord (Ipv4Address srcAddress, Ipv4Mask srcMask,
55  Ipv4Address dstAddress, Ipv4Mask dstMask,
56  uint16_t srcPortLow, uint16_t srcPortHigh,
57  uint16_t dstPortLow, uint16_t dstPortHigh,
58  uint8_t protocol,
59  uint8_t priority);
69  Tlv ToTlv (void) const;
75  void AddSrcAddr (Ipv4Address srcAddress, Ipv4Mask srcMask);
81  void AddDstAddr (Ipv4Address dstAddress, Ipv4Mask dstMask);
87  void AddSrcPortRange ( uint16_t srcPortLow, uint16_t srcPortHigh);
93  void AddDstPortRange ( uint16_t dstPortLow, uint16_t dstPortHigh);
98  void AddProtocol (uint8_t proto);
103  void SetPriority (uint8_t prio);
108  void SetIndex (uint16_t index);
118  bool CheckMatch (Ipv4Address srcAddress, Ipv4Address dstAddress,
119  uint16_t srcPort, uint16_t dstPort,
120  uint8_t proto) const;
124  uint16_t GetCid (void) const;
128  uint8_t GetPriority (void) const;
132  uint16_t GetIndex (void) const;
137  void SetCid (uint16_t cid);
138 
139 
140 private:
146  bool CheckMatchSrcAddr (Ipv4Address srcAddress) const;
152  bool CheckMatchDstAddr (Ipv4Address dstAddress) const;
158  bool CheckMatchSrcPort (uint16_t srcPort) const;
164  bool CheckMatchDstPort (uint16_t dstPort) const;
170  bool CheckMatchProtocol (uint8_t proto) const;
172  struct PortRange
173  {
174  uint16_t PortLow;
175  uint16_t PortHigh;
176  };
178  struct ipv4Addr
179  {
182  };
183 
184  uint8_t m_priority;
185  uint16_t m_index;
186  uint8_t m_tosLow;
187  uint8_t m_tosHigh;
188  uint8_t m_tosMask;
189  std::vector<uint8_t> m_protocol;
190  std::vector<struct ipv4Addr> m_srcAddr;
191  std::vector<struct ipv4Addr> m_dstAddr;
192  std::vector<struct PortRange> m_srcPortRange;
193  std::vector<struct PortRange> m_dstPortRange;
194 
195  uint16_t m_cid;
196 };
197 } // namespace ns3
198 
199 #endif /* IPCS_CLASSIFIER_RECORD_H */
ns3::IpcsClassifierRecord::AddDstAddr
void AddDstAddr(Ipv4Address dstAddress, Ipv4Mask dstMask)
add a new destination ip address to the classifier
Definition: ipcs-classifier-record.cc:161
ns3::IpcsClassifierRecord::CheckMatchProtocol
bool CheckMatchProtocol(uint8_t proto) const
Check match protocol function.
Definition: ipcs-classifier-record.cc:282
ns3::IpcsClassifierRecord::m_tosHigh
uint8_t m_tosHigh
TOS high.
Definition: ipcs-classifier-record.h:187
ns3::IpcsClassifierRecord::ToTlv
Tlv ToTlv(void) const
Creates a TLV from this classifier.
Definition: ipcs-classifier-record.cc:307
ns3::IpcsClassifierRecord::PortRange
PortRange structure.
Definition: ipcs-classifier-record.h:173
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::IpcsClassifierRecord::SetPriority
void SetPriority(uint8_t prio)
Set the priority of this classifier.
Definition: ipcs-classifier-record.cc:191
ns3::IpcsClassifierRecord::ipv4Addr::Mask
Ipv4Mask Mask
net mask
Definition: ipcs-classifier-record.h:181
ns3::IpcsClassifierRecord::AddSrcAddr
void AddSrcAddr(Ipv4Address srcAddress, Ipv4Mask srcMask)
add a new source ip address to the classifier
Definition: ipcs-classifier-record.cc:153
ns3::IpcsClassifierRecord::AddSrcPortRange
void AddSrcPortRange(uint16_t srcPortLow, uint16_t srcPortHigh)
add a range of source port to the classifier
Definition: ipcs-classifier-record.cc:169
ns3::IpcsClassifierRecord::m_protocol
std::vector< uint8_t > m_protocol
protocol
Definition: ipcs-classifier-record.h:189
ns3::IpcsClassifierRecord::m_srcPortRange
std::vector< struct PortRange > m_srcPortRange
surce port range
Definition: ipcs-classifier-record.h:192
ns3::IpcsClassifierRecord::m_tosLow
uint8_t m_tosLow
TOS low.
Definition: ipcs-classifier-record.h:186
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::IpcsClassifierRecord::SetCid
void SetCid(uint16_t cid)
Set the cid associated to this classifier.
Definition: ipcs-classifier-record.cc:196
wimax-tlv.h
ns3::IpcsClassifierRecord::CheckMatchSrcAddr
bool CheckMatchSrcAddr(Ipv4Address srcAddress) const
Check match source address function.
Definition: ipcs-classifier-record.cc:223
ns3::IpcsClassifierRecord::CheckMatchSrcPort
bool CheckMatchSrcPort(uint16_t srcPort) const
Check match source port function.
Definition: ipcs-classifier-record.cc:252
ns3::IpcsClassifierRecord::CheckMatchDstPort
bool CheckMatchDstPort(uint16_t dstPort) const
Check match destination port function.
Definition: ipcs-classifier-record.cc:267
ns3::IpcsClassifierRecord::GetCid
uint16_t GetCid(void) const
Definition: ipcs-classifier-record.cc:212
ns3::IpcsClassifierRecord::m_tosMask
uint8_t m_tosMask
TOS mask.
Definition: ipcs-classifier-record.h:188
ns3::IpcsClassifierRecord::m_dstPortRange
std::vector< struct PortRange > m_dstPortRange
destination port range
Definition: ipcs-classifier-record.h:193
ns3::IpcsClassifierRecord::m_priority
uint8_t m_priority
priority
Definition: ipcs-classifier-record.h:184
ns3::IpcsClassifierRecord::ipv4Addr
ipv4Addr structure
Definition: ipcs-classifier-record.h:179
ns3::IpcsClassifierRecord::m_index
uint16_t m_index
index
Definition: ipcs-classifier-record.h:185
ns3::IpcsClassifierRecord::SetIndex
void SetIndex(uint16_t index)
Set the index of the classifier.
Definition: ipcs-classifier-record.cc:201
ns3::IpcsClassifierRecord::~IpcsClassifierRecord
~IpcsClassifierRecord()
Definition: ipcs-classifier-record.cc:46
ns3::IpcsClassifierRecord::PortRange::PortHigh
uint16_t PortHigh
port high
Definition: ipcs-classifier-record.h:175
ns3::IpcsClassifierRecord::GetPriority
uint8_t GetPriority(void) const
Definition: ipcs-classifier-record.cc:217
ns3::IpcsClassifierRecord::m_srcAddr
std::vector< struct ipv4Addr > m_srcAddr
source address
Definition: ipcs-classifier-record.h:190
ns3::IpcsClassifierRecord::CheckMatch
bool CheckMatch(Ipv4Address srcAddress, Ipv4Address dstAddress, uint16_t srcPort, uint16_t dstPort, uint8_t proto) const
check if a packets can be used with this classifier
Definition: ipcs-classifier-record.cc:296
ns3::Tlv
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
Definition: wimax-tlv.h:84
ns3::IpcsClassifierRecord::CheckMatchDstAddr
bool CheckMatchDstAddr(Ipv4Address dstAddress) const
Check match destination address function.
Definition: ipcs-classifier-record.cc:237
ns3::IpcsClassifierRecord::IpcsClassifierRecord
IpcsClassifierRecord()
Definition: ipcs-classifier-record.cc:29
ns3::IpcsClassifierRecord::PortRange::PortLow
uint16_t PortLow
port low
Definition: ipcs-classifier-record.h:174
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:256
ns3::IpcsClassifierRecord::AddProtocol
void AddProtocol(uint8_t proto)
add a protocol to the classifier
Definition: ipcs-classifier-record.cc:186
ns3::IpcsClassifierRecord::m_dstAddr
std::vector< struct ipv4Addr > m_dstAddr
destination address
Definition: ipcs-classifier-record.h:191
ns3::IpcsClassifierRecord::ipv4Addr::Address
Ipv4Address Address
IP address.
Definition: ipcs-classifier-record.h:180
ns3::IpcsClassifierRecord::AddDstPortRange
void AddDstPortRange(uint16_t dstPortLow, uint16_t dstPortHigh)
add a range of destination port to the classifier
Definition: ipcs-classifier-record.cc:178
ns3::IpcsClassifierRecord::m_cid
uint16_t m_cid
the CID
Definition: ipcs-classifier-record.h:195
ns3::IpcsClassifierRecord::GetIndex
uint16_t GetIndex(void) const
Definition: ipcs-classifier-record.cc:207
ns3::IpcsClassifierRecord
IpcsClassifierRecord class.
Definition: ipcs-classifier-record.h:36