FlightGear next
multiplaymgr.cxx File Reference
#include <config.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <errno.h>
#include <memory>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_random.hxx>
#include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/stdint.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx>
#include <simgear/structure/commands.hxx>
#include <simgear/structure/event_mgr.hxx>
#include <simgear/timing/timestamp.hxx>
#include <AIModel/AIManager.hxx>
#include <AIModel/AIMultiplayer.hxx>
#include <Main/fg_props.hxx>
#include "multiplaymgr.hxx"
#include "mpmessages.hxx"
#include "MPServerResolver.hxx"
#include <FDM/fdm_shell.hxx>
#include <FDM/flightProperties.hxx>
#include <Time/TimeManager.hxx>
#include <Main/sentryIntegration.hxx>
#include "mpirc.hxx"
#include "cpdlc.hxx"

Go to the source code of this file.

Classes

struct  IdPropertyList
 
struct  BoolArrayBuffer
 
class  MPPropertyListener
 
union  FGMultiplayMgr::MsgBuf
 The buffer that holds a multi-player message, suitably aligned. More...
 

Macros

#define MAX_PACKET_SIZE   1200
 
#define MAX_TEXT_SIZE   768
 

Enumerations

enum  TransmissionType {
  TT_ASIS = 0 , TT_BOOL = simgear::props::BOOL , TT_INT = simgear::props::INT , TT_FLOAT = simgear::props::FLOAT ,
  TT_STRING = simgear::props::STRING , TT_SHORTINT = 0x100 , TT_SHORT_FLOAT_NORM = 0x101 , TT_SHORT_FLOAT_1 = 0x102 ,
  TT_SHORT_FLOAT_2 = 0x103 , TT_SHORT_FLOAT_3 = 0x104 , TT_SHORT_FLOAT_4 = 0x105 , TT_BOOLARRAY ,
  TT_CHAR , TT_NOSEND
}
 

Functions

static const IdPropertyListfindProperty (unsigned id)
 
static xdr_data_tencode_launchbar_state_for_transmission (const IdPropertyList *propDef, const xdr_data_t *_xdr, FGPropertyData *p)
 
static xdr_data_tdecode_received_launchbar_state (const IdPropertyList *propDef, const xdr_data_t *_xdr, FGPropertyData *p)
 
static bool IsIncludedInPacket (int filter_base, int property_id)
 
static bool do_multiplayer_connect (const SGPropertyNode *arg, SGPropertyNode *root)
 
static bool do_multiplayer_disconnect (const SGPropertyNode *arg, SGPropertyNode *root)
 
static bool do_multiplayer_refreshserverlist (const SGPropertyNode *arg, SGPropertyNode *root)
 
static bool do_cpdlc_connect (const SGPropertyNode *arg, SGPropertyNode *root)
 
static bool do_cpdlc_send_msg (const SGPropertyNode *arg, SGPropertyNode *root)
 
static bool do_cpdlc_next_msg (const SGPropertyNode *arg, SGPropertyNode *root)
 
static bool do_cpdlc_disconnect (const SGPropertyNode *arg, SGPropertyNode *root)
 
static void copy_default (SGPropertyNode *from, const char *path, SGPropertyNode *to)
 
static std::string makeStringPropertyNameSafe (const std::string &s)
 
SGSubsystemMgr::Registrant< FGMultiplayMgrregistrantFGMultiplayMgr (SGSubsystemMgr::POST_FDM, {{"ai-model", SGSubsystemMgr::Dependency::HARD}, {"flight", SGSubsystemMgr::Dependency::HARD}, {"mp", SGSubsystemMgr::Dependency::HARD}, {"time", SGSubsystemMgr::Dependency::HARD}})
 

Variables

const int V1_1_PROP_ID = 1
 
const int V1_1_2_PROP_ID = 2
 
const int V2_PROP_ID_PROTOCOL = 0x10001
 
const int V2_PAD_MAGIC = 0x1face002
 
const int BOOLARRAY_BLOCKSIZE = 40
 
const int BOOLARRAY_BASE_1 = 11000
 
const int BOOLARRAY_BASE_2 = BOOLARRAY_BASE_1 + BOOLARRAY_BLOCKSIZE
 
