A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
35 {
36 public:
53  IpcsClassifierRecord (Ipv4Address srcAddress, Ipv4Mask srcMask,
54  Ipv4Address dstAddress, Ipv4Mask dstMask,
55  uint16_t srcPortLow, uint16_t srcPortHigh,
56  uint16_t dstPortLow, uint16_t dstPortHigh,
57  uint8_t protocol,
58  uint8_t priority);
68  Tlv ToTlv (void) const;
74  void AddSrcAddr (Ipv4Address srcAddress, Ipv4Mask srcMask);
80  void AddDstAddr (Ipv4Address dstAddress, Ipv4Mask dstMask);
86  void AddSrcPortRange ( uint16_t srcPortLow, uint16_t srcPortHigh);
92  void AddDstPortRange ( uint16_t dstPortLow, uint16_t dstPortHigh);
97  void AddProtocol (uint8_t proto);
102  void SetPriority (uint8_t prio);
107  void SetIndex (uint16_t index);
116  bool CheckMatch (Ipv4Address srcAddress, Ipv4Address dstAddress,
117  uint16_t srcPort, uint16_t dstPort,
118  uint8_t proto) const;
122  uint16_t GetCid (void) const;
126  uint8_t GetPriority (void) const;
130  uint16_t GetIndex (void) const;
135  void SetCid (uint16_t cid);
136 
137 
138 private:
139  bool CheckMatchSrcAddr (Ipv4Address srcAddress) const;
140  bool CheckMatchDstAddr (Ipv4Address dstAddress) const;
141  bool CheckMatchSrcPort (uint16_t srcPort) const;
142  bool CheckMatchDstPort (uint16_t dstPort) const;
143  bool CheckMatchProtocol (uint8_t proto) const;
144  struct PortRange
145  {
146  uint16_t PortLow;
147  uint16_t PortHigh;
148  };
149  struct ipv4Addr
150  {
153  };
154 
155  uint8_t m_priority;
156  uint16_t m_index;
157  uint8_t m_tosLow;
158  uint8_t m_tosHigh;
159  uint8_t m_tosMask;
160  std::vector<uint8_t> m_protocol;
161  std::vector<struct ipv4Addr> m_srcAddr;
162  std::vector<struct ipv4Addr> m_dstAddr;
163  std::vector<struct PortRange> m_srcPortRange;
164  std::vector<struct PortRange> m_dstPortRange;
165 
166  uint16_t m_cid;
167 };
168 } // namespace ns3
169 
170 #endif /* IPCS_CLASSIFIER_RECORD_H */
std::vector< struct PortRange > m_srcPortRange
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:222
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
bool CheckMatchProtocol(uint8_t proto) const
bool CheckMatchSrcAddr(Ipv4Address srcAddress) const
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
Definition: wimax-tlv.h:64
std::vector< uint8_t > m_protocol
void AddSrcAddr(Ipv4Address srcAddress, Ipv4Mask srcMask)
add a new source ip address to the classifier
std::vector< struct ipv4Addr > m_dstAddr
void AddSrcPortRange(uint16_t srcPortLow, uint16_t srcPortHigh)
add a range of source port to the classifier
std::vector< struct PortRange > m_dstPortRange
void AddDstAddr(Ipv4Address dstAddress, Ipv4Mask dstMask)
add a new destination ip address to the classifier
bool CheckMatchDstPort(uint16_t dstPort) const
void SetCid(uint16_t cid)
Set the cid associated to this classifier.
void SetPriority(uint8_t prio)
Set the priority of this classifier.
bool CheckMatchSrcPort(uint16_t srcPort) const
bool CheckMatchDstAddr(Ipv4Address dstAddress) const
std::vector< struct ipv4Addr > m_srcAddr
void AddDstPortRange(uint16_t dstPortLow, uint16_t dstPortHigh)
add a range of destination port to the classifier
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
void AddProtocol(uint8_t proto)
add a protocol to the classifier
void SetIndex(uint16_t index)
Set the index of the classifier.
Tlv ToTlv(void) const
Creates a TLV from this classifier.