// Copyright 2025 Envoy Project Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package envoy.config.listener.v3;

import "envoy/config/core/v3/extension.proto";
import "envoy/config/core/v3/udp_socket_config.proto";
import "envoy/config/listener/v3/quic_config.proto";

import "udpa/annotations/status.proto";
import "udpa/annotations/versioning.proto";

option java_package = "io.envoyproxy.envoy.config.listener.v3";
option java_outer_classname = "UdpListenerConfigProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3;listenerv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: UDP listener config]
// Listener :ref:`configuration overview <config_listeners>`

// [#next-free-field: 9]
message UdpListenerConfig {
  option (udpa.annotations.versioning).previous_message_type =
      "envoy.api.v2.listener.UdpListenerConfig";

  reserved 1, 2, 3, 4, 6;

  reserved "config";

  // UDP socket configuration for the listener. The default for
  // :ref:`prefer_gro <envoy_v3_api_field_config.core.v3.UdpSocketConfig.prefer_gro>` is false for
  // listener sockets. If receiving a large amount of datagrams from a small number of sources, it
  // may be worthwhile to enable this option after performance testing.
  core.v3.UdpSocketConfig downstream_socket_config = 5;

  // Configuration for QUIC protocol. If empty, QUIC will not be enabled on this listener. Set
  // to the default object to enable QUIC without modifying any additional options.
  QuicProtocolOptions quic_options = 7;

  // Configuration for the UDP packet writer. If empty, HTTP/3 will use GSO if available
  // (:ref:`UdpDefaultWriterFactory <envoy_v3_api_msg_extensions.udp_packet_writer.v3.UdpGsoBatchWriterFactory>`)
  // or the default kernel sendmsg if not,
  // (:ref:`UdpDefaultWriterFactory <envoy_v3_api_msg_extensions.udp_packet_writer.v3.UdpDefaultWriterFactory>`)
  // and raw UDP will use kernel sendmsg.
  // [#extension-category: envoy.udp_packet_writer]
  core.v3.TypedExtensionConfig udp_packet_packet_writer_config = 8;
}

message ActiveRawUdpListenerConfig {
  option (udpa.annotations.versioning).previous_message_type =
      "envoy.api.v2.listener.ActiveRawUdpListenerConfig";
}
