GPC Protocol

GPC uses its own protocol to comunicate to the server, the main reason to the protocol exists is to be very fast.

This section is to explain the GPC protocol, package files will be not be explained in this section

Variables

PACKAGE is referred to be the package name, ASCII string null terminated

PLATFORM is referred to be user's CPU architecture, ASCII string null terminated

VERSION is referred to be the package version, ASCII string null terminated

SIZE is referred to be the package size in bytes, 4 byte big endian uint

E_MESSAGE is referred to be the error message, UTF-8 string null terminated

PACKAGE_DATA is referred to be the package file, the package file data that will be transmitted to the client

DEPENDENCIES is referred to be a 1 byte uint and a array of PACKAGE, PLATFORM and VERSION

PACKAGE_DATA_CHECKSUM is referred to be the package file hash in sha256, 32 bytes big endian uint

COMPRESSION_TYPE is referred to be the type of compression which PACKAGE_DATA will be. this affects SIZE, PACKAGE_DATA_CHECKSUM will be the original package content hash. 0 for none, 1 for gzip

COMPRESSED_SIZE is referred to be the package size compressed in bytes (even if compression type is 0), 4 byte big endian uint


OP Codes sent from clients

Requesting package information in the latest version

00 PACKAGE PLATFORM

Requesting package information in a specified version

00 PACKAGE PLATFORMVERSION

Download package request

01 PACKAGE PLATFORM VERSION COMPRESSION_TYPE

Response sent from the server

Request package information response

00 PACKAGE PLATFORM VERSION SIZE DEPENDENCIES

Download request response

00 COMPRESSION_TYPE COMPRESSED_SIZE PACKAGE_DATA_CHECKSUM PACKAGE_DATA

Error

01 E_MESSAGE

Node.JS library for GPC