const int BOOLARRAY_BASE_3 = BOOLARRAY_BASE_2 + BOOLARRAY_BLOCKSIZE
 
const int BOOLARRAY_START_ID = BOOLARRAY_BASE_1
 
const int BOOLARRAY_END_ID = BOOLARRAY_BASE_3
 
const int MAX_BOOL_BUFFERS = 3
 
const int V2018_1_BASE = 11990
 
const int EMESARYBRIDGETYPE_BASE = 12200
 
const int EMESARYBRIDGE_BASE = 12000
 
const int V2018_3_BASE = 13000
 
const int FALLBACK_MODEL_ID = 13000
 
const int V2019_3_BASE = 13001
 
const int V2020_4_BASE = 13003
 
static const IdPropertyList sIdPropertyList []
 
const int MAX_PARTITIONS = 2
 
const unsigned int numProperties = (sizeof(sIdPropertyList) / sizeof(sIdPropertyList[0]))
 

Macro Definition Documentation

◆ MAX_PACKET_SIZE

#define MAX_PACKET_SIZE   1200

Definition at line 68 of file multiplaymgr.cxx.

◆ MAX_TEXT_SIZE

#define MAX_TEXT_SIZE   768

Definition at line 69 of file multiplaymgr.cxx.

Enumeration Type Documentation

◆ TransmissionType

Enumerator
TT_ASIS 
TT_BOOL 
TT_INT 
TT_FLOAT 
TT_STRING 
TT_SHORTINT 
TT_SHORT_FLOAT_NORM 
TT_SHORT_FLOAT_1 
TT_SHORT_FLOAT_2 
TT_SHORT_FLOAT_3 
TT_SHORT_FLOAT_4 
TT_BOOLARRAY 
TT_CHAR 
TT_NOSEND 

Definition at line 75 of file multiplaymgr.cxx.

Function Documentation

◆ copy_default()

static void copy_default ( SGPropertyNode * from,
const char * path,
SGPropertyNode * to )
static

Definition at line 2634 of file multiplaymgr.cxx.

◆ decode_received_launchbar_state()

static xdr_data_t * decode_received_launchbar_state ( const IdPropertyList * propDef,
const xdr_data_t * _xdr,
FGPropertyData * p )
static

Definition at line 198 of file multiplaymgr.cxx.

◆ do_cpdlc_connect()

static bool do_cpdlc_connect ( const SGPropertyNode * arg,
SGPropertyNode * root )
static

Definition at line 961 of file multiplaymgr.cxx.

◆ do_cpdlc_disconnect()

static bool do_cpdlc_disconnect ( const SGPropertyNode * arg,
SGPropertyNode * root )
static

Definition at line 1023 of file multiplaymgr.cxx.

◆ do_cpdlc_next_msg()

static bool do_cpdlc_next_msg ( const SGPropertyNode * arg,
SGPropertyNode * root )
static

Definition at line 1012 of file multiplaymgr.cxx.

◆ do_cpdlc_send_msg()

static bool do_cpdlc_send_msg ( const SGPropertyNode * arg,
SGPropertyNode * root )
static

Definition at line 987 of file multiplaymgr.cxx.

◆ do_multiplayer_connect()

static bool do_multiplayer_connect ( const SGPropertyNode * arg,
SGPropertyNode * root )
static

Definition at line 845 of file multiplaymgr.cxx.

◆ do_multiplayer_disconnect()

static bool do_multiplayer_disconnect ( const SGPropertyNode * arg,
SGPropertyNode * root )
static

Definition at line 880 of file multiplaymgr.cxx.

◆ do_multiplayer_refreshserverlist()

static bool do_multiplayer_refreshserverlist ( const SGPropertyNode * arg,
SGPropertyNode * root )
static

Definition at line 901 of file multiplaymgr.cxx.

◆ encode_launchbar_state_for_transmission()

static xdr_data_t * encode_launchbar_state_for_transmission ( const IdPropertyList * propDef,
const xdr_data_t * _xdr,
FGPropertyData * p )
static

Definition at line 172 of file multiplaymgr.cxx.

◆ findProperty()

const IdPropertyList * findProperty ( unsigned id)
static

Definition at line 717 of file multiplaymgr.cxx.

◆ IsIncludedInPacket()

