Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct PacketData {
- int source_peer_id;
- int target_peer_id;
- byte packet_type; // Actually we need only last 3 bits, but it works fine with test data
- if (packet_type == 0) { // C2S, S2C: remote call
- int data_length;
- string rpc_name;
- byte params_count;
- struct Param {
- int type;
- if (type == 1)
- int value;
- if (type == 2)
- // Bool encoded as int, realy?
- int value;
- if (type == 4) {
- // I dont think that we need len for string (which is ending with 0x00 always), but ok)
- int length;
- char value[length];
- // Why we need pads here, its just waste of memory
- if (length % 4 > 0)
- char pads[4 - length % 4];
- }
- if (type == 19) {
- int length;
- struct ByteArray {
- int type;
- int value;
- } byte_array[length];
- }
- } param[pd.params_count] <optimize=false>;
- // I dont understand why i got this word (Node) in every packet end
- string node_name;
- }
- if (packet_type == 2) { // C2S: simplify_path
- int psc_id; // what is this
- string path;
- }
- //dont mo=ind about pd[4], its just my new example file with only 4 packets
- } pd[4] <optimize=false>;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement