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>
20#include <dfx-utilities/Thread.hpp>
73 explicit Capture(
bool getHwAndOsInfo =
true);
89 template<
typename ... Args>
91 { _setFileSinkImpl(std::make_unique<FileSink>(std::forward<Args>(args)...)); }
103 template<
typename ... Args>
105 { _setPipeSinkImpl(std::make_unique<PipeSink>(std::forward<Args>(args)...)); }
117 template<
typename ... Args>
119 { _setTcpSinkImpl(std::make_unique<TcpSink>(std::forward<Args>(args)...)); }
174 void _setFileSinkImpl(
SinkPtr sink);
175 void _setPipeSinkImpl(
SinkPtr sink);
176 void _setTcpSinkImpl(
SinkPtr sink);
179 Worker const & _worker()
const;
182 std::vector<Core::NodeWPtr> _nodes;
Abstract base class for messages exchanged between nodes.
Definition Message.hpp:86
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:104
void onChannelRemoved(Core::ChannelPtr) override
Graph hook: channel removal is currently ignored for capture.
Definition Capture.hpp:171
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:169
void setFileSink(Args &&... args)
Enable file output using a FileSink.
Definition Capture.hpp:90
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:118
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:73
A managed execution wrapper that ensures a Runnable's full lifecycle occurs within the worker thread.
Definition Thread.hpp:67
Definition Channel.hpp:25
std::shared_ptr< Node > NodePtr
Shared ownership pointer type for Nodes..
Definition Endpoint.hpp:21
std::weak_ptr< Node > NodeWPtr
Weak pointer type for Nodes.
Definition Node.hpp:66
std::shared_ptr< Channel > ChannelPtr
Shared ownership handle for channels.
Definition Channel.hpp:137
Definition Capture.hpp:28
std::unique_ptr< Sink > SinkPtr
Owning pointer type for sinks.
Definition Sink.hpp:122