#include <linux/sockios.h>
#include <linux/dvb/dmx.h>
-#include "../../Scheduler/Scheduler.hh"
-#include "../../Packets/DefaultBundle/EthernetPacket.hh"
-#include "../../Packets/MPEGDVBBundle/DatagramSection.hh"
-#include "../../Utils/membind.hh"
-#include "../../Utils/hexdump.hh"
-#include "../../Socket/Protocols/DVB/DVBDemuxHandles.hh"
-#include "../../Packets/ParseInt.hh"
-#include "../../Packets/Packet.hh"
-#include "../../Packets/PacketData.hh"
+#include <senf/Scheduler/Scheduler.hh>
+#include <senf/Packets/DefaultBundle/EthernetPacket.hh>
+#include <senf/Packets/MPEGDVBBundle/DatagramSection.hh>
+#include <senf/Utils/membind.hh>
+#include <senf/Utils/hexdump.hh>
+#include <senf/Socket/Protocols/DVB.hh>
+#include <senf/Packets.hh>
#define PID 500
#include <linux/dvb/dmx.h>
#include <boost/format.hpp>
-#include "../../Packets/PacketData.hh"
-#include "../../Utils/hexdump.hh"
-#include "../../Utils/membind.hh"
+#include <senf/Packets.hh>
+#include <senf/Utils/hexdump.hh>
+#include <senf/Utils/membind.hh>
#define PID 271
#define TRANSPORT_PACKET_SIZE 188
// Definition of non-inline non-template functions
-#include "../../Scheduler/Scheduler.hh"
-#include "../../Packets/MPEGDVBBundle/TransportPacket.hh"
-#include "../../Packets/MPEGDVBBundle/SNDUPacket.hh"
-#include "../../Socket/Protocols/DVB/DVBDemuxHandles.hh"
+#include <senf/Scheduler/Scheduler.hh>
+#include <senf/Packets/MPEGDVBBundle/TransportPacket.hh>
+#include <senf/Packets/MPEGDVBBundle/SNDUPacket.hh>
+#include <senf/Socket/Protocols/DVB.hh>
class ULEdec
#include <string>
#include <iostream>
-#include "../../Socket/Protocols/DVB/DVBFrontendHandle.hh"
+#include <senf/Socket/Protocols/DVB.hh>
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
#include <fstream>
#include <string>
#include <iomanip>
-#include "../../Socket/Protocols/INet/UDPSocketHandle.hh"
-#include "../../Scheduler/Scheduler.hh"
-#include "../../Packets/DefaultBundle/EthernetPacket.hh"
-#include "../../Utils/membind.hh"
-#include "../../Utils/hexdump.hh"
+#include <senf/Socket/Protocols/INet.hh>
+#include <senf/Scheduler/Scheduler.hh>
+#include <senf/Packets/DefaultBundle/EthernetPacket.hh>
+#include <senf/Utils/membind.hh>
+#include <senf/Utils/hexdump.hh>
//#include "MCSniffer.mpp"
Above image depicts the module setup implementing the rate stuffer. A
senf::ppi::module::ActiveSocketReader reads the incoming UDP packets and sends them into a
- senf::ppi::module::PassiveQueue.
+ senf::ppi::module::PassiveQueue (via a senf::ppi::module::ThrottleBarrier).
The \a queue feeds the packets into a senf::ppi::module::PriorityJoin. The CloneSource
\a generator is fed as second input into the \a join to provide the stuffing packets.
ensures that read requests of the RateStuffer's input are always serviced, either from the \a
queue or, if the \a queue output is throttled, from the \a generator.
+ The \a barrier is not strictly necessary. However, it makes the behavior of the RateStuffer
+ predictable in the case where packets need to be dropped. Without the
+ senf::ppi::module::ThrottleBarrier, the packets will be left in the kernel socket queue. Packets
+ will only start to be dropped when that queue fills up. The size of this queue cannot be easily
+ manipulated and it's initial size is immense. So to stop the kernel queue from filling up with
+ increasingly out-of-date packets, we add the \a barrier which will explicitly read and drop
+ excess packets.
+
\section code Example code
\dontinclude ratestuffer.cc
\skip Custom
\skip #include
- \until Setup
+ \until PPI
We also define some namespace aliases
\until }
The event is initialized to fire eery \a interval nanoseconds. The traffic is routed 'across'
- the timer which controls the traffic. The timer is then registered to call
- RateFilter::timeout().
+ the timer which controls the traffic. This routing lets the module automatically handle
+ throttling events. The timer is registered to call RateFilter::timeout().
\until }
and forwarded to \a output.
This is all there is to the RateFilter module. Due to the routing setup, the timer will
- automatically be disabled if either \a input or \a output become throttled (which is not even
- needed here).
+ automatically be disabled should either \a input or \a output become throttled. However, in this
+ specific case this should never happen: The \a input is connected (via the \a join) to the
+ senf::ppi::module::CloneSource, which will never throttle. The \a output is connected to a UDP
+ socket which also never throttles.
\subsection ratestuffer The RateStuffer subnet
generator and set the timing \a interval of the \a rateFilter.
The \a input and \a output connector references are bound to the corresponding connectors we
- want to expose: \a input to the \a queue's \a input and \a output to the \a rateStuffer's \a
+ want to expose: \a input to the \a barrier's \a input and \a output to the \a rateFilter's \a
output.
\until };
discipline of the \a queue. This Completes the RateStuffer. This subnetwork can now be used like
a module.
- \subsection main Connecting the modules
+ \subsection main Application setup
The applications main() method starts out by initializing the socket handles
//#include "ppitest.ih"
// Custom includes
-#include "../../Socket/Protocols/INet/UDPSocketHandle.hh"
-#include "../../Socket/Protocols/INet/ConnectedUDPSocketHandle.hh"
-#include "../../Socket/Protocols/INet/INetAddressing.hh"
-#include "../../PPI/SocketReader.hh"
-#include "../../PPI/SocketWriter.hh"
-#include "../../PPI/Module.hh"
-#include "../../PPI/IntervalTimer.hh"
-#include "../../PPI/Joins.hh"
-#include "../../PPI/ThrottleBarrier.hh"
-#include "../../PPI/PassiveQueue.hh"
-#include "../../PPI/Queueing.hh"
-#include "../../PPI/CloneSource.hh"
-#include "../../PPI/Setup.hh"
+#include <senf/Socket/Protocols/INet.hh>
+#include <senf/PPI.hh>
//#include "ppitest.mpp"
#define prefix_
int main(int argc, char * argv[])
{
- senf::UDPv4ClientSocketHandle inputSocket;
- inputSocket.bind(senf::INet4SocketAddress("0.0.0.0:44344"));
+ senf::UDPv4ClientSocketHandle inputSocket(
+ senf::INet4SocketAddress("0.0.0.0:44344"));
senf::ConnectedUDPv4ClientSocketHandle outputSocket(
senf::INet4SocketAddress("localhost:44345"));
#include <string>
#include <iostream>
#include <iomanip>
-#include "../../Socket/Protocols/Raw/PacketSocketHandle.hh"
-#include "../../Scheduler/Scheduler.hh"
-#include "../../Utils/membind.hh"
-#include "../../Utils/hexdump.hh"
-#include "../../Packets/DefaultBundle/EthernetPacket.hh"
+#include <senf/Socket/Protocols/Raw.hh>
+#include <senf/Scheduler/Scheduler.hh>
+#include <senf/Utils/membind.hh>
+#include <senf/Utils/hexdump.hh>
+#include <senf/Packets/DefaultBundle/EthernetPacket.hh>
//#include "Sniffer.mpp"
#define prefix_
// Custom includes
#include <iostream>
#include <sstream>
-#include "../../Socket/Protocols/INet/TCPSocketHandle.hh"
-#include "../../Socket/Protocols/INet/INetAddressing.hh"
+#include <senf/Socket/Protocols/INet.hh>
int main(int argc, char const * argv[])
{
// Custom includes
#include <string>
#include <iostream>
-#include "../../Scheduler/Scheduler.hh"
-#include "../../Utils/membind.hh"
-#include "../../Socket/Protocols/INet/TCPSocketHandle.hh"
-#include "../../Socket/Protocols/INet/INetAddressing.hh"
-
+#include <senf/Scheduler/Scheduler.hh>
+#include <senf/Utils/membind.hh>
+#include <senf/Socket/Protocols/INet.hh>
class Server
{
return [ '-I%s' % os.path.split(f)[1] for f in env['CONFIG_FILES'] ]
env.Append(
- CPPPATH = [ '#' ],
+ CPPPATH = [ '#/include' ],
LIBS = [ 'iberty', '$BOOSTREGEXLIB' ],
DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ],
DOXY_HTML_XSL = '#/doclib/html-munge.xsl',
CONFIG_FILES_OPTS = configFilesOpts,
CLEAN_PATTERNS = [ '*.pyc', 'semantic.cache', '.sconsign', '.sconsign.dblite' ],
BUILDPACKAGE_COMMAND = "dpkg-buildpackage -us -uc -rfakeroot -I.svn $CONFIG_FILES_OPTS",
+ TOP_INCLUDES = [ 'Packets', 'PPI', 'Scheduler', 'Socket', 'Utils',
+ 'config.hh', 'local_config.hh' ]
)
Export('env')
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief Socket public header */
+ \brief INet public header */
-#include "Socket/Socket.hh"
+#include "DVB/DVB.hh"
\f
// Local Variables:
###########################################################################
+SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
+ if f not in ('all_includes.hh','DVB.hh') and not f.endswith('.test.hh') ])
+
sources = SENFSCons.GlobSources()
allob = []
ob = SConscript(sc)
if ob : allob.extend(ob)
+SENFSCons.InstallIncludeFiles(env, [ 'DVB.hh', 'all_includes.hh' ])
+
Return('allob')
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief Socket public header */
+ \brief INet public header */
-#include "Socket/Socket.hh"
+#include "INet/INet.hh"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief Socket public header */
+ \brief INet public header */
-#include "Socket/Socket.hh"
+#ifndef HH_INet_
+#define HH_INet_ 1
+
+#include "all_includes.hh"
+
+#endif
\f
// Local Variables:
###########################################################################
+SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
+ if f not in ('all_includes.hh','INet.hh') and not f.endswith('.test.hh') ])
+
sources = SENFSCons.GlobSources()
allob = []
ob = SConscript(sc)
if ob : allob.extend(ob)
+SENFSCons.InstallIncludeFiles(env, [ 'INet.hh', 'all_includes.hh' ])
+
Return('allob')
const
{
init_client();
- connect(address);
+ bind(address);
}
prefix_ std::auto_ptr<senf::SocketProtocol> senf::UDPv4SocketProtocol::clone()
const
{
init_client();
- connect(address);
+ bind(address);
}
prefix_ std::auto_ptr<senf::SocketProtocol> senf::UDPv6SocketProtocol::clone()
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
void init_client(INet4SocketAddress const & address) const;
- ///< Create client socket and connect
- /**< Creates a new client socket and connects to the given
+ ///< Create client socket and bind
+ /**< Creates a new client socket and bind to the given
address.
-
- \param[in] address remote address to connect to */
+ \param[in] local address to bind to */
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
constructor */
void init_client(INet6SocketAddress const & address) const;
///< Create client socket and connect
- /**< Creates a new client socket and connects to the given
+ /**< Creates a new client socket and bind to the given
address.
-
- \param[in] address remote address to connect to */
+ \param[in] local address to bind to */
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief Socket public header */
+ \brief Raw public header */
-#include "Socket/Socket.hh"
+#include "Raw/Raw.hh"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief Socket public header */
+ \brief Raw public header */
-#include "Socket/Socket.hh"
+#ifndef HH_Raw_
+#define HH_Raw_ 1
+
+#include "all_includes.hh"
+
+#endif
\f
// Local Variables:
###########################################################################
+SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
+ if f not in ('all_includes.hh','Raw.hh') and not f.endswith('.test.hh') ])
+
sources = SENFSCons.GlobSources()
allob = []
ob = SConscript(sc)
if ob : allob.extend(ob)
+SENFSCons.InstallIncludeFiles(env, [ 'Raw.hh', 'all_includes.hh' ])
+
Return('allob')
ob = SConscript(sc)
if ob : allob.extend(ob)
+SENFSCons.InstallIncludeFiles(env, [ 'INet.hh', 'Raw.hh' ])
+
Return('allob')
# include "local_config.hh"
# ifndef SENF_ABSOLUTE_INCLUDE_PATH
-# define SENF_ABSOLUTE_INCLUDE_PATH(senf_relative_include_file_path) <senf_relative_include_file_path>
+# define SENF_ABSOLUTE_INCLUDE_PATH(senf_relative_include_file_path) <senf/senf_relative_include_file_path>
# endif
# ifndef SENF_copy_n
debian/tmp/usr/lib/libsenf.a
debian/tmp/usr/lib/*.o usr/lib/senf-packets
-debian/tmp/usr/include/Packets usr/include/senf
-debian/tmp/usr/include/PPI usr/include/senf
-debian/tmp/usr/include/Scheduler usr/include/senf
-debian/tmp/usr/include/Socket usr/include/senf
-debian/tmp/usr/include/Utils usr/include/senf
+debian/tmp/usr/include/senf usr/include
boost usr/include/senf
-debian/local_config.hh usr/include/senf
-debian/Socket.hh usr/include/senf
-debian/Packets.hh usr/include/senf
-debian/PPI.hh usr/include/senf
+local_config.hh usr/include/senf
+include/senf/Socket.hh usr/include/senf
+include/senf/Packets.hh usr/include/senf
+include/senf/PPI.hh usr/include/senf
README usr/share/doc/libsenf-dev
+++ /dev/null
-
-#define SENF_ABSOLUTE_INCLUDE_PATH(senf_relative_include_file_path) <senf/senf_relative_include_file_path>
# # Add here commands to install the package into debian/tmp
scons install_all final=1\
PREFIX='$(destdir)/usr' \
- DOCINSTALLDIR='$$PREFIX/share/doc/libsenf-doc'
+ DOCINSTALLDIR='$$PREFIX/share/doc/libsenf-doc' \
+ INCLUDEINSTALLDIR='$$PREFIX/include/senf'
# We need to install the example sourcecode
find Examples \( -name "*.hh" -o -name "*.cc" \) -printf "%P\n" | \
while read src; do \
--- /dev/null
+../../PPI
\ No newline at end of file
--- /dev/null
+../../Packets
\ No newline at end of file
--- /dev/null
+../../Scheduler
\ No newline at end of file
--- /dev/null
+../../Socket
\ No newline at end of file
--- /dev/null
+../../Utils
\ No newline at end of file
--- /dev/null
+../../config.hh
\ No newline at end of file
--- /dev/null
+../../local_config.hh
\ No newline at end of file
td
templated
ThresholdQueueing
+ThrottleBarrier
todo
tr
TruncatedPacketException
CPPDEFINES = [ 'NDEBUG' ])
else:
env.Append(CXXFLAGS = [ '-O0', '-g', '-fno-inline' ],
- # The unit-test framework is not compiled with _GLIBCXX_DEBUG so this fails.
- # CPPDEFINES = [ '_GLIBCXX_DEBUG', 'BOOST_REGEX_NO_LIB' ],
+ # The boost-regex library is not compiled with _GLIBCXX_DEBUG so this fails.
+ # CPPDEFINES = [ '_GLIBCXX_DEBUG' ],
LINKFLAGS = [ '-g' ])
env.Append(CPPDEFINES = [ '$EXTRA_DEFINES' ],