Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes
RoR::Network Class Reference

Description

Definition at line 110 of file Network.h.

Public Member Functions

bool StartConnecting ()
 
void StopConnecting ()
 
void Disconnect ()
 
void AddPacket (int streamid, int type, int len, const char *content)
 
void AddLocalStream (RoRnet::StreamRegister *reg, int size)
 
std::vector< NetRecvPacket > GetIncomingStreamData ()
 
int GetUID ()
 
int GetNetQuality ()
 
Ogre::String GetTerrainName ()
 
int GetUserColor ()
 
std::string GetUsername ()
 
RoRnet::UserInfo GetLocalUserData ()
 
std::vector< RoRnet::UserInfo > GetUserInfos ()
 
std::vector< BitMask_t > GetAllUsersPeerOpts ()
 
bool GetUserInfo (int uid, RoRnet::UserInfo &result)
 
bool GetUserPeerOpts (int uid, BitMask_t &result)
 
bool GetDisconnectedUserInfo (int uid, RoRnet::UserInfo &result)
 
bool GetAnyUserInfo (int uid, RoRnet::UserInfo &result)
 
bool FindUserInfo (std::string const &username, RoRnet::UserInfo &result)
 
Ogre::ColourValue GetPlayerColor (int color_num)
 
void AddPeerOptions (PeerOptionsRequest *rq)
 
void RemovePeerOptions (PeerOptionsRequest *rq)
 
void BroadcastChatMsg (const char *msg)
 
void WhisperChatMsg (RoRnet::UserInfo const &user, const char *msg)
 
std::string UserAuthToStringShort (RoRnet::UserInfo const &user)
 
std::string UserAuthToStringLong (RoRnet::UserInfo const &user)
 
Plumbing for local serverscripts and AI bots
void SetLocalUserData (RoRnet::UserInfo const &user)
 
void AddBotUserInfo (RoRnet::UserInfo const &user)
 
void RemoveBotUserInfo (int uid)
 

Private Member Functions

void PushNetMessage (MsgType type, std::string const &message)
 
void SetNetQuality (int quality)
 
bool SendMessageRaw (char *buffer, int msgsize)
 
bool SendNetMessage (int type, unsigned int streamid, int len, char *content)
 
void QueueStreamData (RoRnet::Header &header, char *buffer, size_t buffer_len)
 
int ReceiveMessage (RoRnet::Header *head, char *content, int bufferlen)
 
void CouldNotConnect (std::string const &msg, bool close_socket=true)
 
bool ConnectThread ()
 
void SendThread ()
 
void RecvThread ()
 

Private Attributes

SWInetSocket m_socket
 
RoRnet::ServerInfo m_server_settings
 
RoRnet::UserInfo m_userdata
 
std::vector< RoRnet::UserInfo > m_users
 
std::vector< BitMask_t > m_users_peeropts
 
std::vector< RoRnet::UserInfo > m_disconnected_users
 
std::string m_username
 
std::string m_net_host
 
std::string m_password
 
std::string m_token
 
int m_net_port
 
int m_uid
 
int m_authlevel
 
std::thread m_send_thread
 
std::thread m_recv_thread
 
std::thread m_connect_thread
 
std::string m_status_message
 
std::atomic< bool > m_shutdown
 
std::atomic< int > m_net_quality
 
int m_stream_id = 10
 
std::mutex m_users_mutex
 
std::mutex m_userdata_mutex
 
std::mutex m_recv_packetqueue_mutex
 
std::mutex m_send_packetqueue_mutex
 
std::condition_variable m_send_packet_available_cv
 
std::vector< NetRecvPacket > m_recv_packet_buffer
 
std::deque< NetSendPacket > m_send_packet_buffer
 

Member Function Documentation

◆ AddBotUserInfo()

void Network::AddBotUserInfo ( RoRnet::UserInfo const &  user)

Definition at line 900 of file Network.cpp.

◆ AddLocalStream()

void Network::AddLocalStream ( RoRnet::StreamRegister *  reg,
int  size 
)

Definition at line 671 of file Network.cpp.

◆ AddPacket()

void Network::AddPacket ( int  streamid,
int  type,
int  len,
const char *  content 
)

Definition at line 617 of file Network.cpp.

◆ AddPeerOptions()

void Network::AddPeerOptions ( PeerOptionsRequest *  rq)

Definition at line 805 of file Network.cpp.

◆ BroadcastChatMsg()

