Commit graph

25 commits

Author SHA1 Message Date
Jonas Oreland
02ce5887b6 Allow list the places which send STUN_REQUEST w/o password
Bug: chromium:1177125
Change-Id: Ia58a596871c8f15b9638d026a336a30c15f89f90
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/327441
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41165}
2023-11-15 11:31:45 +00:00
Tommi
f7b30e046e A few cleanup things for the port classes to clarify test code.
Remove FlushRequestsForTest
Rename test constant
Remove HasPendingRequestForTest

Bug: webrtc:13892
Change-Id: I78e13d229742c40743465b5fb57480c24d7417c1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258722
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37466}
2022-07-06 15:37:34 +00:00
Artem Titov
c374d11fac Move to_queued_task.h and pending_task_safety_flag.h into public API
Bug: b/235812579
Change-Id: I9fa3dc4a65044df8b44fff4e9bfeac7233fa381c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266080
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37248}
2022-06-17 09:20:39 +00:00
Tommi
7ef4f514c5 [MessageHandler] Remove rtc::MessageHandler inheritance from StunRequest
This removes MessageHandler and Thread dependencies from StunRequest
and StunRequestManager. Instead the TaskQueueBase abstraction is
used for async posting and synchronous Clear() operations removed by
using a pending task safety flag.

Bug: webrtc:9702
Change-Id: I6e9ed5e1b4c446fd1f91af06e3ab36bccb5d7320
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265060
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37218}
2022-06-15 08:42:48 +00:00
Tommi
159f313649 [StunRequest] Remove Construct and Prepare methods.
Construction in StunRequest and derived classes now happens in
the ctor.

Bug: none
Change-Id: I803f6fd2b6d0ac1d9426304d1e1de10dec855eed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264942
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37126}
2022-06-04 07:32:44 +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
f22dfdddfe Use std::function instead of sigslot for sending packets
Bug: webrtc:11943
Change-Id: I2df9908f5e2e2ded1f2c6fbf50ef415f73760b50
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258787
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36541}
2022-04-13 15:01:25 +00:00
Tommi
278b19da38 Rename variables of type StunMessage* from request to message.
This is just to reduce confusion since StunMessage and StunRequest
instances are frequently used together and message objects are often
configured from within request objects (which makes the name confusing).

Bug: none
Change-Id: I8bf5e774a5149239dd3023817614d411633bf583
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258484
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36533}
2022-04-12 12:52:08 +00:00
Tommi
2545257982 [StunRequestManager] Use unique_ptr in RequestMap
This removes the circular delete/remove pattern between the StunRequest
and StunRequestManager whereby deleting a request would call the
manager from the dtor to do a lookup+erase from the map. Instead
the operation of removing from the map, equals delete and is controlled
by the manager (owner) class.

Bug: webrtc:13892
Change-Id: I1920ac4b98636d38b851f4c2057026bfbd392584
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258660
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36532}
2022-04-12 11:52:21 +00:00
Tommi
86aa03e238 Refactor StunRequest and StunRequestManager classes.
* Make StunRequest::manager_ a reference, inject ref at ctor time.
* Make other member variables private.
* Mark methods that are only used for testing with "ForTest"
* Add RTC_GUARDED_BY for member variables and thread checks.
* Remove/reduce 'friend'-ness between classes.
* Use std::unique_ptr for owned and passed message pointers.
* Rename `requests_` to `request_manager_` (type: StunRequestManager)

Bug: webrtc:13892
Change-Id: I3a5d511b3c2645bb6813352d39e9fefe422dd1de
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258620
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36529}
2022-04-12 08:22:27 +00:00
Philipp Hancke
08a6e35848 Reland "Revert "Reland "remove stun origin support"""
This reverts commit 3b18208f13
and is the third attempt at removing stun origin support

Bug: webrtc:12132
Change-Id: Ic41a6d011fb6239907a257cc4c81ec4d2923dc4e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/236260
Reviewed-by: Taylor Brandstetter <deadbeef@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Christoffer Jansson <jansson@google.com>
Cr-Commit-Position: refs/heads/main@{#35294}
2021-11-02 09:53:11 +00:00
Taylor Brandstetter
3b18208f13 Revert "Reland "remove stun origin support""
This reverts commit 11a89c99e9.

Reason for revert: Breaks downstream code which is using the TurnPort constructor.

Original change's description:
> Reland "remove stun origin support"
>
> This is a reland of ba29ce320f
> readding the origin to the CreateRelayPortArgs structure to not break
> downstream tests yet:
>   https://webrtc-review.googlesource.com/c/src/+/235300/1..2
>
> Original change's description:
> > remove stun origin support
> >
> > Bug: webrtc:12132
> > Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
> > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#35202}
>
> Bug: webrtc:12132
> Change-Id: Ied840b59bb7c9497e98f9b80eb0a54d30008a40f
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235300
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35220}

TBR=deadbeef@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com,philipp.hancke@googlemail.com

Change-Id: If16cedb8ccba22d83c919f64f7234873ba859a75
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:12132
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235346
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35221}
2021-10-15 21:27:48 +00:00
Philipp Hancke
11a89c99e9 Reland "remove stun origin support"
This is a reland of ba29ce320f
readding the origin to the CreateRelayPortArgs structure to not break
downstream tests yet:
  https://webrtc-review.googlesource.com/c/src/+/235300/1..2

Original change's description:
> remove stun origin support
>
> Bug: webrtc:12132
> Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35202}

Bug: webrtc:12132
Change-Id: Ied840b59bb7c9497e98f9b80eb0a54d30008a40f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235300
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35220}
2021-10-15 19:46:24 +00:00
Artem Titov
41205b3c4d Revert "remove stun origin support"
This reverts commit ba29ce320f.

Reason for revert: Breaks downstream projects

Original change's description:
> remove stun origin support
>
> Bug: webrtc:12132
> Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35202}

TBR=deadbeef@webrtc.org,hta@webrtc.org,philipp.hancke@googlemail.com,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I5f3a7a15c7da8e752569683bfeac91f2160a4f55
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:12132
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235241
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35209}
2021-10-14 15:08:28 +00:00
Philipp Hancke
ba29ce320f remove stun origin support
Bug: webrtc:12132
Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35202}
2021-10-14 11:27:46 +00:00
Artem Titov
2dbb4c9775 Use backticks not vertical bars to denote variables in comments for /p2p
Bug: webrtc:12338
Change-Id: Ie047b750cdf7ea2efe7a4632d18d5ed719c5ea83
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226952
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34570}
2021-07-27 18:51:02 +00:00
Tomas Gunnarsson
4d76a13b33 Make StunRequest not use auto cleanup.
The class already clears the thread that's used in its dtor
and consistently uses the same thread.

Bug: webrtc:11908
Change-Id: I5ea8d00c2e59bf46c5b369be5b23cf1d8e1875c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184060
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32097}
2020-09-14 14:46:49 +00:00
Tomas Gunnarsson
abdb470d00 Make MessageHandler cleanup optional.
As documented in webrtc:11908 this cleanup is fairly invasive and
when a part of a frequently executed code path, can be quite costly
in terms of performance overhead. This is currently the case with
synchronous calls between threads (Thread) as well with our proxy
api classes.

With this CL, all code in WebRTC should now either be using MessageHandlerAutoCleanup
or calling MessageHandler(false) explicitly.

Next steps will be to update external code to either depend on the
AutoCleanup variant, or call MessageHandler(false).

Changing the proxy classes to use TaskQueue set of concepts instead of
MessageHandler. This avoids the perf overhead related to the cleanup
above as well as incompatibility with the thread policy checks in
Thread that some current external users of the proxies would otherwise
run into (if we were to use Thread::Send() for synchronous call).

Following this we'll move the cleanup step into the AutoCleanup class
and an RTC_DCHECK that all calls to the MessageHandler are setting
the flag to false, before eventually removing the flag and make
MessageHandler pure virtual.

Bug: webrtc:11908
Change-Id: Idf4ff9bcc8438cb8c583777e282005e0bc511c8f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183442
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32049}
2020-09-07 12:57:15 +00:00
Mirko Bonadei
f387946569 Remove WebRTC-Rfc5389StunRetransmissions.
Since there is no plan to follow-up on this, this CL removes the
field trial and the conditional logic based on it.

