import "steamnetworkingsockets_messages_certs.proto";
import "steamnetworkingsockets_messages.proto";

option optimize_for = SPEED;
option cc_generic_services = false;

enum ESteamDatagramMsgID {
	k_ESteamDatagramMsg_Invalid = 0;
	k_ESteamDatagramMsg_RouterPingRequest = 1;
	k_ESteamDatagramMsg_RouterPingReply = 2;
	k_ESteamDatagramMsg_GameserverPingRequest = 3;
	k_ESteamDatagramMsg_LegacyGameserverPingReply = 4;
	k_ESteamDatagramMsg_GameserverSessionRequest = 5;
	k_ESteamDatagramMsg_GameserverSessionEstablished = 6;
	k_ESteamDatagramMsg_NoSession = 7;
	k_ESteamDatagramMsg_Diagnostic = 8;
	k_ESteamDatagramMsg_DataClientToRouter = 9;
	k_ESteamDatagramMsg_DataRouterToServer = 10;
	k_ESteamDatagramMsg_DataServerToRouter = 11;
	k_ESteamDatagramMsg_DataRouterToClient = 12;
	k_ESteamDatagramMsg_Stats = 13;
	k_ESteamDatagramMsg_ClientPingSampleRequest = 14;
	k_ESteamDatagramMsg_ClientPingSampleReply = 15;
	k_ESteamDatagramMsg_ClientToRouterSwitchedPrimary = 16;
	k_ESteamDatagramMsg_RelayHealth = 17;
	k_ESteamDatagramMsg_ConnectRequest = 18;
	k_ESteamDatagramMsg_ConnectOK = 19;
	k_ESteamDatagramMsg_ConnectionClosed = 20;
	k_ESteamDatagramMsg_NoConnection = 21;
	k_ESteamDatagramMsg_RelayToRelayPingRequest = 22;
	k_ESteamDatagramMsg_RelayToRelayPingReply = 23;
	k_ESteamDatagramMsg_P2PSessionRequest = 24;
	k_ESteamDatagramMsg_P2PSessionEstablished = 25;
	k_ESteamDatagramMsg_P2PStatsClient = 26;
	k_ESteamDatagramMsg_P2PStatsRelay = 27;
	k_ESteamDatagramMsg_P2PBadRoute = 28;
	k_ESteamDatagramMsg_GameserverPingReply = 29;
	k_ESteamDatagramMsg_GameserverRegistration = 30;
}

message CMsgSteamDatagramRouterPingReply {
	message RouteException {
		optional fixed32 data_center_id = 1;
		optional uint32 flags = 2;
		optional uint32 penalty = 3;
	}

	optional fixed32 client_timestamp = 1;
	repeated fixed32 latency_datacenter_ids = 2 [packed = true];
	repeated uint32 latency_ping_ms = 3 [packed = true];
	optional fixed32 your_public_ip = 4;
	optional fixed32 server_time = 5;
	optional fixed64 challenge = 6;
	optional uint32 seconds_until_shutdown = 7;
	optional fixed32 client_cookie = 8;
	optional uint32 scoring_penalty_relay_cluster = 9;
	repeated .CMsgSteamDatagramRouterPingReply.RouteException route_exceptions = 10;
}

message CMsgSteamDatagramGameserverPingRequest {
	optional fixed32 your_public_ip = 1;
	optional fixed32 server_time = 2;
	optional fixed64 challenge = 3;
	optional fixed32 router_timestamp = 4;
}

message CMsgSteamDatagramLegacyGameserverPingReply {
	optional fixed32 router_timestamp = 4;
	optional fixed64 dummy_pad = 99;
}

message CMsgSteamDatagramGameserverPingReply {
	message SignedData {
		optional fixed32 challenge_time = 2;
		optional fixed64 challenge = 3;
		optional fixed32 router_timestamp = 4;
		optional fixed32 data_center_id = 5;
		optional uint32 appid = 6;
	}

	optional .CMsgSteamDatagramCertificateSigned cert = 1;
	optional bytes signed_data = 2;
	optional bytes signature = 3;
}

