Commit Graph
101 Commits
Author SHA1 Message Date
Guogang Li 6707efeed8 internal refactor
PiperOrigin-RevId: 676552917
2024-09-19 13:58:21 -07:00
Guogang Li d5b5d92f87 Internal logging update
PiperOrigin-RevId: 669420403
2024-08-30 13:08:35 -07:00
Anay Wadhera 6a638f3042 Split core_internal_test into more manageable targets.
PiperOrigin-RevId: 659571860
2024-08-05 09:04:17 -07:00
Guogang Li 52c80303e3 Enhance on advertising
PiperOrigin-RevId: 655044204
2024-07-22 23:57:16 -07:00
hai007 7c72774167 Multiplex implementation - Create Multiplex Socket
PiperOrigin-RevId: 632628955
2024-05-10 16:11:26 -07:00
Anay Wadhera f26d25ed01 Provide a platform abstraction for RandBytes instead of swapping headers
The `RandBytes` functions were being placed in the `crypto` namespace,
which collides with Chromium's namespace of the same name. Within,
`RandBytes` was defined with almost-the-same API. Then in Chromium
builds, the Chromium header would be used instead (though somewhat
inconsistently).

This creates a lot of pain for Chromium development as there's a
third-party repository directly depending on headers from Chromium's
source tree, and is against the third-party policies for that reason.
There are a number of other headers that mirror Chromium and are
swapped out in the Chromium build that will cause similar pain, such as:
```
include "crypto/aead.h"
include "crypto/ec_private_key.h"
include "crypto/hkdf.h"
```

This CL provides a template for how to get rid of these header swaps and
give a platform abstraction in nearby instead.

We provide a platform abstraction in `platform/crypto.h` (really in
`platform/implementation/crypto.h`) which is implemented in
`platform/implementation/shared/crypto.cc`. However that implementation
is removed by `#ifdef` when in the Chromium build.

Then, in the Chromium repo, we will add (separately) an implementation
of the same abstraction in `//third_party/nearby/platform_impl` with GN
rules to include it in the build. It will replace the implementation
from the nearby repo.

Copybara import of the project:

--
6ca8099 by danakj <danakj@chromium.org>:

Provide a platform abstraction for RandBytes instead of swapping headers

The `RandBytes` functions were being placed in the `crypto` namespace,
which collides with Chromium's namespace of the same name. Within,
`RandBytes` was defined with almost-the-same API. Then in Chromium
builds, the Chromium header would be used instead (though somewhat
inconsistently).

This creates a lot of pain for Chromium development as there's a
third-party repository directly depending on headers from Chromium's
source tree, and is against the third-party policies for that reason.
There are a number of other headers that mirror Chromium and are
swapped out in the Chromium build that will cause similar pain, such as:
```
include "crypto/aead.h"
include "crypto/ec_private_key.h"
include "crypto/hkdf.h"
```

This CL provides a template for how to get rid of these header swaps and
give a platform abstraction in nearby instead.

We provide a platform abstraction in `platform/crypto.h` (really in
`platform/implementation/crypto.h`) which is implemented in
`platform/implementation/shared/crypto.cc`. However that implementation
is removed by `#ifdef` when in the Chromium build.

Then, in the Chromium repo, we will add (separately) an implementation
of the same abstraction in `//third_party/nearby/platform_impl` with GN
rules to include it in the build. It will replace the implementation
from the nearby repo.

--
9c2654b by danakj <danakj@chromium.org>:

Remove CryptoSpan, use absl::Span

The header swapping of Chromium crypto libraries is
problematic, but absl::Span will convert to base::span
so there's no need for the typedef even without
removing the header swapping yet.

--
df1135d by danakj <danakj@chromium.org>:

Add missing files

--
ab18a15 by danakj <danakj@chromium.org>:

Remove the random_unittest.cc from Swift build

The file moved, so the Swift package needs its path
updated.

--
2038f78 by danakj <danakj@chromium.org>:

Combine crypto unittests into crypto_test.cc

--
f7ad176 by danakj <danakj@chromium.org>:

Add stdint and stddef includes for uint8_t and size_t