void Network::BroadcastChatMsg ( const char *  msg)

Definition at line 839 of file Network.cpp.

◆ ConnectThread()

bool Network::ConnectThread ( )
private

Definition at line 428 of file Network.cpp.

◆ CouldNotConnect()

void Network::CouldNotConnect ( std::string const &  msg,
bool  close_socket = true 
)
private

Definition at line 383 of file Network.cpp.

◆ Disconnect()

void Network::Disconnect ( )

Definition at line 573 of file Network.cpp.

◆ FindUserInfo()

bool Network::FindUserInfo ( std::string const &  username,
RoRnet::UserInfo &  result 
)

Definition at line 790 of file Network.cpp.

◆ GetAllUsersPeerOpts()

std::vector< BitMask_t > Network::GetAllUsersPeerOpts ( )

Definition at line 720 of file Network.cpp.

◆ GetAnyUserInfo()

bool Network::GetAnyUserInfo ( int  uid,
RoRnet::UserInfo &  result 
)

Also considers local client.

Definition at line 768 of file Network.cpp.

◆ GetDisconnectedUserInfo()

bool Network::GetDisconnectedUserInfo ( int  uid,
RoRnet::UserInfo &  result 
)

Definition at line 754 of file Network.cpp.

◆ GetIncomingStreamData()

std::vector< NetRecvPacket > Network::GetIncomingStreamData ( )

Definition at line 683 of file Network.cpp.

◆ GetLocalUserData()

RoRnet::UserInfo Network::GetLocalUserData ( )

Definition at line 708 of file Network.cpp.

◆ GetNetQuality()

int Network::GetNetQuality ( )

Definition at line 118 of file Network.cpp.

◆ GetPlayerColor()

Ogre::ColourValue Network::GetPlayerColor ( int  color_num)

Definition at line 95 of file Network.cpp.

◆ GetTerrainName()

Ogre::String Network::GetTerrainName ( )

Definition at line 691 of file Network.cpp.

◆ GetUID()

int Network::GetUID ( )

Definition at line 123 of file Network.cpp.

◆ GetUserColor()

int Network::GetUserColor ( )

Definition at line 696 of file Network.cpp.

◆ GetUserInfo()

bool Network::GetUserInfo ( int  uid,
RoRnet::UserInfo &  result 
)

Definition at line 726 of file Network.cpp.

◆ GetUserInfos()

std::vector< RoRnet::UserInfo > Network::GetUserInfos ( )

Definition at line 714 of file Network.cpp.

◆ GetUsername()

std::string Network::GetUsername ( )

Definition at line 702 of file Network.cpp.

◆ GetUserPeerOpts()

bool Network::GetUserPeerOpts ( int  uid,
BitMask_t &  result 
)

Definition at line 740 of file Network.cpp.

◆ PushNetMessage()

void Network::PushNetMessage ( MsgType  type,
std::string const &  message 
)
private

Definition at line 88 of file Network.cpp.

◆ QueueStreamData()

void Network::QueueStreamData ( RoRnet::Header &  header,
char *  buffer,
size_t  buffer_len 
)
private

Definition at line 164 of file Network.cpp.

◆ ReceiveMessage()

int Network::ReceiveMessage ( RoRnet::Header *  head,
char *  content,
int  bufferlen 
)
private

Definition at line 174 of file Network.cpp.

◆ RecvThread()

void Network::RecvThread ( )
private

Definition at line 239 of file Network.cpp.

◆ RemoveBotUserInfo()

void Network::RemoveBotUserInfo ( int  uid)

Definition at line 908 of file Network.cpp.

◆ RemovePeerOptions()

void Network::RemovePeerOptions ( PeerOptionsRequest *  rq)

Definition at line 822 of file Network.cpp.

◆ SendMessageRaw()

bool Network::SendMessageRaw ( char *  buffer,
int  msgsize 
)
private

Definition at line 128 of file Network.cpp.

◆ SendNetMessage()

bool Network::SendNetMessage ( int  type,
unsigned int  streamid,
int  len,
char *  content 
)
private

Definition at line 141 of file Network.cpp.

◆ SendThread()

void Network::SendThread ( )
private

Definition at line 215 of file Network.cpp.

◆ SetLocalUserData()

void Network::SetLocalUserData ( RoRnet::UserInfo const &  user)

Definition at line 892 of file Network.cpp.

◆ SetNetQuality()

