Skip to content

Commit 3ebe61d

Browse files
authored
Resolving Comments
1 parent 3eb8923 commit 3ebe61d

File tree

1 file changed

+79
-81
lines changed

1 file changed

+79
-81
lines changed

specs/WebRtcPortConfiguration.md

Lines changed: 79 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Common scenarios:
2323

2424
Usage steps:
2525
1. Create `CoreWebView2EnvironmentOptions`.
26-
2. Call `SetAllowedPortRange` for `COREWEBVIEW2_NETWORK_COMPONENT_SCOPE_ALL` and `COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND_UDP`.
26+
2. Call `SetAllowedPortRange` for `COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE_DEFAULT` and `COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND_UDP`.
2727
3. Pass the options when creating the WebView2 environment.
2828

2929
# Examples
@@ -37,12 +37,12 @@ if (options.As(&optionsStaging10) == S_OK)
3737
const INT32 udpMin = 50000, udpMax = 55000;
3838

3939
CHECK_FAILURE(optionsStaging10->SetAllowedPortRange(
40-
COREWEBVIEW2_NETWORK_COMPONENT_SCOPE_ALL,
40+
COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE_DEFAULT,
4141
COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND_UDP, udpMin, udpMax));
4242

4343
// Get the configured port range
44-
CHECK_FAILURE(optionsStaging10->GetAllowedPortRange(
45-
COREWEBVIEW2_NETWORK_COMPONENT_SCOPE_ALL,
44+
CHECK_FAILURE(optionsStaging10->GetEffectiveAllowedPortRange(
45+
COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE_DEFAULT,
4646
COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND_UDP, &m_udpPortRange.minPort,
4747
&m_udpPortRange.maxPort));
4848
}
@@ -65,12 +65,12 @@ if (optionsStaging10 != null)
6565
const int udpMin = 50000, udpMax = 55000;
6666

6767
optionsStaging10.SetAllowedPortRange(
68-
COREWEBVIEW2_NETWORK_COMPONENT_SCOPE_ALL,
68+
COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE_DEFAULT,
6969
COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND_UDP, udpMin, udpMax);
7070

7171
// Get the configured port range
72-
optionsStaging10.GetAllowedPortRange(
73-
COREWEBVIEW2_NETWORK_COMPONENT_SCOPE_ALL,
72+
optionsStaging10.GetEffectiveAllowedPortRange(
73+
COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE_DEFAULT,
7474
COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND_UDP, out m_udpPortRange.minPort,
7575
out m_udpPortRange.maxPort);
7676
}
@@ -82,44 +82,46 @@ OnCreateEnvironmentCompleted(environment);
8282

8383
API Rules and Precedence
8484

85-
1. Network Scope param in SetAllowedPortRange
86-
- A network component-specific scope (e.g. _WEB_RTC) always takes precedence over _ALL for that component in `SetAllowedPortRange`.
87-
- `_ALL` defines the port range restrictions for all components without specific overrides.
88-
- Passing `(0, 0)` for a network component scope removes its restriction.
89-
- If `_ALL` is set and a specific scope is reset, that component becomes unrestricted while `_ALL` still applies to others.
90-
91-
| Network Scope State | Behaviour |
92-
| ------------------------------------------ | ------------------------------------------------------------------------------ |
93-
| Only `_ALL` is set | `_ALL` applies port range restrictions to all network components |
94-
| `_ALL` and `_WEB_RTC` are both set | `_WEB_RTC` port range restrictions applies to WebRTC; `_ALL` applies to others |
95-
| `_WEB_RTC` only is set | `_WEB_RTC` applies port range restrictions only to WebRTC; others unrestricted |
96-
| `_ALL` set and `_WEB_RTC` reset to `(0,0)` | `_ALL` applies port range restrictions to all except WebRTC (unrestricted) |
97-
98-
2. Network Scope param in GetAllowedPortRange
99-
- `GetAllowedPortRange` returns the range explicitly set for the queried scope.
100-
- If a specific scope is unset, it inherits `_ALL`.
101-
- Querying `_ALL` only returns `_ALL`; it does not aggregate component-specific settings.
102-
- If neither `_ALL` nor a component-specific scope is set, the default `(0,0)` (unrestricted) is returned.
103-
104-
| `GetAllowedPortRange` Network Scope query | Returned Range |
105-
| ---------------------------------------------------------------- | ----------------------------- |
106-
| Pass `_WEB_RTC` when only `_ALL` is set | Returns `_ALL` range |
107-
| Pass `_WEB_RTC` when `_WEB_RTC` explicitly set | Returns `_WEB_RTC` range |
108-
| Pass `_WEB_RTC` when `_ALL` unset and `_WEB_RTC` unset | Returns `(0, 0)` |
109-
| Pass `_WEB_RTC` when `_ALL` set and `_WEB_RTC` reset to `(0, 0)` | Returns `(0, 0)` |
110-
| Pass `_ALL` when only `_WEB_RTC` set | Returns `(0,0)` |
85+
1. Port Range Restriction Scope param in SetAllowedPortRange
86+
- A component specific scope (e.g. _WEB_RTC) always takes precedence over _DEFAULT for that component in `SetAllowedPortRange`.
87+
- `_DEFAULT` defines the base port range restrictions for all components without specific overrides.
88+
- Passing `(0, 0)` for a component scope unset its specific range restriction and inherit range restriction from `_DEFAULT`
89+
- If `_DEFAULT` is set and a specific scope is unset, that component inherits `_DEFAULT`.
90+
- Passing `(0,65535)` for a component scope make port range unrestricted for that component.
91+
92+
| Scope State | Behaviour |
93+
| ------------------------------------------ | --------------------------------------------------------------------------------------------- |
94+
| Only `_DEFAULT` is set | `_DEFAULT` applies port range restrictions to all components |
95+
| `_DEFAULT` and `_WEB_RTC` are both set | `_WEB_RTC` port range restrictions applies to WebRTC; `_DEFAULT` applies to others |
96+
| `_WEB_RTC` only is set | `_WEB_RTC` applies port range restrictions only to WebRTC; others unrestricted |
97+
| `_DEFAULT` set and `_WEB_RTC` reset to `(0,0)` | `_DEFAULT` applies port range restrictions to all and WebRTC inherits `_DEFAULT` |
98+
| `_DEFAULT` set and `_WEB_RTC` set to `(0,65535)` | `_DEFAULT` applies port range restrictions to all except WebRTC which is unrestricted |
99+
100+
2. Port Range Restriction Scope param in GetEffectiveAllowedPortRange
101+
- `GetEffectiveAllowedPortRange` returns the range explicitly set for the queried scope.
102+
- If a specific scope is unset, it inherits `_DEFAULT`.
103+
- Querying `_DEFAULT` only returns `_DEFAULT`; it does not aggregate component-specific settings.
104+
- If neither `_DEFAULT` nor a component-specific scope is set, the default `(0,0)` (unset) is returned.
105+
106+
| `GetEffectiveAllowedPortRange` Scope query | Returned Range |
107+
| -------------------------------------------------------------------- | ----------------------------- |
108+
| Pass `_WEB_RTC` when only `_DEFAULT` is set | Returns `_DEFAULT` range |
109+
| Pass `_WEB_RTC` when `_WEB_RTC` explicitly set | Returns `_WEB_RTC` range |
110+
| Pass `_WEB_RTC` when `_DEFAULT` unset and `_WEB_RTC` unset | Returns `(0, 0)` |
111+
| Pass `_WEB_RTC` when `_DEFAULT` set and `_WEB_RTC` reset to `(0, 0)` | Returns `_DEFAULT` |
112+
| Pass `_DEFAULT` when only `_WEB_RTC` set | Returns `(0,0)` |
111113

112114
# API Details
113115
### C++
114116
```
115-
/// Specifies the network component scope for port configuration.
117+
/// Specifies the scope for port configuration.
116118
[v1_enum]
117-
typedef enum COREWEBVIEW2_NETWORK_COMPONENT_SCOPE {
119+
typedef enum COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE {
118120
/// Scope applies to all components.
119-
COREWEBVIEW2_NETWORK_COMPONENT_SCOPE_ALL,
121+
COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE_DEFAULT,
120122
/// Applies only to WebRTC peer-to-peer connection.
121-
COREWEBVIEW2_NETWORK_COMPONENT_SCOPE_WEB_RTC,
122-
} COREWEBVIEW2_NETWORK_COMPONENT_SCOPE;
123+
COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE_WEB_RTC,
124+
} COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE;
123125
124126
/// Specifies the network protocol for port configuration.
125127
[v1_enum]
@@ -131,7 +133,7 @@ typedef enum COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND {
131133
/// Additional options used to create WebView2 Environment to manage port range configuration.
132134
[uuid(6ce30f6b-5dcc-5dc1-9c09-723cf233dbe5), object, pointer_default(unique)]
133135
interface ICoreWebView2StagingEnvironmentOptions10 : IUnknown {
134-
/// Sets the allowed port range restriction for the specified network component
136+
/// Sets the allowed port range restriction for the specified
135137
/// scope and transport protocol.
136138
///
137139
/// This API enables WebView2 to operate within enterprise network or firewall
@@ -145,62 +147,58 @@ interface ICoreWebView2StagingEnvironmentOptions10 : IUnknown {
145147
/// `minPort` must be less than or equal to `maxPort`.
146148
/// If `minPort` equals `maxPort`, the range represents a single port.
147149
///
148-
/// Passing `(0, 0)` resets to the default behavior, meaning no restrictions
149-
/// are applied and the system assigns ports from the full ephemeral range.
150-
///
151150
/// Calls with invalid ranges fail with `E_INVALIDARG`.
152151
///
153-
/// A network component-specific scope (e.g. _WEB_RTC) always takes precedence over _ALL for that component in `SetAllowedPortRange`.
154-
/// `_ALL` defines the port range restrictions for all components without specific overrides.
155-
/// Passing `(0, 0)` for a network component scope removes its restriction.
156-
/// If `_ALL` is set and a specific scope is reset, that component becomes unrestricted while `_ALL` still applies to others.
157-
158-
/// | Network Scope State | Behaviour |
159-
/// | ------------------------------------------ | ------------------------------------------------------------------------------ |
160-
/// | Only `_ALL` is set | `_ALL` applies port range restrictions to all network components |
161-
/// | `_ALL` and `_WEB_RTC` are both set | `_WEB_RTC` port range restrictions applies to WebRTC; `_ALL` applies to others |
162-
/// | `_WEB_RTC` only is set | `_WEB_RTC` applies port range restrictions only to WebRTC; others unrestricted |
163-
/// | `_ALL` set and `_WEB_RTC` reset to `(0,0)` | `_ALL` applies port range restrictions to all except WebRTC (unrestricted) |
164-
165-
/// `scope` Network scope on which restrictions will apply.
152+
/// A component specific scope (e.g. _WEB_RTC) always takes precedence over _DEFAULT for that component in `SetAllowedPortRange`.
153+
/// `_DEFAULT` defines the port range restrictions for all components without specific overrides.
154+
/// Passing `(0, 0)` for a component scope unset its specific range restriction and inherit range restriction from `_DEFAULT`
155+
/// If `_DEFAULT` is set and a specific scope is unset, that component inherits `_DEFAULT`.
156+
/// Passing `(1025,65535)` for a component scope make port range unrestricted for that component.
157+
158+
/// | Scope State | Behaviour |
159+
/// | --------------------------------------------------- | ----------------------------------------------------------------------------------------|
160+
/// | Only `_DEFAULT` is set | `_DEFAULT` applies port range restrictions to all components |
161+
/// | `_DEFAULT` and `_WEB_RTC` are both set | `_WEB_RTC` port range restrictions applies to WebRTC; `_DEFAULT` applies to others |
162+
/// | `_WEB_RTC` only is set | `_WEB_RTC` applies port range restrictions only to WebRTC; others unrestricted |
163+
/// | `_DEFAULT` set and `_WEB_RTC` reset to `(0,0)` | `_DEFAULT` applies port range restrictions to all and WebRTC inherits `_DEFAULT` |
164+
/// | `_DEFAULT` set and `_WEB_RTC` set to `(1025,65535)` | `_DEFAULT` applies port range restrictions to all except WebRTC which is unrestricted |
165+
166+
/// `scope` scope on which restrictions will apply.
166167
/// `protocol` Transport protocol on which restrictions will apply.
167168
/// `minPort` The minimum allowed port number (inclusive).
168169
/// `maxPort` The maximum allowed port number (inclusive).
169170
///
170171
HRESULT SetAllowedPortRange(
171-
[in] COREWEBVIEW2_NETWORK_COMPONENT_SCOPE scope,
172+
[in] COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE scope,
172173
[in] COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND protocol,
173174
[in] INT32 minPort,
174175
[in] INT32 maxPort
175176
);
176177
177-
/// Retrieves the allowed port range for the specified transport protocol.
178-
/// Returns the currently configured port range previously set via
178+
/// Retrieves the effective allowed port range for the specified transport protocol.
179+
/// Returns the effective port range previously set via
179180
/// `SetAllowedPortRange`.
180-
///
181-
/// By default, `(0, 0)` is returned, which indicates no restrictions are applied
182-
/// and ports are allocated from the system's ephemeral range (1025-65535 inclusive).
183181
///
184-
/// `GetAllowedPortRange` returns the range explicitly set for the queried scope.
185-
/// If a specific scope is unset, it inherits `_ALL`.
186-
/// Querying `_ALL` only returns `_ALL`; it does not aggregate component-specific settings.
187-
/// If neither `_ALL` nor a component-specific scope is set, the default `(0,0)` (unrestricted) is returned.
188-
189-
/// | `GetAllowedPortRange` Network Scope query | Returned Range |
190-
/// | ---------------------------------------------------------------- | ----------------------------- |
191-
/// | Pass `_WEB_RTC` when only `_ALL` is set | Returns `_ALL` range |
192-
/// | Pass `_WEB_RTC` when `_WEB_RTC` explicitly set | Returns `_WEB_RTC` range |
193-
/// | Pass `_WEB_RTC` when `_ALL` unset and `_WEB_RTC` unset | Returns `(0, 0)` |
194-
/// | Pass `_WEB_RTC` when `_ALL` set and `_WEB_RTC` reset to `(0, 0)` | Returns `(0, 0)` |
195-
/// | Pass `_ALL` when only `_WEB_RTC` set | Returns `(0,0)` |
196-
197-
/// `scope` Network scope on which restrictions is applied.
182+
/// `GetEffectiveAllowedPortRange` returns the range explicitly set for the queried scope.
183+
/// If a specific scope is unset, it inherits `_DEFAULT`.
184+
/// Querying `_DEFAULT` only returns `_DEFAULT`; it does not aggregate component-specific settings.
185+
/// If neither `_DEFAULT` nor a component-specific scope is set, the default `(0,0)` (unset) is returned.
186+
187+
/// | `GetEffectiveAllowedPortRange` Scope query | Returned Range |
188+
/// | -------------------------------------------------------------------- | ----------------------------- |
189+
/// | Pass `_WEB_RTC` when only `_DEFAULT` is set | Returns `_DEFAULT` range |
190+
/// | Pass `_WEB_RTC` when `_WEB_RTC` explicitly set | Returns `_WEB_RTC` range |
191+
/// | Pass `_WEB_RTC` when `_DEFAULT` unset and `_WEB_RTC` unset | Returns `(0, 0)` |
192+
/// | Pass `_WEB_RTC` when `_DEFAULT` set and `_WEB_RTC` reset to `(0, 0)` | Returns `_DEFAULT` |
193+
/// | Pass `_DEFAULT` when only `_WEB_RTC` set | Returns `(0,0)` |
194+
195+
/// `scope` scope on which restrictions is applied.
198196
/// `protocol` Transport protocol on which restrictions is applied.
199197
/// `minPort` Receives the minimum allowed port number (inclusive).
200198
/// `maxPort` Receives the maximum allowed port number (inclusive).
201199
///
202-
HRESULT GetAllowedPortRange(
203-
[in] COREWEBVIEW2_NETWORK_COMPONENT_SCOPE scope,
200+
HRESULT GetEffectiveAllowedPortRange (
201+
[in] COREWEBVIEW2_PORT_RANGE_RESTRICTION_SCOPE scope,
204202
[in] COREWEBVIEW2_TRANSPORT_PROTOCOL_KIND protocol,
205203
[out] INT32* minPort,
206204
[out] INT32* maxPort
@@ -214,9 +212,9 @@ interface ICoreWebView2StagingEnvironmentOptions10 : IUnknown {
214212
```csharp
215213
namespace Microsoft.Web.WebView2.Core
216214
{
217-
enum CoreWebview2NetworkComponentScope
215+
enum CoreWebview2PortRangeRestrictionScope
218216
{
219-
All = 0,
217+
Default = 0,
220218
WebRtc = 1,
221219
};
222220

@@ -230,8 +228,8 @@ namespace Microsoft.Web.WebView2.Core
230228
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2StagingEnvironmentOptions10")]
231229
{
232230
// ICoreWebView2StagingEnvironmentOptions10 members
233-
void SetAllowedPortRange(CoreWebview2NetworkComponentScope scope, CoreWebView2TransportProtocolKind protocol, Int32 minPort, Int32 maxPort);
234-
void GetAllowedPortRange(CoreWebview2NetworkComponentScope scope, CoreWebView2TransportProtocolKind protocol, out Int32 minPort, out Int32 maxPort);
231+
void SetAllowedPortRange(CoreWebview2PortRangeRestrictionScope scope, CoreWebView2TransportProtocolKind protocol, Int32 minPort, Int32 maxPort);
232+
void GetEffectiveAllowedPortRange(CoreWebview2PortRangeRestrictionScope scope, CoreWebView2TransportProtocolKind protocol, out Int32 minPort, out Int32 maxPort);
235233
}
236234
}
237235
}

0 commit comments

Comments
 (0)