TcpCore

For conceptual usage, see:

Python binding

This C++ class is also exported into Python as rogue.interfaces.stream.TcpCore.

Python API page: - TcpCore

objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::interfaces::stream::TcpCore> rogue::interfaces::stream::TcpCorePtr
[header]

Shared pointer alias for TcpCore.

The class description is shown below:

class TcpCore : public rogue::interfaces::stream::Master, public rogue::interfaces::stream::Slave
[header]

Stream TCP bridge core implementation.

This class implements the core functionality of the TcpClient and TcpServer classes which implement a Rogue stream bridge over a TCP network. This core can operate in either client or server mode. The TcpClient and TcpServer classes are thin wrappers that define which mode flag to pass to this base class.

The TcpServer and TcpClient interfaces are blocking and will stall frame transmissions when the remote side is either not present or is back-pressuring. When the remote server is not present a local buffer is not utilized, where it is utilized when a connection has been established.

Subclassed by rogue::interfaces::stream::TcpClient, rogue::interfaces::stream::TcpServer

Public Functions

TcpCore(const std::string &addr, uint16_t port, bool server)
[header] [impl]

Constructs a TCP stream bridge core.

Creator.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

The constructor takes an address, port, and server mode flag. The address can be an IP address or hostname. In server mode, the address selects the local interface to bind. A value of "*" binds all local interfaces.

The stream bridge uses two consecutive TCP ports; port is the base. For example, port=8000 uses ports 8000 and 8001.

Parameters:
  • addr – Interface address for server, remote server address for client.

  • port – Base TCP port number.

  • server – Set to true to run in server mode.

~TcpCore()
[header] [impl]

Destroys the bridge core and releases resources.

Destructor.

void close()
[header] [impl]

Closes active bridge connections.

virtual void stop()
[header] [impl]

Stops the interface and worker thread.

virtual void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame)
[header] [impl]

Receives a frame from upstream and forwards over the TCP bridge.

Accept a frame from master.

Parameters:

frame – Incoming stream frame.

Public Static Functions

static std::shared_ptr<rogue::interfaces::stream::TcpCore> create(const std::string &addr, uint16_t port, bool server)
[header] [impl]

Creates a TCP stream bridge core instance and returns it as TcpCorePtr.

Class creation.

Parameter semantics are identical to the constructor; see TcpCore() for address and port behavior details. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs. Not exposed to Python.

Company : SLAC National Accelerator Laboratory

Description: Stream Network Core

This file is part of the rogue software platform. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the rogue software platform, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE.txt file.

Parameters:
  • addr – Interface address for server, remote server address for client.

  • port – Base TCP port number.

  • server – Set to true to run in server mode.

Returns:

Shared pointer to the created bridge core.

static void setup_python()
[header] [impl]

Registers this type with Python bindings.