Bug: webrtc:11503, webrtc:10282
Change-Id: Iaf005eba6af0e23ea50456d75c5c53f37d488f7d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173477
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31062}
2020-04-14 12:43:26 +00:00
Sebastian Jansson
4db28b5ac1 Cleanup: Removes redundant includes on message_queue.h
This is part of a CL series merging rtc::MessageQueue into rtc::Thread.

Bug: webrtc:9883
Change-Id: I3cb857cc707d5e897759366d1478cc1ec19bce9a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165344
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30180}
2020-01-08 14:12:08 +00:00
Patrik Höglund
56d945233d Move stun.h to api/.
We now have two downstream users of stun.h, so it appears to be
generally usable. I put this in a new dir networking/, but I'm open to
suggestions here (maybe some things in api/ should move in there).

I checked what our downstream users are actually using, and it's

cricket::ComputeStunCredentialHash
cricket::<constants>
cricket::TurnMessage
cricket::GetStunErrorResponseType
cricket::StunAttribute::CreateAddress
cricket::StunErrorCodeAttribute
cricket::StunByteStringAttribute
StunAttribute::CreateUnknownAttributes
cricket::TurnErrorType
cricket::StunMessage

I reckoned that was pretty much everything in stun.h, so I didn't
bother splitting it up. They don't use every function and constant
in there, but all _types_ of functions and constants, so for the
sake of coherence I don't think it makes sense to split it.

There's some old stuff in there like GTURN which could arguably
be split out, but it should likely go away soon anyway, so I don't
think it's worth the effort.

Steps:
1) land this
2) update downstream to point to the new header and target
3) remove p2p/base:stun_types.

Bug: webrtc:11091
Change-Id: I1f05bf06055475d25601197ec6fefb8d3b55e8e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159923
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29822}
2019-11-18 16:11:27 +00:00
Jonas Olsson
a4d873786f Format almost everything.
This CL was generated by running

git ls-files | grep -P "(\.h|\.cc)$" | grep -v 'sdk/' | grep -v 'rtc_base/ssl_' | \
grep -v 'fake_rtc_certificate_generator.h' | grep -v 'modules/audio_device/win/' | \
grep -v 'system_wrappers/source/clock.cc' | grep -v 'rtc_base/trace_event.h' | \
grep -v 'modules/audio_coding/codecs/ilbc/' | grep -v 'screen_capturer_mac.h' | \
grep -v 'spl_inl_mips.h' | grep -v 'data_size_unittest.cc' | grep -v 'timestamp_unittest.cc' \
| xargs clang-format -i ; git cl format

Most of these changes are clang-format grouping and reordering includes
differently.

Bug: webrtc:9340
Change-Id: Ic83ddbc169bfacd21883e381b5181c3dd4fe8a63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144051
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28505}
2019-07-08 13:45:15 +00:00
Bjorn Terelius
0d28972d8f Add field trial to reduce max STUN check retransmissions from 8 to 6 in accordance with RFC 5389.
Bug: webrtc:10282
Change-Id: I19ac690e3388e2015792695cf7836cb727a4314b
Reviewed-on: https://webrtc-review.googlesource.com/c/120960
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26524}
2019-02-04 10:26:53 +00:00
Steve Anton
10542f21c8 (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries
Mechanically generated by running this command:

tools_webrtc/do-renames.sh update all-renames.txt && git cl format

Then manually updating:

tools_webrtc/sanitizers/tsan_suppressions_webrtc.cc

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I54824cd91dada8fc3ee3d098f971bc319d477833
Reviewed-on: https://webrtc-review.googlesource.com/c/115653
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26226}
2019-01-11 17:11:39 +00:00
Steve Anton
1c05765831 (3) Rename files to snake_case: move the files
Mechanically generated with this command:

tools_webrtc/do-rename.sh move all-renames.txt

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I8b05b6eab9b9d18b29c2199bbea239e9add1e690
Reviewed-on: https://webrtc-review.googlesource.com/c/115481
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26225}
2019-01-11 17:05:20 +00:00
Renamed from p2p/base/stunrequest.h (Browse further)