--
9f04590 by danakj <danakj@chromium.org>:

Mark the shared crypto implementation compatable_with non_prod

--
18eeafd by danakj <danakj@chromium.org>:

Add IWYU pragma for crypto implementation

PiperOrigin-RevId: 632150866
2024-05-09 08:02:50 -07:00
hai007 1e1d841965 Multiplex implementation - Create Virtual Output Stream
PiperOrigin-RevId: 623540454
2024-04-10 10:44:50 -07:00
hai007 419fb08a8f Internal change
PiperOrigin-RevId: 621013420
2024-04-01 19:01:59 -07:00
Nick Bourdakos aa0a1bdfb8 Update Package.swift 2024-03-31 21:36:38 -04:00
hai007 a633a940f4 Multiplex implementation - Frame generation
PiperOrigin-RevId: 616247739
2024-03-15 14:45:01 -07:00
Guogang Li 61f71c6ce0 Added Nearby Context class
PiperOrigin-RevId: 615497408
2024-03-13 12:00:02 -07:00
hai007 16cb7f70b3 Implement Auto-reconnect after disconnection [1]
PiperOrigin-RevId: 592344338
2023-12-19 14:27:40 -08:00
Anay Wadhera 7022e6c5d9 Create instant on loss advertisement format
PiperOrigin-RevId: 590680562
2023-12-13 12:33:12 -08:00
Nick Bourdakos 387393f1d6 Delete old BLE code for Apple platforms
PiperOrigin-RevId: 559515626
2023-08-23 12:54:15 -07:00
Nick Bourdakos 9998093366 Add Objective-C++ BLE Medium wrapper
PiperOrigin-RevId: 558278732
2023-08-18 16:37:09 -07:00
Nick Bourdakos 07a94a950d Add Objective-C++ GATT client wrapper
PiperOrigin-RevId: 557925490
2023-08-17 13:48:48 -07:00
Nick Bourdakos 9d2cfc19c9 Add Objective-C++ GATT server wrapper
PiperOrigin-RevId: 552636264
2023-07-31 17:20:14 -07:00
Nick Bourdakos a42cdc7346 Move Server Socket and its dependencies to their own files
PiperOrigin-RevId: 551330682
2023-07-26 15:21:46 -07:00
Crisrael Lucero 0e44ed626d Refactor crypto/ directory into crypto_cros/ and crypto/
PiperOrigin-RevId: 549467911
2023-07-19 17:12:52 -07:00
Anay Wadhera d6d5310389 Weave port [8/n]: Introduce server socket implementation
PiperOrigin-RevId: 549446494
2023-07-19 15:43:57 -07:00
Anay Wadhera f95a875cde Weave port [7/n]: Introduce Weave client socket implementation
PiperOrigin-RevId: 547812816
2023-07-13 08:45:16 -07:00
Qin Wang a8b6fdee59 Implement fake GetResponse and migrate fake_http_client to third_party/nearby/internal/test
PiperOrigin-RevId: 544518775
2023-06-29 18:39:50 -07:00
Qin Wang 22c3a07677 Migrate DataManager to third_party/nearby/internal
PiperOrigin-RevId: 544395891
2023-06-29 10:31:07 -07:00
Anay Wadhera bb3de11104 Weave port [6/n]: Introduce Base socket implementation and connection interface.
PiperOrigin-RevId: 542872801
2023-06-23 09:00:39 -07:00
Anay Wadhera 2a9bf7c883 Introduce connections authentication transport
PiperOrigin-RevId: 541057398
2023-06-16 17:55:06 -07:00
Juliet Levesque 240159e872 [Nearby Connections] Stop 3 AttemptsToConnect over WebRTC for CancellationFlag
CancellationFlags will be used to prevent crashes during the shutdown of Nearby Connections from pending tasks taking too long during the shutdown period. WebRTC using 3 x 10s retries to connect, which means we are potentially waiting for 30 seconds of retries to execute during shutdown (which is longer than the 10s duration alloted for Core shutdown).

By using CancellationFlags, we can prevent the retries occuring during the Shutdown by short-circuiting an in flight AttemptToConnect, and checking for Cancellation before retries.

