OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2011 Universita' di Firenze, Italy |
| 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: Tommaso Pecorella <tommaso.pecorella@unifi.it> |
| 19 */ |
| 20 |
| 21 #include "sixlowpan-helper.h" |
| 22 #include "ns3/log.h" |
| 23 #include "ns3/sixlowpan-net-device.h" |
| 24 #include "ns3/node.h" |
| 25 #include "ns3/names.h" |
| 26 |
| 27 NS_LOG_COMPONENT_DEFINE ("SixLowPanHelper"); |
| 28 |
| 29 namespace ns3 { |
| 30 |
| 31 SixLowPanHelper::SixLowPanHelper () |
| 32 { |
| 33 NS_LOG_FUNCTION (this); |
| 34 m_deviceFactory.SetTypeId ("ns3::sixlowpan::SixLowPanNetDevice"); |
| 35 } |
| 36 |
| 37 void SixLowPanHelper::SetDeviceAttribute (std::string n1, |
| 38 const AttributeValue &v1) |
| 39 { |
| 40 NS_LOG_FUNCTION (this); |
| 41 m_deviceFactory.Set (n1, v1); |
| 42 } |
| 43 |
| 44 NetDeviceContainer SixLowPanHelper::Install (const NetDeviceContainer c) |
| 45 { |
| 46 NS_LOG_FUNCTION (this); |
| 47 |
| 48 NetDeviceContainer devs; |
| 49 |
| 50 for (uint32_t i = 0; i < c.GetN (); ++i) |
| 51 { |
| 52 Ptr<NetDevice> device = c.Get (i); |
| 53 |
| 54 Ptr<Node> node = device->GetNode (); |
| 55 NS_LOG_LOGIC ("**** Install 6LoWPAN on node " << node->GetId ()); |
| 56 |
| 57 Ptr<sixlowpan::SixLowPanNetDevice> dev = m_deviceFactory.Create<sixlowpan:
:SixLowPanNetDevice> (); |
| 58 devs.Add (dev); |
| 59 node->AddDevice (dev); |
| 60 dev->SetPort (device); |
| 61 } |
| 62 return devs; |
| 63 } |
| 64 |
| 65 } // namespace ns3 |
OLD | NEW |