![]() |
Open 3D Engine GridMate API Reference
2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <Driver.h>
Inherited by GridMate::SocketDriverCommon.
Public Types | |
enum | ErrorCodes { EC_OK = 0, EC_SOCKET_CREATE, EC_SOCKET_LISTEN, EC_SOCKET_CLOSE, EC_SOCKET_MAKE_NONBLOCK, EC_SOCKET_BIND, EC_SOCKET_SOCK_OPT, EC_SOCKET_CONNECT, EC_SOCKET_ACCEPT, EC_SECURE_CONFIG, EC_SECURE_CREATE, EC_SECURE_CERT, EC_SECURE_PKEY, EC_SECURE_CA_CERT, EC_SEND, EC_SEND_ADDRESS_NOT_BOUND, EC_RECEIVE, EC_PLATFORM = 1000, EC_BUFFER_TOOLARGE = 1001 } |
enum | BSDSocketFamilyType { BSD_AF_INET = 0, BSD_AF_INET6, BSD_AF_UNSPEC } |
typedef unsigned int | ResultCode |
Public Member Functions | |
virtual void | Update () |
virtual void | ProcessIncoming () |
virtual void | ProcessOutgoing () |
virtual unsigned int | GetMaxNumConnections () const =0 |
Return maximum number of active connections at the same time. More... | |
virtual unsigned int | GetMaxSendSize () const =0 |
Return maximum data size we can send/receive at once in bytes, supported by the platform. | |
virtual unsigned int | GetPacketOverheadSize () const |
Return packet overhead size in bytes. | |
virtual ResultCode | Initialize (int familyType=0, const char *address=nullptr, unsigned int port=0, bool isBroadcast=false, unsigned int receiveBufferSize=0, unsigned int sendBufferSize=0)=0 |
Transforms an error code to string. More... | |
virtual unsigned int | GetPort () const =0 |
Returns communication port (must be called after Initialize, otherwise it will return 0) | |
virtual ResultCode | Send (const AZStd::intrusive_ptr< DriverAddress > &to, const char *data, unsigned int dataSize)=0 |
Send data to a user defined address. | |
virtual unsigned int | Receive (char *data, unsigned int maxDataSize, AZStd::intrusive_ptr< DriverAddress > &from, ResultCode *resultCode=0)=0 |
virtual bool | WaitForData (AZStd::chrono::microseconds timeOut=AZStd::chrono::microseconds(0))=0 |
virtual void | StopWaitForData ()=0 |
virtual bool | WasStopeedWaitingForData ()=0 |
Return true if WaitForData was interrupted before the timeOut expired, otherwise false. | |
virtual AZStd::intrusive_ptr< DriverAddress > | CreateDriverAddress (const AZStd::string &address)=0 |
virtual bool | CanSend () const |
virtual AZStd::string | IPPortToAddress (const char *ip, unsigned int port) const =0 |
virtual bool | AddressToIPPort (const AZStd::string &address, AZStd::string &ip, unsigned int &port) const =0 |
Protected Member Functions | |
virtual void | DestroyDriverAddress (DriverAddress *address)=0 |
Protected Attributes | |
bool | m_canSend |
Can the driver accept more data. | |
Friends | |
class | DriverAddress |
Driver interface is the interface for the lowest level of the transport layer.
Family types for BSD socket.
|
inlinevirtual |
Returns true if the driver can accept new data (ex, has buffer space).
|
pure virtual |
Creates internal driver address to be used for send/receive calls.
Implemented in GridMate::SocketDriverCommon, and GridMate::SocketDriver.
|
pure virtual |
Return maximum number of active connections at the same time.
Platform specific functionality.
Implemented in GridMate::SocketDriverCommon, and GridMate::StreamSocketDriver.
|
pure virtual |
Transforms an error code to string.
User should implement create and bind a UDP socket. This socket will be used for all communications.
ft | family type (this value depends on the platform), 0 will use the default family type (for BSD socket this is ipv4) |
address | when 0 it we will assume "any address". |
port | When left 0, we use implicit bind (assigned by the system). Otherwise provide a valid port number. |
receiveBufferSize | socket receive buffer size in bytes, use 0 for default values. |
sendBufferSize | socket send buffer size, use 0 for default values. |
Implemented in GridMate::SocketDriverCommon.
|
pure virtual |
Address conversion functionality. They MUST implemented thread safe. Generally this is not a problem since they just part local data. Create address from ip and port. If ip == NULL we will assign a broadcast address.
Implemented in GridMate::SocketDriverCommon.
|
pure virtual |
Receives a datagram and stores the source address. maxDataSize must be >= than GetMaxSendSize(). Returns the num of of received bytes.
Implemented in GridMate::SocketDriverCommon.
|
pure virtual |
When you enter wait for data mode, for many reasons you might want to stop wait for data. If you implement this function you need to make sure it's a thread safe function.
Implemented in GridMate::SocketDriverCommon.
|
pure virtual |
Wait for data to be to the ready for receive. Time out is the maximum time to wait before this function returns. If left to default value it will be in blocking mode (wait until data is ready to be received).
Implemented in GridMate::SocketDriverCommon.