Commit graph

117 commits

Author SHA1 Message Date
Florent Castelli
8037fc6ffa Migrate absl::optional to std::optional
Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
2024-09-02 12:16:47 +00:00
Philipp Hancke
4158678b46 Split "helpers" from SSL target to "crypto_random" and rename
since it contains helpers mostly related to cryptographically secure random numbers and strings.

BUG=webrtc:339300437

Change-Id: I10db939534b25dc792ac1600a4721d1b84521880
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352620
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42441}
2024-06-07 06:41:51 +00:00
Manashi Sarkar
6071f044e1 Revert "Make ICE tiebreaker a construction time argument of Port"
This reverts commit 933357ec0e.

Reason for revert: Breaks build.

Original change's description:
> Make ICE tiebreaker a construction time argument of Port
>
> and remove SetIceTieBreaker()
>
> BUG=webrtc:42224914
>
> Change-Id: Ib806decd061fde1b376064ac9f58df1dad8ee976
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352340
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@meta.com>
> Cr-Commit-Position: refs/heads/main@{#42416}

Bug: webrtc:42224914
Change-Id: Ie50f095e697d6eb36cca6239f9e871b7d627d6f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353141
Commit-Queue: Manashi Sarkar <manashi@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42420}
2024-05-31 09:31:32 +00:00
Philipp Hancke
933357ec0e Make ICE tiebreaker a construction time argument of Port
and remove SetIceTieBreaker()

BUG=webrtc:42224914

Change-Id: Ib806decd061fde1b376064ac9f58df1dad8ee976
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352340
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#42416}
2024-05-30 14:41:14 +00:00
Philipp Hancke
833ec4d123 Make Port constructor take a CreatePortArgs argument
Introduces a struct CreatePortArgs that is similar to the existing
CreateRelayPortArgs and contains parameters that will be passed from
the constructors of descendents of the Port class to the Port.

This struct makes it easier to add new arguments to the port
constructor without changing all inheriting classes.

Rebase of https://webrtc-review.googlesource.com/c/src/+/341021

BUG=webrtc:14626

Change-Id: Id8e5c24a36149e1699e2b42c57e52002d27c86c8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/345860
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#42339}
2024-05-17 15:39:47 +00:00
Tommi
f54e0133d7 Remove deprecated ProxyInfo code
Bug: none
Change-Id: I82d3ee97927031d974e2ef657312101dd910eff4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347620
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42136}
2024-04-22 08:38:36 +00:00
Tommi
db6767dd0c Remove more ProxyInfo references.
This removes many references to the unsupported ProxyInfo struct
but leaves temporary implementations for methods while downstream
code gets updated.

Bug: none
Change-Id: Iab4410b362a8296b2e00cf71080010e515f9f4ba
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/344660
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42096}
2024-04-17 11:55:00 +00:00
Tomas Gunnarsson
0242939296 Reland "Deprecate old constructors and set_type() in Candidate and Port"
This reverts commit ed8390d21a.

Reason for revert: Fix has landed in chrome, ready to reland.

Original change's description:
> Revert "Deprecate old constructors and set_type() in Candidate and Port"
>
> This reverts commit aaa6851d53.
>
> Reason for revert: breaks chromium webrtc import
>
> Original change's description:
> > Deprecate old constructors and set_type() in Candidate and Port
> >
> > * Deprecates constructors that use string based `type`
> > * Deprecates string based type functions in favor of enum based.
> > * Restrict possible values of Candidate::type. Ensure a valid value
> >   is assigned at construction.
> > * Make Port constructors protected to limit their use to subclasses.
> >   - The reason for this is to make sure that use of SharedSocket()
> >     is controlled (it adds a bit of complexity).
> > * Simplify construction of Port (remove Construct() etc)
> >
> > Bug: webrtc:15846
> > Change-Id: If24ed674e175642efa49da37fd2bc847dd14f613
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339860
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#41865}
>
> Bug: webrtc:15846
> Change-Id: Ic8b7cba97f8fb207ef51a88900e704658ade28b7
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/342140
> Auto-Submit: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Owners-Override: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#41867}

Bug: webrtc:15846
Change-Id: I3d52643bbb537d1c072643528828d26eb18fea94
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/342200
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41875}
2024-03-08 20:39:59 +00:00
Ilya Nikolaevskiy
ed8390d21a Revert "Deprecate old constructors and set_type() in Candidate and Port"
This reverts commit aaa6851d53.

