Skip to content
Snippets Groups Projects
Commit 235dbe42 authored by g0dil's avatar g0dil
Browse files

Packets: Restructure documentation

senfscons: Speed up non-documentation builds (doesn't help much)
Socket/Protocols: Add documentation for sockaddr_cast
parent 4a313288
No related branches found
No related tags found
No related merge requests found
Showing
with 314 additions and 129 deletions
......@@ -118,7 +118,7 @@
\see \ref console_testserver for a complete example application
\section intro_usage Access: Configuration files, Network console, ...
\section intro_usage Using the Console: Configuration files, Network console, ...
There are several ways to access the node tree:
\li By parsing configuration files
......@@ -138,7 +138,7 @@
\see \ref node_tree
\section intro_commands Registering console/config commands
\section intro_commands Implementing console/config commands
The console/config language does not define, how arguments are passed to the commands, it just
tokenizes the input and passes the tokens to the commands which then handle the
......@@ -366,7 +366,7 @@
\code
// Create a console/config aware object and place it into the node tree
FooObject foo;
senf::console::add("foo", foo.dir);
senf::console::root().add("foo", foo.dir);
// Open configuration file
senf::console::ConfigFile cf ("/etc/myserver.conf");
......
......@@ -100,6 +100,8 @@
\li senf::console::DirectoryNode provides internal nodes with an arbitrary number of children
\li senf::console::CommandNode describes a command entry in the tree
\li senf::console::LinkNode is a link to another node. It works much like a symlink on POSIX
systems.
senf::console::CommandNode is the base-class of all command nodes of which there are several,
depending on the type of command.
......@@ -119,6 +121,7 @@
\li A senf::console::CommandNode is normally added to the tree by directly adding a callback
using one of the overloaded senf::console::DirectoryNode::add() members. See \ref
console_commands.
\li A senf::console::LinkNode is created by senf::console::DirectoryNode::link()
When directly adding a node callback, the type of node added depends on the type of
callback. The callback types which can be added are listed at \ref console_callbacks.
......
......@@ -11,7 +11,6 @@ TAGFILES = \
"$(TOPDIR)/PPI/doc/PPI.tag" \
"$(TOPDIR)/Scheduler/doc/Scheduler.tag" \
"$(TOPDIR)/Packets/doc/Packets.tag" \
"$(TOPDIR)/Packets/DefaultBundle/doc/DefaultBundle.tag" \
"$(TOPDIR)/Socket/doc/Socket.tag" \
"$(TOPDIR)/Utils/doc/Utils.tag" \
"$(TOPDIR)/senfscons/doc/senfscons.tag"
......@@ -6,7 +6,6 @@ EXAMPLE_PATH = .
TAGFILES = \
"$(TOPDIR)/Scheduler/doc/Scheduler.tag" \
"$(TOPDIR)/Packets/doc/Packets.tag" \
"$(TOPDIR)/Packets/DefaultBundle/doc/DefaultBundle.tag" \
"$(TOPDIR)/Socket/doc/Socket.tag" \
"$(TOPDIR)/Utils/doc/Utils.tag" \
"$(TOPDIR)/doc/overview.tag"
......@@ -24,12 +24,25 @@
<table class="glossary">
<tr><td>collection parser</td> <td>libPackets</td> <td>A packet parser which allows to repeat
another parser or which uses some additional information to decide on the type or number of
sub-parsers.</td></tr>
<tr><td>complete policy</td> <td>libSocket</td> <td>socket policy where each axis is specified
completely</td></tr>
<tr><td>composite parser</td> <td>libPackets</td> <td>A packet parser providing access to named
sub-fields which are parsers themselves.</td></tr>
<tr><td>incomplete policy</td> <td>libSocket</td> <td>socket policy, where at least one axis is
not fully specified</td></tr>
<tr><td>packet interpreter</td> <td>libPackets</td> <td>Internal datastructure which represents
one protocol or header in the chain of interpreters representing a complete packet</td></tr>
<tr><td>packet parser</td> <td>libPackets</td> <td>lightweight class to convert between byte
representation and interpreted value. Derived from senf::PacketParserBase</td></tr>
<tr><td>policy axis</td> <td>libSocket</td> <td>one aspect defined in the socket policy, typedef
and member of the senf::SocketPolicy template</td></tr>
......@@ -54,8 +67,14 @@
senf::ProtocolClientSocketHandle::protocol()/senf::ProtocolServerSocketHandle::protocol()
member</td></tr>
<tr><td>protocol parser</td> <td>libPackets</td> <td>A composite parser which defines a network
protocol.</td></tr>
<tr><td>socket policy</td> <td>libSocket</td> <td>another name for 'policy'</td></tr>
<tr><td>value parser</td> <td>libPackets</td> <td>A packet parser which parses a simple value
like a number or network address.</td></tr>
</table>
*/
......@@ -67,7 +86,7 @@
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"
// compile-command: "scons -u doc"
// mode: flyspell
// mode: auto-fill
// End:
@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global"
INPUT = .
PROJECT_NAME = "HowTos"
@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global"
INPUT = .
PROJECT_NAME = NewPacket
EXAMPLE_PATH = .
......@@ -7,6 +8,5 @@ TAGFILES = \
"$(TOPDIR)/PPI/doc/PPI.tag" \
"$(TOPDIR)/Scheduler/doc/Scheduler.tag" \
"$(TOPDIR)/Packets/doc/Packets.tag" \
"$(TOPDIR)/Packets/DefaultBundle/doc/DefaultBundle.tag" \
"$(TOPDIR)/Socket/doc/Socket.tag" \
"$(TOPDIR)/Utils/doc/Utils.tag"
......@@ -276,18 +276,15 @@
definition to generate a more usable interface:
\code
SENF_PARSER_PRIVATE_VARIANT ( optionalFields_, checksumPresent,
(novalue(disable_checksum, senf::VoidPacketParser))
( id(checksum, GREPacketParser_OptFields)) );
SENF_PARSER_VARIANT ( optionalFields_, checksumPresent,
(novalue(disable_checksum, senf::VoidPacketParser))
( id(checksum, GREPacketParser_OptFields)) );
\endcode
Here, we changed to things:
\li We made the variant private
\li We added some optional information to the variants type list
Here, we added some optional information to the variants type list.
With this information, \ref SENF_PARSER_PRIVATE_VARIANT() will create some additional \e public
accessor members (those are public, only the variant itself is private). The members generated
work like:
With this information, \ref SENF_PARSER_VARIANT() will create some additional \e public accessor
members and will automatically make the variant itself private. The members generated work like:
\code
void disable_checksum() const { optionalFields_().init<0>; }
......
@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global"
PROJECT_NAME= DefaultBundle
GENERATE_TAGFILE = doc/DefaultBundle.tag
INPUT = .
ALPHABETICAL_INDEX = NO
TAGFILES = \
"$(TOPDIR)/Packets/doc/Packets.tag" \
"$(TOPDIR)/Socket/doc/Socket.tag" \
"$(TOPDIR)/Utils/doc/Utils.tag"
......@@ -55,9 +55,6 @@ prefix_ boost::uint16_t senf::IPv4PacketParser::calcChecksum()
validate(bytes(*this));
IpChecksum summer;
summer.feed( i(), i()+checksum_offset );
// Not needed since the number of 0-bytes is even
// summer.feed( 0u );
// summer.feed( 0u );
summer.feed( i()+checksum_offset+2, i()+bytes(*this) );
return summer.sum();
}
......
......@@ -50,8 +50,8 @@ namespace senf {
value_type value() const { return value_type::from_data(i()); }
void value(value_type const & v) { std::copy(v.begin(), v.end(), i()); }
operator value_type() { return value(); }
byte & operator[](size_type index) { return *boost::next(i(),index); }
operator value_type() const { return value(); }
byte & operator[](size_type index) const { return *boost::next(i(),index); }
INet4AddressParser const & operator= (value_type const & other)
{ value(other); return *this; }
};
......
......@@ -51,8 +51,8 @@ namespace senf {
value_type value() const { return value_type::from_data(i()); }
void value(value_type const & v) { std::copy(v.begin(), v.end(), i()); }
operator value_type() { return value(); }
byte & operator[](size_type index) { return *boost::next(i(),index); }
operator value_type() const { return value(); }
byte & operator[](size_type index) const { return *boost::next(i(),index); }
INet6AddressParser const & operator= (value_type const & other)
{ value(other); return *this; }
};
......
......@@ -20,13 +20,7 @@
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \mainpage The Default Bundle
The default bundle combines a set of basic low level protocols like Ethernet or IP. Find the
list of protocols implemented at \ref protocolbundle_default
*/
/** \defgroup protocolbundle_default Protocols contained in the DefaultBundle
/** \defgroup protocolbundle_default The DefaultBundle
Each protocol consists of several objects
......
......@@ -20,5 +20,3 @@ SENFSCons.Lib(env,
no_includes = 1)
SConscript(glob.glob("*/SConscript"))
SENFSCons.Doxygen(env)
......@@ -3,6 +3,7 @@
PROJECT_NAME = libPackets
GENERATE_TAGFILE = doc/Packets.tag
INPUT = .
RECURSIVE = YES
EXAMPLE_PATH = . DefaultBundle
TAGFILES = \
......
......@@ -234,6 +234,10 @@ namespace senf {
Here \c EltParser can be an arbitrary parser and need not have a fixed size.
\warning Realize, that the \a size field is controlled by the list parser. This field
should therefore be declared either read-only or private and must be changed only via
the list parser.
Further additional tags are supported which modify the type of list created:
<table class="senf fixedcolumn">
......
......@@ -20,27 +20,75 @@
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
\brief DTCPPacket non-inline non-template implementation */
//#include "DTCPPacket.hh"
//#include "DTCPPacket.ih"
// Custom includes
#include "DTCPPacket.hh"
#include <boost/io/ios_state.hpp>
#include <iomanip>
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
prefix_ void senf::DTCPPacketType::dump(packet p, std::ostream & os)
prefix_ void senf::DTCPHelloPacketType::dump(packet p, std::ostream & os)
{
static char const * COMMANDS[] = { "0", "JOIN", "LEAVE", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15" };
boost::io::ios_all_saver ias(os);
os << "DTCPPacket" << std::endl
<< " version : " << p->version_number() << std::endl
<< " command : " << p->command() << std::endl
<< " interval : " << p->interval() << std::endl
<< " sequence_number : " << p->sequence_number() << std::endl
<< " receive_capable_feed : " << p->receive_capable_feed() << std::endl
<< " ip_version : " << p->ip_version() << std::endl
<< " tunnel_protocol : " << p->tunnel_protocol() << std::endl
;
//TODO: print included IPs
os << "DTCP HELLO Packet:" << std::endl
<< " version : " << p->versionNumber() << std::endl
<< " command : " << COMMANDS[p->command()] << std::endl
<< " interval : " << unsigned(p->interval()) << std::endl
<< " sequence number : " << p->sequenceNumber() << std::endl
<< " receive capable feed : " << (p->receiveCapableFeed() ? "yes" : "no") << std::endl
<< " ip version : " << p->ipVersion() << std::endl
<< " tunnel protocol : " << unsigned(p->tunnelProtocol()) << std::endl
<< " number of BDL ips : " << unsigned(p->fbipCount()) << std::endl
<< " feed BDL ips : ";
switch (p->ipVersion()) {
case 4 : {
typedef DTCPHelloPacket::Parser::v4fbipList_t FBIPList;
FBIPList::container fbips (p->v4fbipList());
FBIPList::container::iterator i (fbips.begin());
FBIPList::container::iterator const i_end (fbips.end());
for (; i != i_end; ++i)
os << "\n " << *i;
break;
}
case 6 : {
typedef DTCPHelloPacket::Parser::v6fbipList_t FBIPList;
FBIPList::container fbips (p->v6fbipList());
FBIPList::container::iterator i (fbips.begin());
FBIPList::container::iterator const i_end (fbips.end());
for (; i != i_end; ++i)
os << "\n " << *i;
break;
}
default:
os << "unknown ip version";
}
os << std::endl;
}
#undef prefix_
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
// Local Variables:
// mode: c++
// fill-column: 100
// comment-column: 40
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"
// End:
......@@ -20,103 +20,122 @@
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
\brief DTCPPacket public header */
#ifndef DTCPPACKET_HH_
#define DTCPPACKET_HH_
#ifndef HH_DTCPPacket_
#define HH_DTCPPacket_ 1
// Custom includes
#include "../../Packets/Packets.hh"
#include "../../Packets/DefaultBundle/IPv4Packet.hh"
#include "../../Packets/DefaultBundle/IPv6Packet.hh"
#define DTCP_V4_MCADDRESS "224.0.0.36"
#define DTCP_V6_MCADDRESS "FF02:0:0:0:0:0:1:4"
#define DTCP_UDP_PORT 652
//#include "DTCPPacket.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
//first we have to define some helpers
struct DTCPIPv4AddressListParser : public PacketParserBase {
# define DTCP_V4_MCADDRESS "224.0.0.36"
# define DTCP_V6_MCADDRESS "FF02:0:0:0:0:0:1:4"
# define DTCP_UDP_PORT 652
struct DTCPIPv4AddressListParser : public PacketParserBase
{
# include SENF_PARSER()
SENF_PARSER_PRIVATE_FIELD ( num_of_fbips, UInt8Parser );
SENF_PARSER_PRIVATE_FIELD ( reserved , UInt8Parser ); //must be zero
SENF_PARSER_VECTOR ( fbiplist, num_of_fbips, INet4AddressParser );
SENF_PARSER_PRIVATE_FIELD( fbipCount_, UInt8Parser );
SENF_PARSER_PRIVATE_FIELD( reserved_, UInt8Parser );
SENF_PARSER_VECTOR( fbips, fbipCount_, INet4AddressParser );
// Needed since we do NOT want to init fbipCount_ or reseverd_. And since
// INet4AddressParser::init() is a no-op, we can just as well disable init completely
SENF_PARSER_INIT() {}
SENF_PARSER_FINALIZE(DTCPIPv4AddressListParser);
};
struct DTCPIPv6AddressListParser : public PacketParserBase {
struct DTCPIPv6AddressListParser : public PacketParserBase
{
# include SENF_PARSER()
SENF_PARSER_PRIVATE_FIELD ( num_of_fbips, UInt8Parser );
SENF_PARSER_PRIVATE_FIELD ( reserved, UInt8Parser ); //must be zero
SENF_PARSER_VECTOR ( fbiplist, num_of_fbips, INet6AddressParser );
SENF_PARSER_PRIVATE_FIELD( fbipCount_, UInt8Parser );
SENF_PARSER_PRIVATE_FIELD( reserved_, UInt8Parser );
SENF_PARSER_VECTOR( fbips, fbipCount_, INet6AddressParser );
// Needed since we do NOT want to init fbipCount_ or reseverd_. And since
// INet4AddressParser::init() is a no-op, we can just as well disable init completely
SENF_PARSER_INIT() {}
SENF_PARSER_FINALIZE(DTCPIPv6AddressListParser);
};
/** \brief Parse a DTCP packet
/** \brief Parse a DTCP HELLO packet
Parser implementing the DTCP packet according to RFC 3077
\see DTCPPacketType
*/
struct DTCPPacketParser : public PacketParserBase
struct DTCPHelloPacketParser : public PacketParserBase
{
# include SENF_PARSER()
SENF_PARSER_BITFIELD ( version_number, 4, unsigned ); // =1 according to rfc3077
SENF_PARSER_BITFIELD ( command, 4, unsigned ); // 1=JOIN 2=LEAVE
SENF_PARSER_FIELD ( interval, UInt8Parser ); // 5 according to rfc3077
SENF_PARSER_FIELD ( sequence_number, UInt16Parser );
SENF_PARSER_PRIVATE_BITFIELD ( reserved, 3, unsigned );
SENF_PARSER_BITFIELD ( receive_capable_feed, 1, bool ); // 0=send only, 1=receive_capable_feed
SENF_PARSER_BITFIELD_RO ( ip_version, 4, unsigned ); // 4=IPv4, 6=IPv6
SENF_PARSER_FIELD ( tunnel_protocol, UInt8Parser );
/* Please consider the following comments on the implementation given in this class:
* 1. you could think of simply using SENF_PARSER_PRIVATE_VARIANT and List / Vectorparser like this:
* SENF_PARSER_PRIVATE_VARIANT ( fbiplist, ip_version,
* (senf::VoidPacketParser) //ip_version=0
* (senf::VoidPacketParser) //1
* (senf::VoidPacketParser) //2
* (senf::VoidPacketParser) //3
* (senf::ListBParser< IPv4Packet, num_of_fbips>) //4
* (senf::VoidPacketParser) //5
* (senf::ListBParser< IPv6Packet, num_of_fbips>) ); //6
* This can't work for two reasons:
* -SENF_PARSER_PRIVATE_VARIANT only accepts 6 templates in types but you have to start from 0.
* -you NEVER can use templated Parsers in these macros since the macro-preprocessor won't recognize the <> brackets and will
* interpret the ","
*
* The first problem is solved by using key()
* The second problem is solved by introducing Helper-Parser which cover both the list and the number field. By that no
* templates have to be used.
*/
SENF_PARSER_VARIANT( fbiplist, ip_version,
( ids(getIpv4AddressList, na, setIpVersion4,
key(4, senf::DTCPIPv4AddressListParser)) ) //IPv4
( ids(getIpv6AddressList, na, setIpVersion6,
key(6, senf::DTCPIPv6AddressListParser)) ) ); //IPv6
SENF_PARSER_BITFIELD ( versionNumber, 4, unsigned ); // must be 1
SENF_PARSER_BITFIELD ( command, 4, unsigned );
enum Command { JOIN=1, LEAVE=2 };
SENF_PARSER_FIELD ( interval, UInt8Parser ); // should be 5
SENF_PARSER_FIELD ( sequenceNumber, UInt16Parser );
SENF_PARSER_PRIVATE_BITFIELD ( reserved0_, 3, unsigned );
SENF_PARSER_BITFIELD ( receiveCapableFeed, 1, bool );
SENF_PARSER_BITFIELD_RO ( ipVersion, 4, unsigned ); // 4=IPv4, 6=IPv6
SENF_PARSER_FIELD ( tunnelProtocol, UInt8Parser );
SENF_PARSER_FIELD_RO ( fbipCount, UInt8Parser );
SENF_PARSER_PRIVATE_FIELD ( reserved1_, UInt8Parser ); //must be zero
// Go back to fbipCount so the variant has access to that field
SENF_PARSER_GOTO( fbipCount );
SENF_PARSER_VARIANT ( fbipList_, ipVersion,
( ids(na, has_v4fbipList, init_v4fbipList,
key(4, DTCPIPv4AddressListParser)) )
( ids(na, has_v6fbipList, init_v6fbipList,
key(6, DTCPIPv6AddressListParser)) ) );
// We define the two variant accessors ourselves so we can directly return the vector and
// not the collection parser which contains the vector ...
typedef DTCPIPv4AddressListParser::fbips_t v4fbipList_t;
v4fbipList_t v4fbipList() { return fbipList_().get<0>().fbips(); }
typedef DTCPIPv6AddressListParser::fbips_t v6fbipList_t;
v6fbipList_t v6fbipList() { return fbipList_().get<1>().fbips(); }
SENF_PARSER_FINALIZE(DTCPPacketParser);
SENF_PARSER_FINALIZE(DTCPHelloPacketParser);
};
/** \brief DTCP packet
/** \brief DTCP HELLO packet
\par Packet type (typedef):
\ref DTCPPacket
\ref DTCPHelloPacket
\par Fields:
\ref DTCPPacketParser
\ref DTCPHelloPacketParser
\ingroup protocolbundle_mpegdvb
*/
struct DTCPPacketType
struct DTCPHelloPacketType
: public PacketTypeBase,
public PacketTypeMixin<DTCPPacketType>
public PacketTypeMixin<DTCPHelloPacketType>
{
typedef PacketTypeMixin<DTCPPacketType> mixin;
typedef ConcretePacket<DTCPPacketType> packet;
typedef DTCPPacketParser parser;
typedef PacketTypeMixin<DTCPHelloPacketType> mixin;
typedef ConcretePacket<DTCPHelloPacketType> packet;
typedef DTCPHelloPacketParser parser;
using mixin::nextPacketRange;
using mixin::init;
......@@ -126,7 +145,22 @@ namespace senf {
};
/** \brief DTCP packet typedef */
typedef DTCPPacketType::packet DTCPPacket;
typedef DTCPHelloPacketType::packet DTCPHelloPacket;
}
#endif /*DTCPPACKET_HH_*/
///////////////////////////////hh.e////////////////////////////////////////
//#include "DTCPPacket.cci"
//#include "DTCPPacket.ct"
//#include "DTCPPacket.cti"
#endif
// Local Variables:
// mode: c++
// fill-column: 100
// comment-column: 40
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"
// End:
// $Id$
//
// Copyright (C) 2008
// Fraunhofer Institute for Open Communication Systems (FOKUS)
// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
\brief DTCPPacket.test unit tests */
//#include "DTCPPacket.test.hh"
//#include "DTCPPacket.test.ih"
// Custom includes
#include "DTCPPacket.hh"
#include "../../Utils/auto_unit_test.hh"
#include <boost/test/test_tools.hpp>
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
BOOST_AUTO_UNIT_TEST(dtcpPacket)
{
unsigned char data[] = { 0x11, // versionNumber = 1, command = JOIN
5, // interval
0x0A, 0x0B, // sequence number
0x14, // receiveCapable = true, ipVersion = 4
23, // tunnelProtocol
2, // fbipCount
0x00,
101, 102, 103, 104, // fbip1
201, 202, 203, 204 }; // fbip2
senf::DTCPHelloPacket hello (senf::DTCPHelloPacket::create(
boost::make_iterator_range(data, data+sizeof(data))));
BOOST_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data),
hello.data().begin(), hello.data().end() );
BOOST_CHECK_EQUAL( senf::bytes(hello.parser()), 16u );
BOOST_CHECK_EQUAL( hello->versionNumber(), 1u );
BOOST_CHECK_EQUAL( hello->command(), unsigned(senf::DTCPHelloPacket::Parser::JOIN) );
BOOST_CHECK_EQUAL( hello->interval(), 5u );
BOOST_CHECK_EQUAL( hello->sequenceNumber(), 0x0A0Bu );
BOOST_CHECK_EQUAL( hello->receiveCapableFeed(), true );
BOOST_CHECK_EQUAL( hello->ipVersion(), 4u );
BOOST_CHECK_EQUAL( hello->tunnelProtocol(), 23u );
BOOST_CHECK_EQUAL( hello->fbipCount(), 2u );
BOOST_CHECK( hello->has_v4fbipList() );
BOOST_CHECK_EQUAL( boost::lexical_cast<std::string>(hello->v4fbipList()[0]), "101.102.103.104" );
BOOST_CHECK_EQUAL( boost::lexical_cast<std::string>(hello->v4fbipList()[1]), "201.202.203.204" );
std::stringstream ss;
hello.dump(ss);
BOOST_CHECK_EQUAL( ss.str(),
"DTCP HELLO Packet:\n"
" version : 1\n"
" command : JOIN\n"
" interval : 5\n"
" sequence number : 2571\n"
" receive capable feed : yes\n"
" ip version : 4\n"
" tunnel protocol : 23\n"
" number of BDL ips : 2\n"
" feed BDL ips : \n"
" 101.102.103.104\n"
" 201.202.203.204\n" );
senf::DTCPHelloPacket hello2 (senf::DTCPHelloPacket::create());
SENF_CHECK_NO_THROW( hello2->versionNumber() = 1u );
SENF_CHECK_NO_THROW( hello2->command() = senf::DTCPHelloPacket::Parser::JOIN );
SENF_CHECK_NO_THROW( hello2->interval() = 5u );
SENF_CHECK_NO_THROW( hello2->sequenceNumber() = 0x0A0B );
SENF_CHECK_NO_THROW( hello2->receiveCapableFeed() = true );
SENF_CHECK_NO_THROW( hello2->tunnelProtocol() = 23u );
SENF_CHECK_NO_THROW( hello2->init_v4fbipList() );
SENF_CHECK_NO_THROW( hello2->v4fbipList().push_back( senf::INet4Address(0x65666768u) ) );
SENF_CHECK_NO_THROW( hello2->v4fbipList().push_back( senf::INet4Address(0xC9CACBCCu) ) );
BOOST_CHECK_EQUAL( senf::bytes(hello2.parser()), 16u );
BOOST_CHECK_EQUAL_COLLECTIONS( data, data+sizeof(data),
hello2.data().begin(), hello2.data().end() );
}
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
// Local Variables:
// mode: c++
// fill-column: 100
// comment-column: 40
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"
// End:
@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global"
PROJECT_NAME = MPEGDVBBundle
GENERATE_TAGFILE = doc/MPEGDVBBundle.tag
INPUT = .
ALPHABETICAL_INDEX = NO
TAGFILES = \
"$(TOPDIR)/Packets/doc/Packets.tag" \
"$(TOPDIR)/Packets/DefaultBundle/doc/DefaultBundle.tag" \
"$(TOPDIR)/Socket/doc/Socket.tag" \
"$(TOPDIR)/Utils/doc/Utils.tag"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment