1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/test-ipv6.cc Fri Nov 07 11:36:15 2008 -0800
1.3 @@ -0,0 +1,70 @@
1.4 +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
1.5 +/*
1.6 + * Copyright (c) 2008 Louis Pasteur University / Telecom Bretagne
1.7 + *
1.8 + * This program is free software; you can redistribute it and/or modify
1.9 + * it under the terms of the GNU General Public License version 2 as
1.10 + * published by the Free Software Foundation;
1.11 + *
1.12 + * This program is distributed in the hope that it will be useful,
1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 + * GNU General Public License for more details.
1.16 + *
1.17 + * You should have received a copy of the GNU General Public License
1.18 + * along with this program; if not, write to the Free Software
1.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1.20 + *
1.21 + * Author: Angelos Chatzipapas <Angelos.CHATZIPAPAS@enst-bretagne.fr> /
1.22 + * <chatzipa@ceid.upatras.gr>
1.23 + */
1.24 +
1.25 +#include "ns3/log.h"
1.26 +//#include "ns3/ipv6.h"
1.27 +#include "ns3/ipv6-address.h"
1.28 +#include "ns3/node.h"
1.29 +#include "ns3/mac48-address.h"
1.30 +
1.31 +NS_LOG_COMPONENT_DEFINE ("TestIpv6");
1.32 +
1.33 +using namespace ns3;
1.34 +
1.35 +int
1.36 +main (int argc, char *argv[])
1.37 +{
1.38 + LogComponentEnable ("TestIpv6", LOG_LEVEL_ALL);
1.39 +
1.40 + NS_LOG_INFO ("Test Ipv6");
1.41 +
1.42 + Mac48Address m_addresses[10];
1.43 +
1.44 + m_addresses[0]=("00:00:00:00:00:01");
1.45 + m_addresses[1]=("00:00:00:00:00:02");
1.46 + m_addresses[2]=("00:00:00:00:00:03");
1.47 + m_addresses[3]=("00:00:00:00:00:04");
1.48 + m_addresses[4]=("00:00:00:00:00:05");
1.49 + m_addresses[5]=("00:00:00:00:00:06");
1.50 + m_addresses[6]=("00:00:00:00:00:07");
1.51 + m_addresses[7]=("00:00:00:00:00:08");
1.52 + m_addresses[8]=("00:00:00:00:00:09");
1.53 + m_addresses[9]=("00:00:00:00:00:10");
1.54 +
1.55 + Ipv6Address prefix1 ("2001:1::");
1.56 + NS_LOG_INFO ("prefix = " << prefix1);
1.57 + for (uint32_t i = 0; i < 10 ; ++i)
1.58 + {
1.59 + NS_LOG_INFO ("address = " <<m_addresses[i]);
1.60 + Ipv6Address ipv6address=Ipv6Address::MakeAutoconfiguredAddress(m_addresses[i], prefix1);
1.61 + NS_LOG_INFO ("address = " <<ipv6address);
1.62 + }
1.63 +
1.64 + Ipv6Address prefix2 ("2002:1:1::");
1.65 +
1.66 + NS_LOG_INFO ("prefix = " << prefix2);
1.67 + for (uint32_t i = 0; i < 10 ; ++i)
1.68 + {
1.69 + Ipv6Address ipv6address=Ipv6Address::MakeAutoconfiguredAddress(m_addresses[i], prefix2);
1.70 + NS_LOG_INFO ("address = " <<ipv6address);
1.71 + }
1.72 +}
1.73 +