Packet Headers

From FFXIV Classic Wiki
Revision as of 15:20, 4 October 2017 by Ioncannon (talk | contribs) (Created page with "FFXIV uses the TCP protocol to communicate with both the map servers as well as the lobby servers. Commands are separated into subpackets, which can be combined into one base...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

FFXIV uses the TCP protocol to communicate with both the map servers as well as the lobby servers. Commands are separated into subpackets, which can be combined into one base packet. The maximum packet size is 0xFFFF.

Base Packets

This is the main packet container for all subpackets. It can contain a number of subpackets to be processed. Each base packet begins with a 0x10 byte header. Below is how the base packet header is laid out:

0 1 2 3 4 5 6 7 8 9 A B C D E F
Is Authenticated Is Compressed/Encoded Connection Type Packet Size Number of Subpackets Timestamp in Miliseconds

These are the descriptions of the fields:

  • Is Authenticated: 99% of the time this will be 1. It is only set to 0 on the initial handshake packet.
  • Is Compressed/Encoded: The meaning of this byte depends if the client is communicating to the lobby server or the map server. If it is the lobby server, it indicates the packet is currently compressed using Blowfish. If it is to the map server, it means the packet is compressed using zip compression. The server can set these to 0 and send unencrypted/uncompressed packets and have them read properly. Great for development and debugging.
  • Connection Type: When the client connects to the map server, these will be flagged either 0x1 (Zone Connection) or 0x2 (Chat Connection) to define the connection type of the socket. After the server responds, these will always be set to 0x0. Not tested for lobby server.
  • Packet Size: The total size of the packet including header.
  • Number of Subpackets: The number of subpackets this base packet contains.
  • Timestamp in Miliseconds: A unix timestamp in miliseconds.

Subpackets

A base packet can hold a number of subpackets. Each one begins with a 0x10 byte header. Below is how the subpacket header is laid out:

0 1 2 3 4 5 6 7 8 9 A B C D E F
Subpacket Size Type Source Id Target Id Unknown

These are the descriptions of the fields:

  • Subpacket Size: The total size of the subpacket including header.
  • Type: This field defines what this subpacket does:
    • 0x0: Initial Handshake
    • 0x2: Zone Server Related (Unknown)
    • 0x3: Game Packet
    • 0x7: Zone Server Related (Unknown)
    • 0x8: Zone Server Related (Unknown)
  • Source Id: The actor that triggered this subpacket.
  • Target Id: The actor this subpacket is for.
  • Unknown: Still have not figured out what this field does.

Game Packets

Type 0x3 subpackets are the main game packets that both the lobby and map server use to control the game. They also have their own header after the subpacket header. It is 0x10 bytes in size.

0 1 2 3 4 5 6 7 8 9 A B C D E F
Unknown (Always 0x14) Opcode Unknown (Always 0x00) Timestamp Unknown

These are the descriptions of the fields:

  • Opcode: The opcode defining what this game packet does. Check the page Opcodes for a list of opcodes.
  • Timestamp: The current time in seconds. This is used for setting the game time as well and tracking connection health.