static bool IsIncludedInPacket ( int filter_base,
int property_id )
inlinestatic

Definition at line 825 of file multiplaymgr.cxx.

◆ makeStringPropertyNameSafe()

static std::string makeStringPropertyNameSafe ( const std::string & s)
static

Definition at line 2643 of file multiplaymgr.cxx.

◆ registrantFGMultiplayMgr()

SGSubsystemMgr::Registrant< FGMultiplayMgr > registrantFGMultiplayMgr ( SGSubsystemMgr::POST_FDM ,
{{"ai-model", SGSubsystemMgr::Dependency::HARD}, {"flight", SGSubsystemMgr::Dependency::HARD}, {"mp", SGSubsystemMgr::Dependency::HARD}, {"time", SGSubsystemMgr::Dependency::HARD}}  )

Variable Documentation

◆ BOOLARRAY_BASE_1

const int BOOLARRAY_BASE_1 = 11000

Definition at line 117 of file multiplaymgr.cxx.

◆ BOOLARRAY_BASE_2

const int BOOLARRAY_BASE_2 = BOOLARRAY_BASE_1 + BOOLARRAY_BLOCKSIZE

Definition at line 118 of file multiplaymgr.cxx.

◆ BOOLARRAY_BASE_3

const int BOOLARRAY_BASE_3 = BOOLARRAY_BASE_2 + BOOLARRAY_BLOCKSIZE

Definition at line 119 of file multiplaymgr.cxx.

◆ BOOLARRAY_BLOCKSIZE

const int BOOLARRAY_BLOCKSIZE = 40

Definition at line 115 of file multiplaymgr.cxx.

◆ BOOLARRAY_END_ID

const int BOOLARRAY_END_ID = BOOLARRAY_BASE_3

Definition at line 122 of file multiplaymgr.cxx.

◆ BOOLARRAY_START_ID

const int BOOLARRAY_START_ID = BOOLARRAY_BASE_1

Definition at line 121 of file multiplaymgr.cxx.

◆ EMESARYBRIDGE_BASE

const int EMESARYBRIDGE_BASE = 12000

Definition at line 130 of file multiplaymgr.cxx.

◆ EMESARYBRIDGETYPE_BASE

const int EMESARYBRIDGETYPE_BASE = 12200

Definition at line 129 of file multiplaymgr.cxx.

◆ FALLBACK_MODEL_ID

const int FALLBACK_MODEL_ID = 13000

Definition at line 132 of file multiplaymgr.cxx.

◆ MAX_BOOL_BUFFERS

const int MAX_BOOL_BUFFERS = 3

Definition at line 124 of file multiplaymgr.cxx.

◆ MAX_PARTITIONS

const int MAX_PARTITIONS = 2

Definition at line 691 of file multiplaymgr.cxx.

◆ numProperties

const unsigned int numProperties = (sizeof(sIdPropertyList) / sizeof(sIdPropertyList[0]))

Definition at line 692 of file multiplaymgr.cxx.

◆ sIdPropertyList

const IdPropertyList sIdPropertyList[]
static

Definition at line 226 of file multiplaymgr.cxx.

◆ V1_1_2_PROP_ID

const int V1_1_2_PROP_ID = 2

Definition at line 104 of file multiplaymgr.cxx.

◆ V1_1_PROP_ID

const int V1_1_PROP_ID = 1

Definition at line 103 of file multiplaymgr.cxx.

◆ V2018_1_BASE

const int V2018_1_BASE = 11990

Definition at line 128 of file multiplaymgr.cxx.

◆ V2018_3_BASE

const int V2018_3_BASE = 13000

Definition at line 131 of file multiplaymgr.cxx.

◆ V2019_3_BASE

const int V2019_3_BASE = 13001

Definition at line 133 of file multiplaymgr.cxx.

◆ V2020_4_BASE

const int V2020_4_BASE = 13003

Definition at line 134 of file multiplaymgr.cxx.

◆ V2_PAD_MAGIC

const int V2_PAD_MAGIC = 0x1face002

Definition at line 107 of file multiplaymgr.cxx.

◆ V2_PROP_ID_PROTOCOL

const int V2_PROP_ID_PROTOCOL = 0x10001

Definition at line 105 of file multiplaymgr.cxx.