RigsofRods
Soft-body Physics Simulation
Public Member Functions | Private Member Functions | Private Attributes
RoR::Network Class Reference

#include <Network.h>

+ Collaboration diagram for RoR::Network:

Public Member Functions

bool StartConnecting ()
 Launches connecting on background. More...
 
void StopConnecting ()
 
void Disconnect ()
 
void AddPacket (int streamid, int type, int len, const char *content)
 
void AddLocalStream (RoRnet::StreamRegister *reg, int size)
 
std::vector< NetRecvPacketGetIncomingStreamData ()
 
int GetUID ()
 
int GetNetQuality ()
 
Ogre::String GetTerrainName ()
 
int GetUserColor ()
 
Ogre::UTFString GetUsername ()
 
RoRnet::UserInfo GetLocalUserData ()
 
std::vector< RoRnet::UserInfoGetUserInfos ()
 
bool GetUserInfo (int uid, RoRnet::UserInfo &result)
 
bool GetDisconnectedUserInfo (int uid, RoRnet::UserInfo &result)
 
bool GetAnyUserInfo (int uid, RoRnet::UserInfo &result)
 Also considers local client. More...
 
bool FindUserInfo (std::string const &username, RoRnet::UserInfo &result)
 
Ogre::ColourValue GetPlayerColor (int color_num)
 
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)
 

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::UserInfom_users
 
std::vector< RoRnet::UserInfom_disconnected_users
 
Ogre::UTFString 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< NetRecvPacketm_recv_packet_buffer
 
std::deque< NetSendPacketm_send_packet_buffer
 

Detailed Description

Definition at line 104 of file Network.h.

Member Function Documentation

◆ AddLocalStream()

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

Definition at line 660 of file Network.cpp.

+ Here is the caller graph for this function:

◆ AddPacket()

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

Definition at line 606 of file Network.cpp.

+ Here is the caller graph for this function:

◆ BroadcastChatMsg()

void Network::BroadcastChatMsg ( const char *  msg)

Definition at line 773 of file Network.cpp.

+ Here is the caller graph for this function:

◆ ConnectThread()

bool Network::ConnectThread ( )
private

Definition at line 419 of file Network.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CouldNotConnect()

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

Definition at line 376 of file Network.cpp.

+ Here is the call graph for this function:

◆ Disconnect()

void Network::Disconnect ( )

Definition at line 562 of file Network.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindUserInfo()

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

Definition at line 759 of file Network.cpp.

◆ GetAnyUserInfo()

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

Also considers local client.

Definition at line 737 of file Network.cpp.

◆ GetDisconnectedUserInfo()

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

Definition at line 723 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetIncomingStreamData()

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

Definition at line 672 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetLocalUserData()

RoRnet::UserInfo Network::GetLocalUserData ( )

Definition at line 697 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetNetQuality()

int Network::GetNetQuality ( )

Definition at line 117 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetPlayerColor()

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

Definition at line 94 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetTerrainName()

Ogre::String Network::GetTerrainName ( )

Definition at line 680 of file Network.cpp.

◆ GetUID()

int Network::GetUID ( )

Definition at line 122 of file Network.cpp.

◆ GetUserColor()

int Network::GetUserColor ( )

Definition at line 685 of file Network.cpp.

◆ GetUserInfo()

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

Definition at line 709 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetUserInfos()

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

Definition at line 703 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetUsername()

Ogre::UTFString Network::GetUsername ( )

Definition at line 691 of file Network.cpp.

◆ PushNetMessage()

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

Definition at line 87 of file Network.cpp.

+ Here is the call graph for this function:

◆ QueueStreamData()

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

Definition at line 163 of file Network.cpp.

◆ ReceiveMessage()

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

Definition at line 173 of file Network.cpp.

◆ RecvThread()

void Network::RecvThread ( )
private

Definition at line 238 of file Network.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendMessageRaw()

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

Definition at line 127 of file Network.cpp.

◆ SendNetMessage()

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

Definition at line 140 of file Network.cpp.

◆ SendThread()

void Network::SendThread ( )
private

Definition at line 214 of file Network.cpp.

+ Here is the caller graph for this function:

◆ SetNetQuality()

void Network::SetNetQuality ( int  quality)
private

Definition at line 112 of file Network.cpp.

◆ StartConnecting()

bool Network::StartConnecting ( )

Launches connecting on background.

Definition at line 388 of file Network.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StopConnecting()

void Network::StopConnecting ( )

Definition at line 413 of file Network.cpp.

+ Here is the caller graph for this function:

◆ UserAuthToStringLong()

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

Definition at line 806 of file Network.cpp.

◆ UserAuthToStringShort()

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

Definition at line 796 of file Network.cpp.

+ Here is the caller graph for this function:

◆ WhisperChatMsg()

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

Definition at line 778 of file Network.cpp.

+ Here is the caller graph for this function:

Field Documentation

◆ m_authlevel

int RoR::Network::m_authlevel
private

Definition at line 165 of file Network.h.

◆ m_connect_thread

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

Definition at line 169 of file Network.h.

◆ m_disconnected_users

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

Definition at line 157 of file Network.h.

◆ m_net_host

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

Definition at line 160 of file Network.h.

◆ m_net_port

int RoR::Network::m_net_port
private

Definition at line 163 of file Network.h.

◆ m_net_quality

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

Definition at line 173 of file Network.h.

◆ m_password

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

Definition at line 161 of file Network.h.

◆ m_recv_packet_buffer

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

Definition at line 183 of file Network.h.

◆ m_recv_packetqueue_mutex

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

Definition at line 178 of file Network.h.

◆ m_recv_thread

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

Definition at line 168 of file Network.h.

◆ m_send_packet_available_cv

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

Definition at line 181 of file Network.h.

◆ m_send_packet_buffer

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

Definition at line 184 of file Network.h.

◆ m_send_packetqueue_mutex

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

Definition at line 179 of file Network.h.

◆ m_send_thread

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

Definition at line 167 of file Network.h.

◆ m_server_settings

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

Definition at line 154 of file Network.h.

◆ m_shutdown

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

Definition at line 172 of file Network.h.

◆ m_socket

SWInetSocket RoR::Network::m_socket
private

Definition at line 152 of file Network.h.

◆ m_status_message

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

Definition at line 171 of file Network.h.

◆ m_stream_id

int RoR::Network::m_stream_id = 10
private

Definition at line 174 of file Network.h.

◆ m_token

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

Definition at line 162 of file Network.h.

◆ m_uid

int RoR::Network::m_uid
private

Definition at line 164 of file Network.h.

◆ m_userdata

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

Definition at line 155 of file Network.h.

◆ m_userdata_mutex

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

Definition at line 177 of file Network.h.

◆ m_username

Ogre::UTFString RoR::Network::m_username
private

Definition at line 159 of file Network.h.

◆ m_users

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

Definition at line 156 of file Network.h.

◆ m_users_mutex

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

Definition at line 176 of file Network.h.


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