chromium/services/network/public/mojom/structured_headers.mojom

// Copyright 2022 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;

// Structured header types.
// https://www.rfc-editor.org/rfc/rfc8941

import "mojo/public/mojom/base/byte_string.mojom";

// Corresponds to net::structured_headers::Item.
union StructuredHeadersItem {
  // Null type placeholder. Nulls need a value in this union to be sent over
  // Mojo, but this value itself is arbitrary, and is ignored.
  uint8 null_value;
  int64 integer_value;
  double decimal_value;
  string string_value;
  string token_value;
  mojo_base.mojom.ByteString byte_sequence_value;
  bool boolean_value;
};

// Corresponds to element type of net::structured_headers::Parameters.
struct StructuredHeadersParameter {
  string key;
  StructuredHeadersItem item;
};

// Corresponds to net::structured_headers::ParameterizedItem.
struct StructuredHeadersParameterizedItem {
  StructuredHeadersItem item;

  // Parameter order is significant, so a map is not sufficient.
  array<StructuredHeadersParameter> parameters;
};

// Corresponds to net::structured_headers::ParameterizedMember.
struct StructuredHeadersParameterizedMember {
  array<StructuredHeadersParameterizedItem> member;
  bool member_is_inner_list;
  array<StructuredHeadersParameter> parameters;
};

// Corresponds to net::structured_headers::DictionaryMember.
struct StructuredHeadersDictionaryMember {
  string key;
  StructuredHeadersParameterizedMember value;
};

// Corresponds to net::structured_headers::Dictionary.
struct StructuredHeadersDictionary {
  // Member order is significant, so a map is not sufficient.
  array<StructuredHeadersDictionaryMember> members;
};