Pol  Revision:cb584c9
Pol::Network::Client Class Reference

#include <client.h>

+ Inheritance diagram for Pol::Network::Client:

Public Types

enum  e_recv_states {
  RECV_STATE_CRYPTSEED_WAIT, RECV_STATE_MSGTYPE_WAIT, RECV_STATE_MSGLEN_WAIT, RECV_STATE_MSGDATA_WAIT,
  RECV_STATE_CLIENTVERSION_WAIT
}
 

Public Member Functions

 Client (ClientInterface &aInterface, Crypt::TCryptInfo &encryption)
 
void closeConnection ()
 
bool compareVersion (const std::string &ver)
 
bool compareVersion (const VersionDetailStruct &ver2)
 
void Disconnect ()
 
size_t estimatedSize () const
 
void forceDisconnect ()
 
Bscript::BStructgetclientinfo () const
 
const std::string & getversion () const
 
VersionDetailStruct getversiondetail () const
 
weak_ptr< ClientgetWeakPtr () const
 
bool have_queued_data () const
 
std::string ipaddrAsString () const
 
bool isActive () const
 
bool isConnected () const
 
bool isReallyConnected () const
 
bool IsUOKRClient ()
 
Bscript::BObjectImpmake_ref ()
 
bool might_use_v2_handler () const
 
void pause ()
 
void recv_remaining (int total_expected)
 
void recv_remaining_nocrypt (int total_expected)
 
void restart ()
 
void send_pause ()
 
void send_queued_data ()
 
void send_restart ()
 
void setclientinfo (const Core::PKTIN_D9 *msg)
 
void setClientType (ClientTypeFlag type)
 
void setversion (const std::string &ver)
 
void setversiondetail (VersionDetailStruct &detail)
 
bool SpeedHackPrevention (bool add=true)
 
std::string status () const
 
void transmit (const void *data, int len, bool needslock=false)
 
void transmitmore (const void *data, int len)
 
void unregister ()
 

Static Public Member Functions

static void Delete (Client *client)
 
static void itemizeclientversion (const std::string &ver, VersionDetailStruct &detail)
 

Public Attributes

Clib::SpinLock _fpLog_lock
 
Accounts::Accountacct
 
bool aosresist
 
unsigned char bufcheck1_AA
 
unsigned char bufcheck2_55
 
unsigned char buffer [MAXBUFFER]
 
unsigned int bytes_received
 
int checkpoint
 
Mobile::Characterchr
 
u16 ClientType
 
Crypt::CCryptBasecryptengine
 
SOCKET csocket
 
bool encrypt_server_stream
 
std::string fpLog
 
ClientGameDatagd
 
unsigned int instance_
 
ClientInterfaceInterface
 
sockaddr ipaddr
 
Core::polclock_t last_activity_at
 
unsigned char last_msgtype
 
Core::polclock_t last_packet_at
 
unsigned short listen_port
 
unsigned int message_length
 
std::queue< PacketThrottlermovementqueue
 
u8 movementsequence
 
const Core::MessageTypeFiltermsgtype_filter
 
Clib::wallclock_t next_movement
 
std::atomic< int > pause_count
 
bool ready
 
enum Pol::Network::Client::e_recv_states recv_state
 
size_t thread_pid
 
u16 UOExpansionFlag
 
u32 UOExpansionFlagClient
 
unsigned int bytes_transmitted
 

Static Public Attributes

static std::mutex _SocketMutex
 
static unsigned int instance_counter_
 

Protected Member Functions

void queue_data (const void *data, unsigned short datalen)
 
void transmit_encrypted (const void *data, int len)
 
void xmit (const void *data, unsigned short datalen)
 

Protected Attributes

Core::XmitBufferfirst_xmit_buffer
 
Core::XmitBufferlast_xmit_buffer
 
int n_queued
 
int queued_bytes_counter
 

Private Member Functions

virtual ~Client ()
 
void PreDelete ()
 

Private Attributes

Core::PKTIN_D9 clientinfo_
 
struct {
   unsigned int   bytes_received
 
