Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::NetworkModuleSettings Class Referenceabstract

Abstract class for settings for endpoints. More...

Inheritance diagram for Burger::NetworkModuleSettings:
Collaboration diagram for Burger::NetworkModuleSettings:

Classes

struct  EnumeratedServerInfo_t
 Information presented to the callback on a server to add or remove from the application's internal lists. More...
 
struct  LocatedServer_t
 Description of a located server. More...
 

Public Types

enum  eServerEnumerationCommand { kServerAdd , kServerRemove , kServerClearList }
 Command code for enumeration callback. More...
 
typedef void(*) EnumerationProc(void *pThis, eServerEnumerationCommand uCommand, const EnumeratedServerInfo_t *pServerInfo)
 Function prototype for server enumeration callback.
 

Public Member Functions

const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
virtual ~NetworkModuleSettings ()
 Default base destructor.
 
uint32_t GetGameID (void) const
 
eNetworkProtocol GetType (void) const
 
const NetAddr_tGetRemoteAddress (void) const
 
const LocatedServer_tGetServerList (void) const
 
uint_t GetServerListSize (void) const
 
const char * GetURL (void) const
 
eError SetURL (const char *pURL)
 
eError SetURLByAddress (const NetAddr_t *pAddress)
 Set the address of the requested destination endpoint.
 
eSocketFlags GetSocketFlags (void) const
 
void SetSocketFlags (eSocketFlags uSocketFlags)
 
uint_t GetPassiveMode (void) const
 
void SetPassiveMode (uint_t bPassiveMode)
 
virtual eError OpenEndpoint (NetworkEndpoint::CallbackProc pCallback, void *pContext, NetworkEndpoint **ppEndpoint, NetworkEndpoint::eOpenType uFlags)=0
 
virtual eError OpenEndpointInstance (NetworkEndpointInstance::CallbackProc pCallback, void *pContext, NetworkEndpointInstance **ppEndpointInstance, NetworkEndpoint::eOpenType uFlags)=0
 
virtual eError StartEnumeration (EnumerationProc pCallback, void *pData, uint_t bScanNetwork=1)=0
 
virtual eError EndEnumeration (void)=0
 
virtual eError LoadSettings (const LocatedServer_t *pServer)=0
 
virtual eError NewEndpoint (NetworkEndpoint **ppEndpoint, NetworkEndpoint::CallbackProc pCallback, void *pContext, NetworkEndpoint::eOpenType uFlags)=0
 
eError Poll (void) noexcept
 Yield CPU time for background tasks.
 
virtual eError HandleEnumerationPackets (void)=0
 
void UpdateLists (void)
 Update enumerated server lists.
 
- Public Member Functions inherited from Burger::Base
const char * get_class_name (void) const noexcept
 Get the name of the class.
 
virtual ~Base () noexcept=default
 Destructor.
 

Public Attributes

NetworkModulem_pNetworkModule
 Parent NetworkModule.
 
uint32_t m_uGameID
 ID of the game host.
 
eNetworkProtocol m_uType
 Module type that this setting came from.
 
EnumerationProc m_pCallback
 Enumeration callback function.
 
void * m_pCallbackData
 Enumeration callback data.
 
LocatedServer_tm_pGameArray
 Array of located external servers.
 
String m_URL
 URL of the desired address.
 
String m_GameName
 Application supplied game name.
 
NetAddr_t m_RemoteAddress
 Resolved address of the URL.
 
eSocketFlags m_uSocketFlags
 Datagram/Stream flags.
 
uint_t m_bPassiveMode
 Enable passive mode.
 
uint_t m_bIsEnumerating
 Enumeration is in progress.
 
uint_t m_bEnumerationIsActive
 Enumeration is active.
 
uint_t m_uGameCount
 Number of games in the cache.
 
uint_t m_uNewGameCount
 Number of games to add to the list.
 
char m_TempBuffer [kBufferSize]
 Work buffer.
 
LocatedServer_t m_NewGameEntries [kMaxGamesInPendingList]
 Buffer for enumerating games via interrupts.
 

