Yet Another Robot Platform
No Matches
Go to the documentation of this file.
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
10#include <yarp/os/NetType.h>
11#include <yarp/os/Property.h>
17namespace yarp::os::impl {
44 public TwoWayStream,
45 public OutputStream
48 std::string proc;
49 std::string part;
50 bool data;
51 bool filterData;
52 bool chunked;
53 TwoWayStream* delegate;
56 std::string format;
57 std::string outer;
58 bool isWriter;
62 const char* txt,
63 const char* prefix,
65 bool writer);
67 virtual ~HttpTwoWayStream();
69 InputStream& getInputStream() override;
70 OutputStream& getOutputStream() override;
71 const Contact& getLocalAddress() const override;
72 const Contact& getRemoteAddress() const override;
74 bool isOk() const override;
75 void reset() override;
77 void write(const Bytes& b) override;
78 virtual void apply(char ch);
79 void close() override;
80 void beginPacket() override;
81 void endPacket() override;
83 void flip();
84 void finish();
85 bool useJson();
86 std::string* typeHint();
94 public TcpCarrier
97 std::string url, input, prefix;
98 bool urlDone;
99 bool expectPost;
100 int contentLength;
102 HttpTwoWayStream* stream;
105 HttpCarrier();
107 Carrier* create() const override;
109 std::string getName() const override;
111 bool checkHeader(const Bytes& header, const char* prefix);
113 bool checkHeader(const Bytes& header) override;
114 void setParameters(const Bytes& header) override;
115 void getHeader(Bytes& header) const override;
116 bool requireAck() const override;
117 bool isTextMode() const override;
118 bool supportReply() const override;
119 bool sendHeader(ConnectionState& proto) override;
120 bool expectSenderSpecifier(ConnectionState& proto) override;
121 bool expectReplyToHeader(ConnectionState& proto) override;
122 bool sendIndex(ConnectionState& proto, SizedWriter& writer) override;
123 bool expectIndex(ConnectionState& proto) override;
124 bool sendAck(ConnectionState& proto) override;
125 bool expectAck(ConnectionState& proto) override;
126 bool respondToHeader(ConnectionState& proto) override;
128 bool reply(ConnectionState& proto, SizedWriter& writer) override;
129 bool write(ConnectionState& proto, SizedWriter& writer) override;
132} // namespace yarp::os::impl
A simple abstraction for a block of bytes.
Definition Bytes.h:24
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
Definition Carrier.h:44
The basic state of a connection - route, streams in use, etc.
Represents how to reach a part of a YARP network.
Definition Contact.h:33
Simple specification of the minimum functions needed from input streams.
Definition InputStream.h:25
Simple specification of the minimum functions needed from output streams.
virtual void write(char ch)
Write a single byte to the stream.
A class for storing options and configuration information.
Definition Property.h:33
Minimal requirements for an efficient Writer.
Definition SizedWriter.h:32
An InputStream that reads from a string.
An OutputStream that produces a string.
A stream which can be asked to perform bidirectional communication.
Communicating via http.
Definition HttpCarrier.h:95
Carrier * create() const override
Factory method.
void getHeader(Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
bool isTextMode() const override
Check if carrier is textual in nature.
bool respondToHeader(ConnectionState &proto) override
Respond to the header.
bool expectReplyToHeader(ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
bool reply(ConnectionState &proto, SizedWriter &writer) override
bool sendAck(ConnectionState &proto) override
Send an acknowledgement, if needed for this carrier.
bool sendHeader(ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
bool expectAck(ConnectionState &proto) override
Receive an acknowledgement, if expected for this carrier.
bool checkHeader(const Bytes &header, const char *prefix)
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
bool write(ConnectionState &proto, SizedWriter &writer) override
Write a message.
bool expectSenderSpecifier(ConnectionState &proto) override
Expect the name of the sending port.
bool expectIndex(ConnectionState &proto) override
Expect a message header, if there is one for this carrier.
void setParameters(const Bytes &header) override
Configure this carrier based on the first 8 bytes of the connection.
bool sendIndex(ConnectionState &proto, SizedWriter &writer) override
Minimal http connection support.
Definition HttpCarrier.h:46
bool isOk() const override
Check if the stream is ok or in an error state.
OutputStream & getOutputStream() override
Get an OutputStream to write to.
void beginPacket() override
Mark the beginning of a logical packet.
void endPacket() override
Mark the end of a logical packet (see beginPacket).
const Contact & getLocalAddress() const override
Get the address of the local side of the stream.
InputStream & getInputStream() override
Get an InputStream to read from.
void reset() override
Reset the stream.
const Contact & getRemoteAddress() const override
Get the address of the remote side of the stream.
void write(const Bytes &b) override
Write a block of bytes to the stream.
void close() override
Terminate the stream.
Communicating between two ports via TCP.
Definition TcpCarrier.h:19
The components from which ports and connections are built.