YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::os::impl::HttpTwoWayStream Class Reference

Minimal http connection support. More...

#include <yarp/os/impl/HttpCarrier.h>

+ Inheritance diagram for yarp::os::impl::HttpTwoWayStream:

Public Member Functions

 HttpTwoWayStream (TwoWayStream *delegate, const char *txt, const char *prefix, yarp::os::Property &prop, bool writer)
 
virtual ~HttpTwoWayStream ()
 
InputStreamgetInputStream () override
 Get an InputStream to read from.
 
OutputStreamgetOutputStream () override
 Get an OutputStream to write to.
 
const ContactgetLocalAddress () const override
 Get the address of the local side of the stream.
 
const ContactgetRemoteAddress () const override
 Get the address of the remote side of the stream.
 
bool isOk () const override
 Check if the stream is ok or in an error state.
 
void reset () override
 Reset the stream.
 
void write (const Bytes &b) override
 Write a block of bytes to the stream.
 
virtual void apply (char ch)
 
void close () override
 Terminate the stream.
 
void beginPacket () override
 Mark the beginning of a logical packet.
 
void endPacket () override
 Mark the end of a logical packet (see beginPacket).
 
void flip ()
 
void finish ()
 
bool useJson ()
 
std::string * typeHint ()
 
- Public Member Functions inherited from yarp::os::TwoWayStream
virtual ~TwoWayStream ()
 Destructor.
 
- Public Member Functions inherited from yarp::os::OutputStream
virtual ~OutputStream ()
 Destructor.
 
virtual void write (char ch)
 Write a single byte to the stream.
 
virtual void write (const Bytes &b, int offset, int len)
 Write a block of bytes to the stream.
 
virtual void flush ()
 Make sure all pending write operations are finished.
 
virtual void writeLine (const char *data, int len)
 Write some text followed by a line feed.
 
virtual bool setWriteTimeout (double timeout)
 Set activity timeout.
 
virtual bool setTypeOfService (int tos)
 
virtual int getTypeOfService ()
 

Detailed Description

Minimal http connection support.

Most useful for connections to YARP ports from browsers. No support for connections in the opposite direction. This carrier is recruited when a port sees a TCP stream that begins with "GET /".

For "GET /", the URL following the "/" is currently translated to text as follows: ", " becomes newline "+" becomes " " This text is then passed on to the port, just as for a normal text connection. For example "GET /d, list" is the same as telnetting into a port and typing: CONNECT anon d list or typing "list" to "yarp rpc /portname". The response of the port, if any, is output in ugly html.

For "POST /" ... not done yet.

Definition at line 43 of file HttpCarrier.h.

Constructor & Destructor Documentation

◆ HttpTwoWayStream()

yarp::os::impl::HttpTwoWayStream::HttpTwoWayStream ( TwoWayStream delegate,
const char txt,
const char prefix,
yarp::os::Property prop,
bool  writer 
)

Definition at line 167 of file HttpCarrier.cpp.

◆ ~HttpTwoWayStream()

yarp::os::impl::HttpTwoWayStream::~HttpTwoWayStream ( )
virtual

Definition at line 352 of file HttpCarrier.cpp.

Member Function Documentation

◆ apply()

void yarp::os::impl::HttpTwoWayStream::apply ( char  ch)
virtual

Definition at line 401 of file HttpCarrier.cpp.

◆ beginPacket()

void yarp::os::impl::HttpTwoWayStream::beginPacket ( )
overridevirtual

Mark the beginning of a logical packet.

This is a unit that should be treated in an atomic fashion by YARP. If any part is corrupted, the whole should be dropped.

Implements yarp::os::TwoWayStream.

Definition at line 503 of file HttpCarrier.cpp.

◆ close()

void yarp::os::impl::HttpTwoWayStream::close ( )
overridevirtual

Terminate the stream.

Implements yarp::os::TwoWayStream.

Definition at line 496 of file HttpCarrier.cpp.

◆ endPacket()

void yarp::os::impl::HttpTwoWayStream::endPacket ( )
overridevirtual

Mark the end of a logical packet (see beginPacket).

Implements yarp::os::TwoWayStream.

Definition at line 508 of file HttpCarrier.cpp.

◆ finish()

void yarp::os::impl::HttpTwoWayStream::finish ( )

Definition at line 518 of file HttpCarrier.cpp.

◆ flip()

void yarp::os::impl::HttpTwoWayStream::flip ( )

Definition at line 513 of file HttpCarrier.cpp.

◆ getInputStream()

yarp::os::InputStream & yarp::os::impl::HttpTwoWayStream::getInputStream ( )
overridevirtual

Get an InputStream to read from.

Returns
the InputStream associated with this object.

Implements yarp::os::TwoWayStream.

Definition at line 360 of file HttpCarrier.cpp.

◆ getLocalAddress()

const Contact & yarp::os::impl::HttpTwoWayStream::getLocalAddress ( ) const
overridevirtual

Get the address of the local side of the stream.

Returns
the address of the local side of the stream. The address will be tagged as invalid if the stream is not set up.

Implements yarp::os::TwoWayStream.

Definition at line 370 of file HttpCarrier.cpp.

◆ getOutputStream()

yarp::os::OutputStream & yarp::os::impl::HttpTwoWayStream::getOutputStream ( )
overridevirtual

Get an OutputStream to write to.

Returns
the InputStream associated with this object.

Implements yarp::os::TwoWayStream.

Definition at line 365 of file HttpCarrier.cpp.

◆ getRemoteAddress()

const Contact & yarp::os::impl::HttpTwoWayStream::getRemoteAddress ( ) const
overridevirtual

Get the address of the remote side of the stream.

Returns
the address of the remote side of the stream. The address will be tagged as invalid if the stream is not set up.

Implements yarp::os::TwoWayStream.

Definition at line 375 of file HttpCarrier.cpp.

◆ isOk()

bool yarp::os::impl::HttpTwoWayStream::isOk ( ) const
overridevirtual

Check if the stream is ok or in an error state.

Returns
true iff the stream is ok

Implements yarp::os::TwoWayStream.

Definition at line 380 of file HttpCarrier.cpp.

◆ reset()

void yarp::os::impl::HttpTwoWayStream::reset ( )
overridevirtual

Reset the stream.

Implements yarp::os::TwoWayStream.

Definition at line 385 of file HttpCarrier.cpp.

◆ typeHint()

std::string * yarp::os::impl::HttpTwoWayStream::typeHint ( )

Definition at line 528 of file HttpCarrier.cpp.

◆ useJson()

bool yarp::os::impl::HttpTwoWayStream::useJson ( )

Definition at line 523 of file HttpCarrier.cpp.

◆ write()

void yarp::os::impl::HttpTwoWayStream::write ( const Bytes b)
overridevirtual

Write a block of bytes to the stream.

Parameters
bthe bytes to write

Implements yarp::os::OutputStream.

Definition at line 390 of file HttpCarrier.cpp.


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