|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2005 Andras Varga 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 00019 #ifndef _IPv6DATAGRAM_H_ 00020 #define _IPv6DATAGRAM_H_ 00021 00022 #include <list> 00023 #include "INETDefs.h" 00024 #include "IPv6Datagram_m.h" 00025 00030 class INET_API IPv6Datagram : public IPv6Datagram_Base 00031 { 00032 protected: 00033 typedef std::vector<IPv6ExtensionHeader*> ExtensionHeaders; 00034 ExtensionHeaders extensionHeaders; 00035 00036 public: 00037 IPv6Datagram(const char *name=NULL, int kind=0) : IPv6Datagram_Base(name,kind) {} 00038 IPv6Datagram(const IPv6Datagram& other) : IPv6Datagram_Base(other.getName()) {operator=(other);} 00039 IPv6Datagram& operator=(const IPv6Datagram& other); 00040 virtual IPv6Datagram *dup() const {return new IPv6Datagram(*this);} 00041 00043 virtual void setExtensionHeaderArraySize(unsigned int size); 00045 virtual void setExtensionHeader(unsigned int k, const IPv6ExtensionHeaderPtr& extensionHeader_var); 00046 00050 virtual unsigned int getExtensionHeaderArraySize() const; 00051 00055 virtual IPv6ExtensionHeaderPtr& getExtensionHeader(unsigned int k); 00056 00061 virtual void addExtensionHeader(IPv6ExtensionHeader *eh, int atPos=-1); 00062 00067 virtual int calculateHeaderByteLength() const; 00068 }; 00069 00074 class INET_API IPv6ExtensionHeader : public IPv6ExtensionHeader_Base 00075 { 00076 public: 00077 IPv6ExtensionHeader() : IPv6ExtensionHeader_Base() {} 00078 IPv6ExtensionHeader(const IPv6ExtensionHeader& other) : IPv6ExtensionHeader_Base() {operator=(other);} 00079 IPv6ExtensionHeader& operator=(const IPv6ExtensionHeader& other) {IPv6ExtensionHeader_Base::operator=(other); return *this;} 00080 virtual IPv6ExtensionHeader *dup() const {throw cRuntimeError(this, "dup() should be redefined");} 00081 virtual IPProtocolId getExtensionType() const; 00082 virtual int getByteLength() const; 00083 }; 00084 00085 #endif 00086 00087