aboutsummaryrefslogtreecommitdiff
path: root/cast/common
AgeCommit message (Collapse)Author
2021-07-03Rename Device to ReceiverAbraham Corea Diaz
This patch renames relevant usages of Device to Receiver. Bug: b/155337619 Change-Id: Ib21c99ee7ceb6a7f73247e00c0e2638a92c342c1 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2998268 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2021-07-02Remove DVLOG debug logging throughout LibCastAbraham Corea Diaz
This patch removes instances of OSP_DVLOG in LibCast or changes them to OSP_VLOG as needed. Bug: b/159172782 Change-Id: I2fab57cece82af0dc67ad9a596404d563e7707cd Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/3001340 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2021-07-01Update message util to use EnumNameTableJordan Bayles
This patch updates CastMessageType to use EnumNameTable, closing out a TODO and somewhat cleaning up the code. Change-Id: Icae46033db8487e71ea7e15c5d0cc40275794db8 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2994034 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2021-06-30Rename ServiceInfo to ReceiverInfoAbraham Corea Diaz
This patch renames ServiceInfo and all related usages to ReceiverInfo. Bug: b/155337619 Change-Id: I9337dbb7f64339bf60f079726f21af9a2452cddb Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2994467 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2021-06-24Fix GN check issuesJordan Bayles
This patch fixes various issues found through `gn check` throughout the repository, including some fuzzing issues. Bug: b/155434332 Change-Id: I2dffa42f5dfd291a7c59653eb7ca16ec680bfddb Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2964569 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2021-04-21Cleanup TODOs from @miuJordan Bayles
This patch removes all remaining TODOs from the now-departed @miu, either reassigning them to jophba, or for the majority, just implementing the fix directly. Change-Id: I73c21f577bf115cf37ec880fac54eef1555de7c5 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2831302 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2021-04-01Remove OperationLoopbtolsch
This change removes OperationLoop because it's only used in one place and is arguably confusing. OperationLoop mixes sleep() and select() usage, with separate timeouts, which has resulted in some "tuning" bugs in the past. Since there's no benefit to the sleep portion and it is also what causes the confusion, this change removes it and thing directly uses SocketHandleWaiter in PlatformClientPosix. Bug: None Change-Id: I9f62c9253bee7d29b26d1838d34c1399f4d472b5 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2798852 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2021-03-05Fix a few more X509 struct accessesDavid Benjamin
I missed these earlier. Change-Id: I53873874f850193839003c8cb812a0bf68074453 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2740099 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2021-03-04Store NAME_CONSTRAINTS objects in local variablesDavid Benjamin
This avoids repurposing BoringSSL's internal fields, which would break if the X509 objects were ever passed into BoringSSL functions that used those fields. Change-Id: I84b11dba5dfda5483da00b71e0c4a9f672c20174 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2737735 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2021-03-04Maintain self-issued bit in a local variableDavid Benjamin
EXFLAG_SI is recomputed in each loop anyway, so there is no point storing it with the certificate in the first place. It is also, in this code, not *entirely* path-independent due to the is_root check. This fixes a potential bug where checking one path impacts the behavior of another path. Change-Id: If9b0d157dd49c44723c1a8e2f83eebfc3fc2779c Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2737756 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2021-03-04Use X509 getters instead of reaching into BoringSSL internalsDavid Benjamin
This CL is needed to compile with the latest revision of BoringSSL. We're in the process of aligning with OpenSSL upstream and switching the X509 structure from direct struct access to accessors. This CL fixes most instances leaves the mutation of x509->nc and x509->ex_flags (which, even before the struct became opaque, was unsupported), since they're a little more subtle. This also switches from X509V3_EXT_d2i to X509_get_ext_d2i, which saves some code. Note, however, both the old and new version of the CL do not correctly handle encoding errors in the extensions. For this CL, I've preserved the original bugs and have focused on resolving the direct struct accesses, rather than doing a thorough review for correctness. Change-Id: Ib7c535b726684719baa15c76a84e95a18e0d8114 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2737755 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2021-02-09Fix gn check errors for chromiumbtolsch
Bug: 1159043, 1159044, 1159045, 1159046, 1159047 Bug: 1159048, 1159049, 1159050, 1159051 Change-Id: I4c01784608057662fc432f4ac35ced7c0be9b601 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2678725 Commit-Queue: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: mark a. foltz <mfoltz@chromium.org>
2021-02-05Update mDNS service bindingJordan Bayles
This is a followup patch to: https://chromium-review.googlesource.com/c/openscreen/+/2643397 To make it RFC compliant, we now send to the multicast group address, not to ANY. We also bind to ANY address instead of the local address of the interface, since binding filters multicast traffic to only bound addresses. Joining the multicast group is what filters the traffic instead. Bug: b/178102949 Change-Id: I1d7e44b5e90d2f1f1d395cb9a8a689edf16bfafb Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2665304 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2021-02-05Use timegm/_mkgmtime instead of mktimeMin Yun
mktime return localized timezone result. Certification uses UTC time zone, so call timegm/_mkgmtime to match with certification. Change-Id: I338ca14bb75e75d45c1de1ab976a61ec2e51eeca Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2658656 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2020-12-10Refactor session message sendingJordan Bayles
This patch refactors session message sending to include multiple new message types, such as RPC and GET_STATUS. Integration tests are included. Bug: b/170756458, b/174188662 Change-Id: I8b5de8a668171e0ce7cb3e74651d207aa7911c24 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2506651 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Yuri Wiitala <miu@chromium.org>
2020-12-09Remote virtual connections [3/3]: Connection messages are special-cased.Yuri Wiitala
Connection namespace messages are weird: The source_id and destination_id are NOT treated as "envelope routing information," like for all other namespaces. Instead, they are considered part of the payload data for CONNECT/CLOSE requests. Thus, they require special-case handling in VirtualConnectionRouter. Bug: b/162542369 Change-Id: I933ad63c01d9e6af9a58a67a2f05da3a76986c2c Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2546885 Commit-Queue: Yuri Wiitala <miu@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2020-12-09Remote virtual connections [2/3]: Add Open/CloseRemoteConnection().Yuri Wiitala
This patch adds two new methods to ConnectionNamespaceHandler, to allow Cast applications to establish and shutdown virtual connections over a socket to a remote device. Internally, this causes CONNECT, CONNECTED, and CLOSE messages to be sent between peers. Improved/Filled-in fields for CONNECT messaging (based on Chromium's implementation). Bug: b/162542369 Change-Id: I26c3de9a9f79140e553905a35b8ee455f94eaf7e Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2546883 Commit-Queue: Yuri Wiitala <miu@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2020-11-30Remote virtual connections [1/3]: Refactor VCRouter to extend VCManager.Yuri Wiitala
This is a clean-up patch to simplify code structure. Before this patch, all clients of VirtualConnectionRouter need to instantiate both a VirtualConnectionManager and a VirtualConnectionRouter, and then pass the former (by pointer) to the latter. After this patch, VCR extends VCM, and clients need not worry about a VCM. Bug: b/162542369 Change-Id: I0dff69819d9b5282a43643a2da0fe33e7bf0a3fd Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2546803 Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2020-11-25Logging cleanupsJordan Bayles
This patch removes some test-specific logging code in favor of death tests, and makes the OSP_NOTREACHED macro actually be annotated as [[noreturn]], so you don't have to put a bogus return statement after it. Change-Id: I6a6a271182061cbd98593ac0ae79347e48da5bc7 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2555597 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2020-11-24Fix supported_address_families DCHECK in ServiceInstance ctor.Yuri Wiitala
The original DCHECK was mandating IPv4/6 be used if the network interface supports it, even if a client may not want to use IPv4/6. This patch changes the logic to the intended sanity-check: IPv4/6 can only be considered supported if the network interface has an IPv4/6 address. The client can still choose whether to use it or not. Bug: b/162542369 Change-Id: I76e3983eb36c63769d4574e75e07df51dd4540d4 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2552426 Commit-Queue: Yuri Wiitala <miu@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2020-11-24Bring openscreen::cast::ServiceInfo parsing/validation up-to-spec.Yuri Wiitala
1. More-thorough validation-before-serialization (ServiceInfo::IsValid()), ensuring required fields are set, within valid ranges, and will fit within the TXT record field maximum size. 2. Make "model name" an optional field (was being treated as required). 3. Range-checks of untrusted input in DnsSdInstanceEndpointToServiceInfo(). 4. Rename kXYZId[] char constants to kXYZKey[], since they are key names in the record, not identifiers. 5. Removed DnsSdTxtRecord::SetValue() overload for uint8_t values, since it was being erroneously used to set values that were supposed to be decimal-formatted number strings (i.e., not a raw byte value!). 6. Add a regression test, to ensure a real-world TXT record from a Chromecast Ultra is successfully converted into a ServiceInfo. Bug: b/162542369 Change-Id: I06633c6c54dd2f6e6367033381b100949b08be8b Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2552423 Commit-Queue: Yuri Wiitala <miu@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2020-11-20CastSocketMessagePort: Filter broadcast messages.Yuri Wiitala
Adds a filter for broadcast messages since MessagePorts represent 1-to-1 connections. Also, clarified a comment for GetSocketId() in the header file. Bug: b/162542369 Change-Id: Ib30524d2759cf6ef5184ff2881735dcdcd3151dc Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2546886 Commit-Queue: Yuri Wiitala <miu@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2020-11-04Factor WaitForCondition to reuse in testsbtolsch
Bug: None Change-Id: Ia93e7d958c854a268974940263cd0b7b82213190 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2514585 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2020-10-17Mask dev cert arg when build_with_chromiumJordan Bayles
This patch updates the cast_allow_developer_certificate arg to only be defined when !build_with_chromium, to avoid multiple definition errors. Change-Id: Ib7eb92e93bb79286270e17317c1e05fccf302ba1 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2469158 Reviewed-by: Yuri Wiitala <miu@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-10-09Add build flag for self-signed certsJordan Bayles
This patch changes the standalone receiver and sender implementations to use a new CAST_ALLOW_DEVELOPER_CERTIFICATE build flag/preprocessor macro for gating usage of self-signed certificates. When false, the cast_receiver app is disabled, and the cast_sender app will only connect to receivers using a proper Google cert. When the build flag is enabled, the cast sender can use any self-signed certificate as long as the CA bit is set. The cast receiver can either take a self-signed certificate and its private key, or generate both the private key and the certificate. The resulting private key and certificate are written out to files, currently: ./generated_root_cast_receiver.(key|crt) and can then be used with a cast_sender to start a session. Bug: b/169796278 Change-Id: I03675f85ac0b2bda76daf1bf11d9d7df064d0b8f Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2443934 Reviewed-by: Jordan Bayles <jophba@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: mark a. foltz <mfoltz@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-10-05Cast Receiver Application AgentYuri Wiitala
Adds an agent that handles the Cast V2 Application Control messaging, and implements a Cast Application "switcher" and application message router. Added a MakeUniqueSessionId() utility to de-dupe functions that generate transport IDs for Cast Channel messaging. Bug: b/170134050 Change-Id: I1d79e7e3c479dd4f3dc35406b0e64046b4fa011b Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2449149 Commit-Queue: Yuri Wiitala <miu@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2020-10-02[Cast Channel] Add broadcast routing in VirtualConnectionRouter.Yuri Wiitala
Replaces TODO comments with the implementation. :) This change is needed for a soon-upcoming patch that will introduce a basic Cast Agent (service for handling Cast V2 Application Control messages) for a Cast Receiver. The CastMessageHandler interface API contract was adjusted to allow a nullptr CastSocket* argument, when a broadcast message comes from a local peer instead of a remote sender. Bug: b/169453993 Change-Id: Idbc698336e01022b8e7090498e882c66bb4922b0 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2433087 Commit-Queue: Yuri Wiitala <miu@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: Yuri Wiitala <miu@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2020-09-30Properly use message router for cast message portJordan Bayles
This patch updates the CastSocketMessagePort to properly use the VirtualConnectionRouter::Send method instead of directly calling on the socket. This also includes a change to register new connections on the VirtualConnectionManager. Change-Id: I7dab0f2d2595f7c5a5a78bfa8444e22e7f083dd1 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2432093 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Yuri Wiitala <miu@chromium.org>
2020-09-29Fix PEM_read callsJordan Bayles
This patch moves PEM_read calls to using long types plus NOLINT directives. Change-Id: Ib8196599ac8b51deba623f48b252ab8a229b2563 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2438680 Reviewed-by: Jordan Bayles <jophba@chromium.org> Reviewed-by: Yuri Wiitala <miu@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-09-26Fixup standalone_{receiver, sender}Jordan Bayles
Currently the cast sender and receiver cannot connect because the receiver cannot present a CA-signed certificate due to not being able to set the private key or use a self signed certificate. This patch adds support for setting these arguments on both the cast sender and receiver, as well as some fixes found through manual testing. Total changelist: 1. Refactored testing code for reading certificates and private keys to share with the standalone sender, receiver. 2. Refactored TrustStore and CastTrustStore to allow self signed certificates and usage by the Cast Sender. 3. Updated the UDP socket POSIX implementation to allow reading--the previous implementation cannot read packets. 4. Updated certificate validation to work with the self signed certificates in the trust store. 5. Updated documentation. Example usage: $ ./out/Default/cast_sender -s cast_streaming.crt -v ~/video-1080-mp4.mp4 $ ./out/Default/cast_receiver lo0 -v -x -p cast_streaming_rsa -s cast_streaming.crt Bug: b/156995806 Change-Id: I6e31e66beff33c260e467290f454ec1dcc758660 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2426996 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Yuri Wiitala <miu@chromium.org>
2020-09-23Remove duplicate cert code, refactorJordan Bayles
Currently, there is a lot of overlap between test and the standalone receiver code. This patch attempts to rectify some of that duplication. Change-Id: I269e03b56a9977f63208084e97b21fafbff30aab Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2416865 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-09-21[Cast Streaming] Implement CastAgent for standalone senderJordan Bayles
This patch adds a new CastAgent class for the standalone sender executable. It also updates the standalone sender to consume this CastAgent, as well as various fixes for issues exposed by testing with this class. Bug: b/162542753 Change-Id: I54ea372feea9e9f308d012f5495d1034cb61cb39 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2417831 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Yuri Wiitala <miu@chromium.org>
2020-09-21[Cast Streaming] Implement sender session classJordan Bayles
This patch adds a new SenderSession class along with unit testing for this class. Embedders can create an instance of this class in order to start a streaming session with an already known receiver. The embedder is expected to have a valid TLS connection already established with the receiver. Bug: b/162542753 Change-Id: Ia91df728d947e1fa20ed0b360f595f75d41bf11c Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2378540 Reviewed-by: Jordan Bayles <jophba@chromium.org> Reviewed-by: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Yuri Wiitala <miu@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-07-10[Open Screen] Fix/remove some TODOs in util/mark a. foltz
- Replace OSP_LOG with OSP_LOG_INFO - Remove TODO in scoped_trace_operations_unittest.cc - Update TODO in yet_another_bit_vector.cc Bug: openscreen:52 Change-Id: I6584413aeb0d20dc09a91f7744092d3963d62224 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2063423 Reviewed-by: Ryan Keane <rwkeane@google.com> Reviewed-by: Yuri Wiitala <miu@chromium.org> Commit-Queue: mark a. foltz <mfoltz@chromium.org>
2020-06-19Made certificate_proto fuzzable.John Williams
Change-Id: Ia4fe6966c879f9ec4644a7f73c99e786aed53f65 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2252608 Reviewed-by: Jordan Bayles <jophba@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-06-19Discovery: Add support for non-cyclic SRV pointersRyan Keane
This CL implements the swap from dns_data to dns_data_graph, as added in CL: https://chromium-review.googlesource.com/c/openscreen/+/2223690 After the completion of this CL, support for Address records with domain different from that of the SRV record pointing to them will be supported. See documentation at the top of dns_data_graph.h for further details about this hierarchy. NOTE: After this change, the querier will maintain support for multiple address and SRV records as called out in b/158533685 and b/158532090. Bug: b/157683753 Change-Id: I898cb9b98e4808ce7b49e616d42922f29dcfe73a Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2246313 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2020-06-12Discovery: Update Public API to support multiple addressesRyan Keane
Currently, the DNS-SD implementation only supports a single A and AAAA record per received service instance. This works for CastV2, but as a more general mDNS + DNS-SD implementation, this limitation should be removed. This CL takes the first step towards this change by updating the public API to support a vector of addresses rather than a single address. Bug: b/158531165 Change-Id: I0c289428be1e558b0b7a7dede86dbe18aefafd75 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2238900 Reviewed-by: Jordan Bayles <jophba@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-06-03Move std::chrono using statements to util/Jordan Bayles
This patch moves openscreen::<time type> using statements to be part of a new util/ header, chrono_helpers.h. Some helpful convenience functions are provided for doing conversions, and a new conversion method, to_duration, is added to the Clock implementation. Change-Id: I5a153c4da5266bceea97de0cad00a71a739f71ca Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2222684 Reviewed-by: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-05-28[Open Screen] Fix lint errors.mark a. foltz
This fixes a number of lint errors in the codebase flagged by cpplint.py. It also turns off a couple of checks: 1. The header check is too restrictive 2. The whitespace/braces check doesn't fully grok initializer list syntax. Bug: b/156101497 Change-Id: I11caefdc14fa1c5891022357bee35595673c4341 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2219135 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: mark a. foltz <mfoltz@chromium.org>
2020-05-22Added support for libprotobuf-mutator.John Williams
The files added by this change are copied from Chromium with slight alterations to remove dependencies on Chromium build infrastructure. Change-Id: I95d96a02eaa542a8f278dbf46bd8a37a814c9c5a Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2212944 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2020-05-21Add basic functional tests for the CastAgentJordan Bayles
This patch adds some rudimentary test coverage to ensure that the CastAgent in the standalone receiver implementation is not entirely broken. Bug: b/153079471 Change-Id: Iff26badce61fbded172ff27c490440651909b0c3 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2169345 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-05-18Time and clock::duration cleanupsJordan Bayles
This patch contains a few minor time-related cleanups: 1. Instead of having using statements literally everywhere, moved to using statements for common std::chrono types in the trivial clock traits header. 2. Removed some Clock::duration types in favor of std::chrono::milliseconds, because Clock::duration is frequently used incorrectly--it's microseconds, not milliseconds, so typical instantiation values of 50 are essentially 0 seconds. Change-Id: If2b30ca7605bf40165dfb6e76f8386ffa1c0eb87 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2204429 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-05-07Rename util/logging.h to avoid collisionsJordan Bayles
Currently, the util/logging.h file causes build issues because other external repos have the same file. This patch fixes this bug by renaming our copy of logging.h to osp_logging.h, the same way we renamed DCHECK to OSP_DCHECK. Bug: b/155927492 Change-Id: I75ff546775bed01daeda2a631c06b4776e3829f1 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2186351 Reviewed-by: mark a. foltz <mfoltz@chromium.org>
2020-04-29Improve executable debugging optionsJordan Bayles
Currently, we use the gtest main for both unittests and e2e tests, which means that we don't have access to tracing or verbose logging for those binaries. This patch fixes it by adding a custom test main. This, along with other issues, has resulted in major inconsistencies in the options provided by each of our binaries (osp_demo, e2e_tests, openscreen_unittests, especially), even though they all link against the same platform implementation. This patch attempts to fix some of the more frustrating issues with the options these binaries present, by implementing the following list of fixes: 1. Move to actually honoring trace logging gn arg, and deletion of the features.h header since it is unnecessary. This means our trace logging readme is actually right and you can now actually disable trace logging by setting the gn arg enable_trace_logging = false. 2. Addition of a custom unit test main. If trace logging is enabled, -t will toggle it on. If the platform impl is linked (we MUST know this, as when we are embedded we have no way of setting logging, and this test main should be used both in embedded and not embedded use cases) then the log level may be set to verbose by passing -v. 3. The cast_sender, cast_receiver, and osp_demo binaries are cleaned up to match the flags added to the test main binary. Note that additional cleanup is warranted on the osp_demo to make it more in line with other binaries. Change-Id: I500a46cb118c0721c4c59bd367d3c96d1a542720 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2168547 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2020-04-22Move CastSocket components to public/ dirsbtolsch
This change moves CastSocket and both factories to their respective public directories to make embedder DEPS whitelisting clearer. Bug: b/154090565 Change-Id: Ieee5ed5bf794e26683dd0ea58c97c6299c1579af Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2161147 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2020-04-16Add windows path for gmtimebtolsch
This change adds a preprocessor branch for calling the Windows version of gmtime. This is specifically to allow building with Chrome. Bug: 1050913 Change-Id: I230c674fc93b6b83b63c4a1019d2f4505af233d9 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2152211 Commit-Queue: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2020-04-16Read all available CastMessages in CastSocketbtolsch
This change makes CastSocket repeatedly deserialize CastMessages whenever it gets a new block from TLS. This fixes the case where multiple messages are received in one TLS read. Bug: 1050913 Change-Id: Ia29e2c82c29d921073eaa20874a835d33b2eb4bb Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2151857 Commit-Queue: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2020-04-16Rename CastSocket::SendMessage to Sendbtolsch
This change renames both CastSocket::SendMessage and the wrapper VirtualConnectionRouter::SendMessage to Send. On Windows, translation units compiled with windows.h will accidentally rename this to SendMessageA or SendMessageW due Microsoft's macro-ing. This means that libcast code compiled without windows.h won't link with anything compiled with windows.h. Bug: 1050913 Change-Id: I24faa8895a921c4a17a7dafc442a0cbcc980de8e Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2152217 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2020-04-15Discovery: Update contract between discovery layersRyan Keane
This CL updates documentation and source code to fit the new method contract that callbacks from lower layers will not invoke calls back to that same layer It addresses comments in the following CL while providing an alternative solution to the bug: https://chromium-review.googlesource.com/c/openscreen/+/2080670 This fix was added due to the following edge case: The OnRecordChanged callback would fire kExpired for a PTR record. This would make dnssd/impl/querier_impl stop the mDNS kALL query associated with the pointed to domain. This would then call mDNS Querier and update |callbacks_| which would invalidate the iterator still being used by the original call, resulting in an infinite loop since the exit condition is never hit. Additionally, E2E tests have been updated to test for this edge case. Change-Id: Ie1a8301cfb5e8589a83b3015571fac79edca15af Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2148178 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-04-10Force test logic checks in e2e testsbtolsch
This change makes all OSP_DCHECKs into OSP_CHECKs in the e2e tests where they are checking test logic (e.g. taking the place of ASSERT_* for threading reasons). This is slightly more correct/consistent but is also relevant since debug was recently disabled on the bots (temporarily, during a recipe update). Bug: openscreen:121 Change-Id: Ia4c58640c1ad0a9c5d4502c5609309c39f02550d Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2143633 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>