DCSModulesAPI  1.0.0
DCS sub project containing all the control modules as libraries.
Classes | Namespaces | Typedefs | Enumerations | Functions
DCS_ModuleNetwork.h File Reference

Exposes Network functionalities of the API to the end user. More...

#include "../../config/exports.h"
#include "../../DCS_Utils/include/DCS_ModuleUtils.h"
#include "../../config/registry.h"
#include <unordered_map>

Go to the source code of this file.

Classes

class  DCS::CLI::Command
 Class responsible for keeping the state of a declared command to use in the server console. More...
 

Namespaces

 DCS::Network
 Network control using sockets.
 
 DCS::Network::Server
 Server-side handling features.
 
 DCS::Network::Client
 Client-side handling features.
 
 DCS::Network::Message
 Handles default messaging via a simple fixed protocol.
 
 DCS::CLI
 Command Line Interface (CLI) responsible for handling server-side console commands.
 

Typedefs

typedef DCS::GenericHandle DCS::Network::Socket
 A generic socket.
 

Enumerations

enum  DCS::Network::Server::StopMode { DCS::Network::Server::StopMode::IMMEDIATE, DCS::Network::Server::StopMode::WAIT }
 Dictates how the server thread should stop. More...
 
enum  DCS::Network::Message::Operation {
  DCS::Network::Message::Operation::NO_OP = 0, DCS::Network::Message::Operation::REQUEST = 1, DCS::Network::Message::Operation::RESPONSE = 4, DCS::Network::Message::Operation::EVT_SUB = 7,
  DCS::Network::Message::Operation::EVT_UNSUB = 9, DCS::Network::Message::Operation::OP_ERROR, DCS::Network::Message::Operation::CON_VALID, DCS::Network::Message::Operation::DATA
}
 Defines the message operation modes in the tcp/ip connection. More...
 

Functions

DCS_API void DCS::Network::Init ()
 Initializes the Network module.
 
DCS_API bool DCS::Network::GetStatus ()
 Check if the Network module is initilized.
 
DCS_API void DCS::Network::Destroy ()
 Destroys the Network module.
 
DCS_API Socket DCS::Network::Server::Create (i32 port)
 Create server listening port. More...
 
DCS_API void DCS::Network::Server::WaitForConnections (Socket server)
 Wait for any client to connect to the server connection Socket. More...
 
DCS_API void DCS::Network::Server::StopListening (Socket server)
 Closes the server listening socket, no longer accepting new connections. More...
 
DCS_API bool DCS::Network::Server::StartThread (Socket client)
 Starts the server thread on a established connection. More...
 
DCS_API void DCS::Network::Server::StopThread (Socket client, StopMode mode=StopMode::IMMEDIATE)
 Stops the server thread on a established connection (Forces disconnect). More...
 
DCS_API Socket DCS::Network::Server::GetConnectedClient ()
 Returns the currently server connected client.
 
DCS_API Socket DCS::Network::Server::GetListenSocket ()
 Returns the server listen socket.
 
DCS_API bool DCS::Network::Server::IsRunning ()
 Checks if the server is running.
 
DCS_API Socket DCS::Network::Client::Connect (DCS::Utils::String host, i32 port)
 Connect to a running server. More...
 
DCS_API void DCS::Network::Client::Authenticate (Socket socket, DCS::Utils::String username, DCS::Utils::String password)
 Authenticates a valid connection. Call after Connect. More...
 
DCS_API bool DCS::Network::Client::StartThread (Socket connection)
 Starts the client thread on a established connection. More...
 
DCS_API void DCS::Network::Client::StopThread (Socket connection)
 Stops the client thread on a established connection (Forces disconnect). More...
 
DCS_API i16 DCS::Network::Client::GetMillisLatency ()
 Gets the current connection latency in milliseconds. More...
 
DCS_API DCS::Utils::AsyncItem< DCS::Registry::SVReturnDCS::Network::Message::SendAsync (Operation op, u8 *data, i32 size)
 Sends an asynchronous message to the server. More...
 
DCS_API Registry::SVReturn DCS::Network::Message::SendSync (Operation op, u8 *data, i32 size)
 Sends a synchronous message to the server. More...
 
DCS_REGISTER_EVENT DCS_API void DCS::Network::Message::FibSeqEvt ()
 A Sample Event possible to implement in the server/API. When called, returns the next number in the Fibbonacci sequence.
 
DCS_API void DCS::CLI::Spin ()
 Make the current thread wait for, and process, console commands.
 

Detailed Description

Exposes Network functionalities of the API to the end user.

Author
Cesar Godinho
Version
1.0
Date
Date
2021/02/22