RigsofRods
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 ()
 
std::string GetUsername ()
 
RoRnet::UserInfo GetLocalUserData ()
 
std::vector< RoRnet::UserInfoGetUserInfos ()
 
std::vector< BitMask_tGetAllUsersPeerOpts ()
 
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)
 Also considers local client. More...
 
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)
 

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< BitMask_tm_users_peeropts
 See RoRnet::PeerOptions. More...
 
std::vector< RoRnet::UserInfom_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
 Counter. More...
 
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 110 of file Network.h.

Member Function Documentation

◆ AddLocalStream()

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

Definition at line 663 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 609 of file Network.cpp.

+ Here is the caller graph for this function:

◆ AddPeerOptions()

void Network::AddPeerOptions ( PeerOptionsRequest rq)

Definition at line 797 of file Network.cpp.

+ Here is the caller graph for this function:

◆ BroadcastChatMsg()

void Network::BroadcastChatMsg ( const char *  msg)

Definition at line 831 of file Network.cpp.

+ Here is the caller graph for this function:

◆ ConnectThread()

bool Network::ConnectThread ( )
private

Definition at line 427 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 382 of file Network.cpp.

+ Here is the call graph for this function:

◆ Disconnect()

void Network::Disconnect ( )

Definition at line 565 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 782 of file Network.cpp.

◆ GetAllUsersPeerOpts()

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

Definition at line 712 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetAnyUserInfo()

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

Also considers local client.

Definition at line 760 of file Network.cpp.

◆ GetDisconnectedUserInfo()

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

Definition at line 746 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetIncomingStreamData()

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

Definition at line 675 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetLocalUserData()

RoRnet::UserInfo Network::GetLocalUserData ( )

Definition at line 700 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 683 of file Network.cpp.

◆ GetUID()

int Network::GetUID ( )

Definition at line 122 of file Network.cpp.

◆ GetUserColor()

int Network::GetUserColor ( )

Definition at line 688 of file Network.cpp.

◆ GetUserInfo()

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

Definition at line 718 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetUserInfos()

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

Definition at line 706 of file Network.cpp.

+ Here is the caller graph for this function:

◆ GetUsername()

std::string Network::GetUsername ( )

Definition at line 694 of file Network.cpp.

◆ GetUserPeerOpts()

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

Definition at line 732 of file Network.cpp.

+ Here is the caller graph for this function:

◆ 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:

◆ RemovePeerOptions()

void Network::RemovePeerOptions ( PeerOptionsRequest rq)

Definition at line 814 of file Network.cpp.

+ 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 394 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 419 of file Network.cpp.

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

◆ UserAuthToStringLong()

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

Definition at line 864 of file Network.cpp.

◆ UserAuthToStringShort()

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

Definition at line 854 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 836 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 176 of file Network.h.

◆ m_connect_thread

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

Definition at line 180 of file Network.h.

◆ m_disconnected_users

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

Definition at line 168 of file Network.h.

◆ m_net_host

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

Definition at line 171 of file Network.h.

◆ m_net_port

int RoR::Network::m_net_port
private

Definition at line 174 of file Network.h.

◆ m_net_quality

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

Definition at line 184 of file Network.h.

◆ m_password

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

Definition at line 172 of file Network.h.

◆ m_recv_packet_buffer

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

Definition at line 194 of file Network.h.

◆ m_recv_packetqueue_mutex

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

Definition at line 189 of file Network.h.

◆ m_recv_thread

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

Definition at line 179 of file Network.h.

◆ m_send_packet_available_cv

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

Definition at line 192 of file Network.h.

◆ m_send_packet_buffer

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

Definition at line 195 of file Network.h.

◆ m_send_packetqueue_mutex

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

Definition at line 190 of file Network.h.

◆ m_send_thread

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

Definition at line 178 of file Network.h.

◆ m_server_settings

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

Definition at line 164 of file Network.h.

◆ m_shutdown

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

Definition at line 183 of file Network.h.

◆ m_socket

SWInetSocket RoR::Network::m_socket
private

Definition at line 162 of file Network.h.

◆ m_status_message

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

Definition at line 182 of file Network.h.

◆ m_stream_id

int RoR::Network::m_stream_id = 10
private

Counter.

Definition at line 185 of file Network.h.

◆ m_token

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

Definition at line 173 of file Network.h.

◆ m_uid

int RoR::Network::m_uid
private

Definition at line 175 of file Network.h.

◆ m_userdata

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

Definition at line 165 of file Network.h.

◆ m_userdata_mutex

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

Definition at line 188 of file Network.h.

◆ m_username

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

Definition at line 170 of file Network.h.

◆ m_users

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

Definition at line 166 of file Network.h.

◆ m_users_mutex

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

Definition at line 187 of file Network.h.

◆ m_users_peeropts

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

See RoRnet::PeerOptions.

Definition at line 167 of file Network.h.


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