2b7b2b379c14a90a0ce2d1ae050c29cdf8d1b7bd
[senf.git] / senf / Packets / MPEGDVBBundle / DTCPPacket.cc
1 // $Id:TransportPacket.hh 560 2007-12-13 14:39:37Z tho $
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     David Wagner <dw6@berlios.de>
7 //
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.
12 //
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.
17 //
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.
22
23 /** \file
24     \brief DTCPPacket non-inline non-template implementation */
25
26 #include "DTCPPacket.hh"
27 //#include "DTCPPacket.ih"
28
29 // Custom includes
30 #include <boost/io/ios_state.hpp>
31 #include <iomanip>
32
33 #define prefix_
34 //-/////////////////////////////////////////////////////////////////////////////////////////////////
35
36 prefix_ void senf::DTCPHelloPacketType::dump(packet p, std::ostream & os)
37 {
38     static char const * COMMANDS[] = { "0", "JOIN", "LEAVE", "3", "4", "5", "6", "7",
39                                        "8", "9", "10", "11", "12", "13", "14", "15" };
40     boost::io::ios_all_saver ias(os);
41     os << "DTCP HELLO Packet:" << std::endl
42        << senf::fieldName("version")                   << p->versionNumber()                       << "\n"
43        << senf::fieldName("command")                   << COMMANDS[p->command()]                   << "\n"
44        << senf::fieldName("interval")                  << unsigned(p->interval())                  << "\n"
45        << senf::fieldName("sequence number")           << p->sequenceNumber()                      << "\n"
46        << senf::fieldName("receive capable feed")      << (p->receiveCapableFeed() ? "yes" : "no") << "\n"
47        << senf::fieldName("ip version")                << p->ipVersion()                           << "\n"
48        << senf::fieldName("tunnel protocol")           << unsigned(p->tunnelProtocol())            << "\n"
49        << senf::fieldName("number of BDL ips")         << unsigned(p->fbipCount())                 << "\n"
50        << "  feed BDL ips:\n";
51
52     switch (p->ipVersion()) {
53     case 4 : {
54         typedef DTCPHelloPacket::Parser::v4fbipList_t FBIPList;
55         FBIPList::container fbips (p->v4fbipList());
56         FBIPList::container::iterator i (fbips.begin());
57         FBIPList::container::iterator const i_end (fbips.end());
58         for (; i != i_end; ++i)
59             os << "    " << *i << "\n";
60         break;
61     }
62     case 6 : {
63         typedef DTCPHelloPacket::Parser::v6fbipList_t FBIPList;
64         FBIPList::container fbips (p->v6fbipList());
65         FBIPList::container::iterator i (fbips.begin());
66         FBIPList::container::iterator const i_end (fbips.end());
67         for (; i != i_end; ++i)
68             os << "    " << *i << "\n";
69         break;
70     }
71     default:
72         os << "    unknown ip version\n";
73     }
74 }
75
76 #undef prefix_
77
78
79 //-/////////////////////////////////////////////////////////////////////////////////////////////////
80 #undef prefix_
81
82 \f
83 // Local Variables:
84 // mode: c++
85 // fill-column: 100
86 // comment-column: 40
87 // c-file-style: "senf"
88 // indent-tabs-mode: nil
89 // ispell-local-dictionary: "american"
90 // compile-command: "scons -u test"
91 // End: