8ad1d53a57e52f4e9342c7aa138c1208700d8f45
[henge/webcc.git] / src / proto / netmessages_public.proto
1 //====== Copyright (c) 2013, Valve Corporation, All rights reserved. ========//
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are met:
5 //
6 // Redistributions of source code must retain the above copyright notice, this
7 // list of conditions and the following disclaimer.
8 // Redistributions in binary form must reproduce the above copyright notice,
9 // this list of conditions and the following disclaimer in the documentation
10 // and/or other materials provided with the distribution.
11 //
12 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
16 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
22 // THE POSSIBILITY OF SUCH DAMAGE.
23 //===========================================================================//
24 //
25 // Purpose: The file defines our Google Protocol Buffers which are used in over
26 // the wire messages for the Source engine.
27 //
28 //=============================================================================
29
30 // Note about encoding:
31 // http://code.google.com/apis/protocolbuffers/docs/encoding.html
32 //
33 // TL;DR: Use sint32/sint64 for values that may be negative.
34 //
35 // There is an important difference between the signed int types (sint32 and sint64)
36 // and the "standard" int types (int32 and int64) when it comes to encoding negative
37 // numbers. If you use int32 or int64 as the type for a negative number, the
38 // resulting varint is always ten bytes long \96 it is, effectively, treated like a
39 // very large unsigned integer. If you use one of the signed types, the resulting
40 // varint uses ZigZag encoding, which is much more efficient.
41
42
43 // Commenting this out allows it to be compiled for SPEED or LITE_RUNTIME.
44 // option optimize_for = SPEED;
45
46 // We don't use the service generation functionality
47 option cc_generic_services = false;
48
49
50 //
51 // STYLE NOTES:
52 //
53 // Use CamelCase CMsgMyMessageName style names for messages.
54 //
55 // Use lowercase _ delimited names like my_steam_id for field names, this is non-standard for Steam,
56 // but plays nice with the Google formatted code generation.
57 //
58 // Try not to use required fields ever. Only do so if you are really really sure you'll never want them removed.
59 // Optional should be preffered as it will make versioning easier and cleaner in the future if someone refactors
60 // your message and wants to remove or rename fields.
61 //
62 // Use fixed64 for JobId_t, GID_t, or SteamID. This is appropriate for any field that is normally
63 // going to be larger than 2^56. Otherwise use int64 for 64 bit values that are frequently smaller
64 // than 2^56 as it will safe space on the wire in those cases.
65 //
66 // Similar to fixed64, use fixed32 for RTime32 or other 32 bit values that are frequently larger than
67 // 2^28. It will safe space in those cases, otherwise use int32 which will safe space for smaller values.
68 // An exception to this rule for RTime32 is if the value will frequently be zero rather than set to an actual
69 // time.
70 //
71
72 import "google/protobuf/descriptor.proto";
73
74 enum NET_Messages {
75 net_NOP = 0;
76 net_Disconnect = 1;
77 net_File = 2;
78 net_SplitScreenUser = 3;
79 net_Tick = 4;
80 net_StringCmd = 5;
81 net_SetConVar = 6;
82 net_SignonState = 7;
83 net_PlayerAvatarData = 100;
84 }
85
86 enum CLC_Messages {
87 clc_ClientInfo = 8;
88 clc_Move = 9;
89 clc_VoiceData = 10;
90 clc_BaselineAck = 11;
91 clc_ListenEvents = 12;
92 clc_RespondCvarValue = 13;
93 clc_FileCRCCheck = 14;
94 clc_LoadingProgress = 15;
95 clc_SplitPlayerConnect = 16;
96 clc_ClientMessage = 17;
97 clc_CmdKeyValues = 18;
98 clc_HltvReplay = 20;
99 }
100
101 enum VoiceDataFormat_t {
102 VOICEDATA_FORMAT_STEAM = 0;
103 VOICEDATA_FORMAT_ENGINE = 1;
104 }
105
106 enum ESplitScreenMessageType {
107 option allow_alias = true;
108 MSG_SPLITSCREEN_ADDUSER = 0;
109 MSG_SPLITSCREEN_REMOVEUSER = 1;
110 MSG_SPLITSCREEN_TYPE_BITS = 1;
111 }
112
113 enum SVC_Messages {
114 svc_ServerInfo = 8;
115 svc_SendTable = 9;
116 svc_ClassInfo = 10;
117 svc_SetPause = 11;
118 svc_CreateStringTable = 12;
119 svc_UpdateStringTable = 13;
120 svc_VoiceInit = 14;
121 svc_VoiceData = 15;
122 svc_Print = 16;
123 svc_Sounds = 17;
124 svc_SetView = 18;
125 svc_FixAngle = 19;
126 svc_CrosshairAngle = 20;
127 svc_BSPDecal = 21;
128 svc_SplitScreen = 22;
129 svc_UserMessage = 23;
130 svc_EntityMessage = 24;
131 svc_GameEvent = 25;
132 svc_PacketEntities = 26;
133 svc_TempEntities = 27;
134 svc_Prefetch = 28;
135 svc_Menu = 29;
136 svc_GameEventList = 30;
137 svc_GetCvarValue = 31;
138 svc_PaintmapData = 33;
139 svc_CmdKeyValues = 34;
140 svc_EncryptedData = 35;
141 svc_HltvReplay = 36;
142 }
143
144 enum ReplayEventType_t {
145 REPLAY_EVENT_CANCEL = 0;
146 REPLAY_EVENT_DEATH = 1;
147 REPLAY_EVENT_GENERIC = 2;
148 REPLAY_EVENT_STUCK_NEED_FULL_UPDATE = 3;
149 }
150
151 message CMsgVector {
152 optional float x = 1;
153 optional float y = 2;
154 optional float z = 3;
155 }
156
157 message CMsgVector2D {
158 optional float x = 1;
159 optional float y = 2;
160 }
161
162 message CMsgQAngle {
163 optional float x = 1;
164 optional float y = 2;
165 optional float z = 3;
166 }
167
168 message CMsgRGBA {
169 optional int32 r = 1;
170 optional int32 g = 2;
171 optional int32 b = 3;
172 optional int32 a = 4;
173 }
174
175 message CNETMsg_Tick {
176 optional uint32 tick = 1;
177 optional uint32 host_computationtime = 4;
178 optional uint32 host_computationtime_std_deviation = 5;
179 optional uint32 host_framestarttime_std_deviation = 6;
180 optional uint32 hltv_replay_flags = 7;
181 }
182
183 message CNETMsg_StringCmd {
184 optional string command = 1;
185 }
186
187 message CNETMsg_SignonState {
188 optional uint32 signon_state = 1;
189 optional uint32 spawn_count = 2;
190 optional uint32 num_server_players = 3;
191 repeated string players_networkids = 4;
192 optional string map_name = 5;
193 }
194
195 message CMsg_CVars {
196 message CVar {
197 optional string name = 1;
198 optional string value = 2;
199 optional uint32 dictionary_name = 3;
200 }
201
202 repeated .CMsg_CVars.CVar cvars = 1;
203 }
204
205 message CNETMsg_SetConVar {
206 optional .CMsg_CVars convars = 1;
207 }
208
209 message CNETMsg_NOP {
210 }
211
212 message CNETMsg_Disconnect {
213 optional string text = 1;
214 }
215
216 message CNETMsg_File {
217 optional int32 transfer_id = 1;
218 optional string file_name = 2;
219 optional bool is_replay_demo_file = 3;
220 optional bool deny = 4;
221 }
222
223 message CNETMsg_SplitScreenUser {
224 optional int32 slot = 1;
225 }
226
227 message CNETMsg_PlayerAvatarData {
228 optional uint32 accountid = 1;
229 optional bytes rgb = 2;
230 }
231
232 message CCLCMsg_ClientInfo {
233 optional fixed32 send_table_crc = 1;
234 optional uint32 server_count = 2;
235 optional bool is_hltv = 3;
236 optional bool is_replay = 4;
237 optional uint32 friends_id = 5;
238 optional string friends_name = 6;
239 repeated fixed32 custom_files = 7;
240 }
241
242 message CCLCMsg_Move {
243 optional uint32 num_backup_commands = 1;
244 optional uint32 num_new_commands = 2;
245 optional bytes data = 3;
246 }
247
248 message CCLCMsg_VoiceData {
249 optional bytes data = 1;
250 optional fixed64 xuid = 2;
251 optional .VoiceDataFormat_t format = 3 [default = VOICEDATA_FORMAT_ENGINE];
252 optional int32 sequence_bytes = 4;
253 optional uint32 section_number = 5;
254 optional uint32 uncompressed_sample_offset = 6;
255 }
256
257 message CCLCMsg_BaselineAck {
258 optional int32 baseline_tick = 1;
259 optional int32 baseline_nr = 2;
260 }
261
262 message CCLCMsg_ListenEvents {
263 repeated fixed32 event_mask = 1;
264 }
265
266 message CCLCMsg_RespondCvarValue {
267 optional int32 cookie = 1;
268 optional int32 status_code = 2;
269 optional string name = 3;
270 optional string value = 4;
271 }
272
273 message CCLCMsg_FileCRCCheck {
274 optional int32 code_path = 1;
275 optional string path = 2;
276 optional int32 code_filename = 3;
277 optional string filename = 4;
278 optional int32 file_fraction = 5;
279 optional bytes md5 = 6;
280 optional uint32 crc = 7;
281 optional int32 file_hash_type = 8;
282 optional int32 file_len = 9;
283 optional int32 pack_file_id = 10;
284 optional int32 pack_file_number = 11;
285 }
286
287 message CCLCMsg_LoadingProgress {
288 optional int32 progress = 1;
289 }
290
291 message CCLCMsg_SplitPlayerConnect {
292 optional .CMsg_CVars convars = 1;
293 }
294
295 message CCLCMsg_CmdKeyValues {
296 optional bytes keyvalues = 1;
297 }
298
299 message CSVCMsg_ServerInfo {
300 optional int32 protocol = 1;
301 optional int32 server_count = 2;
302 optional bool is_dedicated = 3;
303 optional bool is_official_valve_server = 4;
304 optional bool is_hltv = 5;
305 optional bool is_replay = 6;
306 optional bool is_redirecting_to_proxy_relay = 21;
307 optional int32 c_os = 7;
308 optional fixed32 map_crc = 8;
309 optional fixed32 client_crc = 9;
310 optional fixed32 string_table_crc = 10;
311 optional int32 max_clients = 11;
312 optional int32 max_classes = 12;
313 optional int32 player_slot = 13;
314 optional float tick_interval = 14;
315 optional string game_dir = 15;
316 optional string map_name = 16;
317 optional string map_group_name = 17;
318 optional string sky_name = 18;
319 optional string host_name = 19;
320 optional uint32 public_ip = 20;
321 optional uint64 ugc_map_id = 22;
322 }
323
324 message CSVCMsg_ClassInfo {
325 message class_t {
326 optional int32 class_id = 1;
327 optional string data_table_name = 2;
328 optional string class_name = 3;
329 }
330
331 optional bool create_on_client = 1;
332 repeated .CSVCMsg_ClassInfo.class_t classes = 2;
333 }
334
335 message CSVCMsg_SendTable {
336 message sendprop_t {
337 optional int32 type = 1;
338 optional string var_name = 2;
339 optional int32 flags = 3;
340 optional int32 priority = 4;
341 optional string dt_name = 5;
342 optional int32 num_elements = 6;
343 optional float low_value = 7;
344 optional float high_value = 8;
345 optional int32 num_bits = 9;
346 }
347
348 optional bool is_end = 1;
349 optional string net_table_name = 2;
350 optional bool needs_decoder = 3;
351 repeated .CSVCMsg_SendTable.sendprop_t props = 4;
352 }
353
354 message CSVCMsg_Print {
355 optional string text = 1;
356 }
357
358 message CSVCMsg_SetPause {
359 optional bool paused = 1;
360 }
361
362 message CSVCMsg_SetView {
363 optional int32 entity_index = 1;
364 }
365
366 message CSVCMsg_CreateStringTable {
367 optional string name = 1;
368 optional int32 max_entries = 2;
369 optional int32 num_entries = 3;
370 optional bool user_data_fixed_size = 4;
371 optional int32 user_data_size = 5;
372 optional int32 user_data_size_bits = 6;
373 optional int32 flags = 7;
374 optional bytes string_data = 8;
375 }
376
377 message CSVCMsg_UpdateStringTable {
378 optional int32 table_id = 1;
379 optional int32 num_changed_entries = 2;
380 optional bytes string_data = 3;
381 }
382
383 message CSVCMsg_VoiceInit {
384 optional int32 quality = 1;
385 optional string codec = 2;
386 optional int32 version = 3 [default = 0];
387 }
388
389 message CSVCMsg_VoiceData {
390 optional int32 client = 1;
391 optional bool proximity = 2;
392 optional fixed64 xuid = 3;
393 optional int32 audible_mask = 4;
394 optional bytes voice_data = 5;
395 optional bool caster = 6;
396 optional .VoiceDataFormat_t format = 7 [default = VOICEDATA_FORMAT_ENGINE];
397 optional int32 sequence_bytes = 8;
398 optional uint32 section_number = 9;
399 optional uint32 uncompressed_sample_offset = 10;
400 }
401
402 message CSVCMsg_FixAngle {
403 optional bool relative = 1;
404 optional .CMsgQAngle angle = 2;
405 }
406
407 message CSVCMsg_CrosshairAngle {
408 optional .CMsgQAngle angle = 1;
409 }
410
411 message CSVCMsg_Prefetch {
412 optional int32 sound_index = 1;
413 }
414
415 message CSVCMsg_BSPDecal {
416 optional .CMsgVector pos = 1;
417 optional int32 decal_texture_index = 2;
418 optional int32 entity_index = 3;
419 optional int32 model_index = 4;
420 optional bool low_priority = 5;
421 }
422
423 message CSVCMsg_SplitScreen {
424 optional .ESplitScreenMessageType type = 1 [default = MSG_SPLITSCREEN_ADDUSER];
425 optional int32 slot = 2;
426 optional int32 player_index = 3;
427 }
428
429 message CSVCMsg_GetCvarValue {
430 optional int32 cookie = 1;
431 optional string cvar_name = 2;
432 }
433
434 message CSVCMsg_Menu {
435 optional int32 dialog_type = 1;
436 optional bytes menu_key_values = 2;
437 }
438
439 message CSVCMsg_UserMessage {
440 optional int32 msg_type = 1;
441 optional bytes msg_data = 2;
442 optional int32 passthrough = 3;
443 }
444
445 message CSVCMsg_PaintmapData {
446 optional bytes paintmap = 1;
447 }
448
449 message CSVCMsg_GameEvent {
450 message key_t {
451 optional int32 type = 1;
452 optional string val_string = 2;
453 optional float val_float = 3;
454 optional int32 val_long = 4;
455 optional int32 val_short = 5;
456 optional int32 val_byte = 6;
457 optional bool val_bool = 7;
458 optional uint64 val_uint64 = 8;
459 optional bytes val_wstring = 9;
460 }
461
462 optional string event_name = 1;
463 optional int32 eventid = 2;
464 repeated .CSVCMsg_GameEvent.key_t keys = 3;
465 optional int32 passthrough = 4;
466 }
467
468 message CSVCMsg_GameEventList {
469 message key_t {
470 optional int32 type = 1;
471 optional string name = 2;
472 }
473
474 message descriptor_t {
475 optional int32 eventid = 1;
476 optional string name = 2;
477 repeated .CSVCMsg_GameEventList.key_t keys = 3;
478 }
479
480 repeated .CSVCMsg_GameEventList.descriptor_t descriptors = 1;
481 }
482
483 message CSVCMsg_TempEntities {
484 optional bool reliable = 1;
485 optional int32 num_entries = 2;
486 optional bytes entity_data = 3;
487 }
488
489 message CSVCMsg_PacketEntities {
490 optional int32 max_entries = 1;
491 optional int32 updated_entries = 2;
492 optional bool is_delta = 3;
493 optional bool update_baseline = 4;
494 optional int32 baseline = 5;
495 optional int32 delta_from = 6;
496 optional bytes entity_data = 7;
497 }
498
499 message CSVCMsg_Sounds {
500 message sounddata_t {
501 optional sint32 origin_x = 1;
502 optional sint32 origin_y = 2;
503 optional sint32 origin_z = 3;
504 optional uint32 volume = 4;
505 optional float delay_value = 5;
506 optional int32 sequence_number = 6;
507 optional int32 entity_index = 7;
508 optional int32 channel = 8;
509 optional int32 pitch = 9;
510 optional int32 flags = 10;
511 optional uint32 sound_num = 11;
512 optional fixed32 sound_num_handle = 12;
513 optional int32 speaker_entity = 13;
514 optional int32 random_seed = 14;
515 optional int32 sound_level = 15;
516 optional bool is_sentence = 16;
517 optional bool is_ambient = 17;
518 }
519
520 optional bool reliable_sound = 1;
521 repeated .CSVCMsg_Sounds.sounddata_t sounds = 2;
522 }
523
524 message CSVCMsg_EntityMsg {
525 optional int32 ent_index = 1;
526 optional int32 class_id = 2;
527 optional bytes ent_data = 3;
528 }
529
530 message CSVCMsg_CmdKeyValues {
531 optional bytes keyvalues = 1;
532 }
533
534 message CSVCMsg_EncryptedData {
535 optional bytes encrypted = 1;
536 optional int32 key_type = 2;
537 }
538
539 message CSVCMsg_HltvReplay {
540 optional int32 delay = 1;
541 optional int32 primary_target = 2;
542 optional int32 replay_stop_at = 3;
543 optional int32 replay_start_at = 4;
544 optional int32 replay_slowdown_begin = 5;
545 optional int32 replay_slowdown_end = 6;
546 optional float replay_slowdown_rate = 7;
547 }
548
549 message CCLCMsg_HltvReplay {
550 optional int32 request = 1;
551 optional float slowdown_length = 2;
552 optional float slowdown_rate = 3;
553 optional int32 primary_target_ent_index = 4;
554 optional float event_time = 5;
555 }