author | Vedran Miletić <rivanvx@gmail.com> |
Tue, 02 Aug 2011 17:42:33 -0400 | |
changeset 7385 | 10beb0e53130 |
parent 7353 | 09fccf6195ea |
child 7386 | 2310ed220a61 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7353
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
1752
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
2 |
/* |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
3 |
* Copyright (c) 2004 Francisco J. Ros |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
4 |
* Copyright (c) 2007 INESC Porto |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
5 |
* |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
8 |
* published by the Free Software Foundation; |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
9 |
* |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
13 |
* GNU General Public License for more details. |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
14 |
* |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
18 |
* |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
19 |
* Authors: Francisco J. Ros <fjrm@dif.um.es> |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
20 |
* Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
d9115729b7d6
Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1731
diff
changeset
|
21 |
*/ |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
22 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
23 |
/// |
4481 | 24 |
/// \file olsr-repositories.h |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
25 |
/// \brief Here are defined all data structures needed by an OLSR node. |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
26 |
/// |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
27 |
|
7353
09fccf6195ea
bug 1203: Inconsistently named ifndef/define macros in ns-3 headers
Vedran Miletic <rivanvx@gmail.com>
parents:
7252
diff
changeset
|
28 |
#ifndef OLSR_REPOSITORIES_H |
09fccf6195ea
bug 1203: Inconsistently named ifndef/define macros in ns-3 headers
Vedran Miletic <rivanvx@gmail.com>
parents:
7252
diff
changeset
|
29 |
#define OLSR_REPOSITORIES_H |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
30 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
31 |
#include <set> |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
32 |
#include <vector> |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
33 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
34 |
#include "ns3/ipv4-address.h" |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
35 |
#include "ns3/nstime.h" |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
36 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
37 |
namespace ns3 { namespace olsr { |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
38 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
39 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
40 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
41 |
/// An Interface Association Tuple. |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
42 |
struct IfaceAssocTuple |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
43 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
44 |
/// Interface address of a node. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
45 |
Ipv4Address ifaceAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
46 |
/// Main address of the node. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
47 |
Ipv4Address mainAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
48 |
/// Time at which this tuple expires and must be removed. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
49 |
Time time; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
50 |
}; |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
51 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
52 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
53 |
operator == (const IfaceAssocTuple &a, const IfaceAssocTuple &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
54 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
55 |
return (a.ifaceAddr == b.ifaceAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
56 |
&& a.mainAddr == b.mainAddr); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
57 |
} |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
58 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
59 |
static inline std::ostream& |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
60 |
operator << (std::ostream &os, const IfaceAssocTuple &tuple) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
61 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
62 |
os << "IfaceAssocTuple(ifaceAddr=" << tuple.ifaceAddr |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
63 |
<< ", mainAddr=" << tuple.mainAddr |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
64 |
<< ", time=" << tuple.time << ")"; |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
65 |
return os; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
66 |
} |
2328
caa15068fb3b
OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1778
diff
changeset
|
67 |
|
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
68 |
/// A Link Tuple. |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
69 |
struct LinkTuple |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
70 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
71 |
/// Interface address of the local node. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
72 |
Ipv4Address localIfaceAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
73 |
/// Interface address of the neighbor node. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
74 |
Ipv4Address neighborIfaceAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
75 |
/// The link is considered bidirectional until this time. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
76 |
Time symTime; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
77 |
/// The link is considered unidirectional until this time. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
78 |
Time asymTime; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
79 |
/// Time at which this tuple expires and must be removed. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
80 |
Time time; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
81 |
}; |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
82 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
83 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
84 |
operator == (const LinkTuple &a, const LinkTuple &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
85 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
86 |
return (a.localIfaceAddr == b.localIfaceAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
87 |
&& a.neighborIfaceAddr == b.neighborIfaceAddr); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
88 |
} |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
89 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
90 |
static inline std::ostream& |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
91 |
operator << (std::ostream &os, const LinkTuple &tuple) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
92 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
93 |
os << "LinkTuple(localIfaceAddr=" << tuple.localIfaceAddr |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
94 |
<< ", neighborIfaceAddr=" << tuple.neighborIfaceAddr |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
95 |
<< ", symTime=" << tuple.symTime |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
96 |
<< ", asymTime=" << tuple.asymTime |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
97 |
<< ", expTime=" << tuple.time |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
98 |
<< ")"; |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
99 |
return os; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
100 |
} |
2328
caa15068fb3b
OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1778
diff
changeset
|
101 |
|
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
102 |
/// A Neighbor Tuple. |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
103 |
struct NeighborTuple |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
104 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
105 |
/// Main address of a neighbor node. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
106 |
Ipv4Address neighborMainAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
107 |
/// Neighbor Type and Link Type at the four less significative digits. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
108 |
enum Status { |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
109 |
STATUS_NOT_SYM = 0, // "not symmetric" |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
110 |
STATUS_SYM = 1, // "symmetric" |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
111 |
} status; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
112 |
/// A value between 0 and 7 specifying the node's willingness to carry traffic on behalf of other nodes. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
113 |
uint8_t willingness; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
114 |
}; |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
115 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
116 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
117 |
operator == (const NeighborTuple &a, const NeighborTuple &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
118 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
119 |
return (a.neighborMainAddr == b.neighborMainAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
120 |
&& a.status == b.status |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
121 |
&& a.willingness == b.willingness); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
122 |
} |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
123 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
124 |
static inline std::ostream& |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
125 |
operator << (std::ostream &os, const NeighborTuple &tuple) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
126 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
127 |
os << "NeighborTuple(neighborMainAddr=" << tuple.neighborMainAddr |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
128 |
<< ", status=" << (tuple.status == NeighborTuple::STATUS_SYM ? "SYM" : "NOT_SYM") |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
129 |
<< ", willingness=" << (int) tuple.willingness << ")"; |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
130 |
return os; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
131 |
} |
2328
caa15068fb3b
OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1778
diff
changeset
|
132 |
|
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
133 |
/// A 2-hop Tuple. |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
134 |
struct TwoHopNeighborTuple |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
135 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
136 |
/// Main address of a neighbor. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
137 |
Ipv4Address neighborMainAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
138 |
/// Main address of a 2-hop neighbor with a symmetric link to nb_main_addr. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
139 |
Ipv4Address twoHopNeighborAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
140 |
/// Time at which this tuple expires and must be removed. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
141 |
Time expirationTime; // previously called 'time_' |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
142 |
}; |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
143 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
144 |
static inline std::ostream& |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
145 |
operator << (std::ostream &os, const TwoHopNeighborTuple &tuple) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
146 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
147 |
os << "TwoHopNeighborTuple(neighborMainAddr=" << tuple.neighborMainAddr |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
148 |
<< ", twoHopNeighborAddr=" << tuple.twoHopNeighborAddr |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
149 |
<< ", expirationTime=" << tuple.expirationTime |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
150 |
<< ")"; |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
151 |
return os; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
152 |
} |
2328
caa15068fb3b
OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1778
diff
changeset
|
153 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
154 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
155 |
operator == (const TwoHopNeighborTuple &a, const TwoHopNeighborTuple &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
156 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
157 |
return (a.neighborMainAddr == b.neighborMainAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
158 |
&& a.twoHopNeighborAddr == b.twoHopNeighborAddr); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
159 |
} |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
160 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
161 |
/// An MPR-Selector Tuple. |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
162 |
struct MprSelectorTuple |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
163 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
164 |
/// Main address of a node which have selected this node as a MPR. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
165 |
Ipv4Address mainAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
166 |
/// Time at which this tuple expires and must be removed. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
167 |
Time expirationTime; // previously called 'time_' |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
168 |
}; |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
169 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
170 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
171 |
operator == (const MprSelectorTuple &a, const MprSelectorTuple &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
172 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
173 |
return (a.mainAddr == b.mainAddr); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
174 |
} |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
175 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
176 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
177 |
/// The type "list of interface addresses" |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
178 |
//typedef std::vector<nsaddr_t> addr_list_t; |
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
179 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
180 |
/// A Duplicate Tuple |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
181 |
struct DuplicateTuple |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
182 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
183 |
/// Originator address of the message. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
184 |
Ipv4Address address; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
185 |
/// Message sequence number. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
186 |
uint16_t sequenceNumber; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
187 |
/// Indicates whether the message has been retransmitted or not. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
188 |
bool retransmitted; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
189 |
/// List of interfaces which the message has been received on. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
190 |
std::vector<Ipv4Address> ifaceList; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
191 |
/// Time at which this tuple expires and must be removed. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
192 |
Time expirationTime; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
193 |
}; |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
194 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
195 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
196 |
operator == (const DuplicateTuple &a, const DuplicateTuple &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
197 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
198 |
return (a.address == b.address |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
199 |
&& a.sequenceNumber == b.sequenceNumber); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
200 |
} |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
201 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
202 |
/// A Topology Tuple |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
203 |
struct TopologyTuple |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
204 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
205 |
/// Main address of the destination. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
206 |
Ipv4Address destAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
207 |
/// Main address of a node which is a neighbor of the destination. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
208 |
Ipv4Address lastAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
209 |
/// Sequence number. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
210 |
uint16_t sequenceNumber; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
211 |
/// Time at which this tuple expires and must be removed. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
212 |
Time expirationTime; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
213 |
}; |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
214 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
215 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
216 |
operator == (const TopologyTuple &a, const TopologyTuple &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
217 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
218 |
return (a.destAddr == b.destAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
219 |
&& a.lastAddr == b.lastAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
220 |
&& a.sequenceNumber == b.sequenceNumber); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
221 |
} |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
222 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
223 |
static inline std::ostream& |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
224 |
operator << (std::ostream &os, const TopologyTuple &tuple) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
225 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
226 |
os << "TopologyTuple(destAddr=" << tuple.destAddr |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
227 |
<< ", lastAddr=" << tuple.lastAddr |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
228 |
<< ", sequenceNumber=" << (int) tuple.sequenceNumber |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
229 |
<< ", expirationTime=" << tuple.expirationTime |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
230 |
<< ")"; |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
231 |
return os; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
232 |
} |
2328
caa15068fb3b
OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1778
diff
changeset
|
233 |
|
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
5867
diff
changeset
|
234 |
/// Association |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
235 |
struct Association |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
236 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
237 |
Ipv4Address networkAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
238 |
Ipv4Mask netmask; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
239 |
}; |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
5867
diff
changeset
|
240 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
241 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
242 |
operator == (const Association &a, const Association &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
243 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
244 |
return (a.networkAddr == b.networkAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
245 |
&& a.netmask == b.netmask); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
246 |
} |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
5867
diff
changeset
|
247 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
248 |
static inline std::ostream& |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
249 |
operator << (std::ostream &os, const Association &tuple) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
250 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
251 |
os << "Association(networkAddr=" << tuple.networkAddr |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
252 |
<< ", netmask=" << tuple.netmask |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
253 |
<< ")"; |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
254 |
return os; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
255 |
} |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
5867
diff
changeset
|
256 |
|
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
5867
diff
changeset
|
257 |
/// An Association Tuple |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
258 |
struct AssociationTuple |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
259 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
260 |
/// Main address of the gateway. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
261 |
Ipv4Address gatewayAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
262 |
/// Network Address of network reachable through gatewayAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
263 |
Ipv4Address networkAddr; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
264 |
/// Netmask of network reachable through gatewayAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
265 |
Ipv4Mask netmask; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
266 |
/// Time at which this tuple expires and must be removed |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
267 |
Time expirationTime; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
268 |
}; |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
5867
diff
changeset
|
269 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
270 |
static inline bool |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
271 |
operator == (const AssociationTuple &a, const AssociationTuple &b) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
272 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
273 |
return (a.gatewayAddr == b.gatewayAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
274 |
&& a.networkAddr == b.networkAddr |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
275 |
&& a.netmask == b.netmask); |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
276 |
} |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
5867
diff
changeset
|
277 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
278 |
static inline std::ostream& |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
279 |
operator << (std::ostream &os, const AssociationTuple &tuple) |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
280 |
{ |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
281 |
os << "AssociationTuple(gatewayAddr=" << tuple.gatewayAddr |
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
282 |
<< ", networkAddr=" << tuple.networkAddr |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
283 |
<< ", netmask=" << tuple.netmask |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
284 |
<< ", expirationTime=" << tuple.expirationTime |
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
7184
diff
changeset
|
285 |
<< ")"; |
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
286 |
return os; |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
287 |
} |
6140
12bb87242796
Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents:
5867
diff
changeset
|
288 |
|
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
289 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
290 |
typedef std::set<Ipv4Address> MprSet; ///< MPR Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
291 |
typedef std::vector<MprSelectorTuple> MprSelectorSet; ///< MPR Selector Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
292 |
typedef std::vector<LinkTuple> LinkSet; ///< Link Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
293 |
typedef std::vector<NeighborTuple> NeighborSet; ///< Neighbor Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
294 |
typedef std::vector<TwoHopNeighborTuple> TwoHopNeighborSet; ///< 2-hop Neighbor Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
295 |
typedef std::vector<TopologyTuple> TopologySet; ///< Topology Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
296 |
typedef std::vector<DuplicateTuple> DuplicateSet; ///< Duplicate Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
297 |
typedef std::vector<IfaceAssocTuple> IfaceAssocSet; ///< Interface Association Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
298 |
typedef std::vector<AssociationTuple> AssociationSet; ///< Association Set type. |
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
299 |
typedef std::vector<Association> Associations; ///< Association Set type. |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
300 |
|
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
301 |
|
7184
a15feb312428
olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6852
diff
changeset
|
302 |
}}; // namespace ns3, olsr |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
303 |
|
7353
09fccf6195ea
bug 1203: Inconsistently named ifndef/define macros in ns-3 headers
Vedran Miletic <rivanvx@gmail.com>
parents:
7252
diff
changeset
|
304 |
#endif /* OLSR_REPOSITORIES_H */ |