8 #ifndef FACEBOOK_NETWORK_MAINTENANCE_TCP_CONNECTOR_H
9 #define FACEBOOK_NETWORK_MAINTENANCE_TCP_CONNECTOR_H
61 typedef std::unordered_map<TCPServer::ConnectionId, BufferQueue>
BufferQueueMap;
80 inline bool isSender()
const;
87 inline bool isReceiver()
const;
This class implements a recursive lock object.
Definition: Lock.h:31
This class is the base class for all maintenance connectors.
Definition: Maintenance.h:49
This class wraps an address number with 32 bits.
Definition: Address4.h:26
bool isValid() const
Returns whether this address hold a valid address.
Definition: Address4.h:154
unsigned int ConnectionId
Definition of a connection id.
Definition: ConnectionOrientedServer.h:34
This class implements a network connector between two maintenance managers using the TCP protocol.
Definition: MaintenanceTCPConnector.h:40
~MaintenanceTCPConnector() override
Destructs a maintenance connector object.
Port serverSourcePort_
The source port if this connector is a receiver.
Definition: MaintenanceTCPConnector.h:147
void configurateAsReceiver(const Port &port)
Configures this connector as receiver.
Port clientTargetPort_
The target port if this connector is a sender.
Definition: MaintenanceTCPConnector.h:144
Lock lock_
The lock of this connector.
Definition: MaintenanceTCPConnector.h:138
bool onConnectionRequest(const Address4 &address, const Port &port, TCPServer::ConnectionId connectionId)
Connection request event function.
static bool extractRelatedBuffer(BufferQueue &bufferQueue, Buffer &buffer)
Extracts one related buffer from a queue of messages.
std::unordered_map< TCPServer::ConnectionId, BufferQueue > BufferQueueMap
Definition of a map mapping connection ids to buffer queues.
Definition: MaintenanceTCPConnector.h:61
bool isSender() const
Returns whether this connector is configured as sender.
Definition: MaintenanceTCPConnector.h:162
std::vector< Buffer > Buffers
Definition of a vector storing buffers.
Definition: MaintenanceTCPConnector.h:51
void onReceiveTCPData(const TCPServer::ConnectionId connectionId, const void *data, const size_t size)
TCP data receive event function.
TCPClient tcpClient
The TCP client of this connector, used if this connector is a sender.
Definition: MaintenanceTCPConnector.h:150
bool isReceiver() const
Returns whether this connector is configured as receiver.
Definition: MaintenanceTCPConnector.h:171
std::deque< Buffer > BufferQueue
Definition of a buffer queue.
Definition: MaintenanceTCPConnector.h:56
MaintenanceTCPConnector()
Creates a new maintenance connector object.
Buffer encodedSenderBuffer_
The encoded buffer for the sender.
Definition: MaintenanceTCPConnector.h:159
std::vector< uint8_t > Buffer
Definition of a vector holding bytes.
Definition: MaintenanceTCPConnector.h:46
void threadRun() override
Internal thread run function.
TCPServer tcpServer
The TCP server of this connector, used if this connector is a receiver.
Definition: MaintenanceTCPConnector.h:153
void configurateAsSender(const Address4 &targetAddress, const Port &targetPort)
Configures this connector as sender.
Address4 clientTargetAddress_
The target address if this connector is a sender.
Definition: MaintenanceTCPConnector.h:141
BufferQueueMap bufferQueueMap_
The map of received buffers.
Definition: MaintenanceTCPConnector.h:156
This class wraps a port number with 16 bits.
Definition: Port.h:26
bool isValid() const
Returns whether this port hold a non-zero value.
Definition: Port.h:131
This class implements a TCP client.
Definition: TCPClient.h:27
This class implements a TCP server.
Definition: TCPServer.h:25
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
This class implements a thread.
Definition: Thread.h:115
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15