1//====== Copyright Valve Corporation, All rights reserved. ==================== 2// 3// Wire format messages for Steam networking sockets. 4// These messages are used for all connection types (relayed and direct) 5// 6//============================================================================= 7syntax = "proto2"; 8option optimize_for = SPEED; 9 10import "steamnetworkingsockets_messages_certs.proto"; 11 12// We don't use the service generation functionality 13option cc_generic_services = false; 14 15// Different crypto ciphers we support 16enum ESteamNetworkingSocketsCipher 17{ 18 k_ESteamNetworkingSocketsCipher_INVALID = 0; // Dummy value 19 k_ESteamNetworkingSocketsCipher_NULL = 1; // No encryption or authentication 20 k_ESteamNetworkingSocketsCipher_AES_256_GCM = 2; // AES256 in GCM mode with 12-byte security tag. Basically equivalent to TLS_AES_256_GCM_xxx 21 //k_ESteamNetworkingSocketsCipher_CHACHA20_POLY1305 = 3; 22}; 23 24// Used in crypto handshake. Clients describe what they are willing to use, 25// servers decide what will be used, and reply with the negotiated values. 26message CMsgSteamDatagramSessionCryptInfo 27{ 28 29 // Key used for Diffie-Hellman key exchange. Typically this should be an 30 // ephemeral key used only for this connection. 31 enum EKeyType 32 { 33 INVALID = 0; 34 CURVE25519 = 1; 35 }; 36 optional EKeyType key_type = 1; 37 optional bytes key_data = 2; 38 39 optional fixed64 nonce = 3; // Additional nonce used for key generation 40 optional uint32 protocol_version = 4; // Protocol version used. Must match the version in the header 41 42 /// Clients specify the list of ciphers, in preference order. 43 /// Servers will specify only the single cipher they selected (assuming they allowed the connection). 44 /// If this list is empty (legacy client), then it should be interpreted the same 45 /// as if there were a single entry with k_ESteamNetworkingSocketsCipher_AES_256_GCM 46 repeated ESteamNetworkingSocketsCipher ciphers = 5; 47}; 48 49// Session keys used in key exchange 50message CMsgSteamDatagramSessionCryptInfoSigned 51{ 52 /// Serialized CMsgSteamDatagramSessionCryptInfo 53 optional bytes info = 1; 54 55 /// Signature of encryption_key_data generated using the public key 56 /// from the CMsgSteamDatagramCertificate. 57 optional bytes signature = 2; 58} 59 60// k_ESteamDatagramMsg_Diagnostic 61message CMsgSteamDatagramDiagnostic 62{ 63 optional uint32 severity = 1; // Standard Steam emit levels: 1 = error, 2 = warning, 3 = info, 4 = verbose 64 optional string text = 2; // Message text 65}; 66 67/// Wire version of SteamDatagramLinkInstantaneousStats. 68/// We use integers instead of floats to send this stuff, 69/// so that most fields take 1 or 2 bytes, instead of 70/// always taking 4. 71message CMsgSteamDatagramLinkInstantaneousStats 72{ 73 optional uint32 out_packets_per_sec_x10 = 1; 74 optional uint32 out_bytes_per_sec = 2; 75 optional uint32 in_packets_per_sec_x10 = 3; 76 optional uint32 in_bytes_per_sec = 4; 77 optional uint32 ping_ms = 5; 78 optional uint32 packets_dropped_pct = 6; // 0 ... 100 79 optional uint32 packets_weird_sequence_pct = 7; // 0 ... 100 80 optional uint32 peak_jitter_usec = 8; 81}; 82 83/// Wire version of SteamDatagramLinkLifetimeStats 84message CMsgSteamDatagramLinkLifetimeStats 85{ 86 //optional uint32 rms_ping_ms = 1; 87 88 // Duration of the connection (so far, if we are still connected). 89 // This is primarily used when reporting end-to-end stats to relays, 90 // who may not have been involved with the connection for its entire 91 // duration 92 optional uint32 connected_seconds = 2; 93 94 // Packet counters 95 optional uint64 packets_sent = 3; 96 optional uint64 kb_sent = 4; 97 optional uint64 packets_recv = 5; 98 optional uint64 kb_recv = 6; 99 optional uint64 packets_recv_sequenced = 7; 100 optional uint64 packets_recv_dropped = 8; 101 optional uint64 packets_recv_out_of_order = 9; 102 optional uint64 packets_recv_duplicate = 10; 103 optional uint64 packets_recv_lurch = 11; 104 105 /// Histogram of connection quality. Here we count up the number 106 /// of connection quality measurement intervals (about 5 seconds) 107 /// that fell into each quality measurement. Quality measurment 108 /// is the percentage of packets that were delivered, in order, 109 /// without being duplicated 110 optional uint32 quality_histogram_100 = 21; // This means everything was perfect. Even if we delivered over 100 packets in the interval and we should round up to 100, we will use 99% instead. 111 optional uint32 quality_histogram_99 = 22; // 99%+ 112 optional uint32 quality_histogram_97 = 23; 113 optional uint32 quality_histogram_95 = 24; 114 optional uint32 quality_histogram_90 = 25; 115 optional uint32 quality_histogram_75 = 26; 116 optional uint32 quality_histogram_50 = 27; 117 optional uint32 quality_histogram_1 = 28; 118 optional uint32 quality_histogram_dead = 29; // we received nothing during the interval; it looks like the connection dropped 119 optional uint32 quality_ntile_2nd = 30; // 2% of measurement intervals had quality <= N% 120 optional uint32 quality_ntile_5th = 31; // 5% of measurement intervals had quality <= N% 121 optional uint32 quality_ntile_25th = 32; // 25% of measurement intervals had quality <= N% 122 optional uint32 quality_ntile_50th = 33; // 50% of measurement intervals had quality <= N% 123 124 /// Distribution of ping times. Basically we make sure we take a ping measurement 125 /// at a minimum interval, and then we build a distribution of all the samples. 126 /// Note that we don't take great care to ensure that the samples are taken 127 /// perfectly evenly, but they should be reasonably even. 128 optional uint32 ping_histogram_25 = 41; // 0..25 129 optional uint32 ping_histogram_50 = 42; // 26..50 130 optional uint32 ping_histogram_75 = 43; // 51..75 131 optional uint32 ping_histogram_100 = 44; // etc 132 optional uint32 ping_histogram_125 = 45; 133 optional uint32 ping_histogram_150 = 46; 134 optional uint32 ping_histogram_200 = 47; 135 optional uint32 ping_histogram_300 = 48; 136 optional uint32 ping_histogram_max = 49; // >300 137 optional uint32 ping_ntile_5th = 50; // 5% of ping samples were <= Nms 138 optional uint32 ping_ntile_50th = 51; // 50% of ping samples were <= Nms 139 optional uint32 ping_ntile_75th = 52; // 70% of ping samples were <= Nms 140 optional uint32 ping_ntile_95th = 53; // 95% of ping samples were <= Nms 141 optional uint32 ping_ntile_98th = 54; // 98% of ping samples were <= Nms 142 143 /// Jitter distribution. 144 optional uint32 jitter_histogram_negligible = 61; // <1ms 145 optional uint32 jitter_histogram_1 = 62; // 1..2 146 optional uint32 jitter_histogram_2 = 63; // 2..5 147 optional uint32 jitter_histogram_5 = 64; // 5..10 148 optional uint32 jitter_histogram_10 = 65; // 10..20 149 optional uint32 jitter_histogram_20 = 66; // 20+ 150 151 /// Transmit speed 152 optional uint32 txspeed_max = 67; 153 154 optional uint32 txspeed_histogram_16 = 68; // speed at kb/s 155 optional uint32 txspeed_histogram_32 = 69; 156 optional uint32 txspeed_histogram_64 = 70; 157 optional uint32 txspeed_histogram_128 = 71; 158 optional uint32 txspeed_histogram_256 = 72; 159 optional uint32 txspeed_histogram_512 = 73; 160 optional uint32 txspeed_histogram_1024 = 74; 161 optional uint32 txspeed_histogram_max = 75; 162 163 // distribution. some might be -1, see above for why. 164 optional uint32 txspeed_ntile_5th = 76; // 5% of transmit samples were <= n kb/s 165 optional uint32 txspeed_ntile_50th = 77; // 50% of transmit samples were <= n kb/s 166 optional uint32 txspeed_ntile_75th = 78; // 70% of transmit samples were <= n kb/s 167 optional uint32 txspeed_ntile_95th = 79; // 95% of transmit samples were <= n kb/s 168 optional uint32 txspeed_ntile_98th = 80; // 98% of transmit samples were <= n kb/s 169 170 // 171 // Receive speed 172 // 173 optional uint32 rxspeed_max = 81; // max speed we hit that formed the histogram 174 175 optional uint32 rxspeed_histogram_16 = 82; // speed at kb/s 176 optional uint32 rxspeed_histogram_32 = 83; 177 optional uint32 rxspeed_histogram_64 = 84; 178 optional uint32 rxspeed_histogram_128 = 85; 179 optional uint32 rxspeed_histogram_256 = 86; 180 optional uint32 rxspeed_histogram_512 = 87; 181 optional uint32 rxspeed_histogram_1024 = 88; 182 optional uint32 rxspeed_histogram_max = 89; 183 184 // distribution. some might be -1, see above for why. 185 optional uint32 rxspeed_ntile_5th = 90; // 5% of transmit samples were <= n kb/s 186 optional uint32 rxspeed_ntile_50th = 91; // 50% of transmit samples were <= n kb/s 187 optional uint32 rxspeed_ntile_75th = 92; // 70% of transmit samples were <= n kb/s 188 optional uint32 rxspeed_ntile_95th = 93; // 95% of transmit samples were <= n kb/s 189 optional uint32 rxspeed_ntile_98th = 94; // 98% of transmit samples were <= n kb/s 190}; 191 192/// Message containing connection quality related messages 193/// (possibly inline with a data packet) 194message CMsgSteamDatagramConnectionQuality 195{ 196 optional CMsgSteamDatagramLinkInstantaneousStats instantaneous = 1; 197 optional CMsgSteamDatagramLinkLifetimeStats lifetime = 2; 198 //optional uint32 seqnum_ack_lifetime = 3; 199}; 200 201// ICE rendezvous message, sent reliably 202// FIXME - should use oneof when it is available in all branches we care about 203message CMsgICERendezvous 204{ 205 // Auth info used for STUN to avoid crossing the streams. 206 // This is sent very early in the handshake (in the ConnectRequest / ConnectOKC) 207 message Auth 208 { 209 optional string pwd_frag = 1; 210 } 211 optional Auth auth = 2; 212 213 // ICE candidate 214 message Candidate 215 { 216 //optional string sdpm_id = 1; 217 //optional uint32 sdpm_line_index = 2; 218 optional string candidate = 3; 219 } 220 optional Candidate add_candidate = 1; 221 //optional Candidate remove_candidate = 2; 222}; 223 224/// Introducer message sent through trusted 3rd party (Steam, or some other custom signaling) 225message CMsgSteamNetworkingP2PRendezvous 226{ 227 // Identity of who this is from 228 optional string from_identity = 8; 229 230 // Connection this is from 231 optional fixed32 from_connection_id = 9; 232 233 // Destination identity, if I know it 234 optional string to_identity = 10; 235 236 // Destination connection ID, if I know it. 237 optional fixed32 to_connection_id = 1; 238 239 // SDR routing information. (Serialized CMsgSteamDatagramP2PRoutes) 240 optional bytes sdr_routes = 2; 241 242 // This is the latest SDR route revision I have for you. 243 // On older clients this might not always be present, until they have 244 // received some SDR routes. Newer clients always populate this, if 245 // they are willing to do SDR peer-to-peer routing. 246 optional uint32 ack_peer_routes_revision = 3; 247 248 // Is ICE enabled? 249 optional bool ice_enabled = 7; 250 251 // I'm a hosted dedicated server. Please use 252 // the more optimal path to talk to me. 253 optional bytes hosted_server_ticket = 14; // CMsgSteamDatagramSignedRelayAuthTicket 254 255 // Connect request 256 message ConnectRequest 257 { 258 optional CMsgSteamDatagramSessionCryptInfoSigned crypt = 6; 259 optional CMsgSteamDatagramCertificateSigned cert = 7; 260 optional uint32 to_virtual_port = 9; 261 optional uint32 from_virtual_port = 10; 262 }; 263 optional ConnectRequest connect_request = 4; 264 265 message ConnectOK 266 { 267 optional CMsgSteamDatagramSessionCryptInfoSigned crypt = 5; 268 optional CMsgSteamDatagramCertificateSigned cert = 6; 269 }; 270 optional ConnectOK connect_ok = 5; 271 272 // Graceful close 273 message ConnectionClosed 274 { 275 optional string debug = 5; 276 optional uint32 reason_code = 6; 277 278 // End-to-End connection data 279 //optional CMsgSteamDatagramConnectionQuality quality_e2e = 18; 280 }; 281 optional ConnectionClosed connection_closed = 6; 282 283 // 284 // Generic reliable message stream 285 // 286 287 // Last message that we have received 288 optional uint32 ack_reliable_msg = 11; 289 290 // ID of first message we are sending (if any) 291 optional uint32 first_reliable_msg = 12; 292 293 // A reliable message. 294 // FIXME - should use oneof when it is available in all branches we care about 295 message ReliableMessage 296 { 297 optional CMsgICERendezvous ice = 1; // Currently only ICE uses the reliable message stream, but this may change 298 } 299 repeated ReliableMessage reliable_messages = 13; 300}; 301 302// A summary of what happened in an ICE session, for analytics 303message CMsgSteamNetworkingICESessionSummary 304{ 305 // What was the overall outcome of ICE? 306 // Should always be set. Will be zero if 307 // ICE succeeded 308 optional uint32 failure_reason_code = 7; // ESteamNetConnectionEnd (or special internal value), if we failed in some way 309 310 // What types of candidates were we able to gather? 311 // Should always be present if this message is sent 312 optional uint32 local_candidate_types = 1; // k_EICECandidate_xxx 313 314 // What types of candidates did we receive from peer? 315 optional uint32 remote_candidate_types = 2; // k_EICECandidate_xxx 316 317 // Initial route type, and ping, when when we first pierced NAT. 318 // Will not be present if we never pierced NAT 319 optional uint32 initial_route_kind = 3; // ESteamNetTransportKind 320 optional uint32 initial_ping = 4; 321 optional uint32 initial_score = 6; 322 optional uint32 negotiation_ms = 5; // How long did it take to get a NAT traversal result (either success or failure) 323 324 // Best route and score we ever had over the life of the connection 325 optional uint32 best_route_kind = 16; // ESteamNetTransportKind 326 optional uint32 best_ping = 17; 327 optional uint32 best_score = 18; 328 optional uint32 best_time = 19; // seconds into the connections when this happened 329 330 // How long were we the selcted transport? 331 optional uint32 selected_seconds = 12; 332 333 // User options that were in effect, applied to this connection. 334 // (Meaning depends on platform.) 335 optional uint32 user_settings = 13; 336 337 // Value of the P2P_Transport_ICE_Enable connection configuration value that was set, or determined 338 // from user settings 339 optional uint32 ice_enable_var = 14; 340 341 // What sorts of candidates were we allowed to gather, based on user settings AND local configuration 342 optional uint32 local_candidate_types_allowed = 15; // // k_EICECandidate_xxx 343}; 344 345// Do not remove this comment due to a bug on the Mac OS X protobuf compiler 346 347