Horizon Official Technical Documentation
|
|
#include <ByteBuffer.hpp>
Public Member Functions | |
ByteBuffer () | |
ByteBuffer (size_t reserve) | |
ByteBuffer (ByteBuffer &&buf) | |
ByteBuffer (ByteBuffer &buf, size_t len) | |
ByteBuffer (ByteBuffer const &right) | |
ByteBuffer & | operator= (ByteBuffer const &right) |
virtual | ~ByteBuffer () |
void | clear () |
void | reset () |
template<typename T > | |
void | append (T value) |
template<typename T > | |
void | put (size_t pos, T value) |
ByteBuffer & | operator<< (uint8_t value) |
ByteBuffer & | operator<< (uint16_t value) |
ByteBuffer & | operator<< (uint32_t value) |
ByteBuffer & | operator<< (uint64_t value) |
ByteBuffer & | operator<< (int8_t value) |
ByteBuffer & | operator<< (int16_t value) |
ByteBuffer & | operator<< (int32_t value) |
ByteBuffer & | operator<< (int64_t value) |
ByteBuffer & | operator<< (float value) |
ByteBuffer & | operator<< (double value) |
ByteBuffer & | operator>> (bool &value) |
ByteBuffer & | operator>> (uint8_t &value) |
ByteBuffer & | operator>> (uint16_t &value) |
ByteBuffer & | operator>> (uint32_t &value) |
ByteBuffer & | operator>> (uint64_t &value) |
ByteBuffer & | operator>> (int8_t &value) |
ByteBuffer & | operator>> (int16_t &value) |
ByteBuffer & | operator>> (int32_t &value) |
ByteBuffer & | operator>> (int64_t &value) |
ByteBuffer & | operator>> (float &value) |
ByteBuffer & | operator>> (double &value) |
uint8_t & | operator[] (size_t const pos) |
uint8_t const & | operator[] (size_t const pos) const |
size_t | rpos () const |
size_t | rpos (size_t rpos_) |
uint8_t * | contents () |
uint8_t const * | contents () const |
void | finish_reading () |
void | read_completed (size_t bytes) |
void | write_completed (size_t bytes) |
size_t | wpos () const |
uint8_t * | get_base_pointer () |
uint8_t * | get_read_pointer () |
uint8_t * | get_write_pointer () |
std::string | to_string () |
size_t | maximum_length () const |
size_t | active_length () const |
size_t | remaining_space () const |
bool | is_empty () const |
void | flush () |
void | ensure_free_space () |
void | resize (size_t new_size) |
void | reserve (size_t ressize) |
template<typename T > | |
void | read_skip () |
void | read_skip (size_t skip) |
template<typename T > | |
T | read () |
template<typename T > | |
T | read (size_t pos) const |
void | read (char *dest, size_t len) |
void | read (ByteBuffer &buf, size_t len) |
void | append (const char *src, size_t size) |
void | append (std::string string) |
template<class T > | |
void | append (const T *src, size_t size) |
template<class T , class SubT > | |
void | append (const T *t, size_t t_size, const SubT *sub_t, int count) |
void | append (const uint8_t *src, size_t cnt) |
void | append (const ByteBuffer &buffer) |
void | put (size_t pos, const uint8_t *src, size_t cnt) |
void | print_storage () const |
void | textlike () const |
void | hexlike () const |
template<typename SizeT = uint16_t, typename std::enable_if< std::is_integral< SizeT >::value >::type * = nullptr> | |
void | emplace_size (std::size_t pos=2) |
template<> | |
void | read_skip () |
Static Public Attributes | |
static const size_t | DEFAULT_SIZE = 0x1000 |
Protected Attributes | |
size_t | _rpos {0} |
size_t | _wpos {0} |
std::vector< uint8_t > | _storage |
|
inline |
References _storage, and DEFAULT_SIZE.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
Referenced by flush(), hexlike(), GridPlayerNotifier::notify(), Horizon::Auth::AuthSocket::read_handler(), Horizon::Char::CharSocket::read_handler(), Horizon::Zone::ZoneSocket::read_handler(), textlike(), Horizon::Auth::AuthSession::transmit_buffer(), Horizon::Char::CharSession::transmit_buffer(), Horizon::Zone::ZoneSession::transmit_buffer(), and Horizon::Networking::Socket< SocketType >::write_buffer_and_send().
|
inline |
|
inline |
|
inline |
|
inline |
References append(), and GridTypeListIterator::count().
|
inline |
References _storage, _wpos, and maximum_length().
|
inline |
|
inline |
References append().
Referenced by append(), Horizon::Char::HC_ACK_CHARINFO_PER_PAGE::prepare(), Horizon::Char::HC_ACCEPT_ENTER::prepare(), Horizon::Auth::AuthSocket::read_handler(), Horizon::Char::CharSocket::read_handler(), Horizon::Zone::ZoneSocket::read_handler(), Horizon::Auth::AC_ACCEPT_LOGIN::serialize(), Horizon::Auth::AC_LOGIN_OTP::serialize(), Horizon::Auth::AC_REFUSE_LOGIN::serialize(), Horizon::Char::HC_ACCEPT_ENTER2::serialize(), Horizon::Char::HC_ACCEPT_MAKECHAR::serialize(), Horizon::Char::HC_NOTIFY_ZONESVR::serialize(), Horizon::Zone::ZC_ACCEPT_ENTER::serialize(), Horizon::Zone::ZC_ACCEPT_ENTER2::serialize(), Horizon::Zone::ZC_ACCEPT_ENTER3::serialize(), Horizon::Zone::ZC_ACK_ACCOUNTNAME::serialize(), Horizon::Zone::ZC_ACK_BAN_GUILD::serialize(), Horizon::Zone::ZC_ACK_BAN_GUILD_SSO::serialize(), Horizon::Zone::ZC_ACK_CHANGE_GUILD_POSITIONINFO::serialize(), Horizon::Zone::ZC_ACK_LEAVE_GUILD::serialize(), Horizon::Zone::ZC_ACK_RANKING::serialize(), Horizon::Zone::ZC_ACK_REQNAMEALL::serialize(), Horizon::Zone::ZC_ACK_REQNAMEALL2::serialize(), Horizon::Zone::ZC_ACK_REQ_JOIN_GROUP::serialize(), Horizon::Zone::ZC_ADD_MEMBER_TO_GROUP::serialize(), Horizon::Zone::ZC_BAN_LIST::serialize(), Horizon::Zone::ZC_CHANGE_CHATROOM::serialize(), Horizon::Zone::ZC_ENTER_ROOM::serialize(), Horizon::Zone::ZC_GROUP_LIST::serialize(), Horizon::Zone::ZC_GUILD_CHAT::serialize(), Horizon::Zone::ZC_GUILD_INFO::serialize(), Horizon::Zone::ZC_GUILD_INFO2::serialize(), Horizon::Zone::ZC_GUILD_NOTICE::serialize(), Horizon::Zone::ZC_GUILD_POSITION::serialize(), Horizon::Zone::ZC_GUILD_SKILLINFO::serialize(), Horizon::Zone::ZC_INVENTORY_START::serialize(), Horizon::Zone::ZC_MEMBERMGR_INFO::serialize(), Horizon::Zone::ZC_MENU_LIST::serialize(), Horizon::Zone::ZC_MYGUILD_BASIC_INFO::serialize(), Horizon::Zone::ZC_NOTIFY_ACT::serialize(), Horizon::Zone::ZC_NOTIFY_CHAT::serialize(), Horizon::Zone::ZC_NOTIFY_MOVE::serialize(), Horizon::Zone::ZC_NOTIFY_MOVEENTRY11::serialize(), Horizon::Zone::ZC_NOTIFY_NEWENTRY11::serialize(), Horizon::Zone::ZC_NOTIFY_PLAYERCHAT::serialize(), Horizon::Zone::ZC_NOTIFY_PLAYERMOVE::serialize(), Horizon::Zone::ZC_NOTIFY_STANDENTRY11::serialize(), Horizon::Zone::ZC_NPCACK_MAPMOVE::serialize(), Horizon::Zone::ZC_PARTY_JOIN_REQ::serialize(), Horizon::Zone::ZC_PARTY_JOIN_REQ_ACK::serialize(), Horizon::Zone::ZC_POSITION_ID_NAME_INFO::serialize(), Horizon::Zone::ZC_REQ_ADD_FRIENDS::serialize(), Horizon::Zone::ZC_REQ_ALLY_GUILD::serialize(), Horizon::Zone::ZC_REQ_JOIN_GROUP::serialize(), Horizon::Zone::ZC_REQ_JOIN_GUILD::serialize(), Horizon::Zone::ZC_ROLE_CHANGE::serialize(), Horizon::Zone::ZC_ROOM_NEWENTRY::serialize(), Horizon::Zone::ZC_SKILLINFO_LIST::serialize(), Horizon::Zone::ZC_STORE_ITEMLIST_EQUIP_V6::serialize(), Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5::serialize(), Horizon::Zone::ZC_UPDATE_GDID::serialize(), Horizon::Zone::ZC_WHISPER::serialize(), and Horizon::Auth::CA_LOGIN::serialize().
|
inline |
|
inline |
References _storage.
Referenced by append(), and ByteBuffer().
|
inline |
References _storage.
|
inline |
|
inline |
References _storage, and remaining_space().
Referenced by Horizon::Networking::Socket< SocketType >::async_read(), and Horizon::Networking::Socket< SocketType >::async_read_with_callback().
|
inline |
|
inline |
References _rpos, _wpos, active_length(), get_base_pointer(), and get_read_pointer().
Referenced by Horizon::Networking::Socket< SocketType >::async_read(), and Horizon::Networking::Socket< SocketType >::async_read_with_callback().
|
inline |
References _storage.
Referenced by flush(), get_read_pointer(), and get_write_pointer().
|
inline |
References _rpos, and get_base_pointer().
Referenced by flush(), to_string(), Horizon::Auth::AuthSession::transmit_buffer(), Horizon::Char::CharSession::transmit_buffer(), Horizon::Zone::ZoneSession::transmit_buffer(), and Horizon::Networking::Socket< SocketType >::write_buffer_and_send().
|
inline |
References _wpos, and get_base_pointer().
Referenced by Horizon::Networking::Socket< SocketType >::async_read(), Horizon::Networking::Socket< SocketType >::async_read_with_callback(), and to_string().
void ByteBuffer::hexlike | ( | ) | const |
References active_length().
|
inline |
References _storage.
Referenced by Horizon::Auth::AuthSession::transmit_buffer(), Horizon::Char::CharSession::transmit_buffer(), and Horizon::Zone::ZoneSession::transmit_buffer().
|
inline |
References _storage.
Referenced by append(), operator[](), put(), read(), read_skip(), and reserve().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
References _storage, and maximum_length().
|
inline |
void ByteBuffer::print_storage | ( | ) | const |
|
inline |
References _storage, _wpos, and maximum_length().
|
inline |
References put().
Referenced by emplace_size(), and put().
|
inline |
References _rpos.
Referenced by Horizon::Auth::CA_LOGIN::deserialize(), Horizon::Char::CH_DELETE_CHAR::deserialize(), Horizon::Char::CH_DELETE_CHAR2::deserialize(), Horizon::Char::CH_DELETE_CHAR3::deserialize(), Horizon::Char::CH_EDIT_SECOND_PASSWD::deserialize(), Horizon::Char::CH_MAKE_CHAR::deserialize(), Horizon::Char::CH_MAKE_SECOND_PASSWD::deserialize(), Horizon::Char::CH_SECOND_PASSWD_ACK::deserialize(), Horizon::Zone::CZ_ACK_STORE_PASSWORD::deserialize(), Horizon::Zone::CZ_ADD_FRIENDS::deserialize(), Horizon::Zone::CZ_AUCTION_ITEM_SEARCH::deserialize(), Horizon::Zone::CZ_BATTLEFIELD_CHAT::deserialize(), Horizon::Zone::CZ_BROADCAST::deserialize(), Horizon::Zone::CZ_CHANGE_CHATROOM::deserialize(), Horizon::Zone::CZ_CHECK_RECEIVE_CHARACTER_NAME::deserialize(), Horizon::Zone::CZ_CLAN_CHAT::deserialize(), Horizon::Zone::CZ_CREATE_CHATROOM::deserialize(), Horizon::Zone::CZ_GUILD_CHAT::deserialize(), Horizon::Zone::CZ_GUILD_NOTICE::deserialize(), Horizon::Zone::CZ_INPUT_EDITDLGSTR::deserialize(), Horizon::Zone::CZ_ITEM_CREATE::deserialize(), Horizon::Zone::CZ_ITEM_CREATE_EX::deserialize(), Horizon::Zone::CZ_LOCALBROADCAST::deserialize(), Horizon::Zone::CZ_MAIL_SEND::deserialize(), Horizon::Zone::CZ_MAKE_GROUP::deserialize(), Horizon::Zone::CZ_MAKE_GROUP2::deserialize(), Horizon::Zone::CZ_MOVETO_MAP::deserialize(), Horizon::Zone::CZ_PARTY_JOIN_REQ::deserialize(), Horizon::Zone::CZ_PRIVATE_AIRSHIP_REQUEST::deserialize(), Horizon::Zone::CZ_RECALL::deserialize(), Horizon::Zone::CZ_RECALL_GID::deserialize(), Horizon::Zone::CZ_REGISTER_GUILD_EMBLEM_IMG::deserialize(), Horizon::Zone::CZ_REG_CHANGE_GUILD_POSITIONINFO::deserialize(), Horizon::Zone::CZ_RENAME_MER::deserialize(), Horizon::Zone::CZ_RENAME_PET::deserialize(), Horizon::Zone::CZ_REQUEST_CHAT::deserialize(), Horizon::Zone::CZ_REQUEST_CHAT_PARTY::deserialize(), Horizon::Zone::CZ_REQUEST_MOVE::deserialize(), Horizon::Zone::CZ_REQUEST_MOVE2::deserialize(), Horizon::Zone::CZ_REQUEST_MOVENPC::deserialize(), Horizon::Zone::CZ_REQ_BAN_GUILD::deserialize(), Horizon::Zone::CZ_REQ_DISORGANIZE_GUILD::deserialize(), Horizon::Zone::CZ_REQ_ENTER_ROOM::deserialize(), Horizon::Zone::CZ_REQ_EXPEL_GROUP_MEMBER::deserialize(), Horizon::Zone::CZ_REQ_EXPEL_MEMBER::deserialize(), Horizon::Zone::CZ_REQ_GIVE_MANNER_BYNAME::deserialize(), Horizon::Zone::CZ_REQ_JOIN_GUILD2::deserialize(), Horizon::Zone::CZ_REQ_LEAVE_GUILD::deserialize(), Horizon::Zone::CZ_REQ_MAIL_RETURN::deserialize(), Horizon::Zone::CZ_REQ_MAKE_GUILD::deserialize(), Horizon::Zone::CZ_REQ_OPENSTORE::deserialize(), Horizon::Zone::CZ_REQ_OPENSTORE2::deserialize(), Horizon::Zone::CZ_REQ_OPEN_BUYING_STORE::deserialize(), Horizon::Zone::CZ_REQ_ROLE_CHANGE::deserialize(), Horizon::Zone::CZ_REQ_STATUS_GM::deserialize(), Horizon::Zone::CZ_USE_SKILL_TOGROUND_WITHTALKBOX::deserialize(), Horizon::Zone::CZ_USE_SKILL_TOGROUND_WITHTALKBOX2::deserialize(), and Horizon::Zone::CZ_WHISPER::deserialize().
|
inline |
|
inline |
References _rpos, _storage, and maximum_length().
|
inline |
References _storage, and maximum_length().
|
inline |
References _rpos.
Referenced by Horizon::Auth::AuthSocket::read_handler(), Horizon::Char::CharSocket::read_handler(), and Horizon::Zone::ZoneSocket::read_handler().
|
inline |
References read_skip().
Referenced by read_skip().
|
inline |
|
inline |
References _rpos, and maximum_length().
|
inline |
References _storage, and _wpos.
Referenced by Horizon::Networking::Socket< SocketType >::async_read(), Horizon::Networking::Socket< SocketType >::async_read_with_callback(), and ensure_free_space().
|
inline |
References _storage, and maximum_length().
Referenced by ByteBuffer().
|
inline |
|
inline |
References _storage.
Referenced by Horizon::Networking::Socket< SocketType >::Socket().
|
inline |
void ByteBuffer::textlike | ( | ) | const |
References active_length().
|
inline |
References get_read_pointer(), and get_write_pointer().
Referenced by Horizon::Char::CharSocket::read_handler(), and Horizon::Auth::AC_ACCEPT_LOGIN::serialize().
|
inline |
References _wpos.
Referenced by append(), and finish_reading().
|
inline |
References _wpos.
Referenced by Horizon::Networking::Socket< SocketType >::read_handler_internal().
|
protected |
Referenced by active_length(), ByteBuffer(), finish_reading(), flush(), get_read_pointer(), operator=(), read(), read_completed(), read_skip(), reset(), and rpos().
|
protected |
Referenced by append(), ByteBuffer(), clear(), contents(), emplace_size(), ensure_free_space(), get_base_pointer(), is_empty(), maximum_length(), operator=(), operator[](), print_storage(), put(), read(), remaining_space(), reserve(), and resize().
|
protected |
Referenced by active_length(), append(), ByteBuffer(), emplace_size(), flush(), get_write_pointer(), operator=(), put(), read(), remaining_space(), reset(), wpos(), and write_completed().
|
static |
Referenced by ByteBuffer().