15#include "sinks/FileSink.hpp"
16#include "sinks/PipeSink.hpp"
17#include "sinks/TcpSink.hpp"
18#include <dfx-hooks/Graph.hpp>
19#include <dfx-hooks/Port.hpp>
88 template<
typename ... Args>
90 { _setFileSinkImpl(std::make_unique<FileSink>(std::forward<Args>(args)...)); }
102 template<
typename ... Args>
104 { _setPipeSinkImpl(std::make_unique<PipeSink>(std::forward<Args>(args)...)); }
116 template<
typename ... Args>
118 { _setTcpSinkImpl(std::make_unique<TcpSink>(std::forward<Args>(args)...)); }
173 void _setFileSinkImpl(
SinkPtr sink);
174 void _setPipeSinkImpl(
SinkPtr sink);
175 void _setTcpSinkImpl(
SinkPtr sink);
178 std::unique_ptr<Worker> _worker;
179 std::vector<Core::NodeWPtr> _nodes;
Abstract base class for messages exchanged between nodes.
Definition Message.hpp:76
Outgoing message endpoint attached to a node.
Definition OutputPort.hpp:47
Hooks related to the lifecycle of graph objects (nodes and channels).
Definition Graph.hpp:54
Port-level message observation hook.
Definition Port.hpp:44
void setPipeSink(Args &&... args)
Enable pipe output using a PipeSink.
Definition Capture.hpp:103
void onChannelRemoved(Core::ChannelPtr) override
Graph hook: channel removal is currently ignored for capture.
Definition Capture.hpp:170
void setUserAppInfo(std::string info)
Set application-specific information to embed in the capture.
Capture(bool getHwAndOsInfo=true)
Construct a capture hook.
void unsetTcpSink()
Disable the TCP sink if enabled.
void onMessageSent(Core::OutputPort const &port, Core::Message const &message) override
Port hook: called when a message is sent from an output port.
void unsetPipeSink()
Disable the pipe sink if enabled.
void onChannelCreated(Core::ChannelPtr) override
Graph hook: channel creation is currently ignored for capture.
Definition Capture.hpp:168
void setFileSink(Args &&... args)
Enable file output using a FileSink.
Definition Capture.hpp:89
void onNodeRemoved(Core::NodePtr node) override
Graph hook: called when a node is removed.
void onNodeCreated(Core::NodePtr node) override
Graph hook: called when a node is created.
void setTcpSink(Args &&... args)
Enable TCP output using a TcpSink.
Definition Capture.hpp:117
void onMessageReceived(Core::InputPort const &port, Core::Message const &message) override
Port hook: called when a message is received by an input port.
void unsetFileSink()
Disable the file sink if enabled.
~Capture()
Destroy the capture hook and stop background capture work.
Background capture worker responsible for PCAPNG serialization and sink I/O.
Definition Worker.hpp:74
Definition Channel.hpp:22
std::shared_ptr< Node > NodePtr
Shared ownership pointer type for Nodes..
Definition Node.hpp:61
std::weak_ptr< Node > NodeWPtr
Weak pointer type for Nodes.
Definition Node.hpp:63
std::shared_ptr< Channel > ChannelPtr
Shared ownership handle for channels.
Definition Channel.hpp:147
Definition Capture.hpp:27
std::unique_ptr< Sink > SinkPtr
Owning pointer type for sinks.
Definition Sink.hpp:122