4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Sauer <ssauer@berlios.de>
28 // Definition of non-inline non-template functions
30 #ifndef HH_SENF_Packets_DefaultBundle_NDPOptions_
31 #define HH_SENF_Packets_DefaultBundle_NDPOptions_ 1
34 #include <senf/Packets/Packets.hh>
35 #include <senf/Packets/DefaultBundle/EthernetPacket.hh>
36 #include <senf/Packets/DefaultBundle/IPv6Packet.hh>
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
41 //#############################################################
42 //ICMPv6 Neighbor Discovery (RFC 4861) Options
43 //#############################################################
44 struct NDPOptionParser : public PacketParserBase
47 # include SENF_PARSER()
48 SENF_PARSER_FIELD ( type, UInt8Parser );
49 SENF_PARSER_FIELD ( length, UInt8Parser );
50 SENF_PARSER_FINALIZE ( NDPOptionParser );
52 typedef GenericTLVParserRegistry<NDPOptionParser> Registry;
55 struct NDPGenericOptionParser : public GenericTLVParserBase<NDPOptionParser>
57 typedef GenericTLVParserBase<NDPOptionParser> base;
58 NDPGenericOptionParser(data_iterator i, state_type s) : base(i,s) {}
60 senf::PacketParserBase::size_type bytes() const
66 struct NDPSourceLLAddressTLVParser : public NDPOptionParser
68 # include SENF_PARSER()
69 SENF_PARSER_INHERIT ( NDPOptionParser );
70 SENF_PARSER_FIELD ( source, MACAddressParser);
71 SENF_PARSER_FINALIZE ( NDPSourceLLAddressTLVParser);
78 static const type_t::value_type typeId = 0x01;
79 void dump(std::ostream & os) const;
82 struct NDPTargetLLAddressTLVParser : public NDPOptionParser
84 # include SENF_PARSER()
85 SENF_PARSER_INHERIT ( NDPOptionParser );
86 SENF_PARSER_FIELD ( target, MACAddressParser );
87 SENF_PARSER_FINALIZE ( NDPTargetLLAddressTLVParser );
95 senf::PacketParserBase::size_type bytes(NDPTargetLLAddressTLVParser p) {
98 static const type_t::value_type typeId = 0x02;
99 void dump(std::ostream & os) const;
102 struct NDPPrefixInformationTLVParser : public NDPOptionParser
104 # include SENF_PARSER()
105 SENF_PARSER_INHERIT ( NDPOptionParser );
106 SENF_PARSER_FIELD ( prefixLength, UInt8Parser );
107 SENF_PARSER_BITFIELD ( l, 1, bool );
108 SENF_PARSER_BITFIELD ( a, 1, bool );
109 SENF_PARSER_PRIVATE_BITFIELD ( reserved1, 6, unsigned );
110 SENF_PARSER_FIELD ( validLifetime, UInt32Parser );
111 SENF_PARSER_FIELD ( preferredLifetime, UInt32Parser );
112 SENF_PARSER_PRIVATE_BITFIELD ( reserved2, 32, unsigned );
113 SENF_PARSER_FIELD ( prefix, INet6AddressParser );
114 SENF_PARSER_FINALIZE ( NDPPrefixInformationTLVParser );
123 senf::PacketParserBase::size_type bytes(NDPPrefixInformationTLVParser p) {
126 static const UInt8Parser::value_type typeId = 0x03;
127 void dump(std::ostream & os) const;
130 struct NDPMTUTLVParser : public NDPOptionParser
132 # include SENF_PARSER()
133 SENF_PARSER_INHERIT ( NDPOptionParser );
134 SENF_PARSER_PRIVATE_BITFIELD ( reserved, 16, unsigned );
135 SENF_PARSER_FIELD ( mtu, UInt32Parser );
136 SENF_PARSER_FINALIZE ( NDPMTUTLVParser );
144 static const UInt8Parser::value_type typeId = 0x05;
145 void dump(std::ostream & os) const;
149 //-/////////////////////////////////////////////////////////////////////////////////////////////////
150 //#include "NDPOptions.cci"
151 //#include "NDPOptions.ct"
152 //#include "NDPOptions.cti"
159 // c-file-style: "senf"
160 // indent-tabs-mode: nil
161 // ispell-local-dictionary: "american"
162 // compile-command: "scons -u test"
163 // comment-column: 40