|
Simple Geolocalization and Course Transmission Protocol (SGCTP)
|
TCP transmission of SGCTP payload. More...
#include <sgctp/transmit_tcp.hpp>
Public Member Functions | |
| CTransmit_TCP () | |
| virtual | ~CTransmit_TCP () |
| virtual void | setTimeout (int _iSocket, double _fdTimeout) |
| Set the transmission (send/receive) timeout, in seconds. More... | |
| virtual ETransmitType | getTransmitType () |
| Return the transmission type. More... | |
| virtual int | alloc () |
| Allocate resources required for data transmission (un-/serialization) More... | |
| virtual int | serialize (int _iSocket, const CData &_roData) |
| Serialize the given SGCTP data to the given descriptor. More... | |
| virtual int | unserialize (int _iSocket, CData *_poData, int _iMaxSize=0) |
| Unserialize the SGCTP data from the given descriptor. More... | |
| int | sendHandshake (int _iSocket) |
| Send the TCP handshake. More... | |
| int | recvHandshake (int _iSocket) |
| Receive the TCP handshake (and initialize internal resources: principal/payload) More... | |
Public Member Functions inherited from SGCTP::CTransmit | |
| CTransmit () | |
| virtual | ~CTransmit () |
| bool | hasData () |
| Return whether data are available (in the transmission buffer) More... | |
| virtual bool | hasPayload () |
| Return whether a payload object has been successfully associated/initialized. More... | |
| virtual void | resetPayload () |
| Reset (clear) the associated payload object. More... | |
| virtual int | initPayload (uint8_t _ui8tPayloadType=PAYLOAD_RAW) |
| Associate and initialize payload object. More... | |
| virtual int | allocPayload () |
| Allocate resources required for payload (un-)serialization. More... | |
| virtual void | freePayload () |
| Free resources required for payload (un-)serialization. More... | |
| virtual EPayloadType | getPayloadType () |
| Return the payload type. More... | |
| virtual void | free () |
| Free resources required for data transmission (un-/serialization) More... | |
Public Member Functions inherited from SGCTP::CParameters | |
| CParameters () | |
| ~CParameters () | |
| CPrincipal * | usePrincipal () |
| Return the principal (pointer) More... | |
| void | reset () |
| Reset (undefines) all data. More... | |
| void | setSocketAddress (struct sockaddr *_ptSockaddr, socklen_t *_ptSocklenT) |
| Set the network socket address (pointers to existing variables) More... | |
| void | setPrincipalsPath (const char *_pcPrincipalsPath) |
| Set the principals (database) path (pointer to existing variable) More... | |
| void | setPasswordSalt (const unsigned char *_pucPasswordSalt) |
| Set the cryptographic password salt/nonce (pointer to existing variable) More... | |
Protected Member Functions | |
| virtual int | send (int _iSocket, const void *_pBuffer, int _iSize, int _iFlags) |
| Send data to the given descriptor. More... | |
| virtual int | recv (int _iSocket, void *_pBuffer, int _iSize, int _iFlags) |
| Receive data from the given descriptor. More... | |
Protected Member Functions inherited from SGCTP::CTransmit | |
| int | allocBuffer () |
| Allocate resources required for data transmission. More... | |
| int | recvBuffer (int _iDescriptor, int _iSize) |
| Receive data from the given descriptor (and push them on the data buffer) More... | |
| const unsigned char * | pullBuffer (int _iSize) |
| Pull data from the transmission buffer. More... | |
| void | flushBuffer () |
| Flush the data buffer (from pulled data) More... | |
| void | resetBuffer () |
| Reset the data buffer (clear all data) More... | |
Additional Inherited Members | |
Public Types inherited from SGCTP::CTransmit | |
| enum | ETransmitType { TRANSMIT_UDP = 0, TRANSMIT_TCP = 1, TRANSMIT_FILE = 128, TRANSMIT_UNDEFINED = 255 } |
| Transmission types. More... | |
| enum | EPayloadType { PAYLOAD_RAW = 0, PAYLOAD_AES128 = 1, PAYLOAD_UNDEFINED = 255 } |
| Payload types. More... | |
Static Public Attributes inherited from SGCTP::CTransmit | |
| static const uint8_t | PROTOCOL_VERSION = 1 |
| Protocol version. More... | |
Protected Attributes inherited from SGCTP::CTransmit | |
| unsigned char * | pucBuffer |
| Transmission buffer. More... | |
| int | iBufferSize |
| Transmission buffer size. More... | |
| int | iBufferDataStart |
| Transmission buffer actual data start offset. More... | |
| int | iBufferDataEnd |
| Transmission buffer actual data end offset. More... | |
| double | fdTimeout |
| Transmission timeout, in seconds. More... | |
| CPayload * | poPayload |
| Associated payload object. More... | |
| EPayloadType | ePayloadType |
| Associated payload type. More... | |
Protected Attributes inherited from SGCTP::CParameters | |
| struct sockaddr * | ptSockaddr |
| Network socket address (pointer to existing variable) More... | |
| socklen_t * | ptSocklenT |
| Network socket address length (pointer to existing variable) More... | |
| const char * | pcPrincipalsPath |
| Principals (database) path (pointer to existing variable) More... | |
| CPrincipal | oPrincipal |
| Principal. More... | |
| const unsigned char * | pucPasswordSalt |
| Cryptographic password salt/nonce (pointer to existing variable) More... | |
TCP transmission of SGCTP payload.
This class allows the transmission of a SGCTP payload via TCP, including additional definition of the required handshake (and underlying "session" establishement).
Definition at line 40 of file transmit_tcp.hpp.
|
inline |
Definition at line 48 of file transmit_tcp.hpp.
|
inlinevirtual |
Definition at line 51 of file transmit_tcp.hpp.
|
virtual |
Set the transmission (send/receive) timeout, in seconds.
| [in] | _iDescriptor | File/socket/... descriptor |
| [in] | _fdTimeout | Transmission timeout, in seconds |
Reimplemented from SGCTP::CTransmit.
Definition at line 41 of file transmit_tcp.cpp.
|
protectedvirtual |
Send data to the given descriptor.
| [in] | _iDescriptor | File/socket/... descriptor |
| [in] | _pBuffer | Pointer to buffer (containing data to be sent) |
| [in] | _iSize | Size of data to send |
| [in] | _iFlags | Descriptor-specific control flags |
Implements SGCTP::CTransmit.
Definition at line 61 of file transmit_tcp.cpp.
|
protectedvirtual |
Receive data from the given descriptor.
| [in] | _iDescriptor | File/socket/... descriptor |
| [in] | _pBuffer | Pointer to buffer (to store received data) |
| [in] | _iSize | Size of data to receive |
| [in] | _iFlags | Descriptor-specific control flags |
Implements SGCTP::CTransmit.
Definition at line 73 of file transmit_tcp.cpp.
|
inlinevirtual |
Return the transmission type.
Implements SGCTP::CTransmit.
Definition at line 75 of file transmit_tcp.hpp.
|
virtual |
Allocate resources required for data transmission (un-/serialization)
Implements SGCTP::CTransmit.
Definition at line 85 of file transmit_tcp.cpp.
|
virtual |
Serialize the given SGCTP data to the given descriptor.
| [in] | _iDescriptor | File/socket/... descriptor |
| [in] | _roData | SGCTP data object (to be serialized/sent) |
Reimplemented from SGCTP::CTransmit.
Definition at line 90 of file transmit_tcp.cpp.
|
virtual |
Unserialize the SGCTP data from the given descriptor.
| [in] | _iDescriptor | File/socket/... descriptor |
| [in] | _poData | SGCTP data object (to store unserialized/received data) |
| [in] | _iMaxSize | Maximum size of expected data (0 = no limit) |
Reimplemented from SGCTP::CTransmit.
Definition at line 120 of file transmit_tcp.cpp.
| int CTransmit_TCP::sendHandshake | ( | int | _iSocket | ) |
Send the TCP handshake.
| [in] | _iSocket | TCP socket descriptor |
Definition at line 173 of file transmit_tcp.cpp.
| int CTransmit_TCP::recvHandshake | ( | int | _iSocket | ) |
Receive the TCP handshake (and initialize internal resources: principal/payload)
| [in] | _iSocket | TCP socket descriptor |
Definition at line 347 of file transmit_tcp.cpp.