Binary serializer for RNP protocol packets. More...
#include <Serializer.hpp>
Collaboration diagram for rnp::Serializer:Public Member Functions | |
| Serializer () | |
| Constructor. | |
| Serializer (std::size_t capacity) | |
| Constructor with initial capacity. | |
| Serializer (const std::vector< std::uint8_t > &data) | |
| Constructor from existing data. | |
| void | reset () |
| Reset the serializer for reuse. | |
| const std::vector< std::uint8_t > & | getData () const |
| Get the serialized data. | |
| std::size_t | getSize () const |
| Get the current size of serialized data. | |
| void | writeBytes (const void *data, std::size_t size) |
| Write raw bytes. | |
| void | writeByte (std::uint8_t value) |
| Write a single byte. | |
| void | writeUInt16 (std::uint16_t value) |
| Write a 16-bit integer (network byte order) | |
| void | writeUInt32 (std::uint32_t value) |
| Write a 32-bit integer (network byte order) | |
| void | writeFloat (float value) |
| Write a float (network byte order) | |
| void | writeString (const std::string &str, std::size_t maxLength) |
| Write a string with length prefix. | |
| void | readBytes (void *data, std::size_t size) |
| Read raw bytes. | |
| std::uint8_t | readByte () |
| Read a single byte. | |
| std::uint16_t | readUInt16 () |
| Read a 16-bit integer (network byte order) | |
| std::uint32_t | readUInt32 () |
| Read a 32-bit integer (network byte order) | |
| float | readFloat () |
| Read a float (network byte order) | |
| std::string | readString (std::size_t maxLength) |
| Read a string with length prefix. | |
| void | serializeHeader (const PacketHeader &header) |
| Serialize packet header. | |
| PacketHeader | deserializeHeader () |
| Deserialize packet header. | |
| void | serializeConnect (const PacketConnect &packet) |
| Serialize CONNECT packet. | |
| PacketConnect | deserializeConnect () |
| Deserialize CONNECT packet. | |
| void | serializeConnectAccept (const PacketConnectAccept &packet) |
| Serialize CONNECT_ACCEPT packet. | |
| PacketConnectAccept | deserializeConnectAccept () |
| Deserialize CONNECT_ACCEPT packet. | |
| void | serializeDisconnect (const PacketDisconnect &packet) |
| Serialize DISCONNECT packet. | |
| PacketDisconnect | deserializeDisconnect () |
| Deserialize DISCONNECT packet. | |
| void | serializeEntityState (const EntityState &entity) |
| Serialize EntityState. | |
| EntityState | deserializeEntityState () |
| Deserialize EntityState. | |
| void | serializeWorldState (const PacketWorldState &packet) |
| Serialize WORLD_STATE packet. | |
| PacketWorldState | deserializeWorldState () |
| Deserialize WORLD_STATE packet. | |
| void | serializePingPong (const PacketPingPong &packet) |
| Serialize PING/PONG packet. | |
| PacketPingPong | deserializePingPong () |
| Deserialize PING/PONG packet. | |
| void | serializeError (const PacketError &packet) |
| Serialize ERROR packet. | |
| PacketError | deserializeError () |
| Deserialize ERROR packet. | |
| void | serializeEventRecord (const EventRecord &event) |
| Serialize EventRecord for ENTITY_EVENT packets. | |
| EventRecord | deserializeEventRecord () |
| Deserialize EventRecord from ENTITY_EVENT packets. | |
| void | serializeEntityEvents (const std::vector< EventRecord > &events) |
| Serialize multiple EventRecords for ENTITY_EVENT packet. | |
| std::vector< EventRecord > | deserializeEntityEvents (std::size_t payloadSize) |
| Deserialize multiple EventRecords from ENTITY_EVENT packet. | |
| void | serializeInputData (std::uint8_t keys, float mouseX, float mouseY, std::uint8_t mouseButtons, std::uint32_t timestamp) |
| Serialize input data for INPUT events. | |
| void | deserializeInputData (std::uint8_t &keys, float &mouseX, float &mouseY, std::uint8_t &mouseButtons, std::uint32_t ×tamp) |
| Deserialize input data from INPUT events. | |
| EventRecord | createDespawnEvent (std::uint32_t entityId) |
| Create an EventRecord for despawn event. | |
| void | serializeLobbyInfo (const LobbyInfo &lobbyInfo) |
| Serialize LobbyInfo structure. | |
| LobbyInfo | deserializeLobbyInfo () |
| Deserialize LobbyInfo structure. | |
| void | serializeLobbyListResponse (const PacketLobbyListResponse &packet) |
| Serialize LOBBY_LIST_RESPONSE packet. | |
| PacketLobbyListResponse | deserializeLobbyListResponse () |
| Deserialize LOBBY_LIST_RESPONSE packet. | |
| void | serializeLobbyCreate (const PacketLobbyCreate &packet) |
| Serialize LOBBY_CREATE packet. | |
| PacketLobbyCreate | deserializeLobbyCreate () |
| Deserialize LOBBY_CREATE packet. | |
| void | serializeLobbyCreateResponse (const PacketLobbyCreateResponse &packet) |
| Serialize LOBBY_CREATE_RESPONSE packet. | |
| PacketLobbyCreateResponse | deserializeLobbyCreateResponse () |
| Deserialize LOBBY_CREATE_RESPONSE packet. | |
| void | serializeLobbyJoin (const PacketLobbyJoin &packet) |
| Serialize LOBBY_JOIN packet. | |
| PacketLobbyJoin | deserializeLobbyJoin () |
| Deserialize LOBBY_JOIN packet. | |
| void | serializeLobbyJoinResponse (const PacketLobbyJoinResponse &packet) |
| Serialize LOBBY_JOIN_RESPONSE packet. | |
| PacketLobbyJoinResponse | deserializeLobbyJoinResponse () |
| Deserialize LOBBY_JOIN_RESPONSE packet. | |
| void | serializeLobbyUpdate (const PacketLobbyUpdate &packet) |
| Serialize LOBBY_UPDATE packet. | |
| PacketLobbyUpdate | deserializeLobbyUpdate () |
| Deserialize LOBBY_UPDATE packet. | |
| void | serializeGameStart (const PacketGameStart &packet) |
| Serialize GAME_START packet. | |
| PacketGameStart | deserializeGameStart () |
| Deserialize GAME_START packet. | |
| void | serializeStartGameRequest (const PacketStartGameRequest &packet) |
| Serialize START_GAME_REQUEST packet. | |
| PacketStartGameRequest | deserializeStartGameRequest () |
| Deserialize START_GAME_REQUEST packet. | |
Static Public Member Functions | |
| static EventRecord | createInputEvent (std::uint32_t entityId, std::uint8_t keys, float mouseX, float mouseY, std::uint8_t mouseButtons, std::uint32_t timestamp) |
| Create an EventRecord for input data. | |
| static EventRecord | createSpawnEvent (std::uint32_t entityId, EntityType entityType, float x, float y) |
| Create an EventRecord for spawn event. | |
| static EventRecord | createDamageEvent (std::uint32_t entityId, std::uint32_t damage, std::uint32_t sourceId=0) |
| Create an EventRecord for damage event. | |
| static EventRecord | createScoreEvent (std::uint32_t entityId, std::uint32_t score) |
| Create an EventRecord for score event. | |
Private Attributes | |
| std::vector< std::uint8_t > | buffer_ |
| std::size_t | writePos_ |
| std::size_t | readPos_ |
Binary serializer for RNP protocol packets.
Definition at line 64 of file Serializer.hpp.
|
inline |
Constructor.
Definition at line 75 of file Serializer.hpp.
References buffer_, and rnp::MAX_PAYLOAD.
|
inlineexplicit |
Constructor with initial capacity.
| capacity | Initial buffer capacity |
Definition at line 86 of file Serializer.hpp.
References buffer_.
|
inlineexplicit |
Constructor from existing data.
| data | Existing data to deserialize |
Definition at line 92 of file Serializer.hpp.
|
inlinestatic |
Create an EventRecord for damage event.
| entityId | Entity taking damage |
| damage | Amount of damage |
| sourceId | Source entity causing damage |
Definition at line 653 of file Serializer.hpp.
References rnp::DAMAGE, getData(), rnp::EventRecord::type, and writeUInt32().
Here is the call graph for this function:
|
inline |
Create an EventRecord for despawn event.
| entityId | Entity to despawn |
Definition at line 692 of file Serializer.hpp.
References rnp::DESPAWN, and rnp::EventRecord::type.
|
inlinestatic |
Create an EventRecord for input data.
| entityId | Player entity ID |
| keys | Keyboard input |
| mouseX | Mouse X |
| mouseY | Mouse Y |
| mouseButtons | Mouse buttons |
| timestamp | Timestamp |
Definition at line 609 of file Serializer.hpp.
References getData(), rnp::INPUT, serializeInputData(), and rnp::EventRecord::type.
Here is the call graph for this function:
|
inlinestatic |
Create an EventRecord for score event.
| entityId | Entity gaining score |
| score | Score amount |
Definition at line 674 of file Serializer.hpp.
References getData(), rnp::SCORE, rnp::EventRecord::type, and writeUInt32().
Here is the call graph for this function:
|
inlinestatic |
Create an EventRecord for spawn event.
| entityId | Entity ID to spawn |
| entityType | Type of entity |
| x | X position |
| y | Y position |
Definition at line 631 of file Serializer.hpp.
References getData(), rnp::SPAWN, rnp::EventRecord::type, writeFloat(), and writeUInt16().
Here is the call graph for this function:
|
inline |
Deserialize CONNECT packet.
Definition at line 315 of file Serializer.hpp.
References rnp::PacketConnect::clientCaps, rnp::PacketConnect::nameLen, rnp::PacketConnect::playerName, readByte(), readBytes(), and readUInt32().
Referenced by rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize CONNECT_ACCEPT packet.
Definition at line 340 of file Serializer.hpp.
References rnp::PacketConnectAccept::mtuPayloadBytes, readUInt16(), readUInt32(), rnp::PacketConnectAccept::serverCaps, rnp::PacketConnectAccept::sessionId, and rnp::PacketConnectAccept::tickRateHz.
Referenced by rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize DISCONNECT packet.
Definition at line 360 of file Serializer.hpp.
References readUInt16(), and rnp::PacketDisconnect::reasonCode.
Referenced by rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize multiple EventRecords from ENTITY_EVENT packet.
| payloadSize | Total size of the payload to deserialize |
Definition at line 547 of file Serializer.hpp.
References buffer_, deserializeEventRecord(), and readPos_.
Here is the call graph for this function:
|
inline |
Deserialize EntityState.
Definition at line 389 of file Serializer.hpp.
References rnp::EntityState::healthPercent, rnp::EntityState::id, readByte(), readFloat(), readUInt16(), readUInt32(), rnp::EntityState::score, rnp::EntityState::stateFlags, rnp::EntityState::subtype, rnp::EntityState::type, rnp::EntityState::vx, rnp::EntityState::vy, rnp::EntityState::x, and rnp::EntityState::y.
Referenced by deserializeWorldState().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize ERROR packet.
Definition at line 479 of file Serializer.hpp.
References rnp::PacketError::description, rnp::PacketError::errorCode, rnp::PacketError::msgLen, readBytes(), and readUInt16().
Referenced by rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize EventRecord from ENTITY_EVENT packets.
Definition at line 514 of file Serializer.hpp.
References rnp::EventRecord::data, readByte(), readBytes(), readUInt16(), readUInt32(), and rnp::EventRecord::type.
Referenced by deserializeEntityEvents().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize GAME_START packet.
Definition at line 903 of file Serializer.hpp.
References rnp::PacketGameStart::lobbyId, and readUInt32().
Referenced by gme::WaitingRoomScene::handleGameStart(), and rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize packet header.
Definition at line 291 of file Serializer.hpp.
References rnp::PacketHeader::length, readByte(), readUInt16(), readUInt32(), rnp::PacketHeader::sessionId, and rnp::PacketHeader::type.
Referenced by eng::AsioClient::handleReceive(), srv::AsioServer::handleReceive(), and rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize input data from INPUT events.
| keys | Output keyboard input bitmask |
| mouseX | Output mouse X position |
| mouseY | Output mouse Y position |
| mouseButtons | Output mouse button bitmask |
| timestamp | Output input timestamp |
Definition at line 589 of file Serializer.hpp.
References readByte(), readFloat(), and readUInt32().
Here is the call graph for this function:
|
inline |
Deserialize LOBBY_CREATE packet.
Definition at line 793 of file Serializer.hpp.
References rnp::PacketLobbyCreate::gameMode, rnp::PacketLobbyCreate::lobbyName, rnp::PacketLobbyCreate::maxPlayers, rnp::PacketLobbyCreate::nameLen, readByte(), and readBytes().
Referenced by eng::AsioClient::processBusEvent(), and rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize LOBBY_CREATE_RESPONSE packet.
Definition at line 818 of file Serializer.hpp.
References rnp::PacketLobbyCreateResponse::errorCode, rnp::PacketLobbyCreateResponse::lobbyId, readByte(), readUInt16(), readUInt32(), and rnp::PacketLobbyCreateResponse::success.
Referenced by gme::CreateRoomScene::processEventBus(), and rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize LobbyInfo structure.
Definition at line 726 of file Serializer.hpp.
References rnp::LobbyInfo::currentPlayers, rnp::LobbyInfo::gameMode, rnp::LobbyInfo::hostSessionId, rnp::LobbyInfo::lobbyId, rnp::LobbyInfo::lobbyName, rnp::LobbyInfo::maxPlayers, rnp::LobbyInfo::playerNames, readByte(), readBytes(), readUInt32(), and rnp::LobbyInfo::status.
Referenced by deserializeLobbyJoinResponse(), deserializeLobbyListResponse(), and deserializeLobbyUpdate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize LOBBY_JOIN packet.
Definition at line 837 of file Serializer.hpp.
References rnp::PacketLobbyJoin::lobbyId, and readUInt32().
Referenced by rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize LOBBY_JOIN_RESPONSE packet.
Definition at line 863 of file Serializer.hpp.
References deserializeLobbyInfo(), rnp::PacketLobbyJoinResponse::errorCode, rnp::PacketLobbyJoinResponse::lobbyId, rnp::PacketLobbyJoinResponse::lobbyInfo, readByte(), readUInt16(), readUInt32(), and rnp::PacketLobbyJoinResponse::success.
Referenced by gme::JoinRoomScene::handleLobbyJoinResponse(), and rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize LOBBY_LIST_RESPONSE packet.
Definition at line 763 of file Serializer.hpp.
References deserializeLobbyInfo(), rnp::PacketLobbyListResponse::lobbies, rnp::PacketLobbyListResponse::lobbyCount, and readUInt16().
Referenced by gme::JoinRoomScene::handleLobbyListResponse(), and rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize LOBBY_UPDATE packet.
Definition at line 886 of file Serializer.hpp.
References deserializeLobbyInfo(), and rnp::PacketLobbyUpdate::lobbyInfo.
Referenced by gme::WaitingRoomScene::handleLobbyUpdate(), and rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize PING/PONG packet.
Definition at line 453 of file Serializer.hpp.
References rnp::PacketPingPong::nonce, readUInt32(), and rnp::PacketPingPong::sendTimeMs.
Referenced by rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize START_GAME_REQUEST packet.
Definition at line 920 of file Serializer.hpp.
References rnp::PacketStartGameRequest::lobbyId, and readUInt32().
Referenced by rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Deserialize WORLD_STATE packet.
Definition at line 424 of file Serializer.hpp.
References deserializeEntityState(), rnp::PacketWorldState::entities, rnp::PacketWorldState::entityCount, readUInt16(), readUInt32(), and rnp::PacketWorldState::serverTick.
Referenced by gme::GameMulti::handleWorldStateUpdate(), and rnp::HandlerPacket::processPacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Get the serialized data.
Definition at line 111 of file Serializer.hpp.
References buffer_.
Referenced by srv::AsioServer::broadcastGameOverToLobby(), srv::AsioServer::broadcastGameStart(), srv::AsioServer::broadcastLobbyUpdate(), gme::RTypeServer::broadcastWorldState(), gme::ServerScene::connectServer(), createDamageEvent(), createInputEvent(), eng::AsioClient::createLobby(), createScoreEvent(), createSpawnEvent(), srv::AsioServer::disconnectClient(), eng::AsioClient::handleConnectAccept(), eng::AsioClient::joinLobby(), eng::AsioClient::leaveLobby(), eng::AsioClient::processBusEvent(), utl::EventBus::publish(), eng::AsioClient::requestLobbyList(), eng::AsioClient::requestStartGame(), eng::AsioClient::sendConnect(), srv::AsioServer::sendConnectAccept(), eng::AsioClient::sendDisconnect(), srv::AsioServer::sendError(), gme::PlayerControllerMulti::sendInputToServer(), srv::AsioServer::sendLobbyCreateResponse(), srv::AsioServer::sendLobbyJoinResponse(), srv::AsioServer::sendLobbyList(), eng::AsioClient::sendPing(), eng::AsioClient::sendPong(), srv::AsioServer::sendPong(), srv::AsioServer::stop(), and srv::AsioServer::updateClientManagement().
Here is the caller graph for this function:
|
inline |
Get the current size of serialized data.
Definition at line 117 of file Serializer.hpp.
References writePos_.
Referenced by eng::AsioClient::createLobby(), and eng::AsioClient::requestLobbyList().
Here is the caller graph for this function:
|
inline |
Read a single byte.
Definition at line 213 of file Serializer.hpp.
References readBytes().
Referenced by deserializeConnect(), deserializeEntityState(), deserializeEventRecord(), deserializeHeader(), deserializeInputData(), deserializeLobbyCreate(), deserializeLobbyCreateResponse(), deserializeLobbyInfo(), deserializeLobbyJoinResponse(), rnp::HandlerPacket::parseEntityEvents(), and readString().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Read raw bytes.
| data | Pointer to destination buffer |
| size | Number of bytes to read |
Definition at line 198 of file Serializer.hpp.
References buffer_, and readPos_.
Referenced by deserializeConnect(), deserializeError(), deserializeEventRecord(), deserializeLobbyCreate(), deserializeLobbyInfo(), rnp::HandlerPacket::parseEntityEvents(), readByte(), readFloat(), readString(), readUInt16(), and readUInt32().
Here is the caller graph for this function:
|
inline |
Read a float (network byte order)
Definition at line 246 of file Serializer.hpp.
References rnp::EndianUtils::networkToHostFloat(), and readBytes().
Referenced by deserializeEntityState(), and deserializeInputData().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Read a string with length prefix.
| maxLength | Maximum expected length |
Definition at line 258 of file Serializer.hpp.
References readByte(), and readBytes().
Referenced by eng::AsioClient::processBusEvent().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Read a 16-bit integer (network byte order)
Definition at line 224 of file Serializer.hpp.
References rnp::EndianUtils::networkToHost16(), and readBytes().
Referenced by deserializeConnectAccept(), deserializeDisconnect(), deserializeEntityState(), deserializeError(), deserializeEventRecord(), deserializeHeader(), deserializeLobbyCreateResponse(), deserializeLobbyJoinResponse(), deserializeLobbyListResponse(), deserializeWorldState(), and rnp::HandlerPacket::parseEntityEvents().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Read a 32-bit integer (network byte order)
Definition at line 235 of file Serializer.hpp.
References rnp::EndianUtils::networkToHost32(), and readBytes().
Referenced by deserializeConnect(), deserializeConnectAccept(), deserializeEntityState(), deserializeEventRecord(), deserializeGameStart(), deserializeHeader(), deserializeInputData(), deserializeLobbyCreateResponse(), deserializeLobbyInfo(), deserializeLobbyJoin(), deserializeLobbyJoinResponse(), deserializePingPong(), deserializeStartGameRequest(), deserializeWorldState(), rnp::HandlerPacket::parseEntityEvents(), and eng::AsioClient::processBusEvent().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Reset the serializer for reuse.
Definition at line 100 of file Serializer.hpp.
|
inline |
Serialize CONNECT packet.
| packet | CONNECT packet to serialize |
Definition at line 304 of file Serializer.hpp.
References rnp::PacketConnect::clientCaps, rnp::PacketConnect::nameLen, rnp::PacketConnect::playerName, writeByte(), writeBytes(), and writeUInt32().
Referenced by eng::AsioClient::sendConnect().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize CONNECT_ACCEPT packet.
| packet | CONNECT_ACCEPT packet to serialize |
Definition at line 328 of file Serializer.hpp.
References rnp::PacketConnectAccept::mtuPayloadBytes, rnp::PacketConnectAccept::serverCaps, rnp::PacketConnectAccept::sessionId, rnp::PacketConnectAccept::tickRateHz, writeUInt16(), and writeUInt32().
Referenced by srv::AsioServer::sendConnectAccept().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize DISCONNECT packet.
| packet | DISCONNECT packet to serialize |
Definition at line 354 of file Serializer.hpp.
References rnp::PacketDisconnect::reasonCode, and writeUInt16().
Referenced by srv::AsioServer::disconnectClient(), eng::AsioClient::sendDisconnect(), and srv::AsioServer::stop().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize multiple EventRecords for ENTITY_EVENT packet.
| events | Vector of event records to serialize |
Definition at line 534 of file Serializer.hpp.
References serializeEventRecord().
Referenced by utl::EventBus::publish(), and gme::PlayerControllerMulti::sendInputToServer().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize EntityState.
| entity | Entity state to serialize |
Definition at line 371 of file Serializer.hpp.
References rnp::EntityState::healthPercent, rnp::EntityState::id, rnp::EntityState::score, rnp::EntityState::stateFlags, rnp::EntityState::subtype, rnp::EntityState::type, rnp::EntityState::vx, rnp::EntityState::vy, writeByte(), writeFloat(), writeUInt16(), writeUInt32(), rnp::EntityState::x, and rnp::EntityState::y.
Referenced by serializeWorldState().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize ERROR packet.
| packet | ERROR packet to serialize |
Definition at line 465 of file Serializer.hpp.
References rnp::PacketError::description, rnp::PacketError::errorCode, rnp::PacketError::msgLen, writeBytes(), and writeUInt16().
Referenced by srv::AsioServer::sendError().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize EventRecord for ENTITY_EVENT packets.
| event | Event record to serialize |
Definition at line 498 of file Serializer.hpp.
References rnp::EventRecord::data, rnp::EventRecord::entityId, rnp::EventRecord::type, writeByte(), writeBytes(), writeUInt16(), and writeUInt32().
Referenced by serializeEntityEvents().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize GAME_START packet.
| packet | The packet to serialize |
Definition at line 897 of file Serializer.hpp.
References rnp::PacketGameStart::lobbyId, and writeUInt32().
Referenced by srv::AsioServer::broadcastGameStart(), and utl::EventBus::publish().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize packet header.
| header | Header to serialize |
Definition at line 280 of file Serializer.hpp.
References rnp::PacketHeader::length, rnp::PacketHeader::sessionId, rnp::PacketHeader::type, writeByte(), writeUInt16(), and writeUInt32().
Referenced by srv::AsioServer::broadcastGameOverToLobby(), srv::AsioServer::broadcastGameStart(), srv::AsioServer::broadcastLobbyUpdate(), gme::RTypeServer::broadcastWorldState(), eng::AsioClient::createLobby(), srv::AsioServer::disconnectClient(), eng::AsioClient::joinLobby(), eng::AsioClient::leaveLobby(), eng::AsioClient::processBusEvent(), eng::AsioClient::requestLobbyList(), eng::AsioClient::requestStartGame(), eng::AsioClient::sendConnect(), srv::AsioServer::sendConnectAccept(), eng::AsioClient::sendDisconnect(), srv::AsioServer::sendError(), srv::AsioServer::sendLobbyCreateResponse(), srv::AsioServer::sendLobbyJoinResponse(), srv::AsioServer::sendLobbyList(), eng::AsioClient::sendPing(), eng::AsioClient::sendPong(), srv::AsioServer::sendPong(), srv::AsioServer::stop(), and srv::AsioServer::updateClientManagement().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize input data for INPUT events.
| keys | Keyboard input bitmask |
| mouseX | Mouse X position |
| mouseY | Mouse Y position |
| mouseButtons | Mouse button bitmask |
| timestamp | Input timestamp |
Definition at line 571 of file Serializer.hpp.
References writeByte(), writeFloat(), and writeUInt32().
Referenced by createInputEvent().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize LOBBY_CREATE packet.
| packet | The packet to serialize |
Definition at line 781 of file Serializer.hpp.
References rnp::PacketLobbyCreate::gameMode, rnp::PacketLobbyCreate::lobbyName, rnp::PacketLobbyCreate::maxPlayers, rnp::PacketLobbyCreate::nameLen, writeByte(), and writeBytes().
Referenced by eng::AsioClient::createLobby(), and utl::EventBus::publish().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize LOBBY_CREATE_RESPONSE packet.
| packet | The packet to serialize |
Definition at line 807 of file Serializer.hpp.
References rnp::PacketLobbyCreateResponse::errorCode, rnp::PacketLobbyCreateResponse::lobbyId, rnp::PacketLobbyCreateResponse::success, writeByte(), writeUInt16(), and writeUInt32().
Referenced by utl::EventBus::publish(), and srv::AsioServer::sendLobbyCreateResponse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize LobbyInfo structure.
| lobbyInfo | The lobby info to serialize |
Definition at line 704 of file Serializer.hpp.
References rnp::LobbyInfo::currentPlayers, rnp::LobbyInfo::gameMode, rnp::LobbyInfo::hostSessionId, rnp::LobbyInfo::lobbyId, rnp::LobbyInfo::lobbyName, rnp::LobbyInfo::maxPlayers, rnp::LobbyInfo::playerNames, rnp::LobbyInfo::status, writeByte(), writeBytes(), and writeUInt32().
Referenced by serializeLobbyJoinResponse(), serializeLobbyListResponse(), and serializeLobbyUpdate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize LOBBY_JOIN packet.
| packet | The packet to serialize |
Definition at line 831 of file Serializer.hpp.
References rnp::PacketLobbyJoin::lobbyId, and writeUInt32().
Referenced by eng::AsioClient::joinLobby(), and utl::EventBus::publish().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize LOBBY_JOIN_RESPONSE packet.
| packet | The packet to serialize |
Definition at line 848 of file Serializer.hpp.
References rnp::PacketLobbyJoinResponse::errorCode, rnp::PacketLobbyJoinResponse::lobbyId, rnp::PacketLobbyJoinResponse::lobbyInfo, serializeLobbyInfo(), rnp::PacketLobbyJoinResponse::success, writeByte(), writeUInt16(), and writeUInt32().
Referenced by utl::EventBus::publish(), and srv::AsioServer::sendLobbyJoinResponse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize LOBBY_LIST_RESPONSE packet.
| packet | The packet to serialize |
Definition at line 750 of file Serializer.hpp.
References rnp::PacketLobbyListResponse::lobbies, rnp::PacketLobbyListResponse::lobbyCount, serializeLobbyInfo(), and writeUInt16().
Referenced by utl::EventBus::publish(), and srv::AsioServer::sendLobbyList().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize LOBBY_UPDATE packet.
| packet | The packet to serialize |
Definition at line 880 of file Serializer.hpp.
References rnp::PacketLobbyUpdate::lobbyInfo, and serializeLobbyInfo().
Referenced by srv::AsioServer::broadcastLobbyUpdate(), and utl::EventBus::publish().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize PING/PONG packet.
| packet | PING/PONG packet to serialize |
Definition at line 443 of file Serializer.hpp.
References rnp::PacketPingPong::nonce, rnp::PacketPingPong::sendTimeMs, and writeUInt32().
Referenced by eng::AsioClient::sendPing(), eng::AsioClient::sendPong(), srv::AsioServer::sendPong(), and srv::AsioServer::updateClientManagement().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize START_GAME_REQUEST packet.
| packet | The packet to serialize |
Definition at line 914 of file Serializer.hpp.
References rnp::PacketStartGameRequest::lobbyId, and writeUInt32().
Referenced by eng::AsioClient::requestStartGame().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Serialize WORLD_STATE packet.
| packet | WORLD_STATE packet to serialize |
Definition at line 409 of file Serializer.hpp.
References rnp::PacketWorldState::entities, rnp::PacketWorldState::entityCount, serializeEntityState(), rnp::PacketWorldState::serverTick, writeUInt16(), and writeUInt32().
Referenced by gme::RTypeServer::broadcastWorldState(), and utl::EventBus::publish().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Write a single byte.
| value | Byte value to write |
Definition at line 142 of file Serializer.hpp.
References writeBytes().
Referenced by utl::EventBus::publish(), serializeConnect(), serializeEntityState(), serializeEventRecord(), serializeHeader(), serializeInputData(), serializeLobbyCreate(), serializeLobbyCreateResponse(), serializeLobbyInfo(), serializeLobbyJoinResponse(), and writeString().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Write raw bytes.
| data | Pointer to data |
| size | Number of bytes to write |
Definition at line 124 of file Serializer.hpp.
References buffer_, rnp::MAX_PAYLOAD, and writePos_.
Referenced by eng::AsioClient::processBusEvent(), serializeConnect(), serializeError(), serializeEventRecord(), serializeLobbyCreate(), serializeLobbyInfo(), writeByte(), writeFloat(), writeString(), writeUInt16(), and writeUInt32().
Here is the caller graph for this function:
|
inline |
Write a float (network byte order)
| value | Float to write |
Definition at line 168 of file Serializer.hpp.
References rnp::EndianUtils::hostToNetworkFloat(), and writeBytes().
Referenced by createSpawnEvent(), utl::EventBus::publish(), serializeEntityState(), and serializeInputData().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Write a string with length prefix.
| str | String to write |
| maxLength | Maximum allowed length |
Definition at line 179 of file Serializer.hpp.
References writeByte(), and writeBytes().
Referenced by gme::ServerScene::connectServer(), and utl::EventBus::publish().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Write a 16-bit integer (network byte order)
| value | 16-bit integer to write |
Definition at line 148 of file Serializer.hpp.
References rnp::EndianUtils::hostToNetwork16(), and writeBytes().
Referenced by createSpawnEvent(), utl::EventBus::publish(), serializeConnectAccept(), serializeDisconnect(), serializeEntityState(), serializeError(), serializeEventRecord(), serializeHeader(), serializeLobbyCreateResponse(), serializeLobbyJoinResponse(), serializeLobbyListResponse(), and serializeWorldState().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Write a 32-bit integer (network byte order)
| value | 32-bit integer to write |
Definition at line 158 of file Serializer.hpp.
References rnp::EndianUtils::hostToNetwork32(), and writeBytes().
Referenced by createDamageEvent(), createScoreEvent(), utl::EventBus::publish(), serializeConnect(), serializeConnectAccept(), serializeEntityState(), serializeEventRecord(), serializeGameStart(), serializeHeader(), serializeInputData(), serializeLobbyCreateResponse(), serializeLobbyInfo(), serializeLobbyJoin(), serializeLobbyJoinResponse(), serializePingPong(), serializeStartGameRequest(), and serializeWorldState().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 67 of file Serializer.hpp.
Referenced by deserializeEntityEvents(), getData(), readBytes(), reset(), Serializer(), Serializer(), and writeBytes().
|
private |
Definition at line 69 of file Serializer.hpp.
Referenced by deserializeEntityEvents(), readBytes(), and reset().
|
private |
Definition at line 68 of file Serializer.hpp.
Referenced by getSize(), reset(), and writeBytes().