Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
networkprotocol.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 2.1 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License along
16with this program; if not, write to the Free Software Foundation, Inc.,
1751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20#pragma once
21
22#include "util/string.h"
23
24/*
25 changes by PROTOCOL_VERSION:
26
27 PROTOCOL_VERSION 3:
28 Base for writing changes here
29 PROTOCOL_VERSION 4:
30 Add TOCLIENT_MEDIA
31 Add TOCLIENT_TOOLDEF
32 Add TOCLIENT_NODEDEF
33 Add TOCLIENT_CRAFTITEMDEF
34 Add TOSERVER_INTERACT
35 Obsolete TOSERVER_CLICK_ACTIVEOBJECT
36 Obsolete TOSERVER_GROUND_ACTION
37 PROTOCOL_VERSION 5:
38 Make players to be handled mostly as ActiveObjects
39 PROTOCOL_VERSION 6:
40 Only non-cached textures are sent
41 PROTOCOL_VERSION 7:
42 Add TOCLIENT_ITEMDEF
43 Obsolete TOCLIENT_TOOLDEF
44 Obsolete TOCLIENT_CRAFTITEMDEF
45 Compress the contents of TOCLIENT_ITEMDEF and TOCLIENT_NODEDEF
46 PROTOCOL_VERSION 8:
47 Digging based on item groups
48 Many things
49 PROTOCOL_VERSION 9:
50 ContentFeatures and NodeDefManager use a different serialization
51 format; better for future version cross-compatibility
52 Many things
53 Obsolete TOCLIENT_PLAYERITEM
54 PROTOCOL_VERSION 10:
55 TOCLIENT_PRIVILEGES
56 Version raised to force 'fly' and 'fast' privileges into effect.
57 Node metadata change (came in later; somewhat incompatible)
58 PROTOCOL_VERSION 11:
59 TileDef in ContentFeatures
60 Nodebox drawtype
61 (some dev snapshot)
62 TOCLIENT_INVENTORY_FORMSPEC
63 (0.4.0, 0.4.1)
64 PROTOCOL_VERSION 12:
65 TOSERVER_INVENTORY_FIELDS
66 16-bit node ids
67 TOCLIENT_DETACHED_INVENTORY
68 PROTOCOL_VERSION 13:
69 InventoryList field "Width" (deserialization fails with old versions)
70 PROTOCOL_VERSION 14:
71 Added transfer of player pressed keys to the server
72 Added new messages for mesh and bone animation, as well as attachments
73 AO_CMD_SET_ANIMATION
74 AO_CMD_SET_BONE_POSITION
75 GENERIC_CMD_SET_ATTACHMENT
76 PROTOCOL_VERSION 15:
77 Serialization format changes
78 PROTOCOL_VERSION 16:
79 TOCLIENT_SHOW_FORMSPEC
80 PROTOCOL_VERSION 17:
81 Serialization format change: include backface_culling flag in TileDef
82 Added rightclickable field in nodedef
83 TOCLIENT_SPAWN_PARTICLE
84 TOCLIENT_ADD_PARTICLESPAWNER
85 TOCLIENT_DELETE_PARTICLESPAWNER
86 PROTOCOL_VERSION 18:
87 damageGroups added to ToolCapabilities
88 sound_place added to ItemDefinition
89 PROTOCOL_VERSION 19:
90 AO_CMD_SET_PHYSICS_OVERRIDE
91 PROTOCOL_VERSION 20:
92 TOCLIENT_HUDADD
93 TOCLIENT_HUDRM
94 TOCLIENT_HUDCHANGE
95 TOCLIENT_HUD_SET_FLAGS
96 PROTOCOL_VERSION 21:
97 TOCLIENT_BREATH
98 TOSERVER_BREATH
99 range added to ItemDefinition
100 drowning, leveled and liquid_range added to ContentFeatures
101 stepheight and collideWithObjects added to object properties
102 version, heat and humidity transfer in MapBock
103 automatic_face_movement_dir and automatic_face_movement_dir_offset
104 added to object properties
105 PROTOCOL_VERSION 22:
106 add swap_node
107 PROTOCOL_VERSION 23:
108 Obsolete TOSERVER_RECEIVED_MEDIA
109 Server: Stop using TOSERVER_CLIENT_READY
110 PROTOCOL_VERSION 24:
111 ContentFeatures version 7
112 ContentFeatures: change number of special tiles to 6 (CF_SPECIAL_COUNT)
113 PROTOCOL_VERSION 25:
114 Rename TOCLIENT_ACCESS_DENIED to TOCLIENT_ACCESS_DENIED_LEGAGY
115 Rename TOCLIENT_DELETE_PARTICLESPAWNER to
116 TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY
117 Rename TOSERVER_PASSWORD to TOSERVER_PASSWORD_LEGACY
118 Rename TOSERVER_INIT to TOSERVER_INIT_LEGACY
119 Rename TOCLIENT_INIT to TOCLIENT_INIT_LEGACY
120 Add TOCLIENT_ACCESS_DENIED new opcode (0x0A), using error codes
121 for standard error, keeping customisation possible. This
122 permit translation
123 Add TOCLIENT_DELETE_PARTICLESPAWNER (0x53), fixing the u16 read and
124 reading u32
125 Add new opcode TOSERVER_INIT for client presentation to server
126 Add new opcodes TOSERVER_FIRST_SRP, TOSERVER_SRP_BYTES_A,
127 TOSERVER_SRP_BYTES_M, TOCLIENT_SRP_BYTES_S_B
128 for the three supported auth mechanisms around srp
129 Add new opcodes TOCLIENT_ACCEPT_SUDO_MODE and TOCLIENT_DENY_SUDO_MODE
130 for sudo mode handling (auth mech generic way of changing password).
131 Add TOCLIENT_HELLO for presenting server to client after client
132 presentation
133 Add TOCLIENT_AUTH_ACCEPT to accept connection from client
134 Rename GENERIC_CMD_SET_ATTACHMENT to AO_CMD_ATTACH_TO
135 PROTOCOL_VERSION 26:
136 Add TileDef tileable_horizontal, tileable_vertical flags
137 PROTOCOL_VERSION 27:
138 backface_culling: backwards compatibility for playing with
139 newer client on pre-27 servers.
140 Add nodedef v3 - connected nodeboxes
141 PROTOCOL_VERSION 28:
142 CPT2_MESHOPTIONS
143 PROTOCOL_VERSION 29:
144 Server doesn't accept TOSERVER_BREATH anymore
145 serialization of TileAnimation params changed
146 TAT_SHEET_2D
147 Removed client-sided chat perdiction
148 PROTOCOL VERSION 30:
149 New ContentFeatures serialization version
150 Add node and tile color and palette
151 Fix plantlike visual_scale being applied squared and add compatibility
152 with pre-30 clients by sending sqrt(visual_scale)
153 PROTOCOL VERSION 31:
154 Add tile overlay
155 Stop sending TOSERVER_CLIENT_READY
156 PROTOCOL VERSION 32:
157 Add fading sounds
158 PROTOCOL VERSION 33:
159 Add TOCLIENT_UPDATE_PLAYER_LIST and send the player list to the client,
160 instead of guessing based on the active object list.
161 PROTOCOL VERSION 34:
162 Add sound pitch
163 PROTOCOL VERSION 35:
164 Rename TOCLIENT_CHAT_MESSAGE to TOCLIENT_CHAT_MESSAGE_OLD (0x30)
165 Add TOCLIENT_CHAT_MESSAGE (0x2F)
166 This chat message is a signalisation message containing various
167 informations:
168 * timestamp
169 * sender
170 * type (RAW, NORMAL, ANNOUNCE, SYSTEM)
171 * content
172 Add TOCLIENT_CSM_RESTRICTION_FLAGS to define which CSM features should be
173 limited
174 Add settable player collisionbox. Breaks compatibility with older
175 clients as a 1-node vertical offset has been removed from player's
176 position
177 Add settable player stepheight using existing object property.
178 Breaks compatibility with older clients.
179 PROTOCOL VERSION 36:
180 Backwards compatibility drop
181 Add 'can_zoom' to player object properties
182 Add glow to object properties
183 Change TileDef serialization format.
184 Add world-aligned tiles.
185 Mod channels
186 Raise ObjectProperties version to 3 for removing 'can_zoom' and adding
187 'zoom_fov'.
188 Nodebox version 5
189 Add disconnected nodeboxes
190 Add TOCLIENT_FORMSPEC_PREPEND
191 PROTOCOL VERSION 37:
192 Redo detached inventory sending
193 Add TOCLIENT_NODEMETA_CHANGED
194 New network float format
195 ContentFeatures version 13
196 Add full Euler rotations instead of just yaw
197 Add TOCLIENT_PLAYER_SPEED
198 PROTOCOL VERSION 38:
199 Incremental inventory sending mode
200 Unknown inventory serialization fields no longer throw an error
201 Mod-specific formspec version
202 Player FOV override API
203 "ephemeral" added to TOCLIENT_PLAY_SOUND
204 PROTOCOL VERSION 39:
205 Updated set_sky packet
206 Adds new sun, moon and stars packets
207 Minimap modes
208 PROTOCOL VERSION 40:
209 TOCLIENT_MEDIA_PUSH changed, TOSERVER_HAVE_MEDIA added
210 PROTOCOL VERSION 41:
211 Added new particlespawner parameters
212 [scheduled bump for 5.6.0]
213 PROTOCOL VERSION 42:
214 TOSERVER_UPDATE_CLIENT_INFO added
215 new fields for TOCLIENT_SET_LIGHTING and TOCLIENT_SET_SKY
216 Send forgotten TweenedParameter properties
217 [scheduled bump for 5.7.0]
218 PROTOCOL VERSION 43:
219 "start_time" added to TOCLIENT_PLAY_SOUND
220 place_param2 type change u8 -> optional<u8>
221 [scheduled bump for 5.8.0]
222 PROTOCOL VERSION 44:
223 AO_CMD_SET_BONE_POSITION extended
224 Add TOCLIENT_MOVE_PLAYER_REL
225 Move default minimap from client-side C++ to server-side builtin Lua
226 [scheduled bump for 5.9.0]
227*/
228
229#define LATEST_PROTOCOL_VERSION 44
230#define LATEST_PROTOCOL_VERSION_STRING TOSTRING(LATEST_PROTOCOL_VERSION)
231
232// Server's supported network protocol range
233#define SERVER_PROTOCOL_VERSION_MIN 37
234#define SERVER_PROTOCOL_VERSION_MAX LATEST_PROTOCOL_VERSION
235
236// Client's supported network protocol range
237#define CLIENT_PROTOCOL_VERSION_MIN 37
238#define CLIENT_PROTOCOL_VERSION_MAX LATEST_PROTOCOL_VERSION
239
240// Constant that differentiates the protocol from random data and other protocols
241#define PROTOCOL_ID 0x4f457403
242
243#define PASSWORD_SIZE 28 // Maximum password length. Allows for
244 // base64-encoded SHA-1 (27+\0).
245
246// See also formspec [Version History] in doc/lua_api.md
247#define FORMSPEC_API_VERSION 7
248
249#define TEXTURENAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.-"
250
251typedef u16 session_t;
252
254{
256 /*
257 Sent after TOSERVER_INIT.
258
259 u8 deployed serialization version
260 u16 deployed network compression mode
261 u16 deployed protocol version
262 u32 supported auth methods
263 std::string username that should be used for legacy hash (for proper casing)
264 */
266 /*
267 Message from server to accept auth.
268
269 v3s16 player's position + v3f(0,BS/2,0) floatToInt'd
270 u64 map seed
271 f1000 recommended send interval
272 u32 : supported auth methods for sudo mode
273 (where the user can change their password)
274 */
276 /*
277 Sent to client to show it is in sudo mode now.
278 */
280 /*
281 Signals client that sudo mode auth failed.
282 */
284 /*
285 u8 reason
286 std::string custom reason (if needed, otherwise "")
287 u8 (bool) reconnect
288 */
289
292 /*
293 v3s16 position
294 serialized mapnode
295 u8 keep_metadata // Added in protocol version 22
296 */
298
300 /*
301 [0] u16 command
302 [2] serialized inventory
303 */
304
306 /*
307 u16 time (0-23999)
308 f1000 time_speed
309 */
310
312 /*
313 u32 CSMRestrictionFlags byteflag
314 */
315
317 /*
318 v3f added_vel
319 */
320
322 /*
323 std::string raw_hash
324 std::string filename
325 u32 callback_token
326 bool should_be_cached
327 */
328
330 /*
331 u8 version
332 u8 message_type
333 u16 sendername length
334 wstring sendername
335 u16 length
336 wstring message
337 */
338
340 /*
341 u16 count of removed objects
342 for all removed objects {
343 u16 id
344 }
345 u16 count of added objects
346 for all added objects {
347 u16 id
348 u8 type
349 u32 initialization data length
350 string initialization data
351 }
352 */
353
355 /*
356 for all objects
357 {
358 u16 id
359 u16 message length
360 string message
361 }
362 */
363
365 /*
366 u8 hp
367 */
368
370 /*
371 v3f1000 player position
372 f1000 player pitch
373 f1000 player yaw
374 */
375
377 /*
378 u16 reason_length
379 wstring reason
380 */
381
383 /*
384 Sends an FOV override/multiplier to client.
385
386 f32 fov
387 bool is_multiplier
388 f32 transition_time
389 */
390
392 /*
393 u8 bool set camera point target
394 v3f1000 camera point target (to point the death cause or whatever)
395 */
396
398 /*
399 u16 total number of texture bunches
400 u16 index of this bunch
401 u32 number of files in this bunch
402 for each file {
403 u16 length of name
404 string name
405 u32 length of data
406 data
407 }
408 u16 length of remote media server url (if applicable)
409 string url
410 */
411
413 /*
414 u32 length of the next item
415 serialized NodeDefManager
416 */
417
419 /*
420 u32 number of files
421 for each texture {
422 u16 length of name
423 string name
424 u16 length of sha1_digest
425 string sha1_digest
426 }
427 */
428
430 /*
431 u32 length of next item
432 serialized ItemDefManager
433 */
434
436 /*
437 s32 server_id
438 u16 len
439 u8[len] sound name
440 f32 gain
441 u8 type (SoundLocation: 0=local, 1=positional, 2=object)
442 v3f pos_nodes (in BS-space)
443 u16 object_id
444 u8 loop (bool)
445 f32 fade
446 f32 pitch
447 u8 ephemeral (bool)
448 f32 start_time (in seconds)
449 */
450
452 /*
453 s32 sound_id
454 */
455
457 /*
458 u16 number of privileges
459 for each privilege
460 u16 len
461 u8[len] privilege
462 */
463
465 /*
466 u32 len
467 u8[len] formspec
468 */
469
471 /*
472 [0] u16 command
473 u16 len
474 u8[len] name
475 [2] serialized inventory
476 */
477
479 /*
480 [0] u16 command
481 u32 len
482 u8[len] formspec
483 u16 len
484 u8[len] formname
485 */
486
488 /*
489 f1000 movement_acceleration_default
490 f1000 movement_acceleration_air
491 f1000 movement_acceleration_fast
492 f1000 movement_speed_walk
493 f1000 movement_speed_crouch
494 f1000 movement_speed_fast
495 f1000 movement_speed_climb
496 f1000 movement_speed_jump
497 f1000 movement_liquid_fluidity
498 f1000 movement_liquid_fluidity_smooth
499 f1000 movement_liquid_sink
500 f1000 movement_gravity
501 */
502
504 /*
505 -- struct range<T> { T min, T max, f32 bias };
506 v3f pos
507 v3f velocity
508 v3f acceleration
509 f32 expirationtime
510 f32 size
511 u8 bool collisiondetection
512 u32 len
513 u8[len] texture
514 u8 bool vertical
515 u8 collision_removal
516 TileAnimation animation
517 u8 glow
518 u8 object_collision
519 v3f drag
520 range<v3f> bounce
521 */
522
524 /*
525 using range<T> = RangedParameter<T> {
526 T min, max
527 f32 bias
528 }
529 using tween<T> = TweenedParameter<T> {
530 u8 style
531 u16 reps
532 f32 beginning
533 T start, end
534 }
535
536 u16 amount
537 f32 spawntime
538 if PROTOCOL_VERSION >= 42 {
539 tween<T> pos, vel, acc, exptime, size
540 } else {
541 v3f minpos
542 v3f maxpos
543 v3f minvel
544 v3f maxvel
545 v3f minacc
546 v3f maxacc
547 f32 minexptime
548 f32 maxexptime
549 f32 minsize
550 f32 maxsize
551 }
552 u8 bool collisiondetection
553 u32 len
554 u8[len] texture
555 u8 bool vertical
556 u8 collision_removal
557 u32 id
558 TileAnimation animation
559 u8 glow
560 u8 object_collision
561
562 if PROTOCOL_VERSION < 42 {
563 f32 pos_start_bias
564 f32 vel_start_bias
565 f32 acc_start_bias
566 f32 exptime_start_bias
567 f32 size_start_bias
568
569 range<v3f> pos_end
570 -- i.e v3f pos_end_min
571 -- v3f pos_end_max
572 -- f32 pos_end_bias
573 range<v3f> vel_end
574 range<v3f> acc_end
575 }
576
577 tween<range<v3f>> drag
578 -- i.e. v3f drag_start_min
579 -- v3f drag_start_max
580 -- f32 drag_start_bias
581 -- v3f drag_end_min
582 -- v3f drag_end_max
583 -- f32 drag_end_bias
584 tween<range<v3f>> jitter
585 tween<range<f32>> bounce
586
587 u8 attraction_kind
588 none = 0
589 point = 1
590 line = 2
591 plane = 3
592
593 if attraction_kind > none {
594 tween<range<f32>> attract_strength
595 tween<v3f> attractor_origin
596 u16 attractor_origin_attachment_object_id
597 u8 spawner_flags
598 bit 1: attractor_kill (particles dies on contact)
599 if attraction_mode > point {
600 tween<v3f> attractor_angle
601 u16 attractor_origin_attachment_object_id
602 }
603 }
604
605 tween<range<v3f>> radius
606 tween<range<v3f>> drag
607
608 u16 texpool_sz
609 texpool_sz.times {
610 u8 flags
611 -- bit 0: animated
612 -- other bits free & ignored as of proto v40
613 tween<f32> alpha
614 tween<v2f> scale
615 if flags.animated {
616 TileAnimation animation
617 }
618 }
619
620 */
621
623 /*
624 u32 id
625 u8 type
626 v2f1000 pos
627 u16 len
628 u8[len] name
629 v2f1000 scale
630 u16 len2
631 u8[len2] text
632 u32 number
633 u32 item
634 u32 dir
635 v2f1000 align
636 v2f1000 offset
637 v3f1000 world_pos
638 v2s32 size
639 s16 z_index
640 u16 len3
641 u8[len3] text2
642 */
643
645 /*
646 u32 id
647 */
648
650 /*
651 u32 id
652 u8 stat
653 [v2f1000 data |
654 u32 len
655 u8[len] data |
656 u32 data]
657 */
658
660 /*
661 u32 flags
662 u32 mask
663 */
664
666 /*
667 u16 param
668 u16 len
669 u8[len] value
670 */
671
673 /*
674 u16 breath
675 */
676
678 /*
679 Protocol 38:
680 u8[4] base_color (ARGB)
681 u8 len
682 u8[len] type
683 u16 count
684 foreach count:
685 u8 len
686 u8[len] param
687 u8 clouds (boolean)
688
689 Protocol 39:
690 u8[4] bgcolor (ARGB)
691 std::string type
692 int texture_count
693 std::string[6] param
694 bool clouds
695 bool bgcolor_fog
696 u8[4] day_sky (ARGB)
697 u8[4] day_horizon (ARGB)
698 u8[4] dawn_sky (ARGB)
699 u8[4] dawn_horizon (ARGB)
700 u8[4] night_sky (ARGB)
701 u8[4] night_horizon (ARGB)
702 u8[4] indoors (ARGB)
703 u8[4] fog_sun_tint (ARGB)
704 u8[4] fog_moon_tint (ARGB)
705 std::string fog_tint_type
706 float body_orbit_tilt
707 */
708
710 /*
711 u8 do_override (boolean)
712 u16 day-night ratio 0...65535
713 */
714
716 /*
717 v2s32 stand/idle
718 v2s32 walk
719 v2s32 dig
720 v2s32 walk+dig
721 f1000 frame_speed
722 */
723
725 /*
726 v3f1000 first
727 v3f1000 third
728 v3f1000 third_front
729 */
730
732 /*
733 u32 id
734 */
735
737 /*
738 f1000 density
739 u8[4] color_diffuse (ARGB)
740 u8[4] color_ambient (ARGB)
741 f1000 height
742 f1000 thickness
743 v2f1000 speed
744 */
745
747 /*
748 s32 sound_id
749 float step
750 float gain
751 */
753 /*
754 u8 type
755 u16 number of players
756 for each player
757 u16 len
758 u8[len] player name
759 */
760
762 /*
763 u16 channel name length
764 std::string channel name
765 u16 channel name sender
766 std::string channel name
767 u16 message length
768 std::string message
769 */
770
772 /*
773 u8 signal id
774 u16 channel name length
775 std::string channel name
776 */
777
779 /*
780 serialized and compressed node metadata
781 */
782
784 /*
785 bool visible
786 std::string texture
787 std::string tonemap
788 std::string sunrise
789 f32 scale
790 */
791
793 /*
794 bool visible
795 std::string texture
796 std::string tonemap
797 f32 scale
798 */
799
801 /*
802 bool visible
803 u32 count
804 u8[4] starcolor (ARGB)
805 f32 scale
806 f32 day_opacity
807 */
808
810 /*
811 v3f added_pos
812 */
813
815 /*
816 Belonging to AUTH_MECHANISM_SRP.
817
818 std::string bytes_s
819 std::string bytes_B
820 */
821
823 /*
824 u16 len
825 u8[len] formspec
826 */
827
829 /*
830 u16 count // modes
831 u16 mode // wanted current mode index after change
832 for each mode
833 u16 type
834 std::string label
835 u16 size
836 std::string extra
837 */
838
840 /*
841 f32 shadow_intensity
842 f32 saturation
843 exposure parameters
844 f32 luminance_min
845 f32 luminance_max
846 f32 exposure_correction
847 f32 speed_dark_bright
848 f32 speed_bright_dark
849 f32 center_weight_power
850 */
851
853};
854
856{
858 /*
859 Sent first after connected.
860
861 u8 serialization version (=SER_FMT_VER_HIGHEST_READ)
862 u16 supported network compression modes
863 u16 minimum supported network protocol version
864 u16 maximum supported network protocol version
865 std::string player name
866 */
867
869 /*
870 Sent as an ACK for TOCLIENT_AUTH_ACCEPT.
871 After this, the server can send data.
872 */
873
875 /*
876 u16 channel name length
877 std::string channel name
878 */
879
881 /*
882 u16 channel name length
883 std::string channel name
884 */
885
887 /*
888 u16 channel name length
889 std::string channel name
890 u16 message length
891 std::string message
892 */
893
895 /*
896 [0] u16 command
897 [2] v3s32 position*100
898 [2+12] v3s32 speed*100
899 [2+12+12] s32 pitch*100
900 [2+12+12+4] s32 yaw*100
901 [2+12+12+4+4] u32 keyPressed
902 [2+12+12+4+4+4] u8 fov*80
903 [2+12+12+4+4+4+1] u8 ceil(wanted_range / MAP_BLOCKSIZE)
904 [2+12+12+4+4+4+1+1] u8 camera_inverted (bool)
905
906 */
907
909 /*
910 [0] u16 command
911 [2] u8 count
912 [3] v3s16 pos_0
913 [3+6] v3s16 pos_1
914 ...
915 */
916
918 /*
919 [0] u16 command
920 [2] u8 count
921 [3] v3s16 pos_0
922 [3+6] v3s16 pos_1
923 ...
924 */
925
927 /*
928 See InventoryAction in inventorymanager.h
929 */
930
932 /*
933 u16 length
934 wstring message
935 */
936
938 /*
939 u8 amount
940 */
941
943 /*
944 Sent to change selected item.
945
946 [0] u16 TOSERVER_PLAYERITEM
947 [2] u16 item
948 */
949
951 /*
952 u16 TOSERVER_RESPAWN
953 */
954
956 /*
957 [0] u16 command
958 [2] u8 action
959 [3] u16 item
960 [5] u32 length of the next item
961 [9] serialized PointedThing
962 actions:
963 0: start digging (from undersurface) or use
964 1: stop digging (all parameters ignored)
965 2: digging completed
966 3: place block or item (to abovesurface)
967 4: use item
968 */
969
971 /*
972 u16 len
973 s32[len] sound_id
974 */
975
977 /*
978 v3s16 p
979 u16 len
980 u8[len] form name (reserved for future use)
981 u16 number of fields
982 for each field:
983 u16 len
984 u8[len] field name
985 u32 len
986 u8[len] field value
987 */
988
990 /*
991 u16 len
992 u8[len] form name (reserved for future use)
993 u16 number of fields
994 for each field:
995 u16 len
996 u8[len] field name
997 u32 len
998 u8[len] field value
999 */
1000
1002 /*
1003 u16 number of files requested
1004 for each file {
1005 u16 length of name
1006 string name
1007 }
1008 */
1009
1011 /*
1012 u8 number of callback tokens
1013 for each:
1014 u32 token
1015 */
1016
1018 /*
1019 u8 major
1020 u8 minor
1021 u8 patch
1022 u8 reserved
1023 u16 len
1024 u8[len] full_version_string
1025 */
1026
1028 /*
1029 Belonging to AUTH_MECHANISM_FIRST_SRP.
1030
1031 std::string srp salt
1032 std::string srp verification key
1033 u8 is_empty (=1 if password is empty, 0 otherwise)
1034 */
1035
1037 /*
1038 Belonging to AUTH_MECHANISM_SRP,
1039 depending on current_login_based_on.
1040
1041 std::string bytes_A
1042 u8 current_login_based_on : on which version of the password's
1043 hash this login is based on (0 legacy hash,
1044 or 1 directly the password)
1045 */
1046
1048 /*
1049 Belonging to AUTH_MECHANISM_SRP.
1050
1051 std::string bytes_M
1052 */
1053
1055 /*
1056 v2s16 render_target_size
1057 f32 gui_scaling
1058 f32 hud_scaling
1059 v2f32 max_fs_info
1060 */
1061
1063};
1064
1066{
1067 // reserved
1069
1070 // SRP based on the legacy hash
1072
1073 // SRP based on the srp verification key
1075
1076 // Establishes a srp verification key, for first login and password changing
1078};
1079
1095};
1096
1099};
1100
1102 "Invalid password",
1103 "Your client sent something the server didn't expect. Try reconnecting or updating your client.",
1104 "The server is running in simple singleplayer mode. You cannot connect.",
1105 "Your client's version is not supported.\nPlease contact the server administrator.",
1106 "Player name contains disallowed characters",
1107 "Player name not allowed",
1108 "Too many users",
1109 "Empty passwords are disallowed. Set a password and try again.",
1110 "Another client is connected with this name. If your client closed unexpectedly, try again in a minute.",
1111 "Internal server error",
1112 "",
1113 "Server shutting down",
1114 "The server has experienced an internal error. You will now be disconnected."
1115};
1116
1118{
1122};
1123
1125 CSM_RF_NONE = 0x00000000,
1126 // Until server-sent CSM and verifying of builtin are complete,
1127 // 'CSM_RF_LOAD_CLIENT_MODS' also disables loading 'builtin'.
1128 // When those are complete, this should return to only being a restriction on the
1129 // loading of client mods.
1130 CSM_RF_LOAD_CLIENT_MODS = 0x00000001, // Don't load client-provided mods or 'builtin'
1131 CSM_RF_CHAT_MESSAGES = 0x00000002, // Disable chat message sending from CSM
1132 CSM_RF_READ_ITEMDEFS = 0x00000004, // Disable itemdef lookups
1133 CSM_RF_READ_NODEDEFS = 0x00000008, // Disable nodedef lookups
1134 CSM_RF_LOOKUP_NODES = 0x00000010, // Limit node lookups
1135 CSM_RF_READ_PLAYERINFO = 0x00000020, // Disable player info lookups
1136 CSM_RF_ALL = 0xFFFFFFFF,
1137};
1138
1140{
1141 INTERACT_START_DIGGING, // 0: start digging (from undersurface) or use
1142 INTERACT_STOP_DIGGING, // 1: stop digging (all parameters ignored)
1143 INTERACT_DIGGING_COMPLETED, // 2: digging completed
1144 INTERACT_PLACE, // 3: place block or item (to abovesurface)
1145 INTERACT_USE, // 4: use item
1146 INTERACT_ACTIVATE // 5: rightclick air ("activate")
ToServerCommand
Definition: networkprotocol.h:856
@ TOSERVER_RESPAWN
Definition: networkprotocol.h:950
@ TOSERVER_MODCHANNEL_LEAVE
Definition: networkprotocol.h:880
@ TOSERVER_PLAYERITEM
Definition: networkprotocol.h:942
@ TOSERVER_MODCHANNEL_MSG
Definition: networkprotocol.h:886
@ TOSERVER_DELETEDBLOCKS
Definition: networkprotocol.h:917
@ TOSERVER_GOTBLOCKS
Definition: networkprotocol.h:908
@ TOSERVER_HAVE_MEDIA
Definition: networkprotocol.h:1010
@ TOSERVER_NODEMETA_FIELDS
Definition: networkprotocol.h:976
@ TOSERVER_PLAYERPOS
Definition: networkprotocol.h:894
@ TOSERVER_CLIENT_READY
Definition: networkprotocol.h:1017
@ TOSERVER_REQUEST_MEDIA
Definition: networkprotocol.h:1001
@ TOSERVER_SRP_BYTES_M
Definition: networkprotocol.h:1047
@ TOSERVER_INTERACT
Definition: networkprotocol.h:955
@ TOSERVER_FIRST_SRP
Definition: networkprotocol.h:1027
@ TOSERVER_INIT
Definition: networkprotocol.h:857
@ TOSERVER_REMOVED_SOUNDS
Definition: networkprotocol.h:970
@ TOSERVER_DAMAGE
Definition: networkprotocol.h:937
@ TOSERVER_NUM_MSG_TYPES
Definition: networkprotocol.h:1062
@ TOSERVER_UPDATE_CLIENT_INFO
Definition: networkprotocol.h:1054
@ TOSERVER_SRP_BYTES_A
Definition: networkprotocol.h:1036
@ TOSERVER_CHAT_MESSAGE
Definition: networkprotocol.h:931
@ TOSERVER_MODCHANNEL_JOIN
Definition: networkprotocol.h:874
@ TOSERVER_INIT2
Definition: networkprotocol.h:868
@ TOSERVER_INVENTORY_ACTION
Definition: networkprotocol.h:926
@ TOSERVER_INVENTORY_FIELDS
Definition: networkprotocol.h:989
AccessDeniedCode
Definition: networkprotocol.h:1080
@ SERVER_ACCESSDENIED_SERVER_FAIL
Definition: networkprotocol.h:1090
@ SERVER_ACCESSDENIED_MAX
Definition: networkprotocol.h:1094
@ SERVER_ACCESSDENIED_CUSTOM_STRING
Definition: networkprotocol.h:1091
@ SERVER_ACCESSDENIED_CRASH
Definition: networkprotocol.h:1093
@ SERVER_ACCESSDENIED_ALREADY_CONNECTED
Definition: networkprotocol.h:1089
@ SERVER_ACCESSDENIED_TOO_MANY_USERS
Definition: networkprotocol.h:1087
@ SERVER_ACCESSDENIED_SHUTDOWN
Definition: networkprotocol.h:1092
@ SERVER_ACCESSDENIED_WRONG_PASSWORD
Definition: networkprotocol.h:1081
@ SERVER_ACCESSDENIED_SINGLEPLAYER
Definition: networkprotocol.h:1083
@ SERVER_ACCESSDENIED_UNEXPECTED_DATA
Definition: networkprotocol.h:1082
@ SERVER_ACCESSDENIED_WRONG_VERSION
Definition: networkprotocol.h:1084
@ SERVER_ACCESSDENIED_WRONG_CHARS_IN_NAME
Definition: networkprotocol.h:1085
@ SERVER_ACCESSDENIED_EMPTY_PASSWORD
Definition: networkprotocol.h:1088
@ SERVER_ACCESSDENIED_WRONG_NAME
Definition: networkprotocol.h:1086
CSMRestrictionFlags
Definition: networkprotocol.h:1124
@ CSM_RF_LOAD_CLIENT_MODS
Definition: networkprotocol.h:1130
@ CSM_RF_LOOKUP_NODES
Definition: networkprotocol.h:1134
@ CSM_RF_ALL
Definition: networkprotocol.h:1136
@ CSM_RF_CHAT_MESSAGES
Definition: networkprotocol.h:1131
@ CSM_RF_NONE
Definition: networkprotocol.h:1125
@ CSM_RF_READ_NODEDEFS
Definition: networkprotocol.h:1133
@ CSM_RF_READ_ITEMDEFS
Definition: networkprotocol.h:1132
@ CSM_RF_READ_PLAYERINFO
Definition: networkprotocol.h:1135
InteractAction
Definition: networkprotocol.h:1140
@ INTERACT_START_DIGGING
Definition: networkprotocol.h:1141
@ INTERACT_USE
Definition: networkprotocol.h:1145
@ INTERACT_DIGGING_COMPLETED
Definition: networkprotocol.h:1143
@ INTERACT_PLACE
Definition: networkprotocol.h:1144
@ INTERACT_ACTIVATE
Definition: networkprotocol.h:1146
@ INTERACT_STOP_DIGGING
Definition: networkprotocol.h:1142
AuthMechanism
Definition: networkprotocol.h:1066
@ AUTH_MECHANISM_SRP
Definition: networkprotocol.h:1074
@ AUTH_MECHANISM_NONE
Definition: networkprotocol.h:1068
@ AUTH_MECHANISM_LEGACY_PASSWORD
Definition: networkprotocol.h:1071
@ AUTH_MECHANISM_FIRST_SRP
Definition: networkprotocol.h:1077
ToClientCommand
Definition: networkprotocol.h:254
@ TOCLIENT_LOCAL_PLAYER_ANIMATIONS
Definition: networkprotocol.h:715
@ TOCLIENT_FOV
Definition: networkprotocol.h:382
@ TOCLIENT_ACCESS_DENIED_LEGACY
Definition: networkprotocol.h:376
@ TOCLIENT_ACCEPT_SUDO_MODE
Definition: networkprotocol.h:275
@ TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD
Definition: networkprotocol.h:339
@ TOCLIENT_ITEMDEF
Definition: networkprotocol.h:429
@ TOCLIENT_CHAT_MESSAGE
Definition: networkprotocol.h:329
@ TOCLIENT_ADD_PARTICLESPAWNER
Definition: networkprotocol.h:523
@ TOCLIENT_ACTIVE_OBJECT_MESSAGES
Definition: networkprotocol.h:354
@ TOCLIENT_MODCHANNEL_SIGNAL
Definition: networkprotocol.h:771
@ TOCLIENT_SET_MOON
Definition: networkprotocol.h:792
@ TOCLIENT_ACCESS_DENIED
Definition: networkprotocol.h:283
@ TOCLIENT_SPAWN_PARTICLE
Definition: networkprotocol.h:503
@ TOCLIENT_PRIVILEGES
Definition: networkprotocol.h:456
@ TOCLIENT_HUD_SET_PARAM
Definition: networkprotocol.h:665
@ TOCLIENT_CSM_RESTRICTION_FLAGS
Definition: networkprotocol.h:311
@ TOCLIENT_SET_LIGHTING
Definition: networkprotocol.h:839
@ TOCLIENT_MOVE_PLAYER_REL
Definition: networkprotocol.h:809
@ TOCLIENT_STOP_SOUND
Definition: networkprotocol.h:451
@ TOCLIENT_NODEMETA_CHANGED
Definition: networkprotocol.h:778
@ TOCLIENT_DENY_SUDO_MODE
Definition: networkprotocol.h:279
@ TOCLIENT_PLAY_SOUND
Definition: networkprotocol.h:435
@ TOCLIENT_SET_STARS
Definition: networkprotocol.h:800
@ TOCLIENT_SET_SKY
Definition: networkprotocol.h:677
@ TOCLIENT_MINIMAP_MODES
Definition: networkprotocol.h:828
@ TOCLIENT_REMOVENODE
Definition: networkprotocol.h:297
@ TOCLIENT_HP
Definition: networkprotocol.h:364
@ TOCLIENT_MEDIA_PUSH
Definition: networkprotocol.h:321
@ TOCLIENT_SRP_BYTES_S_B
Definition: networkprotocol.h:814
@ TOCLIENT_DETACHED_INVENTORY
Definition: networkprotocol.h:470
@ TOCLIENT_HELLO
Definition: networkprotocol.h:255
@ TOCLIENT_AUTH_ACCEPT
Definition: networkprotocol.h:265
@ TOCLIENT_MOVEMENT
Definition: networkprotocol.h:487
@ TOCLIENT_CLOUD_PARAMS
Definition: networkprotocol.h:736
@ TOCLIENT_HUDADD
Definition: networkprotocol.h:622
@ TOCLIENT_FADE_SOUND
Definition: networkprotocol.h:746
@ TOCLIENT_NUM_MSG_TYPES
Definition: networkprotocol.h:852
@ TOCLIENT_DELETE_PARTICLESPAWNER
Definition: networkprotocol.h:731
@ TOCLIENT_HUDRM
Definition: networkprotocol.h:644
@ TOCLIENT_MEDIA
Definition: networkprotocol.h:397
@ TOCLIENT_MOVE_PLAYER
Definition: networkprotocol.h:369
@ TOCLIENT_SET_SUN
Definition: networkprotocol.h:783
@ TOCLIENT_SHOW_FORMSPEC
Definition: networkprotocol.h:478
@ TOCLIENT_ADDNODE
Definition: networkprotocol.h:291
@ TOCLIENT_TIME_OF_DAY
Definition: networkprotocol.h:305
@ TOCLIENT_BREATH
Definition: networkprotocol.h:672
@ TOCLIENT_BLOCKDATA
Definition: networkprotocol.h:290
@ TOCLIENT_DEATHSCREEN
Definition: networkprotocol.h:391
@ TOCLIENT_FORMSPEC_PREPEND
Definition: networkprotocol.h:822
@ TOCLIENT_OVERRIDE_DAY_NIGHT_RATIO
Definition: networkprotocol.h:709
@ TOCLIENT_MODCHANNEL_MSG
Definition: networkprotocol.h:761
@ TOCLIENT_NODEDEF
Definition: networkprotocol.h:412
@ TOCLIENT_PLAYER_SPEED
Definition: networkprotocol.h:316
@ TOCLIENT_HUDCHANGE
Definition: networkprotocol.h:649
@ TOCLIENT_EYE_OFFSET
Definition: networkprotocol.h:724
@ TOCLIENT_HUD_SET_FLAGS
Definition: networkprotocol.h:659
@ TOCLIENT_ANNOUNCE_MEDIA
Definition: networkprotocol.h:418
@ TOCLIENT_INVENTORY
Definition: networkprotocol.h:299
@ TOCLIENT_UPDATE_PLAYER_LIST
Definition: networkprotocol.h:752
@ TOCLIENT_INVENTORY_FORMSPEC
Definition: networkprotocol.h:464
NetProtoCompressionMode
Definition: networkprotocol.h:1097
@ NETPROTO_COMPRESSION_NONE
Definition: networkprotocol.h:1098
u16 session_t
Definition: networkprotocol.h:251
constexpr const char * accessDeniedStrings[SERVER_ACCESSDENIED_MAX]
Definition: networkprotocol.h:1101
PlayerListModifer
Definition: networkprotocol.h:1118
@ PLAYER_LIST_INIT
Definition: networkprotocol.h:1119
@ PLAYER_LIST_REMOVE
Definition: networkprotocol.h:1121
@ PLAYER_LIST_ADD
Definition: networkprotocol.h:1120