PiperOrigin-RevId: 539690403
2023-06-12 10:16:36 -07:00
Anay Wadhera 71558c0a5c Add ed25519 signature utilities
PiperOrigin-RevId: 537351543
2023-06-02 10:45:40 -07:00
Anay Wadhera 601d5f6b36 fixup! nearby swift: Update include paths for new ukey2 revisions 2023-05-16 11:52:02 -07:00
Anay Wadhera 4ea5e4cf8a nearby swift: Update include paths for new ukey2 revisions 2023-05-16 10:54:39 -07:00
Chun Zhang a925ed1072 Move FakeAuthenticationManager from location to third_party.
PiperOrigin-RevId: 532237745
2023-05-15 15:04:03 -07:00
Anay Wadhera 69d2edaea9 Weave port [5/n]: Introduce weave message write request
PiperOrigin-RevId: 530915704
2023-05-10 08:32:44 -07:00
Anay Wadhera 332da370a4 Weave port [4/n]: Introduce weave write request and single packet write request
PiperOrigin-RevId: 530439848
2023-05-08 16:33:42 -07:00
Anay Wadhera 630b2dd3db Create ConnectionsDeviceProvider
PiperOrigin-RevId: 529781099
2023-05-05 12:13:06 -07:00
Anay Wadhera d91904d79d Create ConnectionsDevice
PiperOrigin-RevId: 529447365
2023-05-04 10:26:47 -07:00
Anay Wadhera 5edd8e25ca Introduce v3 NC API callbacks
PiperOrigin-RevId: 527747390
2023-04-27 19:01:39 -07:00
Suet-Fei Li b023a666b9 Add empty EmptySwiftPackageManagerFile.cpp to trigger Swift Build of json.
PiperOrigin-RevId: 524017747
2023-04-13 09:11:14 -07:00
Nick Bourdakos ddea50e013 Fix Package.swift
PiperOrigin-RevId: 523907283
2023-04-12 23:17:27 -07:00
hai007 123815e841 Automated visibility attribute cleanup.
PiperOrigin-RevId: 523895219
2023-04-12 21:56:31 -07:00
Suet-fei Li 760b64e2e7 . 2023-04-12 23:09:35 +00:00
hai007 28f7498580 Fix include error for apple json.
PiperOrigin-RevId: 523724151
2023-04-12 09:38:22 -07:00
Suet-Fei Li ed4e000a2d Add Swift support for json depedency.
PiperOrigin-RevId: 523546713
2023-04-11 17:12:58 -07:00
Anay Wadhera a8bb29e1bf Weave port [3/n]: Introduce weave packet counter generator
PiperOrigin-RevId: 523189849
2023-04-10 12:56:57 -07:00
Anay Wadhera a1868432b9 Implement connection info DE format
PiperOrigin-RevId: 522678942
2023-04-07 14:02:40 -07:00
Anay Wadhera 3f1b0c81e3 Weave port [2/n]: Introduce Weave packetizer implementation
PiperOrigin-RevId: 518881931
2023-03-23 09:30:55 -07:00
Janusz Sobczak 1a78b33a89 Add InputStream::ReadExactly
Read() can return fewer bytes than requested.
ReadExactly() will call Read() repeatedly until we
have read as many bytes as we need.

PiperOrigin-RevId: 518719418
2023-03-22 17:45:50 -07:00
Nick Bourdakos f5eac5c47d Update README
PiperOrigin-RevId: 518014725
2023-03-20 10:50:10 -07:00
Anay Wadhera 69d2098ecb Weave port [1/n]: Introduce Weave packet implementation
PiperOrigin-RevId: 517526002
2023-03-17 15:44:09 -07:00
Qin Wang 86ca85b85a Migrate fake functions to third_party/nearby to help unit test
PiperOrigin-RevId: 517433481
2023-03-17 09:34:58 -07:00
Guogang Li f7e6deb8ab internal cleanup
PiperOrigin-RevId: 517211099
2023-03-16 13:27:26 -07:00
Guogang Li fd5430764f Created NearbyFlags to avoid create multiple classes
PiperOrigin-RevId: 516885843
2023-03-15 11:44:25 -07:00