summaryrefslogtreecommitdiff
path: root/enigma-server/docs/protocol.md
diff options
context:
space:
mode:
authorGravatar 2xsaiko2021-07-08 16:30:39 +0200
committerGravatar GitHub2021-07-08 16:30:39 +0200
commit8efb62490ec153246d467a1a72c513781db887bf (patch)
tree0f2eedd97d9c0d95544ff7d24f2b479cf10271fe /enigma-server/docs/protocol.md
parentAdd --single-class-tree argument that puts all classes into deobf panel & hid... (diff)
downloadenigma-8efb62490ec153246d467a1a72c513781db887bf.tar.gz
enigma-8efb62490ec153246d467a1a72c513781db887bf.tar.xz
enigma-8efb62490ec153246d467a1a72c513781db887bf.zip
Entry Changes (#364)
* Initial refactor: Allow EntryMapping to have null targetName, add EntryChange in favor of entry changing methods in GuiController * Fix resetting name not actually removing it, and renaming a class causing name collisions with itself Closes #246. * Use name proposer for setting default deobf name Closes #314 * Make network protocol use EntryChange directly * Handle writing other data correctly when the deobf name is null * b * Add some new abstraction stuff * Use pattern matching instanceof * Move classes out of newabstraction package * Make EntryChange final * Regenerate equals and hashCode * Convert EntryMapping to record * Make TristateChange final * Safety guard null accessModifier initialization
Diffstat (limited to 'enigma-server/docs/protocol.md')
-rw-r--r--enigma-server/docs/protocol.md164
1 files changed, 63 insertions, 101 deletions
diff --git a/enigma-server/docs/protocol.md b/enigma-server/docs/protocol.md
index c14ecb81..83ef4c01 100644
--- a/enigma-server/docs/protocol.md
+++ b/enigma-server/docs/protocol.md
@@ -75,21 +75,15 @@ struct Packet {
75The IDs for client-to-server packets are as follows: 75The IDs for client-to-server packets are as follows:
76- 0: `Login` 76- 0: `Login`
77- 1: `ConfirmChange` 77- 1: `ConfirmChange`
78- 2: `Rename`
79- 3: `RemoveMapping`
80- 4: `ChangeDocs`
81- 5: `MarkDeobfuscated`
82- 6: `Message` 78- 6: `Message`
79- 7: `EntryChange`
83 80
84The IDs for server-to-client packets are as follows: 81The IDs for server-to-client packets are as follows:
85- 0: `Kick` 82- 0: `Kick`
86- 1: `SyncMappings` 83- 1: `SyncMappings`
87- 2: `Rename`
88- 3: `RemoveMapping`
89- 4: `ChangeDocs`
90- 5: `MarkDeobfuscated`
91- 6: `Message` 84- 6: `Message`
92- 7: `UserList` 85- 7: `UserList`
86- 8: `EntryChange`
93 87
94### The utf struct 88### The utf struct
95```c 89```c
@@ -196,6 +190,45 @@ struct Message {
196- `entry`: The entry that was modified. 190- `entry`: The entry that was modified.
197- `new_name`: The new name for the entry. 191- `new_name`: The new name for the entry.
198 192
193### The entry_change struct
194```c
195typedef enum tristate_change {
196 TRISTATE_CHANGE_UNCHANGED = 0,
197 TRISTATE_CHANGE_RESET = 1,
198 TRISTATE_CHANGE_SET = 2
199} tristate_change_t;
200
201typedef enum access_modifier {
202 ACCESS_MODIFIER_UNCHANGED = 0,
203 ACCESS_MODIFIER_PUBLIC = 1,
204 ACCESS_MODIFIER_PROTECTED = 2,
205 ACCESS_MODIFIER_PRIVATE = 3
206} access_modifier_t;
207
208// Contains 4 packed values:
209// bitmask type
210// 00000011 tristate_change_t deobf_name_change;
211// 00001100 tristate_change_t access_change;
212// 00110000 tristate_change_t javadoc_change;
213// 11000000 access_modifier_t access_modifiers;
214typedef uint8_t entry_change_flags;
215
216struct entry_change {
217 Entry entry;
218 entry_change_flags flags;
219 if <deobf_name_change == TRISTATE_CHANGE_SET> {
220 utf deobf_name;
221 }
222 if <javadoc_change == TRISTATE_CHANGE_SET> {
223 utf javadoc;
224 }
225}
226```
227- `entry`: The entry this change gets applied to.
228- `flags`: See definition of `entry_change_flags`.
229- `deobf_name`: The new deobfuscated name, if deobf_name_change == TRISTATE_CHANGE_SET
230- `javadoc`: The new javadoc, if javadoc_change == TRISTATE_CHANGE_SET
231- `access_modifiers`: The new access modifier, if access_change == TRISTATE_CHANGE_SET (otherwise 0)
199 232
200### Login (client-to-server) 233### Login (client-to-server)
201```c 234```c
@@ -223,44 +256,6 @@ struct ConfirmChangeC2SPacket {
223``` 256```
224- `sync_id`: the sync ID to confirm. 257- `sync_id`: the sync ID to confirm.
225 258
226### Rename (client-to-server)
227```c
228struct RenameC2SPacket {
229 Entry obf_entry;
230 utf new_name;
231 boolean refresh_class_tree;
232}
233```
234- `obf_entry`: the obfuscated name and descriptor of the entry to rename.
235- `new_name`: what to rename the entry to.
236- `refresh_class_tree`: whether the class tree on the sidebar of Enigma needs refreshing as a result of this change.
237
238### RemoveMapping (client-to-server)
239```c
240struct RemoveMappingC2SPacket {
241 Entry obf_entry;
242}
243```
244- `obf_entry`: the obfuscated name and descriptor of the entry to remove the mapping for.
245
246### ChangeDocs (client-to-server)
247```c
248struct ChangeDocsC2SPacket {
249 Entry obf_entry;
250 utf new_docs;
251}
252```
253- `obf_entry`: the obfuscated name and descriptor of the entry to change the documentation for.
254- `new_docs`: the new documentation for this entry, or an empty string to remove the documentation.
255
256### MarkDeobfuscated (client-to-server)
257```c
258struct MarkDeobfuscatedC2SPacket {
259 Entry obf_entry;
260}
261```
262- `obf_entry`: the obfuscated name and descriptor of the entry to mark as deobfuscated.
263
264### Message (client-to-server) 259### Message (client-to-server)
265```c 260```c
266struct MessageC2SPacket { 261struct MessageC2SPacket {
@@ -269,6 +264,14 @@ struct MessageC2SPacket {
269``` 264```
270- `message`: The text message the user sent. 265- `message`: The text message the user sent.
271 266
267### EntryChange (client-to-server)
268```c
269struct EntryChangeC2SPacket {
270 entry_change change;
271}
272```
273- `change`: The change to apply.
274
272### Kick (server-to-client) 275### Kick (server-to-client)
273```c 276```c
274struct KickS2CPacket { 277struct KickS2CPacket {
@@ -286,13 +289,8 @@ struct SyncMappingsS2CPacket {
286struct MappingNode { 289struct MappingNode {
287 NoParentEntry obf_entry; 290 NoParentEntry obf_entry;
288 boolean is_named; 291 boolean is_named;
289 if<is_named> { 292 utf name;
290 utf name; 293 utf javadoc;
291 boolean has_javadoc;
292 if<has_javadoc> {
293 utf javadoc;
294 }
295 }
296 unsigned short children_count; 294 unsigned short children_count;
297 MappingNode children[children_count]; 295 MappingNode children[children_count];
298} 296}
@@ -300,56 +298,10 @@ typedef { Entry but without the has_parent or parent fields } NoParentEntry;
300``` 298```
301- `roots`: The root mapping nodes, containing all the entries without parents. 299- `roots`: The root mapping nodes, containing all the entries without parents.
302- `obf_entry`: The value of a node, containing the obfuscated name and descriptor of the entry. 300- `obf_entry`: The value of a node, containing the obfuscated name and descriptor of the entry.
303- `name`: The deobfuscated name of the entry, if it has a mapping. 301- `name`: The deobfuscated name of the entry, if it exists, otherwise the empty string.
304- `javadoc`: The documentation for the entry, if it is named and has documentation. 302- `javadoc`: The documentation for the entry, if it exists, otherwise the empty string.
305- `children`: The children of this node 303- `children`: The children of this node
306 304
307### Rename (server-to-client)
308```c
309struct RenameS2CPacket {
310 unsigned short sync_id;
311 Entry obf_entry;
312 utf new_name;
313 boolean refresh_class_tree;
314}
315```
316- `sync_id`: the sync ID of the change for locking purposes.
317- `obf_entry`: the obfuscated name and descriptor of the entry to rename.
318- `new_name`: what to rename the entry to.
319- `refresh_class_tree`: whether the class tree on the sidebar of Enigma needs refreshing as a result of this change.
320
321### RemoveMapping (server-to-client)
322```c
323struct RemoveMappingS2CPacket {
324 unsigned short sync_id;
325 Entry obf_entry;
326}
327```
328- `sync_id`: the sync ID of the change for locking purposes.
329- `obf_entry`: the obfuscated name and descriptor of the entry to remove the mapping for.
330
331### ChangeDocs (server-to-client)
332```c
333struct ChangeDocsS2CPacket {
334 unsigned short sync_id;
335 Entry obf_entry;
336 utf new_docs;
337}
338```
339- `sync_id`: the sync ID of the change for locking purposes.
340- `obf_entry`: the obfuscated name and descriptor of the entry to change the documentation for.
341- `new_docs`: the new documentation for this entry, or an empty string to remove the documentation.
342
343### MarkDeobfuscated (server-to-client)
344```c
345struct MarkDeobfuscatedS2CPacket {
346 unsigned short sync_id;
347 Entry obf_entry;
348}
349```
350- `sync_id`: the sync ID of the change for locking purposes.
351- `obf_entry`: the obfuscated name and descriptor of the entry to mark as deobfuscated.
352
353### Message (server-to-client) 305### Message (server-to-client)
354```c 306```c
355struct MessageS2CPacket { 307struct MessageS2CPacket {
@@ -364,3 +316,13 @@ struct UserListS2CPacket {
364 utf user[len]; 316 utf user[len];
365} 317}
366``` 318```
319
320### EntryChange (server-to-client)
321```c
322struct EntryChangeS2CPacket {
323 uint16_t sync_id;
324 entry_change change;
325}
326```
327- `sync_id`: The sync ID of the change for locking purposes.
328- `change`: The change to apply. \ No newline at end of file