![]() |
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-2007 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 16, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #ifndef WNS_PDU_HPP 00029 #define WNS_PDU_HPP 00030 00031 00032 #include <WNS/RefCountable.hpp> 00033 #include <WNS/IOutputStreamable.hpp> 00034 #include <WNS/SmartPtr.hpp> 00035 #include <WNS/simulator/Bit.hpp> 00036 00037 #include <stdint.h> 00038 #include <ostream> 00039 #include <iostream> 00040 00041 namespace wns { namespace osi { 00042 00043 class PDU; 00044 class PCI; 00045 typedef wns::SmartPtr<PDU> PDUPtr; 00046 /* We have to do that here not in PCI.hpp since typedefs can not be forward declared*/ 00047 typedef wns::SmartPtr<PCI> PCIPtr; 00048 00049 typedef unsigned long int pduType; 00053 class PDU : 00054 virtual public wns::RefCountable, 00055 public wns::IOutputStreamable 00056 { 00057 public: 00058 // Default constructor 00059 explicit 00060 PDU(PCI* aPCIPtr = NULL, PDU* anSDUPtr = NULL); 00061 00062 00063 // Copy constructor 00064 PDU(const PDU& aPDURef); 00065 00066 // Destructor 00067 virtual ~PDU(); 00068 00069 // Normal output 00070 virtual void print(std::ostream& aStreamRef = std::cout) const; 00071 00072 // Set protocol control information 00073 void setPCI(PCI* aPCIPtr); 00074 00075 // Get protocol control information 00076 PCI* getPCI() const; 00077 00078 // Set encoded higher layer information 00079 void setUserData(PDU* aUserDataPtr); 00080 00081 // Get encoded higher layer information 00082 PDU* getUserData() const; 00083 00084 // Set type of PDU 00085 void setPDUType(pduType aPDUType); 00086 00087 // Get type of PDU 00088 pduType getPDUType() const; 00089 00090 // Get unique identifier 00091 unsigned long int getPDUId() const; 00092 00093 // clone this PDU 00094 virtual PDU* clone(); 00095 00099 Bit getLengthInBits() const; 00100 00101 #ifndef NDEBUG 00102 static long int 00103 getExistingPDUs(); 00104 00105 static long int 00106 getMaxExistingPDUs(); 00107 00108 virtual size_t 00109 calcObjSize() const; 00110 #endif 00111 00112 private: 00116 virtual Bit doGetLengthInBits() const; 00118 PCIPtr p_pciPtr; 00119 00121 PDUPtr p_userDataPtr; 00122 00123 virtual std::string 00124 doToString() const; 00125 00126 #ifndef NDEBUG 00127 static long int existingPDUs; 00128 static long int maxExistingPDUs; 00129 #endif 00130 }; 00131 00132 } // wns 00133 } // osi 00134 00135 #endif // NOT defined WNS_PDU_HPP 00136 00137 /* 00138 Local Variables: 00139 mode: c++ 00140 folded-file: t 00141 End: 00142 */ 00143
1.5.5