dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx::Pcapng::WriteOnlySession Class Reference

TCP session that ignores inbound traffic and is used only for streaming capture data out. More...

#include <dfx-pcapng/sinks/TcpSink.hpp>

Inheritance diagram for dfx::Pcapng::WriteOnlySession:
[legend]
Collaboration diagram for dfx::Pcapng::WriteOnlySession:
[legend]

Public Member Functions

 TcpSession (std::string host, std::string serv, TcpServer &server, std::chrono::milliseconds initialTimeout)
 Construct a session descriptor (not yet bound to a socket).
Public Member Functions inherited from dfx::Server::TcpSession
 TcpSession (std::string host, std::string serv, TcpServer &server, std::chrono::milliseconds initialTimeout)
 Construct a session descriptor (not yet bound to a socket).
 DISABLE_COPY_AND_MOVE (TcpSession)
 TcpSession are not copyable and not movable.
virtual ~TcpSession ()=default
 Virtual destructor for polymorphic session types.
FdWatch::BorrowedFd socket () const noexcept
 Borrowed socket FD (valid after init()).
std::string const & host () const noexcept
 Remote host string.
std::string const & serv () const noexcept
 Remote service/port string.
void init (FdWatch::OwnedFd socket, FdWatch::Poller &poller)
 Bind the accepted socket to this session and register it to the poller.
bool subtractTimeAndCheckTimeout (std::chrono::milliseconds time)
 Decrease the remaining time before timeout and report expiration.
std::chrono::milliseconds initialTimeout () const noexcept
 Current configured initial timeout value.
void setInitialTimeout (std::chrono::milliseconds timeout)
 Update the initial timeout value.
void sendMessage (std::vector< uint8_t > const &message)
 Queue an outgoing message to be sent asynchronously.

Protected Member Functions

void handleMessage (std::vector< uint8_t >) override
 Ignore any inbound messages (capture is output-only).
Protected Member Functions inherited from dfx::Server::TcpSession
void resetTimeout ()
 Reset the remaining timeout countdown to the configured initial value.
void terminate ()
 Ask the owning server to terminate this session.
void setMaxDataQueueSize (std::size_t size)
 Set the maximum number of queued outgoing messages.
std::size_t maxDataQueueSize () const noexcept
 Maximum number of queued outgoing messages.

Additional Inherited Members

Public Types inherited from dfx::Server::TcpSession
enum class  TimeoutPolicy {
  Disabled , Manual , ResetOnRead , ResetOnWrite ,
  ResetOnAny
}
 Policy describing when I/O activity resets the inactivity timeout. More...
Protected Attributes inherited from dfx::Server::TcpSession
std::string _host
 Remote host string.
std::string _serv
 Remote service/port string.
TimeoutPolicy _timeoutPolicy = TimeoutPolicy::ResetOnAny
 Timeout reset policy.

Detailed Description

TCP session that ignores inbound traffic and is used only for streaming capture data out.

This session type is used by TcpSink to represent a connected client. Incoming messages are intentionally ignored: the session exists solely as a write-only transport for PCAPNG bytes.

Member Function Documentation

◆ handleMessage()

void dfx::Pcapng::WriteOnlySession::handleMessage ( std::vector< uint8_t > )
inlineoverrideprotectedvirtual

Ignore any inbound messages (capture is output-only).

Implements dfx::Server::TcpSession.

◆ TcpSession()

dfx::Server::TcpSession::TcpSession ( std::string host,
std::string serv,
TcpServer & server,
std::chrono::milliseconds initialTimeout )

Construct a session descriptor (not yet bound to a socket).

The accepted socket is provided later through init().

Parameters
hostRemote host string (typically from getnameinfo / accept).
servRemote service/port string.
serverReference to the owning server.
initialTimeoutInitial inactivity timeout for the new session.

The documentation for this class was generated from the following file: