2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief IpV6Packet public header */
24 #ifndef HH_IpV6Packet_
25 #define HH_IpV6Packet_ 1
29 #include "ParseInt.hh"
30 #include "ParseArray.hh"
31 #include "PacketRegistry.hh"
32 #include "IpV4Packet.hh"
34 //#include "IpV6Packet.mpp"
35 ///////////////////////////////hh.p////////////////////////////////////////
40 template <class Iterator=nil, class IpV6Packet=nil>
41 struct Parse_IpV6 : public ParserBase<Iterator,IpV6Packet>
43 template <class I, class P=nil>
44 struct rebind { typedef Parse_IpV6<I,P> parser; };
45 typedef Iterator byte_iterator;
48 Parse_IpV6(Iterator const & i) : ParserBase<Iterator,IpV6Packet>(i) {}
50 static unsigned bytes() { return 40; }
52 ///////////////////////////////////////////////////////////////////////////
54 typedef Parse_UIntField < 0, 4, Iterator > Parse_Version;
55 typedef Parse_UIntField < 4, 12, Iterator > Parse_Class;
56 typedef Parse_UIntField < 12, 32, Iterator > Parse_FlowLabel;
57 typedef Parse_UInt8 < Iterator > Parse_8bit;
58 typedef Parse_UInt16 < Iterator > Parse_16bit;
60 typedef Parse_Array < 16, Parse_8bit, Iterator > Parse_Addr;
62 Parse_Version version() const { return Parse_Version (this->i() ); }
63 Parse_Class trafficClass() const { return Parse_Class (this->i() ); }
64 Parse_FlowLabel flowLabel() const { return Parse_FlowLabel (this->i() ); }
65 Parse_16bit length() const { return Parse_16bit (this->i() + 4 ); }
66 Parse_8bit nextHeader() const { return Parse_8bit (this->i() + 6 ); }
67 Parse_8bit hopLimit() const { return Parse_8bit (this->i() + 7 ); }
68 Parse_Addr source() const { return Parse_Addr (this->i() + 8 ); }
69 Parse_Addr destination() const { return Parse_Addr (this->i() + 24 ); }
74 public Parse_IpV6<Packet::iterator, IpV6Packet>,
75 public PacketRegistryMixin<IpTypes, IpV6Packet>
77 using PacketRegistryMixin<IpTypes,IpV6Packet>::registerInterpreter;
79 ///////////////////////////////////////////////////////////////////////////
82 typedef ptr_t<IpV6Packet>::ptr ptr;
84 ///////////////////////////////////////////////////////////////////////////
88 IpV6Packet(Arg const & arg);
90 virtual void v_nextInterpreter() const;
91 virtual void v_finalize();
92 virtual void v_dump(std::ostream & os) const;
99 ///////////////////////////////hh.e////////////////////////////////////////
100 //#include "IpV6Packet.cci"
101 //#include "IpV6Packet.ct"
102 #include "IpV6Packet.cti"
109 // c-file-style: "senf"
110 // indent-tabs-mode: nil
111 // ispell-local-dictionary: "american"