void Network::SetNetQuality ( int  quality)
private

Definition at line 113 of file Network.cpp.

◆ StartConnecting()

bool Network::StartConnecting ( )

Launches connecting on background.

Definition at line 395 of file Network.cpp.

◆ StopConnecting()

void Network::StopConnecting ( )

Definition at line 420 of file Network.cpp.

◆ UserAuthToStringLong()

std::string Network::UserAuthToStringLong ( RoRnet::UserInfo const &  user)

Definition at line 879 of file Network.cpp.

◆ UserAuthToStringShort()

std::string Network::UserAuthToStringShort ( RoRnet::UserInfo const &  user)

Definition at line 869 of file Network.cpp.

◆ WhisperChatMsg()

void Network::WhisperChatMsg ( RoRnet::UserInfo const &  user,
const char *  msg 
)

Definition at line 851 of file Network.cpp.

Field Documentation

◆ m_authlevel

int RoR::Network::m_authlevel
private

Definition at line 183 of file Network.h.

◆ m_connect_thread

std::thread RoR::Network::m_connect_thread
private

Definition at line 187 of file Network.h.

◆ m_disconnected_users

std::vector<RoRnet::UserInfo> RoR::Network::m_disconnected_users
private

Definition at line 175 of file Network.h.

◆ m_net_host

std::string RoR::Network::m_net_host
private

Definition at line 178 of file Network.h.

◆ m_net_port

int RoR::Network::m_net_port
private

Definition at line 181 of file Network.h.

◆ m_net_quality

std::atomic<int> RoR::Network::m_net_quality
private

Definition at line 191 of file Network.h.

◆ m_password

std::string RoR::Network::m_password
private

Definition at line 179 of file Network.h.

◆ m_recv_packet_buffer

std::vector<NetRecvPacket> RoR::Network::m_recv_packet_buffer
private

Definition at line 201 of file Network.h.

◆ m_recv_packetqueue_mutex

std::mutex RoR::Network::m_recv_packetqueue_mutex
private

Definition at line 196 of file Network.h.

◆ m_recv_thread

std::thread RoR::Network::m_recv_thread
private

Definition at line 186 of file Network.h.

◆ m_send_packet_available_cv

std::condition_variable RoR::Network::m_send_packet_available_cv
private

Definition at line 199 of file Network.h.

◆ m_send_packet_buffer

std::deque<NetSendPacket> RoR::Network::m_send_packet_buffer
private

Definition at line 202 of file Network.h.

◆ m_send_packetqueue_mutex

std::mutex RoR::Network::m_send_packetqueue_mutex
private

Definition at line 197 of file Network.h.

◆ m_send_thread

std::thread RoR::Network::m_send_thread
private

Definition at line 185 of file Network.h.

◆ m_server_settings

RoRnet::ServerInfo RoR::Network::m_server_settings
private

Definition at line 171 of file Network.h.

◆ m_shutdown

std::atomic<bool> RoR::Network::m_shutdown
private

Definition at line 190 of file Network.h.

◆ m_socket

SWInetSocket RoR::Network::m_socket
private

Definition at line 169 of file Network.h.

◆ m_status_message

std::string RoR::Network::m_status_message
private

Definition at line 189 of file Network.h.

◆ m_stream_id

int RoR::Network::m_stream_id = 10
private

Counter.

Definition at line 192 of file Network.h.

◆ m_token

std::string RoR::Network::m_token
private

Definition at line 180 of file Network.h.

◆ m_uid

int RoR::Network::m_uid
private

Definition at line 182 of file Network.h.

◆ m_userdata

RoRnet::UserInfo RoR::Network::m_userdata
private

Definition at line 172 of file Network.h.

◆ m_userdata_mutex

std::mutex RoR::Network::m_userdata_mutex
private

Definition at line 195 of file Network.h.

◆ m_username

std::string RoR::Network::m_username
private

Definition at line 177 of file Network.h.

◆ m_users

std::vector<RoRnet::UserInfo> RoR::Network::m_users
private

Definition at line 173 of file Network.h.

◆ m_users_mutex

std::mutex RoR::Network::m_users_mutex
private

Definition at line 194 of file Network.h.

◆ m_users_peeropts

std::vector<BitMask_t> RoR::Network::m_users_peeropts
private

See RoRnet::PeerOptions.

Definition at line 174 of file Network.h.


The documentation for this class was generated from the following files: