A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
ipv4-interface-address.h
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 University of Washington
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
*/
19
20
#ifndef IPV4_INTERFACE_ADDRESS_H
21
#define IPV4_INTERFACE_ADDRESS_H
22
23
#include <stdint.h>
24
#include <ostream>
25
#include "ns3/ipv4-address.h"
26
27
namespace
ns3 {
28
42
class
Ipv4InterfaceAddress
43
{
44
public
:
45
enum
InterfaceAddressScope_e {
46
HOST,
47
LINK,
48
GLOBAL
49
};
50
51
Ipv4InterfaceAddress
();
52
// Configure m_local, m_mask, and m_broadcast from the below constructor
53
Ipv4InterfaceAddress
(
Ipv4Address
local,
Ipv4Mask
mask);
54
Ipv4InterfaceAddress
(
const
Ipv4InterfaceAddress
&o);
55
56
void
SetLocal (
Ipv4Address
local);
57
Ipv4Address
GetLocal (
void
)
const
;
58
void
SetMask (
Ipv4Mask
mask);
59
Ipv4Mask
GetMask (
void
)
const
;
60
void
SetBroadcast (
Ipv4Address
broadcast);
61
Ipv4Address
GetBroadcast (
void
)
const
;
62
63
void
SetScope (Ipv4InterfaceAddress::InterfaceAddressScope_e scope);
64
Ipv4InterfaceAddress::InterfaceAddressScope_e GetScope (
void
)
const
;
65
66
bool
IsSecondary (
void
)
const
;
67
void
SetSecondary (
void
);
68
void
SetPrimary (
void
);
69
70
private
:
71
72
Ipv4Address
m_local;
// Interface address
73
// Note: m_peer may be added in future when necessary
74
// Ipv4Address m_peer; // Peer destination address (in Linux: m_address)
75
Ipv4Mask
m_mask;
// Network mask
76
Ipv4Address
m_broadcast;
// Broadcast address
77
78
InterfaceAddressScope_e m_scope;
79
bool
m_secondary;
// For use in multihoming
80
81
friend
bool
operator == (
Ipv4InterfaceAddress
const
&a,
Ipv4InterfaceAddress
const
&b);
82
friend
bool
operator != (
Ipv4InterfaceAddress
const
&a,
Ipv4InterfaceAddress
const
&b);
83
};
84
85
std::ostream&
operator<<
(std::ostream& os,
const
Ipv4InterfaceAddress
&addr);
86
87
inline
bool
operator == (
const
Ipv4InterfaceAddress
&a,
const
Ipv4InterfaceAddress
&b)
88
{
89
return
(a.m_local == b.m_local && a.m_mask == b.m_mask &&
90
a.m_broadcast == b.m_broadcast && a.m_scope == b.m_scope && a.m_secondary == b.m_secondary);
91
}
92
inline
bool
operator != (
const
Ipv4InterfaceAddress &a,
const
Ipv4InterfaceAddress &b)
93
{
94
return
(a.m_local != b.m_local || a.m_mask != b.m_mask ||
95
a.m_broadcast != b.m_broadcast || a.m_scope != b.m_scope || a.m_secondary != b.m_secondary);
96
}
97
98
99
}
// namespace ns3
100
101
#endif
/* IPV4_ADDRESS_H */
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition:
ipv4-address.h:210
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition:
angles.cc:43
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:38
ns3::Ipv4InterfaceAddress
a class to store IPv4 address information on an interface
Definition:
ipv4-interface-address.h:42
src
internet
model
ipv4-interface-address.h
Generated on Sun Mar 16 2014 11:25:04 for ns-3 by
1.8.6