message CMsgSteamDatagramNoSessionRelayToClient {
	optional fixed32 connection_id = 7;
	optional fixed32 your_public_ip = 2;
	optional fixed32 server_time = 3;
	optional fixed64 challenge = 4;
	optional uint32 seconds_until_shutdown = 5;
}

message CMsgSteamDatagramNoSessionRelayToPeer {
	optional uint32 legacy_relay_session_id = 1;
	optional fixed32 from_relay_session_id = 2;
	optional fixed32 from_connection_id = 7;
	optional fixed64 kludge_pad = 99;
}

message CMsgSteamDatagramClientPingSampleRequest {
	optional fixed32 connection_id = 1;
}

message CMsgSteamDatagramClientPingSampleReply {
	message RoutingCluster {
		optional fixed32 id = 1;
		optional uint32 front_ping_ms = 2;
		optional uint32 e2e_ping_ms = 3;
	}

	message DataCenter {
		optional fixed32 data_center_id = 1;
		optional fixed32 via_relay_id = 2;
		optional uint32 e2e_ping_ms = 3;
	}

	optional fixed32 connection_id = 1;
	repeated .CMsgSteamDatagramClientPingSampleReply.RoutingCluster routing_clusters = 2;
	repeated .CMsgSteamDatagramClientPingSampleReply.DataCenter data_centers = 3;
}

message CMsgSteamDatagramClientSwitchedPrimary {
	message RouterQuality {
		optional uint32 score = 1;
		optional uint32 front_ping = 2;
		optional uint32 back_ping = 3;
		optional uint32 seconds_until_down = 4;
	}

	optional fixed32 connection_id = 1;
	optional fixed32 from_ip = 2;
	optional uint32 from_port = 3;
	optional fixed32 from_router_cluster = 4;
	optional uint32 from_active_time = 5;
	optional uint32 from_active_packets_recv = 6;
	optional string from_dropped_reason = 7;
	optional uint32 gap_ms = 8;
	optional .CMsgSteamDatagramClientSwitchedPrimary.RouterQuality from_quality_now = 9;
	optional .CMsgSteamDatagramClientSwitchedPrimary.RouterQuality to_quality_now = 10;
	optional .CMsgSteamDatagramClientSwitchedPrimary.RouterQuality from_quality_then = 11;
	optional .CMsgSteamDatagramClientSwitchedPrimary.RouterQuality to_quality_then = 12;
}

message CMsgSteamDatagramConnectRequest {
	optional fixed32 connection_id = 1;
	optional fixed64 my_timestamp = 4;
	optional uint32 ping_est_ms = 5;
	optional uint32 virtual_port = 9;
	optional uint32 gameserver_relay_session_id = 2;
	optional .CMsgSteamDatagramSessionCryptInfoSigned crypt = 6;
	optional .CMsgSteamDatagramCertificateSigned cert = 7;
	optional fixed64 routing_secret = 10;
	optional fixed64 legacy_client_steam_id = 3;
}

message CMsgSteamDatagramConnectOK {
	optional fixed32 client_connection_id = 1;
	optional fixed32 server_connection_id = 7;
	optional fixed64 your_timestamp = 3;
	optional uint32 delay_time_usec = 4;
	optional uint32 gameserver_relay_session_id = 2;
	optional .CMsgSteamDatagramSessionCryptInfoSigned crypt = 5;
	optional .CMsgSteamDatagramCertificateSigned cert = 6;
}