Reason for revert: breaks chromium webrtc import

Original change's description:
> Deprecate old constructors and set_type() in Candidate and Port
>
> * Deprecates constructors that use string based `type`
> * Deprecates string based type functions in favor of enum based.
> * Restrict possible values of Candidate::type. Ensure a valid value
>   is assigned at construction.
> * Make Port constructors protected to limit their use to subclasses.
>   - The reason for this is to make sure that use of SharedSocket()
>     is controlled (it adds a bit of complexity).
> * Simplify construction of Port (remove Construct() etc)
>
> Bug: webrtc:15846
> Change-Id: If24ed674e175642efa49da37fd2bc847dd14f613
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339860
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#41865}

Bug: webrtc:15846
Change-Id: Ic8b7cba97f8fb207ef51a88900e704658ade28b7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/342140
Auto-Submit: Ilya Nikolaevskiy <ilnik@webrtc.org>
Owners-Override: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#41867}
2024-03-07 09:43:38 +00:00
Tommi
aaa6851d53 Deprecate old constructors and set_type() in Candidate and Port
* Deprecates constructors that use string based `type`
* Deprecates string based type functions in favor of enum based.
* Restrict possible values of Candidate::type. Ensure a valid value
  is assigned at construction.
* Make Port constructors protected to limit their use to subclasses.
  - The reason for this is to make sure that use of SharedSocket()
    is controlled (it adds a bit of complexity).
* Simplify construction of Port (remove Construct() etc)

Bug: webrtc:15846
Change-Id: If24ed674e175642efa49da37fd2bc847dd14f613
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339860
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41865}
2024-03-06 18:36:14 +00:00
Christoffer Dewerin
7098d110e1 Revert "p2p: separate ICE tie breaker and foundation seed"
This reverts commit d99499abba.

Reason for revert: Breaks downstream projects and I can also repro locally when running the rtc_unittest test target (it does however pass in isolation indicating test cleanup/setup needs to be fixed)

Original change's description:
> p2p: separate ICE tie breaker and foundation seed
>
> BUG=webrtc:14626
>
> Change-Id: I189a708192c9cef0b50c3fcbe798b30376d3b547
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338982
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#41806}

Bug: webrtc:14626
Change-Id: If45f8a33395c562c9388b3d3748e8566efa87ecb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/341081
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Christoffer Dewerin <jansson@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Owners-Override: Christoffer Dewerin <jansson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41812}
2024-02-26 16:05:15 +00:00
Philipp Hancke
d99499abba p2p: separate ICE tie breaker and foundation seed
BUG=webrtc:14626

Change-Id: I189a708192c9cef0b50c3fcbe798b30376d3b547
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/338982
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41806}
2024-02-26 07:47:28 +00:00
Tommi
44e4453067 Fix Port test and supply a legal value for the port type.
This isn't a problem right now but will be when we move away from
using a free string as the storage type.

Bug: none
Change-Id: I12c2de416f9fce13a8284e7d36fa3c2081453299
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/335880
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41602}
2024-01-24 09:00:15 +00:00
Harald Alvestrand
f0ddae8c22 Convert ByteBufferWriter to be type uint8_t
and make follow-on changes.

Bug: webrtc:15665
Change-Id: Ice646f88ba5a09d6a8d9ce70415d8a14d7050d3c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329781
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41393}
2023-12-15 12:27:50 +00:00
Per K
a8cd2babcd Refactor NatServer to use rtc::ReceivedPackets
Instead of using raw pointers.
Also, ensure callbacks are registered on the correct thread.
Nat servers are test only code.

Bug: webrtc:11943
Change-Id: Ib70a5966acb512f1a07212a07aaedab70aa20f9b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/331260
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@google.com>
Cr-Commit-Position: refs/heads/main@{#41372}
2023-12-13 09:40:59 +00:00
Per K
14630a7e37 Use rtc::ReceivedPacket in Stun and TurnServer
StunServer is updated to ensure registring for receiving packet from the socket is happening on the same thread as where the packets are recevied.

Bug: webrtc:15368, webrtc:11943
Change-Id: I94cc3a47278d5489de7f170c8d43015d1551c437
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/328120
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41219}
2023-11-23 10:40:56 +00:00
Per K
4ac371883e AsyncPacketSocket::RegisterReceivedPacketCallback
This cl introduce RegisterReceivedPacketCallback and
DeregisterReceivedPacketCallback that will be used to replace AsyncPacketSocket::SignalReadPacket

