switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Packets / DefaultBundle / NDPOptions.cc
1 // $Id$
2 //
3 // Copyright (C) 2010
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
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
10 //
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.
14 //
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.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
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.
24 //
25 // Contributor(s):
26 //   Stefan Sauer <ssauer@berlios.de>
27
28
29 // Definition of non-inline non-template functions
30
31 // Custom includes
32 #include "NDPOptions.hh"
33
34 #define prefix_
35 //-/////////////////////////////////////////////////////////////////////////////////////////////////
36 SENF_PACKET_TLV_REGISTRY_REGISTER( senf::NDPSourceLLAddressTLVParser );
37 SENF_PACKET_TLV_REGISTRY_REGISTER( senf::NDPTargetLLAddressTLVParser );
38 SENF_PACKET_TLV_REGISTRY_REGISTER( senf::NDPPrefixInformationTLVParser );
39 SENF_PACKET_TLV_REGISTRY_REGISTER( senf::NDPMTUTLVParser );
40
41 prefix_ void senf::NDPSourceLLAddressTLVParser::dump(std::ostream & os) const
42 {
43     os << "Source Link-layer Address Option:" << "\n";
44     os << senf::fieldName("Link-layer Address") << source() << "\n";
45 }
46
47 prefix_ void senf::NDPTargetLLAddressTLVParser::dump(std::ostream & os) const
48 {
49     os << "Target Link-layer Address Option:" << "\n";
50     os << senf::fieldName("Link-layer Address") << target() << "\n";
51 }
52
53 prefix_ void senf::NDPPrefixInformationTLVParser::dump(std::ostream & os) const
54 {
55     os << "Prefix Information Option:" << "\n";
56     os << senf::fieldName("Prefix Length")                         << unsigned(prefixLength()) << "\n";
57     os << senf::fieldName("On-link Flag")                          << unsigned(l()) << "\n";
58     os << senf::fieldName("Autonomous Address-configuration Flag") << unsigned(a()) << "\n";
59     os << senf::fieldName("Reserved(6Bit)")                        << unsigned(reserved1()) << "\n";
60     os << senf::fieldName("Valid Lifetime")                        << unsigned(validLifetime()) << "\n";
61     os << senf::fieldName("Preferred Lifetime")                    << unsigned(preferredLifetime()) << "\n";
62     os << senf::fieldName("Reserved(32Bit)")                       << unsigned(reserved2()) << "\n";
63     os << senf::fieldName("Prefix")                                << prefix() << "\n";
64
65 }
66
67 prefix_ void senf::NDPMTUTLVParser::dump(std::ostream & os) const
68 {
69     os << "MTU Information Option:" << "\n";
70     os << senf::fieldName("MTU") << unsigned(mtu()) << "\n";
71 }
72
73
74 //-/////////////////////////////////////////////////////////////////////////////////////////////////
75 #undef prefix_