// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package quic;

// CachedNetworkParameters contains data that can be used to choose appropriate
// connection parameters (initial RTT, initial CWND, etc.) in new connections.
// Next id: 8
message CachedNetworkParameters {
  // Describes the state of the connection during which the supplied network
  // parameters were calculated.
  enum PreviousConnectionState {
    SLOW_START = 0;
    CONGESTION_AVOIDANCE = 1;
  }

  // serving_region is used to decide whether or not the bandwidth estimate and
  // min RTT are reasonable and if they should be used.
  // For example a group of geographically close servers may share the same
  // serving_region string if they are expected to have similar network
  // performance.
  optional string serving_region = 1;
  // The server can supply a bandwidth estimate (in bytes/s) which it may re-use
  // on receipt of a source-address token with this field set.
  optional int32 bandwidth_estimate_bytes_per_second = 2;
  // The maximum bandwidth seen to the client, not necessarily the latest.
  optional int32 max_bandwidth_estimate_bytes_per_second = 5;
  // Timestamp (seconds since UNIX epoch) that indicates when the max bandwidth
  // was seen by the server.
  optional int64 max_bandwidth_timestamp_seconds = 6;
  // The min RTT seen on a previous connection can be used by the server to
  // inform initial connection parameters for new connections.
  optional int32 min_rtt_ms = 3;
  // Encodes the PreviousConnectionState enum.
  optional int32 previous_connection_state = 4;
  // UNIX timestamp when this bandwidth estimate was created.
  optional int64 timestamp = 7;
};