A "proof of concept" cl is here: https://webrtc-review.googlesource.com/c/src/+/327324

Bug: webrtc:15368
Change-Id: I07e4f564dc8420d78e542991689778d8531225df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/327325
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41164}
2023-11-15 11:17:53 +00:00
Per K
698e0bec17 Add Connection::OnReadPacket(const rtc::PacketReceived&)
Deprecate old version but keep it for the time being.

Bug: webrtc:15368
Change-Id: Icbd2078a00d877ff948a2441c2027a12c85d4f2e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/326104
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41112}
2023-11-09 09:15:02 +00:00
Jonas Oreland
fc92d33327 Add StunDictionary - patch 2
This patch hooks up the StunDictionary to Connection
and P2PTransportChannel.

Bug: webrtc:15392
Change-Id: Ibeea4d8706ebd42f2353d9d300631c02bf0d484d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/315100
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40519}
2023-08-07 13:10:00 +00:00
Philipp Hancke
17ec0569c6 ICE: adjust priority of non-relay candidates
Introduces a field trial
  WebRTC-IncreaseIceCandidatePriorityHostSrflx
that adjusts the priority of non-relay candidates such that the STUN priority attribute calculated as
  (prflx-type-preference << 24) | (priority & 0x00FFFFFF)
as described in
  https://www.rfc-editor.org/rfc/rfc5245#section-7.1.2.1
will satisfy the condition that the STUN priority of server-reflexive candidates will always be higher than the STUN priority of relay candidates.

Previously this was not the case because the TURN relay preference was added to the local_preference for relay candidates, making it higher than the local_preference of srflx candidates gathered from the same interface.
This led to cases where the resulting candidate pair priority of a srflx-relay pair was higher than the candidate pair priority of a srflx-srflx pair, i.e. using a TURN server in cases that work using a direct P2P connection.

Whether the field trial is active can be observed by checking that
  priority-of-srflx-candidate&0x00FFFFFF
is greater than
  priority-of-relay-candidate&0x00FFFFFF

BUG=webrtc:13195,webrtc:5813,webrtc:15020

Change-Id: Ib91708fbe7310b6454f93158a45c9d77da009091
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/292700
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#40311}
2023-06-20 08:02:27 +00:00
Sameer Vijaykar
df7df199ab Clean up IPv6 fixes field trial artifacts.
The fixes have been default enabled, so clean up dead code.

Bug: webrtc:14334
Change-Id: I4967d5ad451ac333c54294fc14bea6c7ba1445e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301180
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#39949}
2023-04-25 14:59:55 +00:00
Sameer Vijaykar
1f251dd67e Default enable WebRTC-IPv6NetworkResolutionFixes
Fully launched on mobile and approved for chrome launch.

Removed tests for feature enablement with field trial.

Bug: webrtc:14334
Change-Id: I7ca7183ff618835fef8c820cfd52863e1c7fa25e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301163
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#39879}
2023-04-17 20:28:53 +00:00
Philipp Hancke
fd91d02210 ice: include tiebreaker in computation of foundation attribute (tests)
split from the actual change for easier review and cherry-picking.

BUG=webrtc:14605

Change-Id: I7dbaf8e1f4a03f35a5d8c4da1a2784b00589bfc3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280680
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38519}
2022-11-01 07:47:23 +00:00
Diep Bui
a5d80a7646 Add PreferGlobalIPv6Address param to IPv6NetworkResolutionFixes field trial string.
Bug: webrtc:14334
Change-Id: Iedbc18d2ebd77b4fedd4e7936a5aa4da35279328
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273101
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37991}
2022-09-02 10:39:58 +00:00
Sameer Vijaykar
71434ae614 Rename PreferGlobalIPv6ToLinkLocal field trial to group IPv6 fixes.
This combines the below IPv6 fixes into the field trial
WebRTC-IPv6NetworkResolutionFixes:
1. Prefer global IPv6 address over link local
2. Use address family when resolving STUN hostname

WebRTC-PreferGlobalIPv6ToLinkLocal is currently in Dev but will be
rolled back temporarily.

