![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2009 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 5, D-52074 Aachen, Germany 00008 * email: info@openwns.org 00009 * www: http://www.openwns.org 00010 * _____________________________________________________________________________ 00011 * 00012 * openWNS is free software; you can redistribute it and/or modify it under the 00013 * terms of the GNU Lesser General Public License version 2 as published by the 00014 * Free Software Foundation; 00015 * 00016 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00017 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00018 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00019 * details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public License 00022 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 * 00024 ******************************************************************************/ 00025 #include <WIMAC/ConnectionIdentifier.hpp> 00026 00027 #include <iostream> 00028 #include <sstream> 00029 00030 using namespace wimac; 00031 00032 ConnectionIdentifier::ConnectionIdentifier () : 00033 baseStation_(0), 00034 cid_(-1), 00035 subscriberStation_(0), 00036 remoteStation_(0), 00037 connectionType_(NoType), 00038 direction_(NoDirection), 00039 qos_(NoQoS), 00040 ciNotListening_(-1), 00041 valid_(false) 00042 { 00043 commandKeyClasses_.connectionClassifier = NULL; 00044 } 00045 00046 00047 ConnectionIdentifier::ConnectionIdentifier(StationID baseStation, 00048 StationID subscriberStation, 00049 StationID remoteStation, 00050 ConnectionType connectionType, 00051 Direction direction, 00052 int qos) : 00053 baseStation_(baseStation), 00054 cid_(-1), 00055 subscriberStation_(subscriberStation), 00056 remoteStation_(remoteStation), 00057 connectionType_(connectionType), 00058 direction_(direction), 00059 qos_(qos), 00060 ciNotListening_(0), 00061 valid_(true) 00062 { 00063 commandKeyClasses_.connectionClassifier = NULL; 00064 } 00065 00066 ConnectionIdentifier::ConnectionIdentifier (StationID baseStation, 00067 CID cid, 00068 StationID subscriberStation, 00069 StationID remoteStation, 00070 ConnectionType connectionType, 00071 Direction direction, 00072 int qos): 00073 baseStation_(baseStation), 00074 cid_(cid), 00075 subscriberStation_(subscriberStation), 00076 remoteStation_(remoteStation), 00077 connectionType_(connectionType), 00078 direction_(direction), 00079 qos_(qos), 00080 ciNotListening_(0), 00081 valid_(true) 00082 { 00083 commandKeyClasses_.connectionClassifier = NULL; 00084 } 00085 00086 ConnectionIdentifier::ConnectionIdentifier( const ConnectionIdentifier& other ) : 00087 wns::CloneableInterface( other ), 00088 wns::RefCountable( other ), 00089 wns::Cloneable<ConnectionIdentifier>( other ), 00090 wns::IOutputStreamable( other ), 00091 baseStation_( other.baseStation_ ), 00092 cid_( other.cid_ ), 00093 subscriberStation_( other.subscriberStation_ ), 00094 remoteStation_( other.remoteStation_ ), 00095 connectionType_( other.connectionType_ ), 00096 direction_( other.direction_ ), 00097 qos_( other.qos_ ), 00098 ciNotListening_( other.ciNotListening_), 00099 valid_( other.valid_ ) 00100 { 00101 commandKeyClasses_.connectionClassifier = other.commandKeyClasses_.connectionClassifier; 00102 } 00103 00104 std::string 00105 ConnectionIdentifier::doToString() const 00106 { 00107 std::ostringstream log; 00108 log << " CID:" << cid_ 00109 << "; Type:" << connectionType_ 00110 << "," << direction_ 00111 << "; QoSCategory:" << qos_ 00112 << "; SS:" << subscriberStation_ 00113 << "; BS:" << baseStation_; 00114 return log.str(); 00115 } 00116 00117 bool 00118 ConnectionIdentifier::integrityCheck() const 00119 { 00120 00121 if( (connectionType_ == ConnectionIdentifier::InitialRanging) 00122 || (connectionType_ == ConnectionIdentifier::Basic) 00123 || (connectionType_ == ConnectionIdentifier::PrimaryManagement) 00124 || (connectionType_ == ConnectionIdentifier::SecondaryManagement) ) 00125 { 00126 if(direction_ == ConnectionIdentifier::Bidirectional) 00127 if(qos_ == ConnectionIdentifier::Signaling) 00128 return true; 00129 00130 } else if( connectionType_ == ConnectionIdentifier::Data ) 00131 { 00132 if( (direction_ == ConnectionIdentifier::Downlink) 00133 || (direction_ == ConnectionIdentifier::Uplink)) 00134 if( (qos_ == ConnectionIdentifier::UGS) 00135 || (qos_ == ConnectionIdentifier::rtPS) 00136 || (qos_ == ConnectionIdentifier::nrtPS) 00137 || (qos_ == ConnectionIdentifier::BE)) 00138 return true; 00139 } 00140 00141 return false; 00142 }
1.5.5