Skip to content

Headless Client

gatchi edited this page May 10, 2017 · 1 revision

This is an upcoming tool for PSONOVA. It's a mock client that can be used via terminal to do admin stuff like sending commands (announcements, updatelocalgms), allowing administrators not having to boot-up the full client. In the future, it may also have diagnostic features.

In order to understand this client, you need to understand the process in which ship and client relate ("client" referring to the Admin Client).

The following refers multiple times to special packets and PSO message format. For more information, see Network Protocol Messages on the Phantasy Star Online Developer's Wiki.

Client Perspective

  • Initiate connection to a block
  • Wait for the ok
  • Send packets (commands)

The client makes a socket and connects to the block server with it. On success, it receives a "start encryption packet" also known as Packet03. The client must now extract encryption info from this packet. Once it does, it encrypts a response packet known as Packet93 using the keys from Packet03 and sends it back. Eventually, the client will receive a ping packet, which it will need to respond with the same packet, but encrypted using the client key. However, this will fail if the client isnt logged onto the login server.

Ship Perspective

  • Check for new ship connection requests and process such a connection if it exists
  • Check on clients
  • If theres activity from the client, check to see if its legit
  • If legit, read header of packet
  • If header is legit, read rest of packet
  • Break if packet was received too recently (i think, some sort of DDOS protection)
  • Hand off packet to either ShipProcessPacket or BlockProcessPacket depending on where client is hanging out

The ship connects to the client. Seeing that the connection is new, it finds a free spot on the connection list and starts encryption. During the encryption start procedure, it prepares a Packet03 to send to the client, and sets the crypt_on flag, the sendCheck flag for Packet03, and the current time in the connected, response, and savetime fields of the connection. Then it waits for any responses. If it doesn't get a response within a certain amount of time, it sends some sort of message over and over again, so it must want some sort of valid response by then.

The client can respond only via encrypted, compressed packets. The information to do such is stored in the Packet03. See PSO Dev Wiki (link at top) for more info.

If the block server receives a packet, it first must verify it is a packet worth processing. It saves the length and the first 8 bytes to a receiving buffer. Those first eight bytes are the message header, which tells the server the size, message number, and any flags that the packet contains.

Clone this wiki locally