message CMsgSteamDatagramConnectionClosed {
	enum ERelayMode {
		None = 0;
		EndToEnd = 1;
		ClosedByPeer = 2;
	}

	optional fixed32 to_connection_id = 7;
	optional fixed32 from_connection_id = 8;
	optional string from_identity_string = 15;
	optional .CMsgSteamNetworkingIdentityLegacyBinary legacy_from_identity_binary = 13;
	optional fixed64 legacy_from_steam_id = 3;
	optional uint32 legacy_gameserver_relay_session_id = 2;
	optional fixed32 to_relay_session_id = 9;
	optional fixed32 from_relay_session_id = 10;
	optional bytes forward_target_relay_routing_token = 11;
	optional uint32 forward_target_revision = 12;
	optional .CMsgSteamDatagramConnectionClosed.ERelayMode relay_mode = 4 [default = None];
	optional string debug = 5;
	optional uint32 reason_code = 6;
	optional fixed64 routing_secret = 14;
	optional uint32 not_primary_session = 16;
	optional .CMsgSteamDatagramConnectionQuality quality_relay = 17;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 18;
}

message CMsgSteamDatagramNoConnection {
	optional fixed32 to_connection_id = 5;
	optional fixed32 from_connection_id = 6;
	optional uint32 legacy_gameserver_relay_session_id = 2;
	optional fixed32 to_relay_session_id = 9;
	optional fixed32 from_relay_session_id = 10;
	optional string from_identity_string = 7;
	optional fixed64 legacy_from_steam_id = 3;
	optional bool end_to_end = 4;
	optional uint32 not_primary_session = 12;
	optional .CMsgSteamDatagramConnectionQuality quality_relay = 13;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 14;
	optional fixed64 routing_secret = 11;
	optional fixed32 dummy_pad = 1023;
}

message CMsgSteamDatagramGameserverSessionRequest {
	optional bytes ticket = 1;
	optional fixed32 challenge_time = 3;
	optional fixed64 challenge = 4;
	optional fixed32 client_connection_id = 5;
	optional fixed32 server_connection_id = 8;
	optional uint32 network_config_version = 6;
	optional uint32 protocol_version = 7;
}

message CMsgSteamDatagramGameserverSessionEstablished {
	optional fixed32 connection_id = 1;
	optional string gameserver_identity_string = 2;
	optional uint32 seconds_until_shutdown = 4;
	optional uint32 seq_num_r2c = 6;
	optional bytes dummy_legacy_identity_binary = 7;
	optional fixed64 legacy_gameserver_steamid = 3;
}

message CMsgSteamDatagramConnectionStatsClientToRouter {
	enum Flags {
		ACK_REQUEST_RELAY = 1;
		ACK_REQUEST_E2E = 2;
		ACK_REQUEST_IMMEDIATE = 4;
		NOT_PRIMARY_SESSION = 8;
	}

	optional .CMsgSteamDatagramConnectionQuality quality_relay = 1;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 2;
	repeated fixed32 ack_relay = 4;
	repeated fixed32 legacy_ack_e2e = 5;
	optional uint32 flags = 6;
	optional fixed32 client_connection_id = 8;
	optional uint32 seq_num_c2r = 9;
	optional uint32 seq_num_e2e = 10;
}

message CMsgSteamDatagramConnectionStatsRouterToClient {
	enum Flags {
		ACK_REQUEST_RELAY = 1;
		ACK_REQUEST_E2E = 2;
		ACK_REQUEST_IMMEDIATE = 4;
	}

	optional .CMsgSteamDatagramConnectionQuality quality_relay = 1;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 2;
	optional uint32 seconds_until_shutdown = 6;
	optional fixed32 migrate_request_ip = 10;
	optional uint32 migrate_request_port = 11;
	optional uint32 scoring_penalty_relay_cluster = 12;
	repeated fixed32 ack_relay = 13;
	repeated fixed32 legacy_ack_e2e = 14;
	optional uint32 flags = 15;
	optional fixed32 client_connection_id = 7;
	optional uint32 seq_num_r2c = 8;
	optional uint32 seq_num_e2e = 9;
}

