Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
senf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wiback
senf
Commits
736e5350
Commit
736e5350
authored
17 years ago
by
g0dil
Browse files
Options
Downloads
Patches
Plain Diff
PPI API adjustments
parent
f27f7355
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
PPI/Mainpage.dox
+22
-20
22 additions, 20 deletions
PPI/Mainpage.dox
PPI/Module.hh
+2
-10
2 additions, 10 deletions
PPI/Module.hh
with
24 additions
and
30 deletions
PPI/Mainpage.dox
+
22
−
20
View file @
736e5350
...
...
@@ -70,10 +70,10 @@
(network connection, writing packets to disk, generating new packets) whereas processing modules
process packets internally. In the target scenario, <em>TAP</em>, <em>ASI Out</em>, <em>Raw
Socket</em> and in a limited way <em>Generator</em> are I/O modules whereas <em>PEP</em>,
<em>DiffServ</em>, <em>DVB Enc</em>, <em>GRE/UDLR</em>, <em>TCP Filter</em> and
<em>Stuffer</em>
are processing modules. <em>ASI/MPEG</em> and <em>Net</em> are external I/O
ports which are
integrated via the <em>TAP</em>, <em>ASI Out</em> and <em>Raw Sock</em> modules
using external
events.
<em>DiffServ</em>, <em>DVB Enc</em>, <em>GRE/UDLR</em>, <em>TCP Filter</em> and
<em>Stuffer</em>
are processing modules. <em>ASI/MPEG</em> and <em>Net</em> are external I/O
ports which are
integrated via the <em>TAP</em>, <em>ASI Out</em> and <em>Raw Sock</em> modules
using external
events.
The following example module declares three I/O connectors (see below): <tt>payload</tt>,
<tt>stuffing</tt> and <tt>output</tt>. These connectors are defined as <em>public</em> data
...
...
@@ -83,18 +83,20 @@
class RateStuffer
: public senf::ppi::Module
{
senf::ppi::IntervalTimer timer_;
public:
ActiveInput payload;
ActiveInput stuffing;
ActiveOutput output;
senf::ppi::
ActiveInput payload;
senf::ppi::
ActiveInput stuffing;
senf::ppi::
ActiveOutput output;
RateStuffer(unsigned packetsPerSecond)
: timer_(1000u, packetsPerSecond)
{
route(payload, output);
route(stuffing, output);
registerEvent(&RateStuffer::tick,
senf::ppi::IntervalTimer(1000u, packetsPerSecond));
registerEvent(&RateStuffer::tick, timer_);
}
private:
...
...
@@ -124,7 +126,7 @@
: public senf::ppi::Module
{
public:
PassiveOutput output;
senf::ppi::
PassiveOutput output;
CopyPacketGenerator(Packet::ptr template)
: template_ (template)
...
...
@@ -244,14 +246,17 @@
class ActiveSocketInput
: public senf::ppi::Module
{
static PacketParser<senf::DataPacket> defaultParser_;
public:
ActiveOutput output;
typedef senf::ClientSocketHandle<
senf::MakeSocketPolicy< senf::ReadablePolicy,
senf::DatagramFramingPolicy > > Socket;
static PacketParser<senf::DataPacket> defaultParser_;
Socket socket_;
DataParser const & parser_;
senf::ppi:IOSignaler event_;
public:
senf::ppi::ActiveOutput output;
// I hestitate taking parser by const & since a const & can be bound to
// a temporary even though a const & is all we need. The real implementation
...
...
@@ -260,16 +265,13 @@
ActiveSocketInput(Socket socket, DataParser & parser = SocketInput::defaultParser_)
: socket_ (socket),
parser_ (parser)
event_ (registerEvent( &ActiveSocketInput::data,
senf::ppi::IOSignaler(socket, senf::ppi::IOSignaler::Read) ))
event_ (socket, senf::ppi::IOSignaler::Read)
{
registerEvent( &ActiveSocketInput::data, event_ );
route(event_, output);
}
private:
Socket socket_;
DataParser const & parser_;
senf::ppi:IOSignaler::EventBinding event_;
void data()
{
...
...
This diff is collapsed.
Click to expand it.
PPI/Module.hh
+
2
−
10
View file @
736e5350
...
...
@@ -97,7 +97,7 @@ namespace ppi {
\param[in] connector Terminal connector to declare */
template
<
class
Target
,
class
Descriptor
>
typename
Descriptor
&
registerEvent
(
Target
target
,
Descriptor
const
&
descriptor
);
void
registerEvent
(
Target
target
,
Descriptor
const
&
descriptor
);
///< Register an external event
/**< The \a target argument may be either an arbitrary
callable object or it may be a member function pointer
...
...
@@ -111,17 +111,9 @@ namespace ppi {
may be a timer event or some type of I/O event on a
file descriptor or socket.
The return value may be used to modify the
binding. This allows to temporarily inhibit event
delivery or to remove the binding explicitly. Depending
on the type of event, other operations may be
possible. See the event descriptor documentation.
\param[in] target The handler to call whenever the event
is signaled
\param[in] descriptor The type of event to register
\returns An event binding instance of the appropriate
type. */
\param[in] descriptor The type of event to register */
boost
::
posix_time
::
ptime
eventTime
();
///< Return timestamp of the currently processing event
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment