4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Sauer <ssauer@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Definition of non-inline non-template functions
25 #ifndef HH_SENF_Packets_DefaultBundle_NDPOptions_
26 #define HH_SENF_Packets_DefaultBundle_NDPOptions_ 1
29 #include <senf/Packets/Packets.hh>
30 #include <senf/Packets/DefaultBundle/EthernetPacket.hh>
31 #include <senf/Packets/DefaultBundle/IPv6Packet.hh>
33 ///////////////////////////////hh.p////////////////////////////////////////
36 //#############################################################
37 //ICMPv6 Neighbor Discovery (RFC 4861) Options
38 //#############################################################
39 struct NDPOptionParser : public PacketParserBase
42 # include SENF_PARSER()
43 SENF_PARSER_FIELD ( type, UInt8Parser );
44 SENF_PARSER_FIELD ( length, UInt8Parser );
45 SENF_PARSER_FINALIZE ( NDPOptionParser );
47 typedef GenericTLVParserRegistry<NDPOptionParser> Registry;
50 struct NDPGenericOptionParser : public GenericTLVParserBase<NDPOptionParser>
52 typedef GenericTLVParserBase<NDPOptionParser> base;
53 NDPGenericOptionParser(data_iterator i, state_type s) : base(i,s) {}
55 senf::PacketParserBase::size_type bytes() const
61 struct NDPSourceLLAddressTLVParser : public NDPOptionParser
63 # include SENF_PARSER()
64 SENF_PARSER_INHERIT ( NDPOptionParser );
65 SENF_PARSER_FIELD ( source, MACAddressParser);
66 SENF_PARSER_FINALIZE ( NDPSourceLLAddressTLVParser);
73 static const type_t::value_type typeId = 0x01;
74 void dump(std::ostream & os) const;
77 struct NDPTargetLLAddressTLVParser : public NDPOptionParser
79 # include SENF_PARSER()
80 SENF_PARSER_INHERIT ( NDPOptionParser );
81 SENF_PARSER_FIELD ( target, MACAddressParser );
82 SENF_PARSER_FINALIZE ( NDPTargetLLAddressTLVParser );
90 senf::PacketParserBase::size_type bytes(NDPTargetLLAddressTLVParser p) {
93 static const type_t::value_type typeId = 0x02;
94 void dump(std::ostream & os) const;
97 struct NDPPrefixInformationTLVParser : public NDPOptionParser
99 # include SENF_PARSER()
100 SENF_PARSER_INHERIT ( NDPOptionParser );
101 SENF_PARSER_FIELD ( prefixLength, UInt8Parser );
102 SENF_PARSER_BITFIELD ( l, 1, bool );
103 SENF_PARSER_BITFIELD ( a, 1, bool );
104 SENF_PARSER_PRIVATE_BITFIELD ( reserved1, 6, unsigned );
105 SENF_PARSER_FIELD ( validLifetime, UInt32Parser );
106 SENF_PARSER_FIELD ( preferredLifetime, UInt32Parser );
107 SENF_PARSER_PRIVATE_BITFIELD ( reserved2, 32, unsigned );
108 SENF_PARSER_FIELD ( prefix, INet6AddressParser );
109 SENF_PARSER_FINALIZE ( NDPPrefixInformationTLVParser );
118 senf::PacketParserBase::size_type bytes(NDPPrefixInformationTLVParser p) {
121 static const UInt8Parser::value_type typeId = 0x03;
122 void dump(std::ostream & os) const;
125 struct NDPMTUTLVParser : public NDPOptionParser
127 # include SENF_PARSER()
128 SENF_PARSER_INHERIT ( NDPOptionParser );
129 SENF_PARSER_PRIVATE_BITFIELD ( reserved, 16, unsigned );
130 SENF_PARSER_FIELD ( mtu, UInt32Parser );
131 SENF_PARSER_FINALIZE ( NDPMTUTLVParser );
139 static const UInt8Parser::value_type typeId = 0x05;
140 void dump(std::ostream & os) const;
144 ///////////////////////////////hh.e////////////////////////////////////////
145 //#include "NDPOptions.cci"
146 //#include "NDPOptions.ct"
147 //#include "NDPOptions.cti"
154 // c-file-style: "senf"
155 // indent-tabs-mode: nil
156 // ispell-local-dictionary: "american"
157 // compile-command: "scons -u test"
158 // comment-column: 40