message CMsgSteamDatagramConnectionStatsRouterToServer {
	enum Flags {
		ACK_REQUEST_RELAY = 1;
		ACK_REQUEST_E2E = 2;
		ACK_REQUEST_IMMEDIATE = 4;
	}

	optional .CMsgSteamDatagramConnectionQuality quality_relay = 1;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 2;
	repeated fixed32 ack_relay = 10;
	repeated fixed32 legacy_ack_e2e = 11;
	optional uint32 flags = 12;
	optional uint32 seq_num_r2s = 5;
	optional uint32 seq_num_e2e = 6;
	optional string client_identity_string = 15;
	optional fixed64 legacy_client_steam_id = 7;
	optional uint32 relay_session_id = 8;
	optional fixed32 client_connection_id = 9;
	optional fixed32 server_connection_id = 13;
	optional fixed64 routing_secret = 14;
}

message CMsgSteamDatagramConnectionStatsServerToRouter {
	enum Flags {
		ACK_REQUEST_RELAY = 1;
		ACK_REQUEST_E2E = 2;
		ACK_REQUEST_IMMEDIATE = 4;
	}

	optional .CMsgSteamDatagramConnectionQuality quality_relay = 1;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 2;
	repeated fixed32 ack_relay = 8;
	repeated fixed32 legacy_ack_e2e = 9;
	optional uint32 flags = 10;
	optional uint32 seq_num_s2r = 3;
	optional uint32 seq_num_e2e = 4;
	optional uint32 relay_session_id = 6;
	optional fixed32 client_connection_id = 7;
	optional fixed32 server_connection_id = 11;
}

message CMsgSteamDatagramP2PSessionRequestBody {
	optional fixed32 challenge_time = 1;
	optional fixed64 challenge = 2;
	optional fixed32 client_connection_id = 3;
	optional fixed64 legacy_peer_steam_id = 4;
	optional string peer_identity_string = 11;
	optional fixed32 peer_connection_id = 5;
	optional uint32 protocol_version = 8;
	optional uint32 network_config_version = 9;
	optional fixed32 public_ip = 10;
}

message CMsgSteamDatagramP2PSessionRequest {
	optional .CMsgSteamDatagramCertificateSigned cert = 1;
	optional bytes body = 2;
	optional bytes signature = 3;
}

message CMsgSteamDatagramP2PSessionEstablished {
	optional fixed32 connection_id = 1;
	optional uint32 seconds_until_shutdown = 3;
	optional bytes relay_routing_token = 4;
	optional uint32 seq_num_r2c = 5;
}

message CMsgSteamDatagramConnectionStatsP2PClientToRouter {
	enum Flags {
		ACK_REQUEST_RELAY = 1;
		ACK_REQUEST_E2E = 2;
		ACK_REQUEST_IMMEDIATE = 4;
		NOT_PRIMARY_SESSION = 8;
	}

	optional .CMsgSteamDatagramConnectionQuality quality_relay = 1;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 2;
	repeated fixed32 ack_relay = 3;
	repeated fixed32 legacy_ack_e2e = 4;
	optional uint32 flags = 5;
	optional bytes forward_target_relay_routing_token = 6;
	optional uint32 forward_target_revision = 7;
	optional bytes routes = 8;
	optional uint32 ack_peer_routes_revision = 9;
	optional fixed32 connection_id = 10;
	optional uint32 seq_num_c2r = 11;
	optional uint32 seq_num_e2e = 12;
}

message CMsgSteamDatagramConnectionStatsP2PRouterToClient {
	enum Flags {
		ACK_REQUEST_RELAY = 1;
		ACK_REQUEST_E2E = 2;
		ACK_REQUEST_IMMEDIATE = 4;
	}

	optional .CMsgSteamDatagramConnectionQuality quality_relay = 1;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 2;
	optional uint32 seconds_until_shutdown = 3;
	optional fixed32 migrate_request_ip = 4;
	optional uint32 migrate_request_port = 5;
	optional uint32 scoring_penalty_relay_cluster = 6;
	repeated fixed32 ack_relay = 7;
	repeated fixed32 legacy_ack_e2e = 8;
	optional uint32 flags = 9;
	optional uint32 ack_forward_target_revision = 10;
	optional bytes routes = 11;
	optional uint32 ack_peer_routes_revision = 12;
	optional fixed32 connection_id = 13;
	optional uint32 seq_num_r2c = 14;
	optional uint32 seq_num_e2e = 15;
}

