/* protocol.h - communications protocols Copyright (C) 2007 Uncle Mike This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef NET_PROTOCOL_H #define NET_PROTOCOL_H #define PROTOCOL_VERSION 49 // server to client #define svc_bad 0 // immediately crash client when received #define svc_nop 1 // does nothing #define svc_disconnect 2 // kick client from server #define svc_event 3 // playback event queue #define svc_changing 4 // changelevel by server request #define svc_setview 5 // [short] entity number #define svc_sound 6 // #define svc_time 7 // [float] server time #define svc_print 8 // [byte] id [string] null terminated string #define svc_stufftext 9 // [string] stuffed into client's console buffer #define svc_setangle 10 // [angle angle angle] set the view angle to this absolute value #define svc_serverdata 11 // [int] protocol ... #define svc_lightstyle 12 // [index][pattern][float] #define svc_updateuserinfo 13 // [byte] playernum, [string] userinfo #define svc_deltatable 14 // [table header][...] #define svc_clientdata 15 // [...] #define svc_resource 16 // [...] late-precached resource will be download in-game #define svc_pings 17 // [bit][idx][ping][packet_loss] #define svc_particle 18 // [float*3][char*3][byte][byte] #define svc_restoresound 19 // #define svc_spawnstatic 20 // creates a static client entity #define svc_event_reliable 21 // playback event directly from message, not queue #define svc_spawnbaseline 22 // #define svc_temp_entity 23 // #define svc_setpause 24 // [byte] 0 = unpaused, 1 = paused #define svc_signonnum 25 // [byte] used for the signon sequence #define svc_centerprint 26 // [string] to put in center of the screen // reserved // reserved // reserved #define svc_intermission 30 // empty message (event) #define svc_finale 31 // empty message (event) #define svc_cdtrack 32 // [string] trackname #define svc_restore 33 // [string] savename #define svc_cutscene 34 // empty message (event) #define svc_weaponanim 35 // [byte]iAnim [byte]body #define svc_bspdecal 36 // [float*3][short][short][short] #define svc_roomtype 37 // [short] room type #define svc_addangle 38 // [angle] add angles when client turn on mover #define svc_usermessage 39 // [byte][byte][string] REG_USER_MSG stuff #define svc_packetentities 40 // [short][...] #define svc_deltapacketentities 41 // [short][byte][...] #define svc_choke 42 // just event #define svc_resourcelist 43 // [short][...] #define svc_deltamovevars 44 // [movevars_t] #define svc_resourcerequest 45 // #define svc_customization 46 #define svc_crosshairangle 47 // [byte][byte] #define svc_soundfade 48 // [float*4] sound fade parms #define svc_filetxferfailed 49 // [string] #define svc_hltv 50 // sending from the game.dll #define svc_director 51 // #define svc_voiceinit 52 // #define svc_voicedata 53 // [byte][short][...] // reserved // reserved #define svc_resourcelocation 56 // [string] #define svc_querycvarvalue 57 // [string] #define svc_querycvarvalue2 58 // [string][int] (context) #define svc_exec 59 // [byte][...] #define svc_lastmsg 59 // start user messages at this point // client to server #define clc_bad 0 // immediately drop client when received #define clc_nop 1 #define clc_move 2 // [[usercmd_t] #define clc_stringcmd 3 // [string] message #define clc_delta 4 // [byte] sequence number, requests delta compression of message #define clc_resourcelist 5 // reserved #define clc_fileconsistency 7 #define clc_voicedata 8 #define clc_requestcvarvalue 9 #define clc_requestcvarvalue2 10 #define clc_lastmsg 11 // end client messages (11 is GoldSrc message) #define MAX_VISIBLE_PACKET_BITS 11 // 2048 visible entities per frame (hl1 has 256) #define MAX_VISIBLE_PACKET (1< (svc_resource) #define svc_updatecolors 17 // [byte] [byte] (svc_pings) #define svc_damage 19 // (svc_restoresound) #define svc_spawnbinary 21 // (svc_event_reliable) #define svc_killedmonster 27 #define svc_foundsecret 28 #define svc_spawnstaticsound 29 // [coord3] [byte] samp [byte] vol [byte] aten #define svc_sellscreen 33 // (svc_restore) // Nehahra added #define svc_showlmp 35 // [string] slotname [string] lmpfilename [coord] x [coord] y #define svc_hidelmp 36 // [string] slotname #define svc_skybox 37 // [string] skyname #define svc_skyboxsize 50 // [coord] size (default is 4096) #define svc_fog 51 // [byte] enable // [float] density [byte] red [byte] green [byte] blue // if the high bit of the servercmd is set, the low bits are fast update flags: #define U_MOREBITS (1<<0) #define U_ORIGIN1 (1<<1) #define U_ORIGIN2 (1<<2) #define U_ORIGIN3 (1<<3) #define U_ANGLE2 (1<<4) #define U_NOLERP (1<<5) // don't interpolate movement #define U_FRAME (1<<6) #define U_SIGNAL (1<<7) // just differentiates from other updates // svc_update can pass all of the fast update bits, plus more #define U_ANGLE1 (1<<8) #define U_ANGLE3 (1<<9) #define U_MODEL (1<<10) #define U_COLORMAP (1<<11) #define U_SKIN (1<<12) #define U_EFFECTS (1<<13) #define U_LONGENTITY (1<<14) #define U_TRANS (1<<15) // nehahra // clientdata flags #define SU_VIEWHEIGHT (1<<0) #define SU_IDEALPITCH (1<<1) #define SU_PUNCH1 (1<<2) #define SU_PUNCH2 (1<<3) #define SU_PUNCH3 (1<<4) #define SU_VELOCITY1 (1<<5) #define SU_VELOCITY2 (1<<6) #define SU_VELOCITY3 (1<<7) //define SU_AIMENT (1<<8) AVAILABLE BIT #define SU_ITEMS (1<<9) #define SU_ONGROUND (1<<10) // no data follows, the bit is it #define SU_INWATER (1<<11) // no data follows, the bit is it #define SU_WEAPONFRAME (1<<12) #define SU_ARMOR (1<<13) #define SU_WEAPON (1<<14) extern const char *const svc_strings[svc_lastmsg+1]; extern const char *const svc_legacy_strings[svc_lastmsg+1]; extern const char *const svc_quake_strings[svc_lastmsg+1]; extern const char *const svc_goldsrc_strings[svc_lastmsg+1]; extern const char *const clc_strings[clc_lastmsg+1]; // FWGS extensions #define NET_EXT_SPLITSIZE (1U<<0) // set splitsize by cl_dlmax // legacy protocol definitons #define PROTOCOL_LEGACY_VERSION 48 #define svc_legacy_modelindex 31 // [index][modelpath] #define svc_legacy_soundindex 28 // [index][soundpath] #define svc_legacy_eventindex 34 // [index][eventname] #define svc_legacy_ambientsound 29 #define svc_legacy_chokecount 42 // old client specified count, new just sends svc_choke #define svc_legacy_event 27 // playback event queue #define svc_legacy_changing 3 // changelevel by server request #define clc_legacy_userinfo 6 // [[userinfo string] #define SND_LEGACY_LARGE_INDEX (1<<2) // a send sound as short #define MAX_LEGACY_ENTITY_BITS 12 #define MAX_LEGACY_WEAPON_BITS 5 #define MAX_LEGACY_MODEL_BITS 11 #define MAX_LEGACY_TOTAL_CMDS 16 // 28 - 16 = 12 real legacy max backup #define MAX_LEGACY_BACKUP_CMDS 12 #define MAX_LEGACY_EDICTS (1 << MAX_LEGACY_ENTITY_BITS) // 4096 edicts #define MIN_LEGACY_EDICTS 30 // legacy engine features that can be implemented through currently supported features #define ENGINE_LEGACY_FEATURES_MASK \ ( ENGINE_WRITE_LARGE_COORD \ | ENGINE_LOAD_DELUXEDATA \ | ENGINE_LARGE_LIGHTMAPS \ | ENGINE_COMPENSATE_QUAKE_BUG \ | ENGINE_COMPUTE_STUDIO_LERP ) // Master Server protocol #define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0" // TODO: implement IP filter // GoldSrc protocol definitions #define PROTOCOL_GOLDSRC_VERSION 48 #define svc_goldsrc_version svc_changing #define svc_goldsrc_serverinfo svc_serverdata #define svc_goldsrc_deltadescription svc_deltatable #define svc_goldsrc_stopsound svc_resource #define svc_goldsrc_damage svc_restoresound #define svc_goldsrc_killedmonster 27 #define svc_goldsrc_foundsecret 28 #define svc_goldsrc_spawnstaticsound 29 #define svc_goldsrc_decalname svc_bspdecal #define svc_goldsrc_newusermsg svc_usermessage #define svc_goldsrc_newmovevars svc_deltamovevars #define svc_goldsrc_sendextrainfo 54 #define svc_goldsrc_timescale 55 #define svc_goldsrc_sendcvarvalue svc_querycvarvalue #define svc_goldsrc_sendcvarvalue2 svc_querycvarvalue2 #define clc_goldsrc_hltv clc_requestcvarvalue // 9 #define clc_goldsrc_requestcvarvalue clc_requestcvarvalue2 // 10 #define clc_goldsrc_requestcvarvalue2 11 #define clc_goldsrc_lastmsg 11 #define MAX_GOLDSRC_BACKUP_CMDS 8 #define MAX_GOLDSRC_TOTAL_CMDS 16 #define MAX_GOLDSRC_MODEL_BITS 10 #define MAX_GOLDSRC_RESOURCE_BITS 12 #define MAX_GOLDSRC_ENTITY_BITS 11 // #define MAX_GOLDSRC_EDICTS BIT( MAX_ENTITY_BITS ) #define MAX_GOLDSRC_EDICTS ( BIT( MAX_ENTITY_BITS ) + ( MAX_CLIENTS * 15 )) #define LAST_GOLDSRC_EDICT ( BIT( MAX_ENTITY_BITS ) - 1 ) // from any to any (must be handled on both server and client) #define A2A_PING "ping" // reply with A2A_ACK #define A2A_ACK "ack" // no-op #define A2A_INFO "info" // different format for client and server, see code #define A2A_NETINFO "netinfo" // different format for client and server, see code #define A2A_GOLDSRC_PING "i" // reply with A2A_GOLDSRC_ACK #define A2A_GOLDSRC_ACK "j" // no-op // from any to server #define A2S_GOLDSRC_INFO "TSource Engine Query" #define A2S_GOLDSRC_RULES 'V' #define A2S_GOLDSRC_PLAYERS 'U' // from server to any #define S2A_GOLDSRC_INFO 'I' #define S2A_GOLDSRC_RULES 'E' #define S2A_GOLDSRC_PLAYERS 'D' // from master to server #define M2S_CHALLENGE "s" #define M2S_NAT_CONNECT "c" // from server to master #define S2M_INFO "0\n" // from client to server #define C2S_BANDWIDTHTEST "bandwidth" #define C2S_GETCHALLENGE "getchallenge" #define C2S_CONNECT "connect" #define C2S_RCON "rcon" // from server to client #define S2C_BANDWIDTHTEST "testpacket" #define S2C_CHALLENGE "challenge" #define S2C_CONNECTION "client_connect" #define S2C_ERRORMSG "errormsg" #define S2C_REJECT "disconnect" #define S2C_GOLDSRC_REJECT_BADPASSWORD '8' #define S2C_GOLDSRC_REJECT '9' #define S2C_GOLDSRC_CHALLENGE "A00000000" #define S2C_GOLDSRC_CONNECTION "B" // from any to client #define A2C_PRINT "print" #define A2C_GOLDSRC_PRINT 'l' // from master to client #define M2A_SERVERSLIST "f" #endif//NET_PROTOCOL_H