xref: /aosp_15_r20/external/grpc-grpc-java/xds/third_party/envoy/src/main/proto/envoy/config/core/v3/socket_option.proto (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1syntax = "proto3";
2
3package envoy.config.core.v3;
4
5import "udpa/annotations/status.proto";
6import "udpa/annotations/versioning.proto";
7import "validate/validate.proto";
8
9option java_package = "io.envoyproxy.envoy.config.core.v3";
10option java_outer_classname = "SocketOptionProto";
11option java_multiple_files = true;
12option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/core/v3;corev3";
13option (udpa.annotations.file_status).package_version_status = ACTIVE;
14
15// [#protodoc-title: Socket option]
16
17// Generic socket option message. This would be used to set socket options that
18// might not exist in upstream kernels or precompiled Envoy binaries.
19//
20// For example:
21//
22// .. code-block:: json
23//
24//  {
25//    "description": "support tcp keep alive",
26//    "state": 0,
27//    "level": 1,
28//    "name": 9,
29//    "int_value": 1,
30//  }
31//
32// 1 means SOL_SOCKET and 9 means SO_KEEPALIVE on Linux.
33// With the above configuration, `TCP Keep-Alives <https://www.freesoft.org/CIE/RFC/1122/114.htm>`_
34// can be enabled in socket with Linux, which can be used in
35// :ref:`listener's<envoy_v3_api_field_config.listener.v3.Listener.socket_options>` or
36// :ref:`admin's <envoy_v3_api_field_config.bootstrap.v3.Admin.socket_options>` socket_options etc.
37//
38// It should be noted that the name or level may have different values on different platforms.
39// [#next-free-field: 7]
40message SocketOption {
41  option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.core.SocketOption";
42
43  enum SocketState {
44    // Socket options are applied after socket creation but before binding the socket to a port
45    STATE_PREBIND = 0;
46
47    // Socket options are applied after binding the socket to a port but before calling listen()
48    STATE_BOUND = 1;
49
50    // Socket options are applied after calling listen()
51    STATE_LISTENING = 2;
52  }
53
54  // An optional name to give this socket option for debugging, etc.
55  // Uniqueness is not required and no special meaning is assumed.
56  string description = 1;
57
58  // Corresponding to the level value passed to setsockopt, such as IPPROTO_TCP
59  int64 level = 2;
60
61  // The numeric name as passed to setsockopt
62  int64 name = 3;
63
64  oneof value {
65    option (validate.required) = true;
66
67    // Because many sockopts take an int value.
68    int64 int_value = 4;
69
70    // Otherwise it's a byte buffer.
71    bytes buf_value = 5;
72  }
73
74  // The state in which the option will be applied. When used in BindConfig
75  // STATE_PREBIND is currently the only valid value.
76  SocketState state = 6 [(validate.rules).enum = {defined_only: true}];
77}
78
79message SocketOptionsOverride {
80  repeated SocketOption socket_options = 1;
81}
82