message CMsgSteamDatagramP2PBadRouteRouterToClient {
	optional fixed32 connection_id = 1;
	optional bytes failed_relay_routing_token = 2;
	optional uint32 ack_forward_target_revision = 3;
	optional fixed64 kludge_pad = 99;
}

message CMsgSteamDatagramP2PRoutes {
	message RelayCluster {
		optional fixed32 pop_id = 1;
		optional uint32 ping_ms = 2;
		optional uint32 score_penalty = 3;
		optional bytes session_relay_routing_token = 4;
	}

	message Route {
		optional fixed32 my_pop_id = 1;
		optional fixed32 your_pop_id = 2;
		optional uint32 score = 3;
	}

	repeated .CMsgSteamDatagramP2PRoutes.RelayCluster relay_clusters = 1;
	repeated .CMsgSteamDatagramP2PRoutes.Route routes = 2;
	optional uint32 revision = 3;
}

message CMsgSteamDatagramGameServerSample {
	optional fixed32 ipv4 = 1;
	optional uint32 port = 2;
}

message CMsgSteamDatagramGameServerSampleDataCenter {
	optional fixed32 datacenter_id = 1;
	repeated .CMsgSteamDatagramGameServerSample servers = 3;
}

message CMsgSteamDatagramRelayToRelayPing {
	optional fixed32 request_timestamp = 1;
	optional fixed32 request_date = 2;
	optional fixed32 my_pop_id = 3;
	optional fixed32 your_pop_id = 4;
	optional fixed32 checksum = 5;
	repeated .CMsgSteamDatagramGameServerSampleDataCenter data_centers = 6;
}

message CMsgSteamDatagramDataCenterState {
	message Server {
		optional string address = 1;
		optional uint32 ping_ms = 2;
	}

	message DataCenter {
		optional string code = 1;
		repeated .CMsgSteamDatagramDataCenterState.Server server_sample = 2;
		repeated .CMsgSteamDatagramDataCenterState.Server relay_sample = 3;
	}

	repeated .CMsgSteamDatagramDataCenterState.DataCenter data_centers = 1;
}

message CMsgSteamDatagramRouterHealth {
	message DataCenter {
		optional fixed32 datacenter_id = 1;
		optional uint32 state = 2;
		repeated .CMsgSteamDatagramGameServerSample servers = 3;
	}

	optional float cpu_load = 1;
	optional float cpu_load_raw = 10;
	optional uint32 active_sessions = 2;
	optional uint32 data_pkts_sec = 3;
	optional uint32 other_pkts_sec = 4;
	optional uint32 seconds_until_shutdown = 5;
	optional float cpu_cost_per_user = 8;
	optional float cpu_cost_per_packet = 9;
	repeated .CMsgSteamDatagramRouterHealth.DataCenter data_centers = 6;
	optional fixed64 magic = 7;
}

message CMsgSteamDatagramConnectionStatsP2PRouterToRouter {
	enum Flags {
		ACK_REQUEST_RELAY = 1;
		ACK_REQUEST_E2E = 2;
		ACK_REQUEST_IMMEDIATE = 4;
	}

	optional .CMsgSteamDatagramConnectionQuality quality_relay = 1;
	optional .CMsgSteamDatagramConnectionQuality quality_e2e = 2;
	repeated fixed32 ack_relay = 3;
	repeated fixed32 legacy_ack_e2e = 4;
	optional uint32 flags = 5;
	optional uint32 ack_forward_target_revision = 6;
	optional bytes routes = 7;
	optional uint32 ack_peer_routes_revision = 8;
	optional uint32 seq_num_r2r = 26;
	optional uint32 seq_num_e2e = 27;
	optional fixed32 from_relay_session_id = 22;
	optional fixed32 to_relay_session_id = 25;
}

message CMsgSteamDatagramP2PBadRouteRouterToRouter {
	optional fixed32 from_relay_session_id = 1;
	optional fixed64 kludge_pad = 99;
}
