Ocean
Ocean::Network::PackagedSocket Class Reference

This class is the base class for all packaged sockets. More...

Inheritance diagram for Ocean::Network::PackagedSocket:

Data Structures

class  MemoryBlock
 This class implements a memory block. More...
 
class  PackageHeader
 Definition of a package header. More...
 

Public Types

typedef uint32_t MessageId
 Definition of a message id. More...
 
- Public Types inherited from Ocean::Network::Socket
enum  SocketResult { SR_SUCCEEDED = 0 , SR_FAILED , SR_BUSY , SR_NOT_CONNECTED }
 Definition of individual result values. More...
 
typedef SOCKET SocketId
 Definition of a socket id. More...
 
typedef int SocketId
 Definition of a socket id. More...
 
typedef std::vector< uint8_t > Buffer
 Definition of a vector holding 8 bit values. More...
 

Static Public Member Functions

static constexpr MessageId invalidMessageId ()
 Returns an invalid message id. More...
 
static constexpr size_t packageManagmentHeaderSize ()
 Returns the size of the package management header in bytes. More...
 
static constexpr size_t maximalPackagedMessageSize ()
 Returns the maximal size of a packaged message. More...
 
- Static Public Member Functions inherited from Ocean::Network::Socket
static constexpr SocketId invalidSocketId ()
 Returns an invalid socket id. More...
 
static bool setBlockingMode (const SocketId socketId, const bool blocking)
 Sets the blocking mode of a socket. More...
 

Protected Types

typedef std::queue< MemoryBlockMemoryBlockQueue
 Definition of a queue holding memory blocks. More...
 

Protected Member Functions

 PackagedSocket ()
 Creates a new packaged socket. More...
 
- Protected Member Functions inherited from Ocean::Network::Socket
 Socket ()
 Creates a new socket object. More...
 
 Socket (const Socket &object)=delete
 Disabled copy constructor. More...
 
bool setBlockingMode (const bool blocking)
 Sets the blocking mode of this socket. More...
 
size_t maximalMessageSize (const size_t defaultSize=65536)
 Returns the maximal message size in bytes. More...
 
bool releaseSocket ()
 Releases the socket. More...
 
virtual bool onScheduler ()
 The scheduler event function. More...
 
Socketoperator= (const Socket &object)=delete
 Disabled copy operator. More...
 

Static Protected Member Functions

static bool extractNextPackage (MemoryBlockQueue &sourceQueue, MemoryBlock &targetMemory)
 Extracts a memory block from a queue with memory block. More...
 

Additional Inherited Members

- Public Member Functions inherited from Ocean::Network::Socket
virtual ~Socket ()
 Destructs a socket object. More...
 
SocketId id () const
 Returns the socket id. More...
 
Address4 address () const
 Returns the own address of this socket. More...
 
Port port () const
 Returns the own port of this socket. More...
 
virtual bool setAddress (const Address4 &address)
 Sets the own address of this socket. More...
 
virtual bool setPort (const Port &port)
 Sets the own port of this socket. More...
 
 operator bool () const
 Returns whether this socket is valid. More...
 
- Protected Attributes inherited from Ocean::Network::Socket
SocketId socketId_ = invalidSocketId()
 Socket id. More...
 
Lock lock_
 Socket lock. More...
 
NetworkResource networkResource_
 The network resource object. More...
 

Detailed Description

This class is the base class for all packaged sockets.

Member Typedef Documentation

◆ MemoryBlockQueue

Definition of a queue holding memory blocks.

◆ MessageId

Definition of a message id.

Constructor & Destructor Documentation

◆ PackagedSocket()

Ocean::Network::PackagedSocket::PackagedSocket ( )
protected

Creates a new packaged socket.

Member Function Documentation

◆ extractNextPackage()

static bool Ocean::Network::PackagedSocket::extractNextPackage ( MemoryBlockQueue sourceQueue,
MemoryBlock targetMemory 
)
staticprotected

Extracts a memory block from a queue with memory block.

Parameters
sourceQueueThe queue from which the memory will be extracted
targetMemoryThe target memory block to be filled, must be valid, must have remaining bytes
Returns
True, if the target memory block has been filled and no byte is remaining anymore

◆ invalidMessageId()

constexpr PackagedSocket::MessageId Ocean::Network::PackagedSocket::invalidMessageId ( )
staticconstexpr

Returns an invalid message id.

Returns
Invalid message id

◆ maximalPackagedMessageSize()

constexpr size_t Ocean::Network::PackagedSocket::maximalPackagedMessageSize ( )
staticconstexpr

Returns the maximal size of a packaged message.

Returns
The maximal size of a packaged message in bytes

◆ packageManagmentHeaderSize()

constexpr size_t Ocean::Network::PackagedSocket::packageManagmentHeaderSize ( )
staticconstexpr

Returns the size of the package management header in bytes.

Returns
The header's size in bytes

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