|
qasimj@4639
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
qasimj@4639
|
2 |
/*
|
|
qasimj@4639
|
3 |
* Copyright (c) 2009 University of Texas at Dallas
|
|
qasimj@4639
|
4 |
*
|
|
qasimj@4639
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
qasimj@4639
|
6 |
* it under the terms of the GNU General Public License version 2 as
|
|
qasimj@4639
|
7 |
* published by the Free Software Foundation;
|
|
qasimj@4639
|
8 |
*
|
|
qasimj@4639
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
qasimj@4639
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
qasimj@4639
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
qasimj@4639
|
12 |
* GNU General Public License for more details.
|
|
qasimj@4639
|
13 |
*
|
|
qasimj@4639
|
14 |
* You should have received a copy of the GNU General Public License
|
|
qasimj@4639
|
15 |
* along with this program; if not, write to the Free Software
|
|
qasimj@4639
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
qasimj@4639
|
17 |
*
|
|
qasimj@4639
|
18 |
* Author: Qasim Javed <qasim@utdallas.edu>
|
|
qasimj@4639
|
19 |
*/
|
|
qasimj@4639
|
20 |
#include "nat-rule.h"
|
|
qasimj@4639
|
21 |
|
|
qasimj@4639
|
22 |
namespace ns3 {
|
|
qasimj@4639
|
23 |
|
|
qasimj@4639
|
24 |
NatRule::NatRule (Ipv4Address orig, Ipv4Address mapped, Ptr<NetDevice> device) //, Ipv4Interface outInterface
|
|
qasimj@4639
|
25 |
{
|
|
qasimj@4639
|
26 |
m_originalSource = orig;
|
|
qasimj@4639
|
27 |
m_mangledSource = mapped;
|
|
qasimj@4639
|
28 |
m_device = device;
|
|
qasimj@4639
|
29 |
//m_outInterface = outInterface;
|
|
qasimj@4639
|
30 |
}
|
|
qasimj@4639
|
31 |
|
|
qasimj@4639
|
32 |
bool
|
|
qasimj@4639
|
33 |
NatRule::operator == (const NatRule& other) const
|
|
qasimj@4639
|
34 |
{
|
|
qasimj@4639
|
35 |
return (m_originalSource == other.m_originalSource) &&
|
|
qasimj@4639
|
36 |
(m_mangledSource == other.m_mangledSource) &&
|
|
qasimj@4639
|
37 |
(m_device == other.m_device);
|
|
qasimj@4639
|
38 |
// (m_outInterface == other.m_outInterface);
|
|
qasimj@4639
|
39 |
}
|
|
qasimj@4639
|
40 |
|
|
qasimj@4639
|
41 |
Ipv4Address
|
|
qasimj@4639
|
42 |
NatRule::GetOriginalSource () const
|
|
qasimj@4639
|
43 |
{
|
|
qasimj@4639
|
44 |
return m_originalSource;
|
|
qasimj@4639
|
45 |
}
|
|
qasimj@4639
|
46 |
|
|
qasimj@4639
|
47 |
Ipv4Address
|
|
qasimj@4639
|
48 |
NatRule::GetMangledSource () const
|
|
qasimj@4639
|
49 |
{
|
|
qasimj@4639
|
50 |
return m_mangledSource;
|
|
qasimj@4639
|
51 |
}
|
|
qasimj@4639
|
52 |
|
|
qasimj@4639
|
53 |
Ptr<NetDevice>
|
|
qasimj@4639
|
54 |
NatRule::GetDevice () const
|
|
qasimj@4639
|
55 |
{
|
|
qasimj@4639
|
56 |
return m_device;
|
|
qasimj@4639
|
57 |
}
|
|
qasimj@4639
|
58 |
|
|
qasimj@4639
|
59 |
}
|