Bug: webrtc:14334, webrtc:14131
Change-Id: I1fb3f55c4c5f3c5c0b441ece30e72cf393e074d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271340
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37754}
2022-08-11 16:24:12 +00:00
Diep Bui
1e589eb77f Modify GetBestIP to prefer global IPv6 addresses to the link local IPv6 addresses.
The change is behind the flag WebRTC-PreferGlobalIPv6ToLinkLocal.

Bug: webrtc:14306
Change-Id: Id2cae2e510fcfd007016e79ae4bd46947101d0fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269762
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37658}
2022-08-02 10:16:35 +00:00
Ali Tofigh
de2ac5a6f3 Adopt absl::string_view in p2p/
Bug: webrtc:13579
Change-Id: Ia33afa2a9ad12d1a586087d49f581a93fddb565d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262766
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37381}
2022-06-30 13:19:18 +00:00
Ali Tofigh
42b163f236 Remove unnecessary overloads
Bug: webrtc:13579
Change-Id: I6fbc1ea8fdc30b0d3e1084a941910027655c6feb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/267062
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37377}
2022-06-30 09:39:28 +00:00
Ali Tofigh
58ecd42deb Remove std::string version of some functions that are no longer needed.
The absl::string_view versions can now be made pure virtual due to
downstream client changes. The std::string versions in the base
classes are still needed by downstream users, but will be removed
eventually.

Bug: webrtc:13579
Change-Id: Id757a07380f0518edf407ff5d0644511eb1e53d3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265980
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37349}
2022-06-28 09:06:02 +00:00
Ali Tofigh
ea5a944921 Add absl::string_view version of PortInterface::SupportsProtocol()
This is the first step of migrating SupportsProtocol() to
absl::string_view. The std::string version will be removed once all
downstream users have migrated and have implemented the
absl::string_view version.

Bug: webrtc:13579
Change-Id: Ib609b9bab0c2e525553daddb1e365050bbe1c1f5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265806
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37211}
2022-06-14 15:01:12 +00:00
Tommi
6fd77f3d3f Reland "Make deletion of Connection objects more deterministic."
This reverts commit 869c87a2b9.

Reason for revert: Re-landing

Original change's description:
> Revert "Make deletion of Connection objects more deterministic."
>
> This reverts commit 942cac2e9e.
>
> Reason for revert: Reverting while downstream updates are made.
>
> Original change's description:
> > Make deletion of Connection objects more deterministic.
> >
> > This changes most deletion paths of Connection objects to go through
> > the owner class of the Connection instances, Port.
> >
> > In situations where Connection objects still need to be deleted
> > asynchronously, `async = true` can be passed to
> > `Port::DestroyConnection` and get the same behavior as
> > `Connection::Destroy` formerly gave.
> >
> > The `Destroy()` method still exists for downstream compatibility, but
> > instead of deleting connection objects asynchronously, the deletion
> > now happens synchronously via the Port class.
> >
> > Bug: webrtc:13892, webrtc:13865
> > Change-Id: I07edb7bb5e5d93b33542581b4b09def548de9e12
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259826
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#36676}
>
> Bug: webrtc:13892, webrtc:13865
> Change-Id: I37a15692c8201716402ba5c10f249e4d3754ce4c
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260862
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36736}

Bug: webrtc:13892, webrtc:13865
Change-Id: I29da6c8899d8550c26ccecbbd0fe5f5556c80212
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260943
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37171}
2022-06-10 06:06:05 +00:00
Tommi
b5af6ee6df [StunMessage] Remove/deprecate StunMessage::SetType
Removes all remaining usage of SetType and marks the method as
deprecated.

Bug: none
Change-Id: I98dc613978ffe7ad8a4ffd951dd974d56ed92983
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265100
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37137}
2022-06-07 10:19:16 +00:00
Tommi
e83500e17b [Connection] Construct ping/connection requests in one step.
This moves the construction of StunMessage instances for
ConnectionRequest, outside of the Prepare() method.

Following this, removing Construct()+Prepare() is relatively
straight forward.

Bug: none
Change-Id: Ibcf0510cef30a6e648005b43602c7ae1fb06729e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264558
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37122}
2022-06-03 20:04:24 +00:00
Tommi
408143d5af Refactor StunMessage a bit
* Add ctors for providing the type and transaction id at construction.
* Update tests to use them instead of SetType+SetTransactionID
* Make sure stun message enum types are based on uint16_t
* Mark SetTransactionID as deprecated.
* Mark SetStunMagicCookie as deprecated (unused in webrtc).
* Add SetTransactionIdForTest for the one test that uses it (might not
  actually need it)
