chromium/services/network/public/mojom/network_param.mojom

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

module network.mojom;

import "mojo/public/mojom/base/time.mojom";
import "url/mojom/scheme_host_port.mojom";

// Information related to an authentication challenge in an HTTP response.
// Typemapped to net::AuthChallengeInfo.
struct AuthChallengeInfo {
  // True if the challenge was for proxy authentication.
  bool is_proxy;
  // The service issuing the challenge.
  url.mojom.SchemeHostPort challenger;
  // The authentication scheme used, such as "basic" or "digest".
  string scheme;
  // The realm of the authentication challenge. May be empty.
  string realm;
  // The authentication challenge.
  string challenge;
  // The path on which authentication was requested.
  string path;
};

[Native]
struct AuthCredentials;

[Native]
struct CertVerifyResult;

[Native]
struct HttpResponseHeaders;

struct HttpVersion {
  uint16 major_value;
  uint16 minor_value;
};

// Mirror of net::HostPortPair.
struct HostPortPair {
  string host;
  uint16 port;
};

// Mirror of net::ProxyServer::Scheme.
enum ProxyScheme {
  kInvalid,
  kHttp,
  kSocks4,
  kSocks5,
  kHttps,
  kQuic,
};

// Mirror of net::ProxyServer.
struct ProxyServer {
  ProxyScheme scheme;

  // |host_and_port| field is set iff |scheme| is not INVALID or DIRECT.
  HostPortPair? host_and_port;
};

// Mirror of net::ProxyChain.
struct ProxyChain {
  // The sequence of servers in this chain, or if nullopt, an invalid chain.
  array<ProxyServer>? proxy_servers;

  // IP Protection proxy chain ID, or -1 if not for IP protection. A `chain_id`
  // greater than zero identifies a specific chain, as defined on the server. A
  // `chain_id` of zero indicates an unidentified chain. Note that `chain_id`
  // is not unique: chains with different `proxy_a` or `proxy_b` values may
  // have the same `chain_id`.
  int32 ip_protection_chain_id;
};

// Host resolution error info.
struct ResolveErrorInfo {
  // Underlying network error code. See net/base/net_error_list.h for error
  // descriptions.
  int32 error;

  // Whether |error| came from a DNS-over-HTTPS lookup. This will be false if
  // the answer was obtained from the cache or if |error| is net::OK since this
  // field is intended to identify secure DNS *network* failures.
  bool is_secure_network_error = false;
};

// Mirror of net::SSLCertRequestInfo.
struct SSLCertRequestInfo {
  // The host and port of the SSL server that requested client authentication.
  HostPortPair host_and_port;

  // True if the server that issues this request was the HTTPS proxy used in
  // the request.  False, if the server was the origin server.
  bool is_proxy = false;

  // List of DER-encoded X.509 DistinguishedName of certificate authorities
  // allowed by the server.
  array<string> cert_authorities;

  // List of signature algorithms (using TLS 1.3 SignatureScheme constants)
  // advertised as supported by the server.
  array<uint16> signature_algorithms;
};

[Native]
struct SSLInfo;

[Native]
struct X509Certificate;

// Typemapped to net::NetLogSource.
struct NetLogSource {
  uint32 source_type;
  uint32 source_id;
  mojo_base.mojom.TimeTicks start_time;
};