#include <Transport.h> [code]
Inherits Protocols::Generics::Connection, and Protocols::Generics::Buffer.
Inherited by Protocols::Generics::SocketTransport, and Protocols::Generics::Testing::TransportStub.
Inheritance diagram for Protocols::Generics::Transport:


A Transport is a Connection with a built-in Buffer.
Typically each application layer protocol (TCP/IP suite) is bound to using either TCP or UDP transport. For the sake of extensibility we at Calitko would like to be able to easily change transports and for example run HTTP on top of a custom UDP-based transport protocol (e.g. make NAT to NAT transfers possible, or to run Gnutella over UDP instead of TCP).
The classical socket interface requires users to implement a mechanism for buffering incoming or outgoing data until a complete information unit (e.g. packet) has been received or sent. User code can be largely simplified by guaranteeing that a certain number of bytes can be read or written via the Transport. The clients can thus buffer only higher level representation of their data (as C++ objects) and write/read each one as raw bytes in a single call to Transport. High level implementation would not need to care about buffering raw data anymore. Hence, a Transport implementation will manage internal read and write buffers. Take a look at the functions peek(), peekTo(), peekAll(), read(), readTo(), readAll() and write().
Since concrete protocols may be either stream oriented or datagram oriented, the data read/write interface of Connection should provide for unambiguous interpretation how the raw data should be arranged in datagrams. The flush flag of write() can be used to give the transport a clue where is the end of a packet for example. Then all buffered data between flushes will be written in a single datagram. When reading packets send over datagram based transports, the transport may validate the packet headers to make sure that the packet could correctly be extracted from the sequential interface of Transport.
Definition at line 79 of file Transport.h.
Public Member Functions | |
| virtual | ~Transport () |
| virtual void | setTransportStatus (TransportStatus *)=0 |
|
|
Definition at line 84 of file Transport.h. |
|
|
Implemented in Protocols::Generics::SocketTransport, and Protocols::Generics::Testing::TransportStub. |