Documentation updates
[senf.git] / Packets / DefaultBundle / IPv6Packet.cc
1 // Copyright (C) 2007
2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 //     Stefan Bund <g0dil@berlios.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 /** \file
22     \brief IPv6Packet non-inline non-template implementation */
23
24 #include "IPv6Packet.hh"
25 //#include "IPv6Packet.ih"
26
27 // Custom includes
28 #include <iomanip>
29 #include <boost/io/ios_state.hpp>
30 #include "EthernetPacket.hh"
31 #include "../../Socket/Protocols/INet/INetAddressing.hh"
32
33 //#include "IPv6Packet.mpp"
34 #define prefix_
35 ///////////////////////////////cc.p////////////////////////////////////////
36
37 namespace {
38     senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IPv6Packet>
39         registerIPv6Packet (0x86dd);
40
41     senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6Packet>
42         registerIPv6Packet2 (41); // IP6-in-IP(6) encapsulation
43
44     senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::DataPacket>
45         registerNoNextHeader (59);
46 }
47
48 prefix_ void senf::IPv6PacketType::dump(packet p, std::ostream & os)
49 {
50     boost::io::ios_all_saver ias(os);
51     os << "Internet protocol Version 6:\n"
52        << "  version        : " << unsigned(p->version()) << "\n"
53        << "  traffic class  : 0x" 
54          << std::hex << std::setw(2) << std::setfill('0') << unsigned(p->trafficClass()) << "\n"
55        << "  flow label     : 0x" 
56          << std::hex << std::setw(5) << std::setfill('0') << unsigned(p->flowLabel()) << "\n"
57        << "  payload length : " << std::dec << unsigned(p->length()) << "\n"
58        << "  next header    : " << unsigned(p->nextHeader()) << "\n"
59        << "  hop limit      : " << unsigned(p->hopLimit()) << "\n"
60        << "  source         : " << p->source() << "\n"
61        << "  destination    : " << p->destination() << "\n";
62 }
63
64 prefix_ void senf::IPv6PacketType::finalize(packet p)
65 {
66     p->length() << (p.size() - Parse_IPv6::fixed_bytes);
67     p->nextHeader() << key(p.next());
68 }
69
70 ///////////////////////////////cc.e////////////////////////////////////////
71 #undef prefix_
72 //#include "IPv6Packet.mpp"
73
74 \f
75 // Local Variables:
76 // mode: c++
77 // fill-column: 100
78 // c-file-style: "senf"
79 // indent-tabs-mode: nil
80 // ispell-local-dictionary: "american"
81 // compile-command: "scons -u test"
82 // comment-column: 40
83 // End: