author | John Abraham |
Tue, 01 Oct 2013 11:45:13 -0700 | |
changeset 10287 | bba8452a580f |
parent 7252 | c8200621e252 |
permissions | -rw-r--r-- |
3852 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2008 Louis Pasteur University / Telecom Bretagne |
|
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 |
* Author: Angelos Chatzipapas <Angelos.CHATZIPAPAS@enst-bretagne.fr> / |
|
19 |
* <chatzipa@ceid.upatras.gr> |
|
20 |
*/ |
|
21 |
||
22 |
#include "ns3/log.h" |
|
23 |
#include "ns3/ipv6-address.h" |
|
24 |
#include "ns3/node.h" |
|
25 |
#include "ns3/mac48-address.h" |
|
10287 | 26 |
#ifdef WIN32 |
27 |
#include "ns3/simulator.h" |
|
28 |
#endif |
|
3852 | 29 |
|
30 |
NS_LOG_COMPONENT_DEFINE ("TestIpv6"); |
|
31 |
||
32 |
using namespace ns3; |
|
33 |
||
34 |
int |
|
35 |
main (int argc, char *argv[]) |
|
36 |
{ |
|
37 |
LogComponentEnable ("TestIpv6", LOG_LEVEL_ALL); |
|
38 |
||
39 |
NS_LOG_INFO ("Test Ipv6"); |
|
40 |
||
41 |
Mac48Address m_addresses[10]; |
|
42 |
||
4767
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
43 |
m_addresses[0] = ("00:00:00:00:00:01"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
44 |
m_addresses[1] = ("00:00:00:00:00:02"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
45 |
m_addresses[2] = ("00:00:00:00:00:03"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
46 |
m_addresses[3] = ("00:00:00:00:00:04"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
47 |
m_addresses[4] = ("00:00:00:00:00:05"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
48 |
m_addresses[5] = ("00:00:00:00:00:06"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
49 |
m_addresses[6] = ("00:00:00:00:00:07"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
50 |
m_addresses[7] = ("00:00:00:00:00:08"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
51 |
m_addresses[8] = ("00:00:00:00:00:09"); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
52 |
m_addresses[9] = ("00:00:00:00:00:10"); |
3852 | 53 |
|
54 |
Ipv6Address prefix1 ("2001:1::"); |
|
55 |
NS_LOG_INFO ("prefix = " << prefix1); |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
5369
diff
changeset
|
56 |
for (uint32_t i = 0; i < 10; ++i) |
3852 | 57 |
{ |
4767
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
58 |
NS_LOG_INFO ("address = " << m_addresses[i]); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
59 |
Ipv6Address ipv6address = Ipv6Address::MakeAutoconfiguredAddress (m_addresses[i], prefix1); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
60 |
NS_LOG_INFO ("address = " << ipv6address); |
3852 | 61 |
} |
62 |
||
63 |
Ipv6Address prefix2 ("2002:1:1::"); |
|
64 |
||
65 |
NS_LOG_INFO ("prefix = " << prefix2); |
|
7252
c8200621e252
rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents:
5369
diff
changeset
|
66 |
for (uint32_t i = 0; i < 10; ++i) |
3852 | 67 |
{ |
4767
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
68 |
Ipv6Address ipv6address = Ipv6Address::MakeAutoconfiguredAddress (m_addresses[i], prefix2); |
7433d307ed51
Cleanup, reindent, NULL -> 0.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3852
diff
changeset
|
69 |
NS_LOG_INFO ("address = " << ipv6address); |
3852 | 70 |
} |
10287 | 71 |
#ifdef WIN32 |
72 |
Simulator::Run (); |
|
73 |
#endif |
|
3852 | 74 |
} |
75 |