1 // $Id: ICMPv6TypePacket.hh 1449 2009-09-25 23:03:48Z g0dil $
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/ListOptionTypeParser.hh>
34 //#############################################################
35 //ICMPv6 Neighbor Discovery (RFC 4861) Options
36 //#############################################################
37 struct NDPOptionParser : public PacketParserBase
40 # include SENF_PARSER()
41 SENF_PARSER_FIELD ( type, UInt8Parser );
42 SENF_PARSER_FIELD ( length, UInt8Parser );
43 SENF_PARSER_FINALIZE ( NDPOptionParser );
45 typedef GenericTLVParserRegistry<NDPOptionParser> Registry;
47 typedef GenericTLVParserBase<NDPOptionParser> NDPGenericOptionParser;
49 struct NDPSourceLLAddressTLVParser : public NDPOptionParser
51 # include SENF_PARSER()
52 SENF_PARSER_INHERIT ( NDPOptionParser );
53 SENF_PARSER_FIELD ( source, MACAddressParser);
54 SENF_PARSER_FINALIZE ( NDPSourceLLAddressTLVParser);
61 static const type_t::value_type typeId = 0x01;
62 void dump(std::ostream & os) const;
65 struct NDPTargetLLAddressTLVParser : public NDPOptionParser
67 # include SENF_PARSER()
68 SENF_PARSER_INHERIT ( NDPOptionParser );
69 SENF_PARSER_FIELD ( target, MACAddressParser );
70 SENF_PARSER_FINALIZE ( NDPTargetLLAddressTLVParser );
77 static const UInt8Parser::value_type typeId = 0x02;
78 void dump(std::ostream & os) const;
81 struct NDPPrefixInformationTLVParser : public NDPOptionParser
83 # include SENF_PARSER()
84 SENF_PARSER_INHERIT ( NDPOptionParser );
85 SENF_PARSER_FIELD ( prefixLength, UInt8Parser );
86 SENF_PARSER_BITFIELD ( l, 1, bool );
87 SENF_PARSER_BITFIELD ( a, 1, bool );
88 SENF_PARSER_PRIVATE_BITFIELD ( reserved1, 6, unsigned );
89 SENF_PARSER_FIELD ( validLifetime, UInt32Parser );
90 SENF_PARSER_FIELD ( preferredLifetime, UInt32Parser );
91 SENF_PARSER_PRIVATE_BITFIELD ( reserved2, 32, unsigned );
92 SENF_PARSER_FIELD ( prefix, INet6AddressParser );
93 SENF_PARSER_FINALIZE ( NDPPrefixInformationTLVParser );
102 static const UInt8Parser::value_type typeId = 0x03;
103 void dump(std::ostream & os) const;
106 struct NDPMTUTLVParser : public NDPOptionParser
108 # include SENF_PARSER()
109 SENF_PARSER_INHERIT ( NDPOptionParser );
110 SENF_PARSER_PRIVATE_BITFIELD ( reserved, 16, unsigned );
111 SENF_PARSER_FIELD ( mtu, UInt32Parser );
112 SENF_PARSER_FINALIZE ( NDPMTUTLVParser );
120 static const UInt8Parser::value_type typeId = 0x05;
121 void dump(std::ostream & os) const;
131 // c-file-style: "senf"
132 // indent-tabs-mode: nil
133 // ispell-local-dictionary: "american"
134 // compile-command: "scons -u test"
135 // comment-column: 40