* Make StunRequest::Construct() protected.
  * Add a TODO to follow up on this since construction of StunRequest
    goes through an unnecessarily complex 3-step process involving
    other classes and a virtual method.

Bug: none
Change-Id: Ib013e58f28e7b2b4fcb3b3e1034da31dfc93e9d3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264546
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37079}
2022-06-01 17:43:55 +00:00
Tomas Gunnarsson
869c87a2b9 Revert "Make deletion of Connection objects more deterministic."
This reverts commit 942cac2e9e.

Reason for revert: Reverting while downstream updates are made.

Original change's description:
> Make deletion of Connection objects more deterministic.
>
> This changes most deletion paths of Connection objects to go through
> the owner class of the Connection instances, Port.
>
> In situations where Connection objects still need to be deleted
> asynchronously, `async = true` can be passed to
> `Port::DestroyConnection` and get the same behavior as
> `Connection::Destroy` formerly gave.
>
> The `Destroy()` method still exists for downstream compatibility, but
> instead of deleting connection objects asynchronously, the deletion
> now happens synchronously via the Port class.
>
> Bug: webrtc:13892, webrtc:13865
> Change-Id: I07edb7bb5e5d93b33542581b4b09def548de9e12
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259826
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36676}

Bug: webrtc:13892, webrtc:13865
Change-Id: I37a15692c8201716402ba5c10f249e4d3754ce4c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260862
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36736}
2022-05-02 20:41:39 +00:00
Tommi
942cac2e9e Make deletion of Connection objects more deterministic.
This changes most deletion paths of Connection objects to go through
the owner class of the Connection instances, Port.

In situations where Connection objects still need to be deleted
asynchronously, `async = true` can be passed to
`Port::DestroyConnection` and get the same behavior as
`Connection::Destroy` formerly gave.

The `Destroy()` method still exists for downstream compatibility, but
instead of deleting connection objects asynchronously, the deletion
now happens synchronously via the Port class.

Bug: webrtc:13892, webrtc:13865
Change-Id: I07edb7bb5e5d93b33542581b4b09def548de9e12
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259826
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36676}
2022-04-27 21:52:31 +00:00
Tomas Gunnarsson
f15189dbce [CallbackList] Use CallbackList in AsyncPacketSocket for close events.
This removes use of the SignalClose sigslot. This CL includes thread
checks for the callback list and updates some call sites to unsubscribe
from events before deletion or detaching from a socket instance.

Bug: webrtc:11943
Change-Id: Ib66d39aa5cc795b750c9e3eaa85ed6af8b55b2b5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258561
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36540}
2022-04-13 14:56:58 +00:00
Tommi
d7e5cfb3cf Use WeakPtr<Port> in Connection classes.
This is to aid with catching issues whereby a connection object might
have a bad reference back to a port object, e.g. inside of an async
callback.

Bug: webrtc:13892
Change-Id: I56503fedc2865919713b10f236ce023554c68ded
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257164
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36394}
2022-03-31 12:44:02 +00:00
Jonas Oreland
c06fe8b04e WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 11/inf
convert rtc_base/network and collateral.

This also remove last usage of system_wrappers/field_trials
in p2p/...Yay!

Bug: webrtc:10335
Change-Id: Ie8507b1f52bf7f3067e9b4bf8c81a825e4644fda
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256640
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36357}
2022-03-28 15:48:01 +00:00
Niels Möller
e0c6bdf071 Use const rtc::Network* in ports and port allocator
No-try: True
Bug: webrtc:13869
Change-Id: I6004fa96278263d0d25a1446d7bb8de41a563433
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256682
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@google.com>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36353}
2022-03-28 12:48:30 +00:00
Jonas Oreland
f11a04d0f5 remove all but 2 redundant factory methods in TurnPort
and those will be fixed after I fixed downstream.

Bug: webrtc:10335
Change-Id: Ie824b422b4240fbcdb5d7ee40ae9be91655abae7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256111
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36274}
2022-03-21 08:12:22 +00:00
David Sanders
60c588d77e Fixed typos, candiate -> candidate
Bug: None
Change-Id: I2dee549aa79f1eb6bddd58cfc6c9f67eb6ba3663
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256147
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36273}
2022-03-21 06:30:32 +00:00
Jonas Oreland
340cb5e46a WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 8/inf
Convert p2p/.
This completes work started in https://webrtc-review.googlesource.com/c/src/+/255602

