Impulsion
Impulsion is a bit-optimised format for communication between NeL server and client.
Impulsion Format
The basic header format for impulsions is simple:
packetNumber: 32-bit signed integer systemMode: 1-bit bool, if this is a system impulsion or not
For system-mode impulsions (which are used for connection and deconnection “meta” messages) there are 10 types, identified by the next number:
systemMessageType: 8-bit unsigned integer, meaning:
0 | SYSTEM_LOGIN_CODE | client → server |
1 | SYSTEM_SYNC_CODE | server → client |
2 | SYSTEM_ACK_SYNC_CODE | client → server |
3 | SYSTEM_PROBE_CODE | server → client |
4 | SYSTEM_ACK_PROBE_CODE | client → server |
5 | SYSTEM_DISCONNECTION_CODE | client → server |
6 | SYSTEM_STALLED_CODE | server → client |
7 | SYSTEM_SERVER_DOWN_CODE | server → client |
8 | SYSTEM_QUIT_CODE | client → server |
9 | SYSTEM_ACK_QUIT_CODE | server → client |
For normal impulsions:
ackNumber: 32-bit signed integer (packetNumber which is acked by this packet?)
Then there are three levels, each of which looks like follows:
channelPresent: 1-bit bool, if there is anything sent in this channel or not
shortCode: 1-bit bool, if the action code is only 2 bits or 8 bits
actionCode: either 2-bit or 8-bit unsigned integer, 2-bit if shortCode is true, meaning:
0 | ACTION_POSITION_CODE | for sending position of a creature (not checked) |
1 | ACTION_GENERIC_CODE | for sending generic data in just one impulsion |
2 | ACTION_GENERIC_MULTI_PART_CODE | for sending generic data split over impulsions |
3 | ACTION_SINT64 | for sending any properties, how to decode correct size? |
10 | ACTION_SYNC_CODE | ? |
11 | ACTION_DISCONNECTION_CODE | ? |
12 | ACTION_ASSOCIATION_CODE | ? |
13 | ACTION_LOGIN_CODE | ? |
40 | ACTION_TARGET_SLOT_CODE | ? |
99 | ACTION_DUMMY_CODE | ? |
Wireshark
The git repository with the layer5 (inter-service communication on server) lua dissector for wireshark, now also includes a start for impulsion dissection. For now it just dissects specified UDP port (47851) so you might have to change that for it to work (in nelimpulsion.lua:198). Also for now it just dissects some system messages (types 0-4) and a start for normal impulsion dissection.
Since it's somewhat complicated, and bit-wise dissection in wireshark is quite annoying to do, this is very much work in progress still. A lot has to be understood and correctly dissected still.