Extension IPC Caller - KonataDev/Konata.Core GitHub Wiki
IPC Caller
Structure
Length
|Len |
+--+--+--+--+
|01|00|00|00|
+--+--+--+--+
0 2 4
It specifies the length of the data, including itself.
It's a 4 bytes little-endian unsigned integer.
In this example, the length is 1
.
Metadata
Metadata is fixed with 6 items but only 4 used.
For reserved items please set them to 0x00. The length of each item is 2 bytes.
|Ver |Seq |Flg |Arg |X |X |
+--+--+--+--+--+--+--+--+--+--+--+--+
|01|00|E9|00|00|00|01|00|--|--|--|--|
+--+--+--+--+--+--+--+--+--+--+--+--+
0 2 4 6 8 A C
-
The
protocol version
, which contains an unsigned short in little-endian.
In this example, the version is1
. -
The event
sequence
, which contains an unsigned short in little endian.
While the sequence comes up to the max value(65535), will be turned to 0 in the next event.
In this example, the sequence is233
. -
The event
flag
. -
The
argument count
, which contains an unsigned short in little endian.
In this example, the total argument is1
.
The event flag can be a combination of the following constants
Name | Value |
---|---|
Need Result | 1 |
Name
The event name has 1 byte for length ahead and without '\0' cut off.
|L.|Name |
+--+--+--+--+
|03|46|6F|6F|
+--+--+--+--+
0 2 4
In this example, the event name is Foo
.
Arguments
Every argument is a <string, raw> key value pair.
The arguments are stored one by one.
|L.|Key |Len |Val |
+--+--+--+--+--+--+--+--+--+--+--+
|03|46|6F|6F|03|00|00|00|42|61|72|
+--+--+--+--+--+--+--+--+--+--+--+
0 2 4 6 8 A
A valid argument has 4 parts.
- The first is the length of the
key name
, not including itself, unsigned short. - The second is the key name string without the '\0' cut off.
- The third is the length of the
value name
, not including itself, unsigned short. - The last is the raw value data.
In this example, the argument name is Foo
which value is Bar
.
Checksum
|S.|
+--+
|FE|
+--+
0 1
The checksum is very simple only 1 byte.
Calculate the sum with every single byte and placed it at the end of the data. including the length.
In this example, the original data is FF FF
, so finally the checksum is FE
.
Example
FooBar
27 00 00 00 01 00 E9 00 #.....é.
00 00 02 00 00 00 00 00 ........
03 46 6F 6F 01 78 03 00 .Foo.x..
00 00 46 6F 6F 01 79 03 ..Foo.y.
00 00 00 42 61 72 6C ...Barl
The pseudo code in C
void Foo("Foo", "Bar");
OnStartUp
17 00 00 00 01 00 E9 00 ......é.
01 00 00 00 00 00 00 00 ........
09 4F 6E 53 74 61 72 74 .OnStart
55 70 9B Up›
The pseudo code in C
bool OnStartUp();