Static Public Attributes

static const Burger::StaticRTTI g_StaticRTTI
 
static const uint_t kMaxGameNameLen = 31
 The longest allowed game name in bytes.
 
static const uint_t kMaxGamesInPendingList = 10
 Maximum number of PENDING servers to process in a single pass.
 
static const uint_t kBufferSize = 1024
 Maximum size of a server description packet.
 
static const uint_t kEnumerationTimeout = 2000
 Time in milliseconds before a server is dropped for lack of pings.
 
static const uint_t kEnumerationPingTime = 500
 Number of milliseconds to wait between pings.
 
- Static Public Attributes inherited from Burger::Base
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 

Protected Member Functions

 NetworkModuleSettings (NetworkModule *pNetworkModule, uint32_t uGameID, const char *pGameName)
 Default base constructor.
 

Private Member Functions

 NetworkModuleSettings (const NetworkModuleSettings &)=delete
 
NetworkModuleSettingsoperator= (const NetworkModuleSettings &)=delete
 
 NetworkModuleSettings (NetworkModuleSettings &&)=delete
 
NetworkModuleSettingsoperator= (NetworkModuleSettings &&)=delete
 

Detailed Description

Abstract class for settings for endpoints.


When a network protocol is selected, a setting class is created to allow modifications by the application for where the connection is to be directed at. Both passive (GET/POST requests) and active (Live games) are supported.

This class is not meant to be created directly, instead request an instance from NetworkModule which will redirect to the proper instantiator for the selected protocol / module

See also
NetworkModule, NetworkEndpoint and NetPlay

Member Typedef Documentation

◆ EnumerationProc

void( *) Burger::NetworkModuleSettings::EnumerationProc(void *pThis, eServerEnumerationCommand uCommand, const EnumeratedServerInfo_t *pServerInfo)

Function prototype for server enumeration callback.


Parameters
pThisPointer to application provided context pointer
uCommandCommand code
pServerInfoPointer to information about the server the command is referring to.
//
// Sample callback
//
void BURGER_API EnumerationCallback(void *pThis,NetworkModuleSettings::eServerEnumerationCommand uCommand,
{
// pThis is used by the application only if needed
switch (uCommand) {
AddEntry(pServerInfo);
break;
RemoveEntry(pServerInfo);
break;
// pServerInfo is likely \ref NULL in this case
ClearList();
break;
}
}
#define BURGER_API
Default parameter passing type for Burgerlib functions.
Definition burger.h:831
eServerEnumerationCommand
Command code for enumeration callback.
Definition burger.h:26268
@ kServerClearList
Clear out your list.
Definition burger.h:26271
@ kServerRemove
Remove a server from your list.
Definition burger.h:26270
@ kServerAdd
Add a server to your list.
Definition burger.h:26269
Information presented to the callback on a server to add or remove from the application's internal li...
Definition burger.h:26274
See also
EnumeratedServerInfo_t or eServerEnumerationCommand

Member Enumeration Documentation

◆ eServerEnumerationCommand

Command code for enumeration callback.


When enumeration is active, when remote servers are found or lost a user supplied callback will be issued and this enumeration value contains the command the callback should follow to maintain its own list of servers.

See also
EnumerationProc
Enumerator
kServerAdd 

Add a server to your list.

kServerRemove 

Remove a server from your list.

kServerClearList 

Clear out your list.

Constructor & Destructor Documentation

◆ NetworkModuleSettings() [1/3]

Burger::NetworkModuleSettings::NetworkModuleSettings ( const NetworkModuleSettings & )
privatedelete

◆ NetworkModuleSettings() [2/3]

Burger::NetworkModuleSettings::NetworkModuleSettings ( NetworkModuleSettings && )
privatedelete

◆ NetworkModuleSettings() [3/3]

Burger::NetworkModuleSettings::NetworkModuleSettings ( NetworkModule * pNetworkModule,
uint32_t uGameID,
const char * pGameName )
protected

Default base constructor.


This base class constructor will set up all the defaults which can be overridden by the derived classes.

Parameters
pNetworkModulePointer to the parent NetworkModule
uGameIDUnique Game ID for the game server being created
pGameNameName of the game server

◆ ~NetworkModuleSettings()

Burger::NetworkModuleSettings::~NetworkModuleSettings ( )
virtual

Default base destructor.


Member Function Documentation

◆ EndEnumeration()

virtual eError Burger::NetworkModuleSettings::EndEnumeration ( void )
pure virtual

◆ get_StaticRTTI()

const Burger::StaticRTTI * Burger::NetworkModuleSettings::get_StaticRTTI ( void ) const
overridevirtualnoexcept

Get the description to the class.


This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.

Returns
Pointer to a global, read only instance of StaticRTTI for the true class

Reimplemented from Burger::Base.

◆ GetGameID()

uint32_t Burger::NetworkModuleSettings::GetGameID ( void ) const
inline

◆ GetPassiveMode()

uint_t Burger::NetworkModuleSettings::GetPassiveMode ( void ) const
inline

◆ GetRemoteAddress()

const NetAddr_t * Burger::NetworkModuleSettings::GetRemoteAddress ( void ) const
inline

◆ GetServerList()

const LocatedServer_t * Burger::NetworkModuleSettings::GetServerList ( void ) const
inline

◆ GetServerListSize()

uint_t Burger::NetworkModuleSettings::GetServerListSize ( void ) const
inline

◆ GetSocketFlags()

eSocketFlags Burger::NetworkModuleSettings::GetSocketFlags ( void ) const
inline

◆ GetType()

eNetworkProtocol Burger::NetworkModuleSettings::GetType ( void ) const
inline

◆ GetURL()

const char * Burger::NetworkModuleSettings::GetURL ( void ) const
inline

◆ HandleEnumerationPackets()

virtual eError Burger::NetworkModuleSettings::HandleEnumerationPackets ( void )
pure virtual

◆ LoadSettings()

virtual eError Burger::NetworkModuleSettings::LoadSettings ( const LocatedServer_t * pServer)
pure virtual

◆ NewEndpoint()

virtual eError Burger::NetworkModuleSettings::NewEndpoint ( NetworkEndpoint ** ppEndpoint,
NetworkEndpoint::CallbackProc pCallback,
void * pContext,
NetworkEndpoint::eOpenType uFlags )
pure virtual

◆ OpenEndpoint()

virtual eError Burger::NetworkModuleSettings::OpenEndpoint ( NetworkEndpoint::CallbackProc pCallback,
void * pContext,
NetworkEndpoint ** ppEndpoint,
NetworkEndpoint::eOpenType uFlags )
pure virtual

◆ OpenEndpointInstance()

virtual eError Burger::NetworkModuleSettings::OpenEndpointInstance ( NetworkEndpointInstance::CallbackProc pCallback,
void * pContext,
NetworkEndpointInstance ** ppEndpointInstance,
NetworkEndpoint::eOpenType uFlags )
pure virtual

◆ operator=() [1/2]

NetworkModuleSettings & Burger::NetworkModuleSettings::operator= ( const NetworkModuleSettings & )
privatedelete

◆ operator=() [2/2]

NetworkModuleSettings & Burger::NetworkModuleSettings::operator= ( NetworkModuleSettings && )
privatedelete

◆ Poll()

Burger::eError BURGER_API Burger::NetworkModuleSettings::Poll ( void )
noexcept

Yield CPU time for background tasks.


Returns
Zero if no error, non-zero on error.

◆ SetPassiveMode()

void Burger::NetworkModuleSettings::SetPassiveMode ( uint_t bPassiveMode)
inline

◆ SetSocketFlags()

void Burger::NetworkModuleSettings::SetSocketFlags ( eSocketFlags uSocketFlags)
inline

◆ SetURL()

eError Burger::NetworkModuleSettings::SetURL ( const char * pURL)
inline

◆ SetURLByAddress()

Burger::eError BURGER_API Burger::NetworkModuleSettings::SetURLByAddress ( const NetAddr_t * pAddress)

Set the address of the requested destination endpoint.


Parameters
pAddressPointer to the address the endpoint will connect to.
Returns
Zero if no error, non-zero on error.

◆ StartEnumeration()

virtual eError Burger::NetworkModuleSettings::StartEnumeration ( EnumerationProc pCallback,
void * pData,
uint_t bScanNetwork = 1 )
pure virtual

◆ UpdateLists()

void BURGER_API Burger::NetworkModuleSettings::UpdateLists ( void )

Update enumerated server lists.


This private function is called by NetworkModule code that's scanning the network for game servers. If any are found, the entries are stored in a buffer which is scanned by this function and the internal game list is adjusted to maintain this list

See also
Poll(void) and StartEnumeration(EnumerationProc,void *,uint_t)

Member Data Documentation

◆ g_StaticRTTI

const Burger::StaticRTTI Burger::NetworkModuleSettings::g_StaticRTTI
static

◆ kBufferSize

const uint_t Burger::NetworkModuleSettings::kBufferSize = 1024
static

Maximum size of a server description packet.

◆ kEnumerationPingTime

const uint_t Burger::NetworkModuleSettings::kEnumerationPingTime = 500
static

Number of milliseconds to wait between pings.

◆ kEnumerationTimeout

const uint_t Burger::NetworkModuleSettings::kEnumerationTimeout = 2000
static

Time in milliseconds before a server is dropped for lack of pings.

◆ kMaxGameNameLen

const uint_t Burger::NetworkModuleSettings::kMaxGameNameLen = 31
static

The longest allowed game name in bytes.

◆ kMaxGamesInPendingList

const uint_t Burger::NetworkModuleSettings::kMaxGamesInPendingList = 10
static

Maximum number of PENDING servers to process in a single pass.

◆ m_bEnumerationIsActive

uint_t Burger::NetworkModuleSettings::m_bEnumerationIsActive

Enumeration is active.

◆ m_bIsEnumerating

uint_t Burger::NetworkModuleSettings::m_bIsEnumerating

Enumeration is in progress.

◆ m_bPassiveMode

uint_t Burger::NetworkModuleSettings::m_bPassiveMode

Enable passive mode.

◆ m_GameName

String Burger::NetworkModuleSettings::m_GameName

Application supplied game name.

◆ m_NewGameEntries

LocatedServer_t Burger::NetworkModuleSettings::m_NewGameEntries[kMaxGamesInPendingList]

Buffer for enumerating games via interrupts.

◆ m_pCallback

EnumerationProc Burger::NetworkModuleSettings::m_pCallback

Enumeration callback function.

◆ m_pCallbackData

void* Burger::NetworkModuleSettings::m_pCallbackData

Enumeration callback data.

◆ m_pGameArray

LocatedServer_t* Burger::NetworkModuleSettings::m_pGameArray

Array of located external servers.

◆ m_pNetworkModule

NetworkModule* Burger::NetworkModuleSettings::m_pNetworkModule

Parent NetworkModule.

◆ m_RemoteAddress

NetAddr_t Burger::NetworkModuleSettings::m_RemoteAddress

Resolved address of the URL.

◆ m_TempBuffer

char Burger::NetworkModuleSettings::m_TempBuffer[kBufferSize]

Work buffer.

◆ m_uGameCount

uint_t Burger::NetworkModuleSettings::m_uGameCount

Number of games in the cache.

◆ m_uGameID

uint32_t Burger::NetworkModuleSettings::m_uGameID

ID of the game host.

◆ m_uNewGameCount

uint_t Burger::NetworkModuleSettings::m_uNewGameCount

Number of games to add to the list.

◆ m_URL

String Burger::NetworkModuleSettings::m_URL

URL of the desired address.

◆ m_uSocketFlags

eSocketFlags Burger::NetworkModuleSettings::m_uSocketFlags

Datagram/Stream flags.

◆ m_uType

eNetworkProtocol Burger::NetworkModuleSettings::m_uType

Module type that this setting came from.