OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
I3IPAddress.cc
Go to the documentation of this file.
1
// Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
2
//
3
// This program is free software; you can redistribute it and/or
4
// modify it under the terms of the GNU General Public License
5
// as published by the Free Software Foundation; either version 2
6
// of the License, or (at your option) any later version.
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
24
#include "
I3IPAddress.h
"
25
26
I3IPAddress::I3IPAddress
()
27
{
28
port
= 0;
29
}
30
31
I3IPAddress::I3IPAddress
(IPvXAddress add,
int
p)
32
{
33
ip
= add;
34
port
= p;
35
}
36
37
bool
I3IPAddress::operator<
(
const
I3IPAddress
&a)
const
38
{
39
return
ip
< a.
ip
|| (
ip
== a.
ip
&&
port
< a.
port
);
40
}
41
42
bool
I3IPAddress::operator==
(
const
I3IPAddress
&a)
const
43
{
44
return
ip
== a.
ip
&&
port
== a.
port
;
45
}
46
47
bool
I3IPAddress::operator>
(
const
I3IPAddress
&a)
const
48
{
49
return
a < *
this
;
50
}
51
52
int
I3IPAddress::length
()
const
{
53
//return sizeof(address) + sizeof(port);
54
return
(
ip
.isIPv6() ? 128 : 32) + 16;
// 16 = port length
55
}
56
57
std::ostream&
operator<<
(std::ostream& os,
const
I3IPAddress
& ip) {
58
os << ip.
ip
<<
':'
<< ip.
port
;
59
return
os;
60
}
src
applications
i3
I3IPAddress.cc
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2