4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
7 // Philipp Batroff <philipp.batroff@fokus.fraunhofer.de>
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the
21 // Free Software Foundation, Inc.,
22 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 \brief IPv6Extensions non-inline non-template implementation */
27 #include "IPv6Extensions.hh"
28 //#include "IPv6Extensions.ih"
31 #include <senf/Utils/hexdump.hh>
33 //#include "IPv6Extensions.mpp"
35 ///////////////////////////////cc.p////////////////////////////////////////
38 SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 44, senf::IPv6FragmentPacket );
39 SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 43, senf::IPv6RoutingPacket );
40 SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 0u, senf::IPv6HopByHopOptionsPacket );
41 SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 60u, senf::IPv6DestinationOptionsPacket );
44 prefix_ void senf::IPv6FragmentPacketType::dump(packet p, std::ostream & os)
46 os << "Internet protocol Version 6 fragment extension:\n"
47 << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n"
48 << senf::fieldName("fragment offset")
49 << "0x" << std::hex << unsigned(p->fragmentOffset()) << "\n"
50 << senf::fieldName("more fragments") << (p->moreFragments()?"yes":"no") << "\n"
51 << senf::fieldName("id")
52 << "0x" << std::hex << unsigned(p->id()) << "\n";
55 prefix_ void senf::IPv6RoutingPacketType::dump(packet p, std::ostream & os)
57 os << "Internet protocol Version 6 routing extension:\n"
58 << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n"
59 << senf::fieldName("header length") << unsigned(p->headerLength()) << "\n"
60 << senf::fieldName("routing type") << unsigned(p->routingType()) << "\n"
61 << senf::fieldName("segments left") << unsigned(p->segmentsLeft()) << "\n"
62 << " further Hop Addresses:\n";
63 typedef IPv6RoutingPacket::Parser::hopAddresses_t::container addrContainer_t;
64 addrContainer_t hopAddresses (p->hopAddresses());
65 if ( p->segmentsLeft() != 0 )
66 for (addrContainer_t::iterator i (hopAddresses.begin()); i != hopAddresses.end(); ++i)
67 os << " " << *i << "\n";
70 prefix_ void senf::IPv6HopByHopOptionsPacketType::dump(packet p, std::ostream & os)
72 os << "Internet protocol Version 6 Hop-By-Hop extension:\n"
73 << senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n"
74 << senf::fieldName("header length") << unsigned(p->headerLength()) << "\n";
75 os << " OptionTypes:\n";
76 typedef IPv6HopByHopOptionsPacket::Parser::options_t::container optContainer_t;
77 optContainer_t options (p->options());
78 optContainer_t::iterator optIter(options.begin());
79 for(; optIter != options.end(); ++optIter) {
80 os << senf::fieldName(" AltAction") << unsigned(optIter->altAction()) << "\n"
81 << senf::fieldName(" ChangeFlag") << unsigned(optIter->changeFlag()) << "\n"
82 << senf::fieldName(" Option Type") << unsigned(optIter->optionType()) << "\n"
83 << senf::fieldName(" length") << unsigned(optIter->length()) <<"\n";
84 senf::hexdump(boost::begin(optIter->value()) , boost::end(optIter->value()), os );
88 prefix_ void senf::IPv6DestinationOptionsPacketType::dump(packet p, std::ostream & os)
90 os << "Internet protocol Version 6 Destination Options extension:\n"
91 << senf::fieldName("next header") << unsigned (p->nextHeader()) << "\n"
92 << senf::fieldName("header length") << unsigned (p->headerLength()) << "\n";
95 ///////////////////////////////cc.e////////////////////////////////////////
97 //#include "IPv6Extensions.mpp"
103 // c-file-style: "senf"
104 // indent-tabs-mode: nil
105 // ispell-local-dictionary: "american"
106 // compile-command: "scons -u test"
107 // comment-column: 40