Bug: webrtc:10335
Change-Id: I39f70890be0599c8ef46ff7982d2a229e10e67ff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/255827
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36231}
2022-03-17 09:08:45 +00:00
Mirko Bonadei
8382968781 Reland "Remove workaround in AutoSocketServerThread that isn't needed anymore."
This reverts commit e4d3952bf0.

Reason for revert: Speculative revert.

Original change's description:
> Revert "Remove workaround in AutoSocketServerThread that isn't needed anymore."
>
> This reverts commit 44156fa024.
>
> Reason for revert: Needed in order to revert https://webrtc-review.googlesource.com/c/src/+/249941, which introduced a crash
>
> Original change's description:
> > Remove workaround in AutoSocketServerThread that isn't needed anymore.
> >
> > Cleanup steps for the Connection class have changed as of:
> > https://webrtc-review.googlesource.com/c/src/+/249941
> >
> > However, it turns out that the PortTest suite still needs it, so the
> > workaround has migrated to there.
> >
> > Bug: none
> > Change-Id: Ia68f47b6c65b3a8fd5e8c04d70a43d15ba1a6422
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250223
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#35894}
>
> Bug: none
> Change-Id: I13a4a79ebcb864054d14c1ba7726e18e044e3bd4
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252542
> Auto-Submit: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36076}

No-Try: True
Bug: none
Change-Id: If39bb2f26349c42c2377ed9f80c26eb18d90869f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252585
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36082}
2022-02-25 11:33:32 +00:00
Taylor Brandstetter
e4d3952bf0 Revert "Remove workaround in AutoSocketServerThread that isn't needed anymore."
This reverts commit 44156fa024.

Reason for revert: Needed in order to revert https://webrtc-review.googlesource.com/c/src/+/249941, which introduced a crash

Original change's description:
> Remove workaround in AutoSocketServerThread that isn't needed anymore.
>
> Cleanup steps for the Connection class have changed as of:
> https://webrtc-review.googlesource.com/c/src/+/249941
>
> However, it turns out that the PortTest suite still needs it, so the
> workaround has migrated to there.
>
> Bug: none
> Change-Id: Ia68f47b6c65b3a8fd5e8c04d70a43d15ba1a6422
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250223
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35894}

Bug: none
Change-Id: I13a4a79ebcb864054d14c1ba7726e18e044e3bd4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252542
Auto-Submit: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36076}
2022-02-25 10:14:38 +00:00
Tommi
44156fa024 Remove workaround in AutoSocketServerThread that isn't needed anymore.
Cleanup steps for the Connection class have changed as of:
https://webrtc-review.googlesource.com/c/src/+/249941

However, it turns out that the PortTest suite still needs it, so the
workaround has migrated to there.

Bug: none
Change-Id: Ia68f47b6c65b3a8fd5e8c04d70a43d15ba1a6422
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250223
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35894}
2022-02-03 07:29:22 +00:00
Tommi
f564bfe82d Fix potentially dangling pointers in several Connection related tests.
Bug: webrtc:11988
Change-Id: Iba3f41ba4be8c911d6bdc5241f736831c5a74d0f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249983
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35855}
2022-01-31 14:04:47 +00:00
Tommi
1bea008f9f Remove unused remote ice member from Connection
Bug: none
Change-Id: Ia80c362ca8cf0fb0ef63427e05131199b4685c6f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249982
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35837}
2022-01-31 08:02:13 +00:00
Niels Möller
6dd4997950 Fix TestTurnServer to not depend on rtc::Thread::socketserver() accessor
Updated all calls to constructor to pass appropriate
rtc::SocketFactory explicitly.

Bug: webrtc:13145
Change-Id: Ibaa764c7eaffbdb8dd6825fd518c54b37316ecb8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238807
Auto-Submit: Niels Moller <nisse@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35436}
2021-11-29 21:10:31 +00:00
Harald Alvestrand
97597c0f51 Remove usage of INFO alias for LS_INFO in log messages
Bug: webrtc:13362
Change-Id: Ifda893861a036a85c045cd366f9eab33c62ebde0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237221
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35310}
2021-11-04 13:46:17 +00:00