A Discrete-Event Network Simulator
API
ipcs-classifier-record.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007,2008, 2009 INRIA, UDcast
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
18  *
19  */
20 
21 #ifndef IPCS_CLASSIFIER_RECORD_H
22 #define IPCS_CLASSIFIER_RECORD_H
23 
24 #include "wimax-tlv.h"
25 
26 #include "ns3/ipv4-address.h"
27 
28 #include <stdint.h>
29 
30 namespace ns3
31 {
32 
38 {
39  public:
57  Ipv4Mask srcMask,
58  Ipv4Address dstAddress,
59  Ipv4Mask dstMask,
60  uint16_t srcPortLow,
61  uint16_t srcPortHigh,
62  uint16_t dstPortLow,
63  uint16_t dstPortHigh,
64  uint8_t protocol,
65  uint8_t priority);
75  Tlv ToTlv() const;
81  void AddSrcAddr(Ipv4Address srcAddress, Ipv4Mask srcMask);
87  void AddDstAddr(Ipv4Address dstAddress, Ipv4Mask dstMask);
93  void AddSrcPortRange(uint16_t srcPortLow, uint16_t srcPortHigh);
99  void AddDstPortRange(uint16_t dstPortLow, uint16_t dstPortHigh);
104  void AddProtocol(uint8_t proto);
109  void SetPriority(uint8_t prio);
114  void SetIndex(uint16_t index);
124  bool CheckMatch(Ipv4Address srcAddress,
125  Ipv4Address dstAddress,
126  uint16_t srcPort,
127  uint16_t dstPort,
128  uint8_t proto) const;
132  uint16_t GetCid() const;
136  uint8_t GetPriority() const;
140  uint16_t GetIndex() const;
145  void SetCid(uint16_t cid);
146 
147  private:
153  bool CheckMatchSrcAddr(Ipv4Address srcAddress) const;
159  bool CheckMatchDstAddr(Ipv4Address dstAddress) const;
165  bool CheckMatchSrcPort(uint16_t srcPort) const;
171  bool CheckMatchDstPort(uint16_t dstPort) const;
177  bool CheckMatchProtocol(uint8_t proto) const;
178 
180  struct PortRange
181  {
182  uint16_t PortLow;
183  uint16_t PortHigh;
184  };
185 
187  struct Ipv4Addr
188  {
191  };
192 
193  uint8_t m_priority;
194  uint16_t m_index;
195  uint8_t m_tosLow;
196  uint8_t m_tosHigh;
197  uint8_t m_tosMask;
198  std::vector<uint8_t> m_protocol;
199  std::vector<Ipv4Addr> m_srcAddr;
200  std::vector<Ipv4Addr> m_dstAddr;
201  std::vector<PortRange> m_srcPortRange;
202  std::vector<PortRange> m_dstPortRange;
203 
204  uint16_t m_cid;
205 };
206 } // namespace ns3
207 
208 #endif /* IPCS_CLASSIFIER_RECORD_H */
IpcsClassifierRecord class.
void SetPriority(uint8_t prio)
Set the priority of this classifier.
std::vector< PortRange > m_dstPortRange
destination port range
bool CheckMatchSrcAddr(Ipv4Address srcAddress) const
Check match source address function.
bool CheckMatchProtocol(uint8_t proto) const
Check match protocol function.
void SetIndex(uint16_t index)
Set the index of the classifier.
void AddDstAddr(Ipv4Address dstAddress, Ipv4Mask dstMask)
add a new destination ip address to the classifier
bool CheckMatchSrcPort(uint16_t srcPort) const
Check match source port function.
std::vector< PortRange > m_srcPortRange
source port range
void AddSrcPortRange(uint16_t srcPortLow, uint16_t srcPortHigh)
add a range of source port to the classifier
std::vector< Ipv4Addr > m_dstAddr
destination address
bool CheckMatchDstAddr(Ipv4Address dstAddress) const
Check match destination address function.
Tlv ToTlv() const
Creates a TLV from this classifier.
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
void SetCid(uint16_t cid)
Set the cid associated to this classifier.
void AddDstPortRange(uint16_t dstPortLow, uint16_t dstPortHigh)
add a range of destination port to the classifier
std::vector< uint8_t > m_protocol
protocol
void AddSrcAddr(Ipv4Address srcAddress, Ipv4Mask srcMask)
add a new source ip address to the classifier
std::vector< Ipv4Addr > m_srcAddr
source address
void AddProtocol(uint8_t proto)
add a protocol to the classifier
bool CheckMatchDstPort(uint16_t dstPort) const
Check match destination port function.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:257
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
Definition: wimax-tlv.h:87
Every class exported by the ns3 library is enclosed in the ns3 namespace.