r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
Protocol.hpp File Reference

This file contains the network protocol. More...

#include <array>
#include <cstdint>
#include <cstring>
#include <stdexcept>
#include <vector>
+ Include dependency graph for Protocol.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rnp::EventRecord
 Event record for ENTITY_EVENT packets (TLV format) More...
 
struct  rnp::PacketHeader
 Packet header according to RNP specification (Big Endian) Total size: 7 bytes (1 + 2 + 4) More...
 
struct  rnp::PacketConnect
 CONNECT packet payload. More...
 
struct  rnp::PacketConnectAccept
 CONNECT_ACCEPT packet payload. More...
 
struct  rnp::PacketDisconnect
 DISCONNECT packet payload. More...
 
struct  rnp::EntityState
 Entity state for WORLD_STATE packet. More...
 
struct  rnp::PacketWorldState
 WORLD_STATE packet payload. More...
 
struct  rnp::PacketPingPong
 PING/PONG packet payload. More...
 
struct  rnp::PacketError
 ERROR packet payload. More...
 
struct  rnp::LobbyInfo
 Lobby information structure. More...
 
struct  rnp::PacketLobbyListResponse
 LOBBY_LIST_RESPONSE packet payload. More...
 
struct  rnp::PacketLobbyCreate
 LOBBY_CREATE packet payload. More...
 
struct  rnp::PacketLobbyCreateResponse
 LOBBY_CREATE_RESPONSE packet payload. More...
 
struct  rnp::PacketLobbyJoin
 LOBBY_JOIN packet payload. More...
 
struct  rnp::PacketLobbyJoinResponse
 LOBBY_JOIN_RESPONSE packet payload. More...
 
struct  rnp::PacketLobbyUpdate
 LOBBY_UPDATE packet payload. More...
 
struct  rnp::PacketGameStart
 GAME_START packet payload. More...
 
struct  rnp::PacketStartGameRequest
 START_GAME_REQUEST packet payload (client requests to start game) More...
 

Namespaces

namespace  rnp
 

Enumerations

enum class  rnp::PacketType : std::uint8_t {
  rnp::CONNECT = 0x01 , rnp::DISCONNECT = 0x02 , rnp::WORLD_STATE = 0x03 , rnp::PING = 0x04 ,
  rnp::PONG = 0x05 , rnp::PACKET_ERROR = 0x06 , rnp::ENTITY_EVENT = 0x07 , rnp::CONNECT_ACCEPT = 0x08 ,
  rnp::LOBBY_LIST_REQUEST = 0x09 , rnp::LOBBY_LIST_RESPONSE = 0x0A , rnp::LOBBY_CREATE = 0x0B , rnp::LOBBY_CREATE_RESPONSE = 0x0C ,
  rnp::LOBBY_JOIN = 0x0D , rnp::LOBBY_JOIN_RESPONSE = 0x0E , rnp::LOBBY_LEAVE = 0x0F , rnp::LOBBY_UPDATE = 0x10 ,
  rnp::GAME_START = 0x11 , rnp::START_GAME_REQUEST = 0x12 , rnp::GAME_OVER = 0x13
}
 Packet types according to RNP specification. More...
 
enum class  rnp::PacketFlags : std::uint16_t { rnp::NONE = 0x0000 , rnp::RELIABLE = 0x0001 , rnp::COMPRESSED = 0x0002 }
 Packet flags for reliability and fragmentation. More...
 
enum class  rnp::DisconnectReason : std::uint16_t {
  rnp::UNSPECIFIED = 0 , rnp::CLIENT_REQUEST = 1 , rnp::TIMEOUT = 2 , rnp::PROTOCOL_ERROR = 3 ,
  rnp::SERVER_SHUTDOWN = 4 , rnp::SERVER_FULL = 5 , rnp::BANNED = 6
}
 Disconnect reason codes. More...
 
enum class  rnp::ErrorCode : std::uint16_t {
  rnp::NONE = 0 , rnp::INVALID_PAYLOAD = 1 , rnp::UNAUTHORIZED_SESSION = 2 , rnp::RATE_LIMITED = 3 ,
  rnp::INTERNAL_ERROR = 4 , rnp::LOBBY_NOT_FOUND = 5 , rnp::LOBBY_FULL = 6 , rnp::ALREADY_IN_LOBBY = 7 ,
  rnp::NOT_IN_LOBBY = 8 , rnp::NOT_LOBBY_HOST = 9
}
 Error codes. More...
 
enum class  rnp::EventType : std::uint8_t {
  rnp::SPAWN = 0x01 , rnp::DESPAWN = 0x02 , rnp::DAMAGE = 0x03 , rnp::SCORE = 0x04 ,
  rnp::POWERUP = 0x05 , rnp::INPUT = 0x06 , rnp::CUSTOM = 0xFF
}
 Event types for ENTITY_EVENT packets. More...
 
enum class  rnp::EntityType : std::uint16_t { rnp::PLAYER = 0x01 , rnp::ENEMY = 0x02 , rnp::PROJECTILE = 0x03 , rnp::BOSS = 0x04 }
 Entity types for world state. More...
 
enum class  rnp::EntitySubtype : std::uint8_t {
  rnp::NONE = 0 , rnp::ENEMY_BASIC = 1 , rnp::ENEMY_ADVANCED = 2 , rnp::ENEMY_BOSS = 3 ,
  rnp::PROJECTILE_PLAYER = 10 , rnp::PROJECTILE_PLAYER_SUPERCHARGED = 11 , rnp::PROJECTILE_ENEMY = 12
}
 Entity subtype enumeration. More...
 
enum class  rnp::LobbyStatus : std::uint8_t { rnp::WAITING = 0 , rnp::IN_GAME = 1 , rnp::FINISHED = 2 }
 Lobby status enumeration. More...
 

Variables

constexpr std::size_t rnp::MAX_PAYLOAD = 512
 

Detailed Description

This file contains the network protocol.

Definition in file Protocol.hpp.