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;
49 typedef GenericTLVParserBase<NDPOptionParser> NDPGenericOptionParser;
51 struct NDPSourceLLAddressTLVParser : public NDPOptionParser
53 # include SENF_PARSER()
54 SENF_PARSER_INHERIT ( NDPOptionParser );
55 SENF_PARSER_FIELD ( source, MACAddressParser);
56 SENF_PARSER_FINALIZE ( NDPSourceLLAddressTLVParser);
63 static const type_t::value_type typeId = 0x01;
64 void dump(std::ostream & os) const;
67 struct NDPTargetLLAddressTLVParser : public NDPOptionParser
69 # include SENF_PARSER()
70 SENF_PARSER_INHERIT ( NDPOptionParser );
71 SENF_PARSER_FIELD ( target, MACAddressParser );
72 SENF_PARSER_FINALIZE ( NDPTargetLLAddressTLVParser );
79 static const UInt8Parser::value_type typeId = 0x02;
80 void dump(std::ostream & os) const;
83 struct NDPPrefixInformationTLVParser : public NDPOptionParser
85 # include SENF_PARSER()
86 SENF_PARSER_INHERIT ( NDPOptionParser );
87 SENF_PARSER_FIELD ( prefixLength, UInt8Parser );
88 SENF_PARSER_BITFIELD ( l, 1, bool );
89 SENF_PARSER_BITFIELD ( a, 1, bool );
90 SENF_PARSER_PRIVATE_BITFIELD ( reserved1, 6, unsigned );
91 SENF_PARSER_FIELD ( validLifetime, UInt32Parser );
92 SENF_PARSER_FIELD ( preferredLifetime, UInt32Parser );
93 SENF_PARSER_PRIVATE_BITFIELD ( reserved2, 32, unsigned );
94 SENF_PARSER_FIELD ( prefix, INet6AddressParser );
95 SENF_PARSER_FINALIZE ( NDPPrefixInformationTLVParser );
104 static const UInt8Parser::value_type typeId = 0x03;
105 void dump(std::ostream & os) const;
108 struct NDPMTUTLVParser : public NDPOptionParser
110 # include SENF_PARSER()
111 SENF_PARSER_INHERIT ( NDPOptionParser );
112 SENF_PARSER_PRIVATE_BITFIELD ( reserved, 16, unsigned );
113 SENF_PARSER_FIELD ( mtu, UInt32Parser );
114 SENF_PARSER_FINALIZE ( NDPMTUTLVParser );
122 static const UInt8Parser::value_type typeId = 0x05;
123 void dump(std::ostream & os) const;
127 ///////////////////////////////hh.e////////////////////////////////////////
128 //#include "NDPOptions.cci"
129 //#include "NDPOptions.ct"
130 //#include "NDPOptions.cti"
137 // c-file-style: "senf"
138 // indent-tabs-mode: nil
139 // ispell-local-dictionary: "american"
140 // compile-command: "scons -u test"
141 // comment-column: 40