Skip to content

Instantly share code, notes, and snippets.

@BenLubar
Created June 3, 2020 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenLubar/1f51cf570b4c8dca275db9687fa6b9e3 to your computer and use it in GitHub Desktop.
Save BenLubar/1f51cf570b4c8dca275db9687fa6b9e3 to your computer and use it in GitHub Desktop.
Conversation Flow ([ and ] represent 0 or more repetitions):
c->s handshake_request
s->c handshake_reply
[
c->s request
[
s->c text
]
s->c (result OR fail)
]
c->s quit
Data type definitions (all numbers are little-endian, strings are ASCII):
a payload size of greater than 64MiB is an error
handshake_request:
char[8] = "DFHack?\n";
int32_t version = 1;
handshake_reply:
char[8] = "DFHack!\n";
int32_t version = 1;
header(m, n):
int16_t = m;
(2 bytes padding)
int32_t = n;
request:
header(id, size);
(protobuf-encoded payload of (size) bytes, input message type for method (id))
text:
header(-3, size);
(protobuf-encoded payload of (size) bytes, message type dfproto.CoreTextNotification)
result:
header(-1, size);
(protobuf-encoded payload of (size) bytes, output message type for first incomplete method call. completes the first incomplete method call.)
fail:
header(-2, command_result);
(no payload. completes the first incomplete method call.)
quit:
header(-4, 0);
(no payload. connection is closed afterwards.)
ID | Method | Input | Output
---+------------+-------------------------------+-----------------------
0 | BindMethod | dfproto.CoreBindRequest | dfproto.CoreBindReply
1 | RunCommand | dfproto.CoreRunCommandRequest | dfproto.EmptyMessage
All other method IDs are obtained via BindMethod.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment