ConnectionStream
ConnectionStream
#include <icy/http/connection.h>class ConnectionStreamDefined in src/http/include/icy/http/connection.h:261
Inherits:
SocketAdapter
Packet stream wrapper for an HTTP connection.
List of all members
| Name | Kind | Owner |
|---|---|---|
Outgoing | variable | Declared here |
Incoming | variable | Declared here |
IncomingProgress | variable | Declared here |
OutgoingProgress | variable | Declared here |
ConnectionStream | function | Declared here |
~ConnectionStream | function | Declared here |
send | function | Declared here |
connection | function | Declared here |
_connection | variable | Declared here |
onSocketRecv | function | Declared here |
priority | variable | Inherited from SocketAdapter |
SocketAdapter | function | Inherited from SocketAdapter |
~SocketAdapter | function | Inherited from SocketAdapter |
send | function | Inherited from SocketAdapter |
send | function | Inherited from SocketAdapter |
sendOwned | function | Inherited from SocketAdapter |
sendOwned | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
sendPacket | function | Inherited from SocketAdapter |
setSender | function | Inherited from SocketAdapter |
sender | function | Inherited from SocketAdapter |
addReceiver | function | Inherited from SocketAdapter |
removeReceiver | function | Inherited from SocketAdapter |
hasReceiver | function | Inherited from SocketAdapter |
receivers | function | Inherited from SocketAdapter |
onSocketConnect | function | Inherited from SocketAdapter |
onSocketRecv | function | Inherited from SocketAdapter |
onSocketError | function | Inherited from SocketAdapter |
onSocketClose | function | Inherited from SocketAdapter |
_sender | variable | Inherited from SocketAdapter |
_receivers | variable | Inherited from SocketAdapter |
_dirty | variable | Inherited from SocketAdapter |
cleanupReceivers | function | Inherited from SocketAdapter |
Inherited from SocketAdapter
| Kind | Name | Description |
|---|---|---|
variable | priority | The priority of this adapter for STL sort operations. |
function | SocketAdapter | Creates the SocketAdapter. |
function | ~SocketAdapter virtual noexcept | Destroys the SocketAdapter. |
function | send virtual | Sends 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. |
function | send virtual | |
function | sendOwned virtual | Sends an owned payload buffer to the connected peer. |
function | sendOwned virtual | |
function | sendPacket virtual | Sends 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. |
function | sendPacket virtual | |
function | sendPacket virtual | Sends 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. |
function | setSender virtual | Sets the pointer to the outgoing data adapter. Send methods proxy data to this adapter by default. |
function | sender | Returns the output SocketAdapter pointer. |
function | addReceiver virtual | Sets the pointer to the incoming data adapter. Events proxy data to this adapter by default. |
function | removeReceiver virtual | Remove the given receiver. |
function | hasReceiver virtual | Returns true if the given receiver is connected. |
function | receivers | Returns all currently registered input SocketAdapter pointers. Dead (removed) entries are excluded from the returned list. |
function | onSocketConnect virtual | Called 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. |
function | onSocketRecv virtual | Called when data is received from the socket. Forwards the event to all registered receivers in priority order. |
function | onSocketError virtual | Called when the socket encounters an error. Forwards the event to all registered receivers in priority order. |
function | onSocketClose virtual | Called when the socket is closed. Forwards the event to all registered receivers in priority order. |
variable | _sender | |
variable | _receivers | |
variable | _dirty | |
function | cleanupReceivers virtual |
Public Attributes
| Return | Name | Description |
|---|---|---|
PacketStream | Outgoing | The Outgoing stream is responsible for packetizing raw application data into the agreed upon HTTP format and sending it to the peer. |
PacketStream | Incoming | The Incoming stream emits incoming HTTP packets for processing by the application. |
ProgressSignal | IncomingProgress | Fired on download progress. |
ProgressSignal | OutgoingProgress | Fired on upload progress. |
Outgoing
PacketStream OutgoingDefined 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 IncomingDefined 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 IncomingProgressDefined in src/http/include/icy/http/connection.h:288
Fired on download progress.
OutgoingProgress
ProgressSignal OutgoingProgressDefined in src/http/include/icy/http/connection.h:289
Fired on upload progress.
Public Methods
| Return | Name | Description |
|---|---|---|
ConnectionStream | 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. | |
ssize_t | send virtual override | Send data via the Outgoing stream. |
Connection::Ptr | connection | Return 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
connectionThe HTTP connection to wrap.
send
virtual override
virtual ssize_t send(const char * data, size_t len, int flags = 0) overrideDefined 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
| Return | Name | Description |
|---|---|---|
Connection::Ptr | _connection |
_connection
Connection::Ptr _connectionDefined in src/http/include/icy/http/connection.h:294
Protected Methods
| Return | Name | Description |
|---|---|---|
bool | onSocketRecv virtual override | Called 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) overrideDefined 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
socketThe socket that received data.bufferThe received data buffer.peerAddressAddress of the sender.
Returns
true to stop propagation to subsequent receivers.