   unsigned int   bytes_transmitted
 
counters
 
bool disconnect
 
bool paused_
 
bool preDisconnect
 
std::string version_
 
VersionDetailStruct versiondetail_
 
weak_ptr_owner< Clientweakptr
 

Detailed Description

Definition at line 133 of file client.h.

Member Enumeration Documentation

Enumerator
RECV_STATE_CRYPTSEED_WAIT 
RECV_STATE_MSGTYPE_WAIT 
RECV_STATE_MSGLEN_WAIT 
RECV_STATE_MSGDATA_WAIT 
RECV_STATE_CLIENTVERSION_WAIT 

Definition at line 198 of file client.h.

Constructor & Destructor Documentation

Pol::Network::Client::Client ( ClientInterface aInterface,
Crypt::TCryptInfo encryption 
)
Pol::Network::Client::~Client ( )
privatevirtual

Definition at line 138 of file client.cpp.

Member Function Documentation

void Pol::Network::Client::closeConnection ( )

Definition at line 148 of file client.cpp.

References csocket, and INVALID_SOCKET.

Referenced by PreDelete().

bool Pol::Network::Client::compareVersion ( const std::string &  ver)
void Pol::Network::Client::Delete ( Client client)
static
const std::string& Pol::Network::Client::getversion ( ) const
inline

Definition at line 163 of file client.h.

weak_ptr< Client > Pol::Network::Client::getWeakPtr ( ) const
bool Pol::Network::Client::have_queued_data ( ) const
inline

Definition at line 281 of file client.h.

Referenced by Pol::Core::check_incoming_data(), Pol::Core::client_io_thread(), and status().

std::string Pol::Network::Client::ipaddrAsString ( ) const
bool Pol::Network::Client::isActive ( ) const
inline

Definition at line 306 of file client.h.

Referenced by Pol::Mobile::Character::has_active_client().

bool Pol::Network::Client::isReallyConnected ( ) const
inline
bool Pol::Network::Client::IsUOKRClient ( )
void Pol::Network::Client::itemizeclientversion ( const std::string &  ver,
VersionDetailStruct detail 
)
static
Bscript::BObjectImp * Pol::Network::Client::make_ref ( )
bool Pol::Network::Client::might_use_v2_handler ( ) const
inline

Definition at line 311 of file client.h.

References Pol::Network::CLIENTTYPE_6017.

Referenced by Pol::Network::PacketRegistry::find_handler().

void Pol::Network::Client::queue_data ( const void *  data,
unsigned short  datalen 
)
protected
void Pol::Network::Client::recv_remaining_nocrypt ( int  total_expected)
void Pol::Network::Client::send_pause ( )
void Pol::Network::Client::send_restart ( )
void Pol::Network::Client::setclientinfo ( const Core::PKTIN_D9 msg)
inline

Definition at line 175 of file client.h.

Referenced by Pol::Core::handle_D9().

void Pol::Network::Client::setversion ( const std::string &  ver)
inline

Definition at line 162 of file client.h.

Referenced by Pol::Core::handle_client_version(), and Pol::Core::handle_ef_seed().

void Pol::Network::Client::setversiondetail ( VersionDetailStruct detail)
inline
void Pol::Network::Client::transmitmore ( const void *  data,
int  len 
)
void Pol::Network::Client::unregister ( )

Member Data Documentation

std::mutex Pol::Network::Client::_SocketMutex
static

Definition at line 193 of file client.h.

Referenced by Delete(), recv_remaining(), recv_remaining_nocrypt(), send_queued_data(), and transmit().

bool Pol::Network::Client::aosresist

Definition at line 195 of file client.h.

Referenced by Pol::Core::UoClientThread::create(), and Pol::Core::send_full_statmsg().

unsigned char Pol::Network::Client::bufcheck1_AA

Definition at line 207 of file client.h.

Referenced by Pol::Core::process_data().

unsigned char Pol::Network::Client::bufcheck2_55

Definition at line 209 of file client.h.

Referenced by Pol::Core::process_data().

unsigned int Pol::Network::Client::bytes_received
unsigned int Pol::Network::Client::bytes_transmitted

Definition at line 271 of file client.h.

int Pol::Network::Client::checkpoint

Definition at line 255 of file client.h.

Referenced by Pol::Core::client_io_thread(), status(), and Pol::Core::threadstatus_thread().

Mobile::Character* Pol::Network::Client::chr

Definition at line 182 of file client.h.

Referenced by Pol::Core::add_item_to_stack(), Pol::Core::UDoor::builtin_on_use(), Pol::Module::buyhandler(), Pol::Network::CallOutgoingPacketExportedFunction(), Pol::Core::can_see_on_corpse(), Pol::Core::cancel_all_trades(), Pol::Core::CanUseSkill(), Pol::Core::char_select(), Pol::Module::character_race_changer_handler(), Pol::Mobile::Character::check_justice_region_change(), Pol::Core::client_io_thread(), Pol::Core::ClientCreateChar(), Pol::Core::ClientCreateChar70160(), Pol::Core::ClientCreateCharKR(), Pol::Core::clientHasCharacter(), Pol::Core::do_cast(), Pol::Core::do_open_trade_window(), Pol::Core::do_place_item_in_secure_trade_container(), Pol::Core::Spellbook::double_click(), Pol::Items::Item::double_click(), Pol::Core::doubleclick(), Pol::Core::drop_item(), Pol::Core::drop_item_on_ground(), Pol::Core::drop_item_on_mobile(), Pol::Core::drop_item_on_object(), Pol::Core::drop_item_v2(), Pol::Core::equip_item(), Pol::Network::ExportedPacketHookHandler(), Pol::Core::ext_stats_in(), Pol::Core::get_item(), Pol::Module::gumpbutton_handler(), Pol::Core::handle_accept_invite(), Pol::Core::handle_action(), Pol::Core::handle_add(), Pol::Core::handle_allnames(), Pol::Core::handle_aos_commands(), Pol::Mobile::handle_attack(), Pol::Core::handle_char_profile_request(), Pol::Core::handle_client_version(), Pol::Core::handle_decline_invite(), Pol::Core::handle_help(), Pol::Core::handle_loot_perm(), Pol::Core::handle_map_pin(), Pol::Core::handle_member_msg(), Pol::Core::handle_menu_selection(), Pol::Core::handle_mode_set(), Pol::Core::handle_msg_BF(), Pol::Core::handle_open_spellbook(), Pol::Core::handle_party_msg(), Pol::Core::handle_processed_speech(), Pol::Core::handle_remove(), Pol::Core::handle_rename_char(), Pol::Core::handle_request_tooltip(), Pol::Module::handle_resurrect_menu(), Pol::Core::handle_resync_request(), Pol::Core::handle_secure_trade_msg(), Pol::Module::handle_selcolor(), Pol::Core::handle_singleclick(), Pol::Core::handle_skill_lock(), Pol::Core::handle_target_cursor(), Pol::Module::handle_textentry(), Pol::Core::handle_walk(), Pol::Core::NetworkManager::kill_disconnected_clients(), Pol::Module::menu_selection_made(), Pol::Module::UOExecutorModule::mf_SendOverallSeason(), Pol::Multi::UBoat::move(), Pol::Multi::UBoat::move_components(), Pol::Multi::UBoat::move_travellers(), Pol::Module::oldBuyHandler(), Pol::Module::oldSellHandler(), Pol::Mobile::Character::on_aos_ext_stat_changed(), Pol::Mobile::Character::on_color_changed(), Pol::Mobile::Character::on_death(), Pol::Mobile::Character::on_facing_changed(), Pol::Mobile::Character::on_poison_changed(), Pol::Core::OnChatButton(), Pol::Core::OnGuildButton(), Pol::Core::OnQuestButton(), Pol::Module::open_book_handler(), Pol::Core::open_trade_window(), Pol::Core::place_item(), Pol::Core::place_item_in_container(), Pol::Core::place_item_in_secure_trade_container(), Pol::Module::popup_menu_selection_made(), PreDelete(), Pol::Core::process_command(), Pol::Module::read_book_page_handler(), Pol::Core::remove_objects_inrange(), Pol::Mobile::Character::resurrect(), Pol::Module::sellhandler(), Pol::Network::MoveChrPkt::Send(), Pol::Core::send_char_data(), Pol::Core::send_char_if_newly_inrange(), Pol::Core::send_client_char_data(), Pol::Core::send_container_contents(), Pol::Core::LosCheckedCoordCursor::send_coord_cursor(), Pol::Mobile::send_create_ghost(), Pol::Core::send_create_mobile_if_nearby_cansee(), Pol::Multi::UBoat::send_display_boat(), Pol::Multi::UBoat::send_display_boat_to_inrange(), Pol::Core::send_fight_occuring(), Pol::Core::send_inrange_items(), Pol::Core::send_inrange_multis(), Pol::Core::send_item(), Pol::Core::send_item_if_newly_inrange(), Pol::Core::send_item_to_inrange(), Pol::Core::send_mana_level(), Pol::Core::send_move_if_inrange2(), Pol::Core::send_multi_if_newly_inrange(), Pol::Core::send_nametext(), Pol::Core::send_new_subserver(), Pol::Core::TargetCursor::send_object_cursor(), Pol::Core::send_objects_newly_inrange(), Pol::Core::send_objects_newly_inrange_on_boat(), Pol::Core::send_owncreate(), Pol::Core::send_paperdoll(), Pol::Core::MultiPlacementCursor::send_placemulti(), Pol::Core::send_remove_character(), Pol::Mobile::send_remove_if_hidden_ghost(), Pol::Core::send_remove_object_if_inrange(), Pol::Core::send_season_info(), Pol::Core::send_short_statmsg(), Pol::Multi::UBoat::send_smooth_move_to_inrange(), Pol::Core::send_stamina_level(), Pol::Core::send_startup(), Pol::Core::SendUnicodeSpeech(), Pol::Mobile::Character::setgraphic(), Pol::Core::SetRegionLightLevel(), Pol::Core::singleclick(), Pol::Core::skillrequest(), SpeedHackPrevention(), Pol::Core::srequest(), Pol::Core::start_client_char(), Pol::Core::start_textcmd_script(), Pol::Core::StartSkillScript(), Pol::Core::statrequest(), status(), Pol::Core::textcmd_flag1(), Pol::Core::textcmd_flag2(), Pol::Core::textcmd_listarmor(), Pol::Core::textcmd_resendchars(), Pol::Core::textcmd_singlezone_integ_item(), Pol::Core::textcmd_startlog(), Pol::Core::textcmd_stoplog(), Pol::Multi::UBoat::transform_components(), Pol::Multi::UBoat::turn_travellers(), Pol::Core::UnicodeSpeechHandler(), Pol::Core::update_lightregion(), Pol::Core::update_weatherregion(), and Pol::Mobile::Character::~Character().

Core::PKTIN_D9 Pol::Network::Client::clientinfo_
private

Definition at line 275 of file client.h.

Referenced by Client(), and getclientinfo().

struct { ... } Pol::Network::Client::counters
Crypt::CCryptBase* Pol::Network::Client::cryptengine
bool Pol::Network::Client::disconnect
private
bool Pol::Network::Client::encrypt_server_stream

Definition at line 217 of file client.h.

Referenced by Pol::Core::login2(), transmit(), transmitmore(), and xmit().

Core::XmitBuffer* Pol::Network::Client::first_xmit_buffer
protected

Definition at line 240 of file client.h.

Referenced by estimatedSize(), PreDelete(), queue_data(), and send_queued_data().

ClientGameData* Pol::Network::Client::gd

Definition at line 252 of file client.h.

Referenced by Pol::Module::buyhandler(), Pol::Core::char_select(), Pol::Mobile::Character::check_justice_region_change(), Pol::Mobile::Character::check_light_region_change(), Pol::Mobile::Character::check_music_region_change(), Pol::Mobile::Character::check_weather_region_change(), Pol::Module::clear_gumphandler(), Pol::Core::client_io_thread(), Pol::Multi::CustomHouseStopEditing(), Pol::Mobile::Character::CustomHousingMove(), estimatedSize(), Pol::Multi::UHouse::FindWorkingHouse(), Pol::Module::gumpbutton_handler(), Pol::Module::handle_coord_cursor(), Pol::Core::handle_prompt(), Pol::Module::handle_resurrect_menu(), Pol::Module::handle_script_cursor(), Pol::Module::handle_selcolor(), Pol::Module::handle_textentry(), Pol::Core::handle_unicode_prompt(), Pol::Mobile::Character::has_active_gump(), Pol::Mobile::Character::has_active_prompt(), Pol::Module::UOExecutorModule::internal_SendCompressedGumpMenu(), Pol::Module::UOExecutorModule::internal_SendUnCompressedGumpMenu(), Pol::Mobile::Character::is_house_editing(), Pol::Module::menu_selection_made(), Pol::Module::UOExecutorModule::mf_CloseGump(), Pol::Module::UOExecutorModule::mf_GetRegionName(), Pol::Module::UOExecutorModule::mf_PromptInput(), Pol::Module::UnicodeExecutorModule::mf_RequestInputUC(), Pol::Module::UOExecutorModule::mf_SelectColor(), Pol::Module::UOExecutorModule::mf_SelectMenuItem(), Pol::Module::UOExecutorModule::mf_SendBuyWindow(), Pol::Module::UOExecutorModule::mf_SendHousingTool(), Pol::Module::UOExecutorModule::mf_SendInstaResDialog(), Pol::Module::UOExecutorModule::mf_SendPopUpMenu(), Pol::Module::UOExecutorModule::mf_SendSellWindow(), Pol::Module::UOExecutorModule::mf_SendTextEntryGump(), Pol::Module::UOExecutorModule::mf_Target(), Pol::Module::UOExecutorModule::mf_TargetCoordinates(), Pol::Module::UOExecutorModule::mf_TargetMultiPlacement(), Pol::Core::move_character_to(), Pol::Module::oldBuyHandler(), Pol::Module::oldSellHandler(), Pol::Module::popup_menu_selection_made(), PreDelete(), Pol::Core::JusticeRegion::RunNoCombatCheck(), Pol::Multi::UHouse::script_method_id(), Pol::Module::sellhandler(), Pol::Core::send_season_info(), Pol::Core::SetRegionLightLevel(), Pol::Core::start_client_char(), Pol::Mobile::Character::target_cursor_busy(), Pol::Core::update_weatherregion(), Pol::Realms::Realm::walkheight(), Pol::Module::UnicodeExecutorModule::~UnicodeExecutorModule(), and Pol::Module::UOExecutorModule::~UOExecutorModule().

unsigned int Pol::Network::Client::instance_counter_
static

Definition at line 254 of file client.h.

Core::polclock_t Pol::Network::Client::last_activity_at

Definition at line 265 of file client.h.

Referenced by Pol::Core::client_io_thread().

unsigned char Pol::Network::Client::last_msgtype

Definition at line 256 of file client.h.

Referenced by Pol::Core::process_data(), and status().

Core::polclock_t Pol::Network::Client::last_packet_at

Definition at line 266 of file client.h.

Referenced by Pol::Core::client_io_thread().

Core::XmitBuffer* Pol::Network::Client::last_xmit_buffer
protected

Definition at line 241 of file client.h.

Referenced by PreDelete(), queue_data(), send_queued_data(), transmit(), and xmit().

unsigned short Pol::Network::Client::listen_port

Definition at line 194 of file client.h.

Referenced by Pol::Core::UoClientThread::create(), and Pol::Core::select_server().

unsigned int Pol::Network::Client::message_length

Definition at line 211 of file client.h.

Referenced by Pol::Core::process_data(), and Pol::Core::valid_message_length().

std::queue<PacketThrottler> Pol::Network::Client::movementqueue

Definition at line 261 of file client.h.

Referenced by Pol::Core::client_io_thread(), estimatedSize(), and SpeedHackPrevention().

u8 Pol::Network::Client::movementsequence

Definition at line 263 of file client.h.

Referenced by Pol::Core::handle_walk().

int Pol::Network::Client::n_queued
protected

Definition at line 242 of file client.h.

Referenced by PreDelete(), queue_data(), and send_queued_data().

Clib::wallclock_t Pol::Network::Client::next_movement

Definition at line 262 of file client.h.

Referenced by Pol::Core::handle_walk(), and SpeedHackPrevention().

std::atomic<int> Pol::Network::Client::pause_count
bool Pol::Network::Client::paused_
private

Definition at line 276 of file client.h.

Referenced by send_pause(), send_restart(), and status().

bool Pol::Network::Client::preDisconnect
private

Definition at line 143 of file client.h.

Referenced by Disconnect().

int Pol::Network::Client::queued_bytes_counter
protected

Definition at line 243 of file client.h.

Referenced by queue_data(), and send_queued_data().

enum Pol::Network::Client::e_recv_states Pol::Network::Client::recv_state

Referenced by Client(), and Pol::Core::process_data().

size_t Pol::Network::Client::thread_pid

Definition at line 257 of file client.h.

Referenced by Pol::Core::UoClientThread::run(), and status().

std::string Pol::Network::Client::version_
private

Definition at line 274 of file client.h.

Referenced by estimatedSize().

VersionDetailStruct Pol::Network::Client::versiondetail_
private

Definition at line 277 of file client.h.

Referenced by Client().

weak_ptr_owner<Client> Pol::Network::Client::weakptr
private

Definition at line 278 of file client.h.

Referenced by Client(), getWeakPtr(), and make_ref().


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