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 Bund <g0dil@berlios.de>
27 // Philipp Batroff <pug@berlios.de>
30 \brief IPv6Extensions non-inline non-template implementation */
32 #include "IPv6Extensions.hh"
33 //#include "IPv6Extensions.ih"
37 //#include "IPv6Extensions.mpp"
39 //-/////////////////////////////////////////////////////////////////////////////////////////////////
42 SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 44, senf::IPv6FragmentPacket );
43 SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 43, senf::IPv6RoutingPacket );
44 SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 0u, senf::IPv6HopByHopOptionsPacket );
45 SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 60u, senf::IPv6DestinationOptionsPacket );
48 prefix_ void senf::IPv6FragmentPacketType::dump(packet p, std::ostream & os)
50 os << "Internet protocol Version 6 fragment extension:\n"
51 << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n"
52 << senf::fieldName("fragment offset")
53 << "0x" << std::hex << unsigned(p->fragmentOffset()) << "\n"
54 << senf::fieldName("more fragments") << (p->moreFragments()?"yes":"no") << "\n"
55 << senf::fieldName("id")
56 << "0x" << std::hex << unsigned(p->id()) << "\n";
59 prefix_ void senf::IPv6FragmentPacketType::finalize(packet p)
62 p->nextHeader() << key(p.next());
64 catch (InvalidPacketChainException & ex) {
65 p->nextHeader() << 59; // No next header
69 prefix_ void senf::IPv6RoutingPacketType::dump(packet p, std::ostream & os)
71 os << "Internet protocol Version 6 routing extension:\n"
72 << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n"
73 << senf::fieldName("header length") << unsigned(p->headerLength()) << "\n"
74 << senf::fieldName("routing type") << unsigned(p->routingType()) << "\n"
75 << senf::fieldName("segments left") << unsigned(p->segmentsLeft()) << "\n"
76 << " further Hop Addresses:\n";
77 typedef IPv6RoutingPacket::Parser::hopAddresses_t::container addrContainer_t;
78 addrContainer_t hopAddresses (p->hopAddresses());
79 if ( p->segmentsLeft() != 0 )
80 for (addrContainer_t::iterator i (hopAddresses.begin()); i != hopAddresses.end(); ++i)
81 os << " " << *i << "\n";
84 prefix_ void senf::IPv6RoutingPacketType::finalize(packet p)
87 p->nextHeader() << key(p.next());
89 catch (InvalidPacketChainException & ex) {
90 p->nextHeader() << 59; // No next header
94 prefix_ void senf::IPv6HopByHopOptionsPacketType::dump(packet p, std::ostream & os)
96 os << "Internet protocol Version 6 Hop-By-Hop extension:\n"
97 << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n"
98 << senf::fieldName("header length") << unsigned(p->headerLength()) <<" ("<< unsigned((1+p->headerLength())*8)<< ")\n";
99 os << " OptionTypes:\n";
100 typedef IPv6HopByHopOptionsPacket::Parser::options_t::container optContainer_t;
101 optContainer_t options (p->options());
102 for (optContainer_t::const_iterator i = options.begin(); i != options.end(); ++i)
106 prefix_ void senf::IPv6HopByHopOptionsPacketType::finalize(packet p)
109 p->nextHeader() << key(p.next());
111 catch (InvalidPacketChainException & ex) {
112 p->nextHeader() << 59; // No next header
116 prefix_ void senf::IPv6DestinationOptionsPacketType::dump(packet p, std::ostream & os)
118 os << "Internet protocol Version 6 Destination Options extension:\n"
119 << senf::fieldName("next header") << unsigned (p->nextHeader()) << "\n"
120 << senf::fieldName("header length") << unsigned (p->headerLength()) << "\n";
121 os << " OptionTypes:\n";
122 typedef IPv6DestinationOptionsPacket::Parser::options_t::container optContainer_t;
123 optContainer_t options (p->options());
124 for (optContainer_t::const_iterator i = options.begin(); i != options.end(); ++i)
128 prefix_ void senf::IPv6DestinationOptionsPacketType::finalize(packet p)
131 p->nextHeader() << key(p.next());
133 catch (InvalidPacketChainException & ex) {
134 p->nextHeader() << 59; // No next header
139 //-/////////////////////////////////////////////////////////////////////////////////////////////////
141 //#include "IPv6Extensions.mpp"
147 // c-file-style: "senf"
148 // indent-tabs-mode: nil
149 // ispell-local-dictionary: "american"
150 // compile-command: "scons -u test"
151 // comment-column: 40