1//====== Copyright Valve Corporation, All rights reserved. ====================
2//
3// Wire format messages for Steam Networking sockets connections
4// over direct UDP (not relayed).
5//
6//=============================================================================
7syntax = "proto2";
8option optimize_for = SPEED;
9
10// We don't use the service generation functionality
11option cc_generic_services = false;
12
13import "steamnetworkingsockets_messages_certs.proto";
14import "steamnetworkingsockets_messages.proto";
15
16/// Control message ID.
17enum ESteamNetworkingUDPMsgID
18{
19	// Steam networking using direct UDP connect
20	k_ESteamNetworkingUDPMsg_ChallengeRequest = 32;			// Client->server
21	k_ESteamNetworkingUDPMsg_ChallengeReply = 33;			// Server->client
22	k_ESteamNetworkingUDPMsg_ConnectRequest = 34;			// Client->server
23	k_ESteamNetworkingUDPMsg_ConnectOK = 35;				// Server->client
24	k_ESteamNetworkingUDPMsg_ConnectionClosed = 36;			// Client<->server.  A reply is requested to this packet
25	k_ESteamNetworkingUDPMsg_NoConnection = 37;				// Client<->server.  A reply should never be sent to this packet
26};
27
28// k_ESteamNetworkingUDPMsg_ChallengeRequest
29message CMsgSteamSockets_UDP_ChallengeRequest
30{
31	optional fixed32 connection_id = 1;
32	//optional fixed64 client_steam_id = 2;
33	optional fixed64 my_timestamp = 3; // Please send this back to me
34
35	// Version of the code I'm running
36	optional uint32 protocol_version = 4;
37};
38
39// k_ESteamNetworkingUDPMsg_ChallengeReply
40message CMsgSteamSockets_UDP_ChallengeReply
41{
42	optional fixed32 connection_id = 1;
43	optional fixed64 challenge = 2;
44	//optional uint32 required_proof_of_work_bits = 3;
45	optional fixed64 your_timestamp = 3; // the my_timestamp you sent to us in ChallengeRequest
46
47	// Version of the code I'm running
48	optional uint32 protocol_version = 4;
49};
50
51// k_ESteamNetworkingUDPMsg_ConnectRequest
52message CMsgSteamSockets_UDP_ConnectRequest
53{
54	optional fixed32 client_connection_id = 1;
55	optional fixed64 challenge = 2;
56	//optional fixed64 proof_of_work = 4;
57	optional fixed64 my_timestamp = 5; // Please send this back to me
58	optional uint32 ping_est_ms = 6; // My estimate of the ping time
59
60	/// My ephemeral keys, and any crypto parameter negotiation.
61	optional CMsgSteamDatagramSessionCryptInfoSigned crypt = 7;
62
63	/// Certificate that contains:
64	/// - my public key.
65	/// - my identity, if certificate was issued to a single user
66	/// - signature of a CA, if authenticated connection is being attempted.
67	optional CMsgSteamDatagramCertificateSigned cert = 4;
68
69	// Version of the code I'm running.  This has been moved into the
70	// signed crypt parameters so that it could not be forged.
71	optional uint32 legacy_protocol_version = 8;
72
73	// Identity of host making connect request is in the cert, usually.
74	// (Even if cert is unsigned.)  But, if cert was not issued to my specific
75	// identity (e.g. it is for all gameservers in a data center, etc) then
76	// I need to communicate my identity seperately.
77	optional string identity_string = 10;
78
79	//
80	// Legacy fields
81	//
82
83	optional fixed64 legacy_client_steam_id = 3;
84	optional CMsgSteamNetworkingIdentityLegacyBinary legacy_identity_binary = 9;
85};
86
87// k_ESteamDatagramMsg_UDP_ConnectOK
88message CMsgSteamSockets_UDP_ConnectOK
89{
90	optional fixed32 client_connection_id = 1;
91	optional fixed32 server_connection_id = 5;
92	optional fixed64 your_timestamp = 3; // the timestamp (or whatever) you send to us in ConnectRequest
93	optional uint32 delay_time_usec = 4; // number of microseconds between when we received your request and we replied
94
95	/// My ephemeral keys, and any crypto parameter negotiation.
96	optional CMsgSteamDatagramSessionCryptInfoSigned crypt = 7;
97
98	/// Certificate used to prove my identity
99	optional CMsgSteamDatagramCertificateSigned cert = 8;
100
101	// Identity of server is in the cert, usually.
102	// (Even if cert is unsigned.)  But, if cert was not issued to my specific
103	// identity (e.g. it is for all gameservers in a data center, etc) then
104	// I need to communicate my identity seperately.
105	optional string identity_string = 11;
106
107	//
108	// Legacy fields
109	//
110
111	optional fixed64 legacy_server_steam_id = 2;
112	//optional uint32 protocol_version = 9; // moved into crypt, to prevent tampering
113	optional CMsgSteamNetworkingIdentityLegacyBinary legacy_identity_binary = 10;
114};
115
116// k_ESteamDatagramMsg_UDP_ConnectionClosed
117message CMsgSteamSockets_UDP_ConnectionClosed
118{
119	//optional fixed32 legacy_client_connection_id = 1;
120	optional fixed32 to_connection_id = 4;
121	optional fixed32 from_connection_id = 5;
122	optional string debug = 2;
123	optional uint32 reason_code = 3;
124};
125
126// k_ESteamDatagramMsg_UDP_NoConnection
127message CMsgSteamSockets_UDP_NoConnection
128{
129	//optional fixed32 legacy_client_connection_id = 1; // The client-side connection ID
130	optional fixed32 from_connection_id = 2; // "My" portion of the connection ID you tried to use (always present), but that connection doesn't exist or has been closed.
131	optional fixed32 to_connection_id = 3; // Your portion of the connection ID you sent (if any)
132};
133
134message CMsgSteamSockets_UDP_Stats
135{
136	// End to end stats
137	optional CMsgSteamDatagramConnectionQuality stats = 1;
138
139	enum Flags
140	{
141		//ACK_REQUEST_RELAY = 1; // Reserved
142		ACK_REQUEST_E2E = 2;
143		ACK_REQUEST_IMMEDIATE = 4;
144		//NOT_PRIMARY_SESSION = 8; // Reserved
145		NOT_PRIMARY_TRANSPORT_E2E = 16;
146	};
147
148	/// Additional flags.  Should we try to put these in the
149	/// message header and save a few bytes?
150	optional uint32 flags = 3;
151};
152
153// Do not remove this comment due to a bug on the Mac OS X protobuf compiler
154
155