Home
HTTP module

ConnectionStream

Packet stream wrapper for an HTTP connection.

ConnectionStream

#include <icy/http/connection.h>
class ConnectionStream

Defined in src/http/include/icy/http/connection.h:261

Inherits: SocketAdapter

Packet stream wrapper for an HTTP connection.

List of all members

NameKindOwner
OutgoingvariableDeclared here
IncomingvariableDeclared here
IncomingProgressvariableDeclared here
OutgoingProgressvariableDeclared here
ConnectionStreamfunctionDeclared here
~ConnectionStreamfunctionDeclared here
sendfunctionDeclared here
connectionfunctionDeclared here
_connectionvariableDeclared here
onSocketRecvfunctionDeclared here
priorityvariableInherited from SocketAdapter
SocketAdapterfunctionInherited from SocketAdapter
~SocketAdapterfunctionInherited from SocketAdapter
sendfunctionInherited from SocketAdapter
sendfunctionInherited from SocketAdapter
sendOwnedfunctionInherited from SocketAdapter
sendOwnedfunctionInherited from SocketAdapter
sendPacketfunctionInherited from SocketAdapter
sendPacketfunctionInherited from SocketAdapter
sendPacketfunctionInherited from SocketAdapter
setSenderfunctionInherited from SocketAdapter
senderfunctionInherited from SocketAdapter
addReceiverfunctionInherited from SocketAdapter
removeReceiverfunctionInherited from SocketAdapter
hasReceiverfunctionInherited from SocketAdapter
receiversfunctionInherited from SocketAdapter
onSocketConnectfunctionInherited from SocketAdapter
onSocketRecvfunctionInherited from SocketAdapter
onSocketErrorfunctionInherited from SocketAdapter
onSocketClosefunctionInherited from SocketAdapter
_sendervariableInherited from SocketAdapter
_receiversvariableInherited from SocketAdapter
_dirtyvariableInherited from SocketAdapter
cleanupReceiversfunctionInherited from SocketAdapter

Inherited from SocketAdapter

KindNameDescription
variablepriorityThe priority of this adapter for STL sort operations.
functionSocketAdapterCreates the SocketAdapter.
function~SocketAdapter virtual noexceptDestroys the SocketAdapter.
functionsend virtualSends the given data buffer to the connected peer. Returns the number of bytes sent or -1 on error. No exception will be thrown. For TCP sockets the given peer address must match the connected peer address.
functionsend virtual
functionsendOwned virtualSends an owned payload buffer to the connected peer.
functionsendOwned virtual
functionsendPacket virtualSends the given packet to the connected peer. Returns the number of bytes sent or -1 on error. No exception will be thrown. For TCP sockets the given peer address must match the connected peer address.
functionsendPacket virtual
functionsendPacket virtualSends the given packet to the connected peer. This method provides delegate compatibility, and unlike other send methods throws an exception if the underlying socket is closed.
functionsetSender virtualSets the pointer to the outgoing data adapter. Send methods proxy data to this adapter by default.
functionsenderReturns the output SocketAdapter pointer.
functionaddReceiver virtualSets the pointer to the incoming data adapter. Events proxy data to this adapter by default.
functionremoveReceiver virtualRemove the given receiver.
functionhasReceiver virtualReturns true if the given receiver is connected.
functionreceiversReturns all currently registered input SocketAdapter pointers. Dead (removed) entries are excluded from the returned list.
functiononSocketConnect virtualCalled when the socket establishes a connection. Forwards the event to all registered receivers in priority order. Override to intercept before the application sees the event.
functiononSocketRecv virtualCalled when data is received from the socket. Forwards the event to all registered receivers in priority order.
functiononSocketError virtualCalled when the socket encounters an error. Forwards the event to all registered receivers in priority order.
functiononSocketClose virtualCalled when the socket is closed. Forwards the event to all registered receivers in priority order.
variable_sender
variable_receivers
variable_dirty
functioncleanupReceivers virtual

Public Attributes

ReturnNameDescription
PacketStreamOutgoingThe Outgoing stream is responsible for packetizing raw application data into the agreed upon HTTP format and sending it to the peer.
PacketStreamIncomingThe Incoming stream emits incoming HTTP packets for processing by the application.
ProgressSignalIncomingProgressFired on download progress.
ProgressSignalOutgoingProgressFired on upload progress.

Outgoing

PacketStream Outgoing

Defined in src/http/include/icy/http/connection.h:280

The Outgoing stream is responsible for packetizing raw application data into the agreed upon HTTP format and sending it to the peer.


Incoming

PacketStream Incoming

Defined in src/http/include/icy/http/connection.h:286

The Incoming stream emits incoming HTTP packets for processing by the application.

This is useful for example when writing incoming data to a file.


IncomingProgress

ProgressSignal IncomingProgress

Defined in src/http/include/icy/http/connection.h:288

Fired on download progress.


OutgoingProgress

ProgressSignal OutgoingProgress

Defined in src/http/include/icy/http/connection.h:289

Fired on upload progress.

Public Methods

ReturnNameDescription
ConnectionStreamCreates a ConnectionStream wrapping the given HTTP connection. Wires the Outgoing stream emitter to the connection adapter and registers this stream to receive incoming data from the adapter.
ssize_tsend virtual overrideSend data via the Outgoing stream.
Connection::PtrconnectionReturn a reference to the underlying connection.

ConnectionStream

ConnectionStream(Connection::Ptr connection)

Defined in src/http/include/icy/http/connection.h:268

Creates a ConnectionStream wrapping the given HTTP connection. Wires the Outgoing stream emitter to the connection adapter and registers this stream to receive incoming data from the adapter.

Parameters

  • connection The HTTP connection to wrap.

send

virtual override

virtual ssize_t send(const char * data, size_t len, int flags = 0) override

Defined in src/http/include/icy/http/connection.h:272

Send data via the Outgoing stream.

Reimplements

connection

Connection::Ptr connection()

Defined in src/http/include/icy/http/connection.h:275

Return a reference to the underlying connection.

Protected Attributes

ReturnNameDescription
Connection::Ptr_connection

_connection

Connection::Ptr _connection

Defined in src/http/include/icy/http/connection.h:294

Protected Methods

ReturnNameDescription
boolonSocketRecv virtual overrideCalled when data is received from the socket. Forwards the event to all registered receivers in priority order.

onSocketRecv

virtual override

virtual bool onSocketRecv(net::Socket & socket, const MutableBuffer & buffer, const net::Address & peerAddress) override

Defined in src/http/include/icy/http/connection.h:292

Called when data is received from the socket. Forwards the event to all registered receivers in priority order.

Parameters

  • socket The socket that received data.

  • buffer The received data buffer.

  • peerAddress Address of the sender.

Returns

true to stop propagation to subsequent receivers.

Reimplements