YARP
Yet Another Robot Platform
TcpCarrier.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_IMPL_TCPCARRIER_H
11 #define YARP_OS_IMPL_TCPCARRIER_H
12 
14 
15 namespace yarp {
16 namespace os {
17 namespace impl {
18 
22 class TcpCarrier :
23  public AbstractCarrier
24 {
25 public:
26  TcpCarrier(bool requireAckFlag = true);
27 
28  Carrier* create() const override;
29 
30  std::string getName() const override;
31 
32  virtual int getSpecifierCode() const;
33 
34  bool checkHeader(const yarp::os::Bytes& header) override;
35  void getHeader(yarp::os::Bytes& header) const override;
36  void setParameters(const yarp::os::Bytes& header) override;
37  bool requireAck() const override;
38  bool isConnectionless() const override;
39  bool respondToHeader(yarp::os::ConnectionState& proto) override;
40  bool expectReplyToHeader(yarp::os::ConnectionState& proto) override;
41 
42 private:
43  bool requireAckFlag;
44 };
45 
46 } // namespace impl
47 } // namespace os
48 } // namespace yarp
49 
50 #endif // YARP_OS_IMPL_TCPCARRIER_H
yarp::os::Carrier
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
Definition: Carrier.h:48
yarp::os::impl::TcpCarrier::isConnectionless
bool isConnectionless() const override
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
Definition: TcpCarrier.cpp:69
AbstractCarrier.h
yarp::os::AbstractCarrier
A starter class for implementing simple carriers.
Definition: AbstractCarrier.h:25
yarp::os::impl::TcpCarrier::getHeader
void getHeader(yarp::os::Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
Definition: TcpCarrier.cpp:51
yarp::os::impl::TcpCarrier::expectReplyToHeader
bool expectReplyToHeader(yarp::os::ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
Definition: TcpCarrier.cpp:81
yarp::os::impl::TcpCarrier::getSpecifierCode
virtual int getSpecifierCode() const
Definition: TcpCarrier.cpp:35
yarp::os::impl::TcpCarrier::respondToHeader
bool respondToHeader(yarp::os::ConnectionState &proto) override
Respond to the header.
Definition: TcpCarrier.cpp:74
yarp::os::impl::TcpCarrier::create
Carrier * create() const override
Factory method.
Definition: TcpCarrier.cpp:25
yarp::os::impl::TcpCarrier::TcpCarrier
TcpCarrier(bool requireAckFlag=true)
Definition: TcpCarrier.cpp:20
yarp::os::impl::TcpCarrier::getName
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
Definition: TcpCarrier.cpp:30
yarp::os::impl::TcpCarrier
Communicating between two ports via TCP.
Definition: TcpCarrier.h:24
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
yarp::os::impl::TcpCarrier::setParameters
void setParameters(const yarp::os::Bytes &header) override
Configure this carrier based on the first 8 bytes of the connection.
Definition: TcpCarrier.cpp:56
yarp::os::ConnectionState
The basic state of a connection - route, streams in use, etc.
Definition: ConnectionState.h:31
yarp::os::impl::TcpCarrier::requireAck
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
Definition: TcpCarrier.cpp:64
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::impl::TcpCarrier::checkHeader
bool checkHeader(const yarp::os::Bytes &header) override
Given the first 8 bytes received on a connection, decide if this is the right carrier type to use for...
Definition: TcpCarrier.cpp:40