RNET

Types

Adapter

Address

IMessage

IPeer

LogEntry

System

MessageType

PeerStatus

LogEvent

Type Aliases

RED_RC (*

ON_CONNECTION_READY_CALLBACK

RED_RC (*

ON_CONNECTION_CLOSED_CALLBACK

RED_RC (*

ON_DATA_RECEIVED_CALLBACK

RED_RC (*

ON_DATA_REQUEST_CALLBACK

RED_RC (*

ON_POLL_CALLBACK

RED_RC (*

ON_SHUTDOWN_CALLBACK

void(*

LOG_CALLBACK

Fields

MST_INVALID

MST_ERROR

MST_DISPATCHER_REGISTRATION_REFUSED

MST_DISPATCHER_REGISTRATION_SUCCESSFUL

MST_DISPATCHER_SHUTDOWN

MST_DISPATCHER_CONNECTION_ACCEPTED

MST_DISPATCHER_CONNECTION_LOST

MST_DISPATCHER_PEER_STATUS_REQUESTED

MST_PEER_ALIVE

MST_PEER_STATUS_READY

MST_PEER_STATUS_BUSY

MST_PEER_STATUS_UNDEFINED

MST_PEER_KILLED

MST_PEER_REGISTRATION_REQUESTED

MST_PEER_UNREGISTRATION_REQUESTED

MST_PEER_LOG_REQUESTED

MST_PEER_LOG_CONTENT

MST_DATA_STRING

MST_DATA_IMAGE

MST_DATA_WEBSOCKET

MST_DATA_CUSTOM

RPS_UNDEFINED

RPS_READY

RPS_BUSY

RLE_CUSTOM

RLE_UNDEFINED

RLE_INFO_LOG_START

RLE_INFO_LOG_END

RLE_INFO_CONNECT

RLE_INFO_DISCONNECT

RLE_INFO_TIME_OUT

RLE_INFO_PEER_START

RLE_INFO_PEER_SHUTDOWN

RLE_INFO_SYS_START

RLE_INFO_SYS_SHUTDOWN

RLE_WARNING_NET_ERROR

RLE_ERROR_NET_ERROR

Detailed Description

namespace RNET

Namespace of all REDnet interfaces and classes.

Type Documentation

enum RNET::MessageType

List of different message types.

Values:

enumerator MST_INVALID

Invalid message. No data.

enumerator MST_ERROR

Message received upon a network error. No data.

enumerator MST_DISPATCHER_REGISTRATION_REFUSED

Sent by the dispatcher when a registration request has been refused. No data.

enumerator MST_DISPATCHER_REGISTRATION_SUCCESSFUL

Sent by the dispatcher when a peer has been successfully registered. No data.

enumerator MST_DISPATCHER_SHUTDOWN

Sent by the dispatcher before shuting down. No data.

enumerator MST_DISPATCHER_CONNECTION_ACCEPTED

Sent by the dispatcher when an input connection is accepted. No data.

enumerator MST_DISPATCHER_CONNECTION_LOST

Received by a peer when its connection with the dispatcher has been abnormally close. No data.

enumerator MST_DISPATCHER_PEER_STATUS_REQUESTED

Sent by the dispatcher to a peer when wanting to know the peer status. No data.

enumerator MST_PEER_ALIVE

Sent by a peer to inform it’s alive. No data.

enumerator MST_PEER_STATUS_READY

Sent by a peer to inform it’s ready for connection. No data.

enumerator MST_PEER_STATUS_BUSY

Sent by a peer to inform it’s busy and can’t accept new connections. No data.

enumerator MST_PEER_STATUS_UNDEFINED

Sent by a peer to inform it’s in an undefined status. No data.

enumerator MST_PEER_KILLED

Sent by a peer to inform it’s been killed. No data.

enumerator MST_PEER_REGISTRATION_REQUESTED

Sent by a peer when wanting to be registered to a dispatcher. No data.

enumerator MST_PEER_UNREGISTRATION_REQUESTED

Sent by a peer when wanting to be unregistered from a dispatcher. No data.

enumerator MST_PEER_LOG_REQUESTED

Sent by a peer when wanting to receive the dest log file. No data.

enumerator MST_PEER_LOG_CONTENT

Sent by a peer with the content of its log file. Data are the log file content.

enumerator MST_DATA_STRING

The message contains a string. Following data are the string itself.

enumerator MST_DATA_IMAGE

The message contains an image. Following data are the image itself.

enumerator MST_DATA_WEBSOCKET

The message contains data coming from a websocket. Data type is the one set to the websocket.

enumerator MST_DATA_CUSTOM

The message contains data in an unknown format.

enum RNET::PeerStatus

Lists the possible status of a peer.

Values:

enumerator RPS_UNDEFINED

The peer is alive but in an undefined status.

enumerator RPS_READY

The peer is alive and ready to connect to.

enumerator RPS_BUSY

The peer is alive but can’t accept any incoming connection.

enum RNET::LogEvent

Enumeration of the various loggable events.

Values:

enumerator RLE_CUSTOM

Custom event.

enumerator RLE_UNDEFINED

Undefined event.

enumerator RLE_INFO_LOG_START

Log start event.

enumerator RLE_INFO_LOG_END

Log end event.

enumerator RLE_INFO_CONNECT

Peer connection event.

enumerator RLE_INFO_DISCONNECT

Peer disconnection event.

enumerator RLE_INFO_TIME_OUT

Time-out event.

enumerator RLE_INFO_PEER_START

Peer start event.

enumerator RLE_INFO_PEER_SHUTDOWN

Peer shutdown event.

enumerator RLE_INFO_SYS_START

REDnet start event.

enumerator RLE_INFO_SYS_SHUTDOWN

REDnet shutdown event.

enumerator RLE_WARNING_NET_ERROR

Network warning event (a non-fatal error has been detected and handled).

enumerator RLE_ERROR_NET_ERROR

Network error event (an error has been detected and not handled).

Type Alias Documentation

typedef RED_RC (*RNET::ON_CONNECTION_READY_CALLBACK)(int iConnection, const RNET::Address &iAddress, void *ioUserData)

Custom on peer connection ready callback.

This callback is called each time a peer accepted a connection and the connection has been successfully set between the two peers.

Param iConnection

handle of the input connection.

Param iAddress

network address of the distant peer.

Param ioUserData

user data pointer.

Return

RED_OK on success, RED_FAIL otherwise.

typedef RED_RC (*RNET::ON_CONNECTION_CLOSED_CALLBACK)(int iConnection, void *ioUserData)

Custom on peer connection closed callback.

This callback is called each time a connection is closed by the distant peer.

Param iConnection

handle of the input connection.

Param ioUserData

user data pointer.

Return

RED_OK on success, RED_FAIL otherwise.

typedef RED_RC (*RNET::ON_DATA_RECEIVED_CALLBACK)(int iConnection, const RNET::IMessage &iMessage, void *ioUserData)

Custom on data received callback.

This callback is called each time data are received through an accepted connection.

Param iConnection

handle of the input connection.

Param iMessage

pointer to the received message.

Param ioUserData

user data pointer.

Return

RED_OK on success, RED_FAIL otherwise.

typedef RED_RC (*RNET::ON_DATA_REQUEST_CALLBACK)(int iConnection, const RED::String &iQuery, const RED::String &iArguments, void *ioUserData)

Custom on data request callback.

This callback is called each time data are requested by a client. If the callback can serve the request by sending the data to the connection, it must returns RED_NET_PROCESSED, otherwise it must returns RED_OK (if no error occured) to let RNET process the request.

Param iConnection

handle of the input connection.

Param iQuery

string describing the requested data.

Param iArguments

optional query arguments.

Param ioUserData

user data pointer.

Return

RED_OK on success (but the query was not processed by the callback),

RED_NET_PROCESSED on success (the query was processed by the callback),

RED_FAIL otherwise.

typedef RED_RC (*RNET::ON_POLL_CALLBACK)(void *ioUserData)

Custom on poll callback.

This callback is called each time REDnet performs polling.

Param ioUserData

user data pointer.

Return

RED_OK on success, RED_FAIL otherwise.

typedef RED_RC (*RNET::ON_SHUTDOWN_CALLBACK)(void *ioUserData)

Custom on shutdown callback.

This callback is called when a peer is shutdown.

Param ioUserData

user data pointer.

Return

RED_OK on success, RED_FAIL otherwise.

typedef void (*RNET::LOG_CALLBACK)(const RNET::LogEntry &iLogEntry, void *ioUserData)

Custom callback called on each network event log.

This callback can be used to intercept every network event log and process them directly.

Param iLogEntry

new log entry.

Param ioUserData

user data pointer.