![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiMeMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2011 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 5, D-52074 Aachen, Germany 00009 * phone: ++49-241-80-27910, 00010 * fax: ++49-241-80-22242 00011 * email: info@openwns.org 00012 * www: http://www.openwns.org 00013 * _____________________________________________________________________________ 00014 * 00015 * openWNS is free software; you can redistribute it and/or modify it under the 00016 * terms of the GNU Lesser General Public License version 2 as published by the 00017 * Free Software Foundation; 00018 * 00019 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00020 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00021 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00022 * details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00026 * 00027 ******************************************************************************/ 00028 00029 #include <WIMEMAC/helper/TargetKeys.hpp> 00030 00031 using namespace wimemac::helper; 00032 00033 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00034 wimemac::helper::MACIDKeyBuilder, 00035 wns::ldk::KeyBuilder, 00036 "wimemac.helper.MACIDKeyBuilder", 00037 wns::ldk::FUNConfigCreator ); 00038 00039 TargetMACKey::TargetMACKey(const MACIDKeyBuilder* factory, const wns::ldk::CompoundPtr& compound, int) 00040 { 00041 wns::ldk::CommandPool* commandPool = compound->getCommandPool(); 00042 wimemac::convergence::UnicastUpperCommand* unicastcommand = 00043 factory->friends.keyReader->readCommand<wimemac::convergence::UnicastUpperCommand>(commandPool); 00044 00045 00046 rx = unicastcommand->peer.targetMACAddress; 00047 } 00048 00049 00050 bool 00051 TargetMACKey::operator<(const wns::ldk::Key& _other) const 00052 { 00053 00054 assureType(&_other, const TargetMACKey*); 00055 const TargetMACKey* other = static_cast<const TargetMACKey*>(&_other); 00056 if(rx == other->rx) 00057 return rx < other->rx; 00058 } 00059 00060 std::string 00061 TargetMACKey::str() const 00062 { 00063 std::stringstream ss; 00064 ss << "MAC Address: " << rx; 00065 return ss.str(); 00066 } 00067 00068 00069 MACIDKeyBuilder::MACIDKeyBuilder(const wns::ldk::fun::FUN* _fun, const wns::pyconfig::View&): 00070 fun(_fun) 00071 { 00072 } 00073 void 00074 MACIDKeyBuilder::onFUNCreated() 00075 { 00076 friends.keyReader = fun->getProxy()->getCommandReader("unicastUpperConvergence"); 00077 } 00078 00079 00080 wns::ldk::ConstKeyPtr 00081 MACIDKeyBuilder::operator() (const wns::ldk::CompoundPtr& compound, int direction) const 00082 { 00083 return wns::ldk::ConstKeyPtr(new TargetMACKey(this, compound, direction)); 00084 }
1.5.5