aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn6
-rw-r--r--DEPS10
-rwxr-xr-x[-rw-r--r--]PRESUBMIT.py0
-rw-r--r--cast/common/BUILD.gn4
-rw-r--r--cast/common/mdns/mdns_reader.h2
-rw-r--r--cast/common/mdns/mdns_records.h2
-rw-r--r--cast/common/mdns/mdns_writer.h2
-rw-r--r--osp/impl/BUILD.gn6
-rw-r--r--osp/impl/discovery/mdns/BUILD.gn4
-rw-r--r--osp/impl/discovery/mdns/domain_name.cc2
-rw-r--r--osp/impl/discovery/mdns/domain_name.h2
-rw-r--r--osp/impl/discovery/mdns/domain_name_unittest.cc2
-rw-r--r--osp/impl/discovery/mdns/embedder_demo.cc2
-rw-r--r--osp/impl/discovery/mdns/mdns_responder_adapter.h4
-rw-r--r--osp/impl/discovery/mdns/mdns_responder_adapter_impl.h2
-rw-r--r--osp/impl/discovery/mdns/mdns_responder_platform.cc4
-rw-r--r--osp/impl/internal_services.cc2
-rw-r--r--osp/impl/internal_services.h4
-rw-r--r--osp/impl/mdns_responder_service.cc2
-rw-r--r--osp/impl/mdns_responder_service.h2
-rw-r--r--osp/impl/presentation/presentation_connection.cc2
-rw-r--r--osp/impl/presentation/url_availability_requester.h2
-rw-r--r--osp/impl/quic/BUILD.gn4
-rw-r--r--osp/impl/quic/quic_client.h2
-rw-r--r--osp/impl/quic/quic_client_unittest.cc2
-rw-r--r--osp/impl/quic/quic_connection_factory.h2
-rw-r--r--osp/impl/quic/quic_connection_factory_impl.cc2
-rw-r--r--osp/impl/quic/quic_connection_factory_impl.h2
-rw-r--r--osp/impl/quic/quic_connection_impl.cc2
-rw-r--r--osp/impl/quic/quic_connection_impl.h2
-rw-r--r--osp/impl/quic/quic_server.h2
-rw-r--r--osp/impl/quic/quic_server_unittest.cc2
-rw-r--r--osp/impl/quic/testing/quic_test_support.h2
-rw-r--r--osp/impl/receiver_list.h2
-rw-r--r--osp/impl/receiver_list_unittest.cc2
-rw-r--r--osp/impl/service_listener_impl.cc2
-rw-r--r--osp/impl/service_listener_impl.h4
-rw-r--r--osp/impl/service_publisher_impl.h4
-rw-r--r--osp/impl/testing/fake_mdns_responder_adapter.cc2
-rw-r--r--osp/impl/with_destruction_callback.cc (renamed from osp_base/with_destruction_callback.cc)2
-rw-r--r--osp/impl/with_destruction_callback.h (renamed from osp_base/with_destruction_callback.h)8
-rw-r--r--osp/msgs/request_response_handler.h4
-rw-r--r--osp/public/BUILD.gn3
-rw-r--r--osp/public/endpoint_request_ids.h2
-rw-r--r--osp/public/message_demuxer.cc4
-rw-r--r--osp/public/message_demuxer.h2
-rw-r--r--osp/public/network_metrics.h2
-rw-r--r--osp/public/presentation/presentation_connection.h6
-rw-r--r--osp/public/presentation/presentation_controller.h2
-rw-r--r--osp/public/protocol_connection.h2
-rw-r--r--osp/public/protocol_connection_client.h6
-rw-r--r--osp/public/protocol_connection_server.h6
-rw-r--r--osp/public/server_config.h2
-rw-r--r--osp/public/service_info.h4
-rw-r--r--osp/public/service_info_unittest.cc2
-rw-r--r--osp/public/service_listener.h4
-rw-r--r--osp/public/service_publisher.h4
-rw-r--r--osp/public/timestamp.h (renamed from osp_base/time.h)6
-rw-r--r--osp_base/DEPS13
-rw-r--r--platform/BUILD.gn27
-rw-r--r--platform/README.md31
-rw-r--r--platform/api/DEPS10
-rw-r--r--platform/api/event_waiter.h2
-rw-r--r--platform/api/export.h (renamed from osp_base/export.h)6
-rw-r--r--platform/api/network_interface.h2
-rw-r--r--platform/api/network_runner.h4
-rw-r--r--platform/api/network_waiter.h2
-rw-r--r--platform/api/tls_socket.h6
-rw-r--r--platform/api/tls_socket_creds.h2
-rw-r--r--platform/api/udp_read_callback.h2
-rw-r--r--platform/api/udp_socket.h6
-rw-r--r--platform/base/DEPS7
-rw-r--r--platform/base/error.cc (renamed from osp_base/error.cc)2
-rw-r--r--platform/base/error.h (renamed from osp_base/error.h)8
-rw-r--r--platform/base/error_unittest.cc (renamed from osp_base/error_unittest.cc)2
-rw-r--r--platform/base/ip_address.cc (renamed from osp_base/ip_address.cc)2
-rw-r--r--platform/base/ip_address.h (renamed from osp_base/ip_address.h)8
-rw-r--r--platform/base/ip_address_unittest.cc (renamed from osp_base/ip_address_unittest.cc)4
-rw-r--r--platform/base/location.cc (renamed from osp_base/location.cc)4
-rw-r--r--platform/base/location.h (renamed from osp_base/location.h)6
-rw-r--r--platform/base/location_unittest.cc (renamed from osp_base/location_unittest.cc)2
-rw-r--r--platform/base/macros.h (renamed from osp_base/macros.h)6
-rw-r--r--platform/impl/DEPS12
-rw-r--r--platform/impl/event_loop.h2
-rw-r--r--platform/impl/event_waiter_posix.cc2
-rw-r--r--platform/impl/network_interface_linux.cc4
-rw-r--r--platform/impl/network_interface_mac.cc4
-rw-r--r--platform/impl/network_runner.cc2
-rw-r--r--platform/impl/network_waiter_posix.cc2
-rw-r--r--platform/impl/scoped_pipe.h (renamed from osp_base/scoped_pipe.h)6
-rw-r--r--platform/impl/scoped_pipe_unittest.cc (renamed from osp_base/scoped_pipe_unittest.cc)2
-rw-r--r--platform/impl/ssl_context.cc2
-rw-r--r--platform/impl/ssl_context_unittest.cc4
-rw-r--r--platform/impl/task_runner.cc (renamed from platform/impl/task_runner_impl.cc)2
-rw-r--r--platform/impl/task_runner.h (renamed from platform/impl/task_runner_impl.h)8
-rw-r--r--platform/impl/task_runner_unittest.cc (renamed from platform/impl/task_runner_impl_unittest.cc)3
-rw-r--r--platform/impl/udp_socket_posix.cc2
-rw-r--r--streaming/cast/DEPS9
-rw-r--r--streaming/cast/compound_rtcp_builder.cc2
-rw-r--r--streaming/cast/compound_rtcp_parser.cc2
-rw-r--r--streaming/cast/encoded_frame.h2
-rw-r--r--streaming/cast/frame_crypto.cc4
-rw-r--r--streaming/cast/frame_crypto.h2
-rw-r--r--streaming/cast/packet_util.h2
-rw-r--r--streaming/cast/rtp_packetizer.cc2
-rw-r--r--streaming/cast/ssrc_unittest.cc2
-rw-r--r--util/BUILD.gn (renamed from osp_base/BUILD.gn)23
-rw-r--r--util/DEPS7
-rw-r--r--util/README.md8
-rw-r--r--util/alarm.cc (renamed from osp_base/alarm.cc)2
-rw-r--r--util/alarm.h (renamed from osp_base/alarm.h)6
-rw-r--r--util/alarm_unittest.cc (renamed from osp_base/alarm_unittest.cc)2
-rw-r--r--util/big_endian.cc (renamed from osp_base/big_endian.cc)2
-rw-r--r--util/big_endian.h (renamed from osp_base/big_endian.h)6
-rw-r--r--util/big_endian_unittest.cc (renamed from osp_base/big_endian_unittest.cc)2
-rw-r--r--util/crypto/DEPS11
-rw-r--r--util/crypto/openssl_util.cc (renamed from osp_base/crypto/openssl_util.cc)2
-rw-r--r--util/crypto/openssl_util.h (renamed from osp_base/crypto/openssl_util.h)10
-rw-r--r--util/crypto/rsa_private_key.cc (renamed from osp_base/crypto/rsa_private_key.cc)4
-rw-r--r--util/crypto/rsa_private_key.h (renamed from osp_base/crypto/rsa_private_key.h)8
-rw-r--r--util/crypto/rsa_private_key_unittest.cc (renamed from osp_base/crypto/rsa_private_key_unittest.cc)2
-rw-r--r--util/crypto/secure_hash.cc (renamed from osp_base/crypto/secure_hash.cc)4
-rw-r--r--util/crypto/secure_hash.h (renamed from osp_base/crypto/secure_hash.h)8
-rw-r--r--util/crypto/secure_hash_unittest.cc (renamed from osp_base/crypto/secure_hash_unittest.cc)2
-rw-r--r--util/crypto/sha2.cc (renamed from osp_base/crypto/sha2.cc)6
-rw-r--r--util/crypto/sha2.h (renamed from osp_base/crypto/sha2.h)6
-rw-r--r--util/crypto/sha2_unittest.cc (renamed from osp_base/crypto/sha2_unittest.cc)4
-rw-r--r--util/json/DEPS8
-rw-r--r--util/json/json_reader.cc (renamed from osp_base/json/json_reader.cc)4
-rw-r--r--util/json/json_reader.h (renamed from osp_base/json/json_reader.h)6
-rw-r--r--util/json/json_reader_unittest.cc (renamed from osp_base/json/json_reader_unittest.cc)8
-rw-r--r--util/json/json_writer.cc (renamed from osp_base/json/json_writer.cc)4
-rw-r--r--util/json/json_writer.h (renamed from osp_base/json/json_writer.h)6
-rw-r--r--util/json/json_writer_unittest.cc (renamed from osp_base/json/json_writer_unittest.cc)8
-rw-r--r--util/std_util.h (renamed from osp_base/std_util.h)6
-rw-r--r--util/stringprintf.h (renamed from osp_base/stringprintf.h)6
136 files changed, 336 insertions, 272 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 7a778bcf..d38b29e8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -12,11 +12,11 @@ group("gn_all") {
"cast/common:mdns",
"osp",
"osp/msgs",
- "osp_base",
"platform",
"third_party/abseil",
"third_party/tinycbor",
"tools/cddl",
+ "util",
]
if (use_mdns_responder) {
@@ -39,11 +39,11 @@ executable("openscreen_unittests") {
"osp:osp_unittests",
"osp/impl/discovery/mdns:mdns_unittests",
"osp/msgs:unittests",
- "osp_base:osp_base_unittests",
"platform:platform_unittests",
"streaming/cast:cast_unittests",
"third_party/abseil",
"third_party/googletest:gtest_main",
+ "util:util_unittests",
]
}
@@ -56,8 +56,8 @@ if (use_chromium_quic && use_mdns_responder) {
deps = [
"//osp:osp_with_chromium_quic",
"//osp/impl/discovery/mdns",
- "//osp_base",
"//platform",
+ "//util",
]
}
}
diff --git a/DEPS b/DEPS
index d60266af..294aadb5 100644
--- a/DEPS
+++ b/DEPS
@@ -111,15 +111,11 @@ recursedeps = [
'third_party/chromium_quic/src',
]
-# TODO(mfoltz): Change to allow only base and third_party from the top level
-# once OSP code is moved into osp/.
include_rules = [
- '+osp',
- '+osp_base',
+ '+util',
'+platform',
'+third_party',
-
# Don't include abseil from the root so the path can change via include_dirs
# rules when in Chromium.
'-third_party/abseil',
@@ -143,10 +139,6 @@ include_rules = [
"-third_party/googletest",
"+gtest",
"+gmock",
-
- # BoringSSL includes
- '-third_party/boringssl',
- '+openssl',
]
skip_child_includes = [
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 3721d614..3721d614 100644..100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
diff --git a/cast/common/BUILD.gn b/cast/common/BUILD.gn
index c4105448..8704ef23 100644
--- a/cast/common/BUILD.gn
+++ b/cast/common/BUILD.gn
@@ -16,9 +16,9 @@ source_set("mdns") {
]
deps = [
- "../../osp_base",
"../../platform",
"../../third_party/abseil",
+ "../../util",
]
configs += [ "../../build:allow_build_from_embedder" ]
@@ -35,11 +35,11 @@ source_set("mdns_unittests") {
deps = [
":mdns",
- "../../osp_base",
"../../platform",
"../../third_party/abseil",
"../../third_party/googletest:gmock",
"../../third_party/googletest:gtest",
+ "../../util",
]
configs += [ "../../build:allow_build_from_embedder" ]
diff --git a/cast/common/mdns/mdns_reader.h b/cast/common/mdns/mdns_reader.h
index 16649296..690588c3 100644
--- a/cast/common/mdns/mdns_reader.h
+++ b/cast/common/mdns/mdns_reader.h
@@ -6,7 +6,7 @@
#define CAST_COMMON_MDNS_MDNS_READER_H_
#include "cast/common/mdns/mdns_records.h"
-#include "osp_base/big_endian.h"
+#include "util/big_endian.h"
namespace cast {
namespace mdns {
diff --git a/cast/common/mdns/mdns_records.h b/cast/common/mdns/mdns_records.h
index 1e0d9623..adbece2b 100644
--- a/cast/common/mdns/mdns_records.h
+++ b/cast/common/mdns/mdns_records.h
@@ -12,8 +12,8 @@
#include "absl/strings/string_view.h"
#include "absl/types/variant.h"
#include "cast/common/mdns/mdns_constants.h"
-#include "osp_base/ip_address.h"
#include "platform/api/logging.h"
+#include "platform/base/ip_address.h"
namespace cast {
namespace mdns {
diff --git a/cast/common/mdns/mdns_writer.h b/cast/common/mdns/mdns_writer.h
index 157d0cbc..23e548e2 100644
--- a/cast/common/mdns/mdns_writer.h
+++ b/cast/common/mdns/mdns_writer.h
@@ -9,7 +9,7 @@
#include "absl/strings/string_view.h"
#include "cast/common/mdns/mdns_records.h"
-#include "osp_base/big_endian.h"
+#include "util/big_endian.h"
namespace cast {
namespace mdns {
diff --git a/osp/impl/BUILD.gn b/osp/impl/BUILD.gn
index a248fb4a..b446aef9 100644
--- a/osp/impl/BUILD.gn
+++ b/osp/impl/BUILD.gn
@@ -22,6 +22,8 @@ source_set("impl") {
"service_listener_impl.h",
"service_publisher_impl.cc",
"service_publisher_impl.h",
+ "with_destruction_callback.cc",
+ "with_destruction_callback.h",
]
if (use_mdns_responder) {
@@ -40,8 +42,8 @@ source_set("impl") {
"../../osp/public",
]
deps = [
- "../../osp_base",
"../../platform",
+ "../../util",
"quic",
]
}
@@ -61,9 +63,9 @@ if (use_chromium_quic) {
deps = [
"../../osp/msgs",
- "../../osp_base",
"../../platform",
"../../third_party/chromium_quic",
+ "../../util",
"quic",
]
}
diff --git a/osp/impl/discovery/mdns/BUILD.gn b/osp/impl/discovery/mdns/BUILD.gn
index eb226ceb..6da373fb 100644
--- a/osp/impl/discovery/mdns/BUILD.gn
+++ b/osp/impl/discovery/mdns/BUILD.gn
@@ -13,8 +13,8 @@ source_set("mdns_interface") {
]
public_deps = [
- "../../../../osp_base",
"../../../../platform",
+ "../../../../util",
]
}
@@ -58,8 +58,8 @@ if (use_mdns_responder) {
public_deps = [
":mdns_interface",
- "../../../../osp_base",
"../../../../platform",
+ "../../../../util",
]
deps = [
diff --git a/osp/impl/discovery/mdns/domain_name.cc b/osp/impl/discovery/mdns/domain_name.cc
index 30d4b357..c901cd5d 100644
--- a/osp/impl/discovery/mdns/domain_name.cc
+++ b/osp/impl/discovery/mdns/domain_name.cc
@@ -7,7 +7,7 @@
#include <algorithm>
#include <iterator>
-#include "osp_base/stringprintf.h"
+#include "util/stringprintf.h"
namespace openscreen {
namespace mdns {
diff --git a/osp/impl/discovery/mdns/domain_name.h b/osp/impl/discovery/mdns/domain_name.h
index d743a213..7f1e0931 100644
--- a/osp/impl/discovery/mdns/domain_name.h
+++ b/osp/impl/discovery/mdns/domain_name.h
@@ -10,8 +10,8 @@
#include <string>
#include <vector>
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace mdns {
diff --git a/osp/impl/discovery/mdns/domain_name_unittest.cc b/osp/impl/discovery/mdns/domain_name_unittest.cc
index 5b6152d8..ebfb7cc5 100644
--- a/osp/impl/discovery/mdns/domain_name_unittest.cc
+++ b/osp/impl/discovery/mdns/domain_name_unittest.cc
@@ -7,7 +7,7 @@
#include <sstream>
#include "gtest/gtest.h"
-#include "osp_base/error.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace mdns {
diff --git a/osp/impl/discovery/mdns/embedder_demo.cc b/osp/impl/discovery/mdns/embedder_demo.cc
index e51b5cab..3cab141a 100644
--- a/osp/impl/discovery/mdns/embedder_demo.cc
+++ b/osp/impl/discovery/mdns/embedder_demo.cc
@@ -11,8 +11,8 @@
#include <vector>
#include "osp/impl/discovery/mdns/mdns_responder_adapter_impl.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
// This file contains a demo of our mDNSResponder wrapper code. It can both
// listen for mDNS services and advertise an mDNS service. The command-line
diff --git a/osp/impl/discovery/mdns/mdns_responder_adapter.h b/osp/impl/discovery/mdns/mdns_responder_adapter.h
index 5d168197..0bf732be 100644
--- a/osp/impl/discovery/mdns/mdns_responder_adapter.h
+++ b/osp/impl/discovery/mdns/mdns_responder_adapter.h
@@ -12,10 +12,10 @@
#include "osp/impl/discovery/mdns/domain_name.h"
#include "osp/impl/discovery/mdns/mdns_responder_platform.h"
-#include "osp_base/error.h"
-#include "osp_base/ip_address.h"
#include "platform/api/network_interface.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/error.h"
+#include "platform/base/ip_address.h"
#include "platform/impl/event_loop.h"
namespace openscreen {
diff --git a/osp/impl/discovery/mdns/mdns_responder_adapter_impl.h b/osp/impl/discovery/mdns/mdns_responder_adapter_impl.h
index 35db4520..ea874ee2 100644
--- a/osp/impl/discovery/mdns/mdns_responder_adapter_impl.h
+++ b/osp/impl/discovery/mdns/mdns_responder_adapter_impl.h
@@ -10,8 +10,8 @@
#include <vector>
#include "osp/impl/discovery/mdns/mdns_responder_adapter.h"
-#include "osp_base/error.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/error.h"
#include "third_party/mDNSResponder/src/mDNSCore/mDNSEmbeddedAPI.h"
namespace openscreen {
diff --git a/osp/impl/discovery/mdns/mdns_responder_platform.cc b/osp/impl/discovery/mdns/mdns_responder_platform.cc
index d7605243..cb47357e 100644
--- a/osp/impl/discovery/mdns/mdns_responder_platform.cc
+++ b/osp/impl/discovery/mdns/mdns_responder_platform.cc
@@ -10,12 +10,12 @@
#include <limits>
#include <vector>
-#include "osp_base/error.h"
-#include "osp_base/ip_address.h"
#include "platform/api/logging.h"
#include "platform/api/network_interface.h"
#include "platform/api/time.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/error.h"
+#include "platform/base/ip_address.h"
#include "third_party/mDNSResponder/src/mDNSCore/mDNSEmbeddedAPI.h"
using openscreen::platform::Clock;
diff --git a/osp/impl/internal_services.cc b/osp/impl/internal_services.cc
index 39b1e905..c948c403 100644
--- a/osp/impl/internal_services.cc
+++ b/osp/impl/internal_services.cc
@@ -8,9 +8,9 @@
#include "osp/impl/discovery/mdns/mdns_responder_adapter_impl.h"
#include "osp/impl/mdns_responder_service.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace {
diff --git a/osp/impl/internal_services.h b/osp/impl/internal_services.h
index 7fe2b260..82df8404 100644
--- a/osp/impl/internal_services.h
+++ b/osp/impl/internal_services.h
@@ -17,11 +17,11 @@
#include "osp/public/mdns_service_publisher_factory.h"
#include "osp/public/protocol_connection_client.h"
#include "osp/public/protocol_connection_server.h"
-#include "osp_base/ip_address.h"
-#include "osp_base/macros.h"
#include "platform/api/event_waiter.h"
#include "platform/api/network_interface.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/ip_address.h"
+#include "platform/base/macros.h"
#include "platform/impl/event_loop.h"
namespace openscreen {
diff --git a/osp/impl/mdns_responder_service.cc b/osp/impl/mdns_responder_service.cc
index 8141ee56..b6885773 100644
--- a/osp/impl/mdns_responder_service.cc
+++ b/osp/impl/mdns_responder_service.cc
@@ -9,8 +9,8 @@
#include <utility>
#include "osp/impl/internal_services.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace {
diff --git a/osp/impl/mdns_responder_service.h b/osp/impl/mdns_responder_service.h
index 82110e39..996607b7 100644
--- a/osp/impl/mdns_responder_service.h
+++ b/osp/impl/mdns_responder_service.h
@@ -16,8 +16,8 @@
#include "osp/impl/mdns_platform_service.h"
#include "osp/impl/service_listener_impl.h"
#include "osp/impl/service_publisher_impl.h"
-#include "osp_base/ip_address.h"
#include "platform/api/network_interface.h"
+#include "platform/base/ip_address.h"
#include "platform/impl/event_loop.h"
namespace openscreen {
diff --git a/osp/impl/presentation/presentation_connection.cc b/osp/impl/presentation/presentation_connection.cc
index d12f695f..6e213533 100644
--- a/osp/impl/presentation/presentation_connection.cc
+++ b/osp/impl/presentation/presentation_connection.cc
@@ -14,8 +14,8 @@
#include "osp/public/presentation/presentation_controller.h"
#include "osp/public/presentation/presentation_receiver.h"
#include "osp/public/protocol_connection.h"
-#include "osp_base/std_util.h"
#include "platform/api/logging.h"
+#include "util/std_util.h"
// TODO(issue/27): Address TODOs in this file
namespace openscreen {
diff --git a/osp/impl/presentation/url_availability_requester.h b/osp/impl/presentation/url_availability_requester.h
index 750b1dad..b5b9cec7 100644
--- a/osp/impl/presentation/url_availability_requester.h
+++ b/osp/impl/presentation/url_availability_requester.h
@@ -15,8 +15,8 @@
#include "osp/public/presentation/presentation_controller.h"
#include "osp/public/protocol_connection_client.h"
#include "osp/public/service_info.h"
-#include "osp_base/error.h"
#include "platform/api/time.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace presentation {
diff --git a/osp/impl/quic/BUILD.gn b/osp/impl/quic/BUILD.gn
index 7ad21d49..9b0c8028 100644
--- a/osp/impl/quic/BUILD.gn
+++ b/osp/impl/quic/BUILD.gn
@@ -15,8 +15,8 @@ source_set("quic") {
]
deps = [
- "../../../osp_base",
"../../../platform",
+ "../../../util",
"../../public",
]
}
@@ -33,9 +33,9 @@ source_set("test_support") {
]
deps = [
- "../../../osp_base",
"../../../platform",
"../../../third_party/googletest:gmock",
+ "../../../util",
"../../msgs",
]
}
diff --git a/osp/impl/quic/quic_client.h b/osp/impl/quic/quic_client.h
index 742eeced..605f199d 100644
--- a/osp/impl/quic/quic_client.h
+++ b/osp/impl/quic/quic_client.h
@@ -13,7 +13,7 @@
#include "osp/impl/quic/quic_connection_factory.h"
#include "osp/impl/quic/quic_service_common.h"
#include "osp/public/protocol_connection_client.h"
-#include "osp_base/ip_address.h"
+#include "platform/base/ip_address.h"
namespace openscreen {
diff --git a/osp/impl/quic/quic_client_unittest.cc b/osp/impl/quic/quic_client_unittest.cc
index db40c413..9ee1938f 100644
--- a/osp/impl/quic/quic_client_unittest.cc
+++ b/osp/impl/quic/quic_client_unittest.cc
@@ -14,8 +14,8 @@
#include "osp/public/network_metrics.h"
#include "osp/public/network_service_manager.h"
#include "osp/public/testing/message_demuxer_test_support.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
#include "platform/test/fake_clock.h"
namespace openscreen {
diff --git a/osp/impl/quic/quic_connection_factory.h b/osp/impl/quic/quic_connection_factory.h
index df3cf771..5668f9dc 100644
--- a/osp/impl/quic/quic_connection_factory.h
+++ b/osp/impl/quic/quic_connection_factory.h
@@ -9,7 +9,7 @@
#include <vector>
#include "osp/impl/quic/quic_connection.h"
-#include "osp_base/ip_address.h"
+#include "platform/base/ip_address.h"
namespace openscreen {
diff --git a/osp/impl/quic/quic_connection_factory_impl.cc b/osp/impl/quic/quic_connection_factory_impl.cc
index 2344e8e9..e3edf25d 100644
--- a/osp/impl/quic/quic_connection_factory_impl.cc
+++ b/osp/impl/quic/quic_connection_factory_impl.cc
@@ -8,8 +8,8 @@
#include <memory>
#include "osp/impl/quic/quic_connection_impl.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
#include "platform/impl/event_loop.h"
#include "third_party/chromium_quic/src/base/location.h"
#include "third_party/chromium_quic/src/base/task_runner.h"
diff --git a/osp/impl/quic/quic_connection_factory_impl.h b/osp/impl/quic/quic_connection_factory_impl.h
index 68ba6dad..8771eacd 100644
--- a/osp/impl/quic/quic_connection_factory_impl.h
+++ b/osp/impl/quic/quic_connection_factory_impl.h
@@ -9,9 +9,9 @@
#include <memory>
#include "osp/impl/quic/quic_connection_factory.h"
-#include "osp_base/ip_address.h"
#include "platform/api/event_waiter.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/ip_address.h"
#include "third_party/chromium_quic/src/base/at_exit.h"
#include "third_party/chromium_quic/src/net/quic/quic_chromium_alarm_factory.h"
#include "third_party/chromium_quic/src/net/third_party/quic/quartc/quartc_factory.h"
diff --git a/osp/impl/quic/quic_connection_impl.cc b/osp/impl/quic/quic_connection_impl.cc
index 1e42eae3..d56f91ca 100644
--- a/osp/impl/quic/quic_connection_impl.cc
+++ b/osp/impl/quic/quic_connection_impl.cc
@@ -9,8 +9,8 @@
#include "absl/types/optional.h"
#include "osp/impl/quic/quic_connection_factory_impl.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
#include "third_party/chromium_quic/src/net/third_party/quic/platform/impl/quic_chromium_clock.h"
namespace openscreen {
diff --git a/osp/impl/quic/quic_connection_impl.h b/osp/impl/quic/quic_connection_impl.h
index 6f494399..8e39d631 100644
--- a/osp/impl/quic/quic_connection_impl.h
+++ b/osp/impl/quic/quic_connection_impl.h
@@ -9,8 +9,8 @@
#include <memory>
#include "osp/impl/quic/quic_connection.h"
-#include "osp_base/ip_address.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/ip_address.h"
#include "third_party/chromium_quic/src/base/callback.h"
#include "third_party/chromium_quic/src/base/location.h"
#include "third_party/chromium_quic/src/base/task_runner.h"
diff --git a/osp/impl/quic/quic_server.h b/osp/impl/quic/quic_server.h
index d7af8bf7..289ccbf1 100644
--- a/osp/impl/quic/quic_server.h
+++ b/osp/impl/quic/quic_server.h
@@ -12,7 +12,7 @@
#include "osp/impl/quic/quic_connection_factory.h"
#include "osp/impl/quic/quic_service_common.h"
#include "osp/public/protocol_connection_server.h"
-#include "osp_base/ip_address.h"
+#include "platform/base/ip_address.h"
namespace openscreen {
diff --git a/osp/impl/quic/quic_server_unittest.cc b/osp/impl/quic/quic_server_unittest.cc
index b4b12628..7442f44b 100644
--- a/osp/impl/quic/quic_server_unittest.cc
+++ b/osp/impl/quic/quic_server_unittest.cc
@@ -13,7 +13,7 @@
#include "osp/public/network_metrics.h"
#include "osp/public/network_service_manager.h"
#include "osp/public/testing/message_demuxer_test_support.h"
-#include "osp_base/error.h"
+#include "platform/base/error.h"
#include "platform/test/fake_clock.h"
namespace openscreen {
diff --git a/osp/impl/quic/testing/quic_test_support.h b/osp/impl/quic/testing/quic_test_support.h
index 6f1720b9..e3c261bf 100644
--- a/osp/impl/quic/testing/quic_test_support.h
+++ b/osp/impl/quic/testing/quic_test_support.h
@@ -15,8 +15,8 @@
#include "osp/public/network_metrics.h"
#include "osp/public/protocol_connection_client.h"
#include "osp/public/protocol_connection_server.h"
-#include "osp_base/ip_address.h"
#include "platform/api/time.h"
+#include "platform/base/ip_address.h"
#include "platform/test/fake_clock.h"
namespace openscreen {
diff --git a/osp/impl/receiver_list.h b/osp/impl/receiver_list.h
index 3ef63692..8387768e 100644
--- a/osp/impl/receiver_list.h
+++ b/osp/impl/receiver_list.h
@@ -8,7 +8,7 @@
#include <vector>
#include "osp/public/service_info.h"
-#include "osp_base/error.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp/impl/receiver_list_unittest.cc b/osp/impl/receiver_list_unittest.cc
index 3c7361f6..c39d09bd 100644
--- a/osp/impl/receiver_list_unittest.cc
+++ b/osp/impl/receiver_list_unittest.cc
@@ -5,7 +5,7 @@
#include "osp/impl/receiver_list.h"
#include "gtest/gtest.h"
-#include "osp_base/error.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp/impl/service_listener_impl.cc b/osp/impl/service_listener_impl.cc
index f3dcce58..8ba3473f 100644
--- a/osp/impl/service_listener_impl.cc
+++ b/osp/impl/service_listener_impl.cc
@@ -4,8 +4,8 @@
#include "osp/impl/service_listener_impl.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace {
diff --git a/osp/impl/service_listener_impl.h b/osp/impl/service_listener_impl.h
index dafccac5..04f9dd04 100644
--- a/osp/impl/service_listener_impl.h
+++ b/osp/impl/service_listener_impl.h
@@ -8,10 +8,10 @@
#include <vector>
#include "osp/impl/receiver_list.h"
+#include "osp/impl/with_destruction_callback.h"
#include "osp/public/service_info.h"
#include "osp/public/service_listener.h"
-#include "osp_base/macros.h"
-#include "osp_base/with_destruction_callback.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/impl/service_publisher_impl.h b/osp/impl/service_publisher_impl.h
index b20ac0ba..b2805fc9 100644
--- a/osp/impl/service_publisher_impl.h
+++ b/osp/impl/service_publisher_impl.h
@@ -5,9 +5,9 @@
#ifndef OSP_IMPL_SERVICE_PUBLISHER_IMPL_H_
#define OSP_IMPL_SERVICE_PUBLISHER_IMPL_H_
+#include "osp/impl/with_destruction_callback.h"
#include "osp/public/service_publisher.h"
-#include "osp_base/macros.h"
-#include "osp_base/with_destruction_callback.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/impl/testing/fake_mdns_responder_adapter.cc b/osp/impl/testing/fake_mdns_responder_adapter.cc
index 10b459d8..9f2064fe 100644
--- a/osp/impl/testing/fake_mdns_responder_adapter.cc
+++ b/osp/impl/testing/fake_mdns_responder_adapter.cc
@@ -6,8 +6,8 @@
#include <algorithm>
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp_base/with_destruction_callback.cc b/osp/impl/with_destruction_callback.cc
index f84f41f7..b182baeb 100644
--- a/osp_base/with_destruction_callback.cc
+++ b/osp/impl/with_destruction_callback.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/with_destruction_callback.h"
+#include "osp/impl/with_destruction_callback.h"
#include "platform/api/logging.h"
diff --git a/osp_base/with_destruction_callback.h b/osp/impl/with_destruction_callback.h
index 6c223cbb..0e80a4b7 100644
--- a/osp_base/with_destruction_callback.h
+++ b/osp/impl/with_destruction_callback.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_WITH_DESTRUCTION_CALLBACK_H_
-#define OSP_BASE_WITH_DESTRUCTION_CALLBACK_H_
+#ifndef OSP_IMPL_WITH_DESTRUCTION_CALLBACK_H_
+#define OSP_IMPL_WITH_DESTRUCTION_CALLBACK_H_
-#include "osp_base/macros.h"
+#include "platform/base/macros.h"
namespace openscreen {
@@ -31,4 +31,4 @@ class WithDestructionCallback {
} // namespace openscreen
-#endif // OSP_BASE_WITH_DESTRUCTION_CALLBACK_H_
+#endif // OSP_IMPL_WITH_DESTRUCTION_CALLBACK_H_
diff --git a/osp/msgs/request_response_handler.h b/osp/msgs/request_response_handler.h
index aa7f65a8..7c496c91 100644
--- a/osp/msgs/request_response_handler.h
+++ b/osp/msgs/request_response_handler.h
@@ -13,9 +13,9 @@
#include "osp/public/message_demuxer.h"
#include "osp/public/network_service_manager.h"
#include "osp/public/protocol_connection.h"
-#include "osp_base/error.h"
-#include "osp_base/macros.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/public/BUILD.gn b/osp/public/BUILD.gn
index 0a8108f9..20d5ed43 100644
--- a/osp/public/BUILD.gn
+++ b/osp/public/BUILD.gn
@@ -35,6 +35,7 @@ source_set("public") {
"service_listener.h",
"service_publisher.cc",
"service_publisher.h",
+ "timestamp.h",
]
public_deps = [
@@ -42,8 +43,8 @@ source_set("public") {
]
deps = [
- "../../osp_base",
"../../platform",
+ "../../util",
]
configs += [ "../../build:allow_build_from_embedder" ]
diff --git a/osp/public/endpoint_request_ids.h b/osp/public/endpoint_request_ids.h
index d57fab28..92651294 100644
--- a/osp/public/endpoint_request_ids.h
+++ b/osp/public/endpoint_request_ids.h
@@ -8,7 +8,7 @@
#include <cstdint>
#include <map>
-#include "osp_base/macros.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/public/message_demuxer.cc b/osp/public/message_demuxer.cc
index 069c7689..c9ec82f1 100644
--- a/osp/public/message_demuxer.cc
+++ b/osp/public/message_demuxer.cc
@@ -7,9 +7,9 @@
#include <memory>
#include "osp/impl/quic/quic_connection.h"
-#include "osp_base/big_endian.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
+#include "util/big_endian.h"
namespace openscreen {
diff --git a/osp/public/message_demuxer.h b/osp/public/message_demuxer.h
index f22ac650..1cbfcc59 100644
--- a/osp/public/message_demuxer.h
+++ b/osp/public/message_demuxer.h
@@ -10,8 +10,8 @@
#include <vector>
#include "osp/msgs/osp_messages.h"
-#include "osp_base/error.h"
#include "platform/api/time.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp/public/network_metrics.h b/osp/public/network_metrics.h
index 491b0b26..b0ab020b 100644
--- a/osp/public/network_metrics.h
+++ b/osp/public/network_metrics.h
@@ -7,7 +7,7 @@
#include <cstdint>
-#include "osp_base/time.h"
+#include "osp/public/timestamp.h"
namespace openscreen {
diff --git a/osp/public/presentation/presentation_connection.h b/osp/public/presentation/presentation_connection.h
index 48cc2632..eb39b6aa 100644
--- a/osp/public/presentation/presentation_connection.h
+++ b/osp/public/presentation/presentation_connection.h
@@ -14,11 +14,11 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "osp/public/message_demuxer.h"
-#include "osp_base/error.h"
-#include "osp_base/ip_address.h"
-#include "osp_base/macros.h"
#include "platform/api/logging.h"
#include "platform/api/time.h"
+#include "platform/base/error.h"
+#include "platform/base/ip_address.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/public/presentation/presentation_controller.h b/osp/public/presentation/presentation_controller.h
index 49db9053..309c86f1 100644
--- a/osp/public/presentation/presentation_controller.h
+++ b/osp/public/presentation/presentation_controller.h
@@ -14,8 +14,8 @@
#include "osp/public/presentation/presentation_connection.h"
#include "osp/public/protocol_connection.h"
#include "osp/public/service_listener.h"
-#include "osp_base/error.h"
#include "platform/api/time.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace presentation {
diff --git a/osp/public/protocol_connection.h b/osp/public/protocol_connection.h
index 494f652e..184723fa 100644
--- a/osp/public/protocol_connection.h
+++ b/osp/public/protocol_connection.h
@@ -10,8 +10,8 @@
#include <type_traits>
#include "osp/msgs/osp_messages.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp/public/protocol_connection_client.h b/osp/public/protocol_connection_client.h
index 24b96592..b53f74a6 100644
--- a/osp/public/protocol_connection_client.h
+++ b/osp/public/protocol_connection_client.h
@@ -12,9 +12,9 @@
#include "osp/public/endpoint_request_ids.h"
#include "osp/public/message_demuxer.h"
#include "osp/public/protocol_connection.h"
-#include "osp_base/error.h"
-#include "osp_base/ip_address.h"
-#include "osp_base/macros.h"
+#include "platform/base/error.h"
+#include "platform/base/ip_address.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/public/protocol_connection_server.h b/osp/public/protocol_connection_server.h
index 5ded44a7..8eafe965 100644
--- a/osp/public/protocol_connection_server.h
+++ b/osp/public/protocol_connection_server.h
@@ -14,9 +14,9 @@
#include "osp/public/message_demuxer.h"
#include "osp/public/protocol_connection.h"
#include "osp/public/server_config.h"
-#include "osp_base/error.h"
-#include "osp_base/ip_address.h"
-#include "osp_base/macros.h"
+#include "platform/base/error.h"
+#include "platform/base/ip_address.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/public/server_config.h b/osp/public/server_config.h
index 9095ed69..b29069e7 100644
--- a/osp/public/server_config.h
+++ b/osp/public/server_config.h
@@ -8,8 +8,8 @@
#include <cstdint>
#include <vector>
-#include "osp_base/ip_address.h"
#include "platform/api/network_interface.h"
+#include "platform/base/ip_address.h"
namespace openscreen {
diff --git a/osp/public/service_info.h b/osp/public/service_info.h
index 6efac00b..b8cdc05f 100644
--- a/osp/public/service_info.h
+++ b/osp/public/service_info.h
@@ -8,9 +8,9 @@
#include <cstdint>
#include <string>
-#include "osp_base/ip_address.h"
-#include "osp_base/macros.h"
#include "platform/api/network_interface.h"
+#include "platform/base/ip_address.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/public/service_info_unittest.cc b/osp/public/service_info_unittest.cc
index 891b8a25..e6bc9a88 100644
--- a/osp/public/service_info_unittest.cc
+++ b/osp/public/service_info_unittest.cc
@@ -7,7 +7,7 @@
#include <utility>
#include "gtest/gtest.h"
-#include "osp_base/error.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp/public/service_listener.h b/osp/public/service_listener.h
index f480670f..41d88604 100644
--- a/osp/public/service_listener.h
+++ b/osp/public/service_listener.h
@@ -10,8 +10,8 @@
#include <vector>
#include "osp/public/service_info.h"
-#include "osp_base/macros.h"
-#include "osp_base/time.h"
+#include "osp/public/timestamp.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp/public/service_publisher.h b/osp/public/service_publisher.h
index 2580116d..d17e08ed 100644
--- a/osp/public/service_publisher.h
+++ b/osp/public/service_publisher.h
@@ -9,9 +9,9 @@
#include <string>
#include <vector>
-#include "osp_base/macros.h"
-#include "osp_base/time.h"
+#include "osp/public/timestamp.h"
#include "platform/api/network_interface.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp_base/time.h b/osp/public/timestamp.h
index 09cb2493..409f06ae 100644
--- a/osp_base/time.h
+++ b/osp/public/timestamp.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_TIME_H_
-#define OSP_BASE_TIME_H_
+#ifndef OSP_PUBLIC_TIMESTAMP_H_
+#define OSP_PUBLIC_TIMESTAMP_H_
namespace openscreen {
@@ -12,4 +12,4 @@ typedef uint64_t timestamp_t;
} // namespace openscreen
-#endif // OSP_BASE_TIME_H_
+#endif // OSP_PUBLIC_TIMESTAMP_H_
diff --git a/osp_base/DEPS b/osp_base/DEPS
deleted file mode 100644
index 2883bfe0..00000000
--- a/osp_base/DEPS
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2019 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include_rules = [
- '-platform',
- '+platform/api/logging.h',
- '+platform/api/task_runner.h',
- '+platform/api/time.h',
- '+platform/test',
- '+json',
- '+openssl',
-]
diff --git a/platform/BUILD.gn b/platform/BUILD.gn
index bdaddf2e..1ee805b0 100644
--- a/platform/BUILD.gn
+++ b/platform/BUILD.gn
@@ -24,18 +24,24 @@ source_set("platform") {
"api/udp_socket.cc",
"api/udp_socket.h",
"api/upd_read_callback.h",
+ "base/error.cc",
+ "base/error.h",
+ "base/ip_address.cc",
+ "base/ip_address.h",
+ "base/location.cc",
+ "base/location.h",
"impl/ssl_context.cc",
"impl/ssl_context.h",
"impl/time.cc",
]
public_deps = [
- "../osp_base",
"../third_party/abseil",
"../third_party/boringssl",
+ "../util",
]
- allow_circular_includes_from = [ "../osp_base" ]
+ allow_circular_includes_from = [ "../util" ]
configs += [ "../build:allow_build_from_embedder" ]
@@ -47,8 +53,8 @@ source_set("platform") {
"impl/network_reader.h",
"impl/network_runner.cc",
"impl/network_runner.h",
- "impl/task_runner_impl.cc",
- "impl/task_runner_impl.h",
+ "impl/task_runner.cc",
+ "impl/task_runner.h",
]
if (is_linux) {
@@ -67,6 +73,7 @@ source_set("platform") {
"impl/event_waiter_posix.cc",
"impl/network_waiter_posix.cc",
"impl/network_waiter_posix.h",
+ "impl/scoped_pipe.h",
"impl/scoped_wake_lock_posix.cc",
"impl/scoped_wake_lock_posix.h",
"impl/udp_socket_posix.cc",
@@ -111,8 +118,8 @@ source_set("default_logger") {
configs += [ "../build:allow_build_from_embedder" ]
deps = [
- "../osp_base",
"../third_party/abseil",
+ "../util",
]
}
@@ -122,6 +129,9 @@ source_set("platform_unittests") {
sources = [
"api/time_unittest.cc",
"api/udp_socket_unittest.cc",
+ "base/error_unittest.cc",
+ "base/ip_address_unittest.cc",
+ "base/location_unittest.cc",
"impl/ssl_context_unittest.cc",
]
@@ -130,11 +140,14 @@ source_set("platform_unittests") {
if (!build_with_chromium) {
sources += [
"impl/network_reader_unittest.cc",
- "impl/task_runner_impl_unittest.cc",
+ "impl/task_runner_unittest.cc",
"impl/time_unittest.cc",
]
if (is_posix) {
- sources += [ "impl/network_waiter_posix_unittest.cc" ]
+ sources += [
+ "impl/network_waiter_posix_unittest.cc",
+ "impl/scoped_pipe_unittest.cc",
+ ]
}
}
diff --git a/platform/README.md b/platform/README.md
index 4caef036..a82da1cb 100644
--- a/platform/README.md
+++ b/platform/README.md
@@ -1,17 +1,30 @@
# Platform API
The Platform API is designed to allow easy porting of the Open Screen Library
-between platforms. There are some default implementations included in the
-library.
+between platforms. This folder contains classes and logic used by Open Screen to
+access system resources and other common OS-level facilities, such as the clock
+and task runner. Note: utilities are generally not homed here, instead
+preferring the top level util/ directory. New classes added here must NOT
+depend on any other folders in the openscreen repository, excepting third party
+libraries like Abseil or GTest. We include "default implementations" of many
+platform features.
## Directory structure
- api/ contains the Platform API which is used by the Open Screen Library.
Some of the public API may also include adapter code that acts as a small
- shim above the C functions to be implemented by the platform.
- - Other directories contain default implementations provided for the API.
- Currently, this includes:
- - base/ is implemented without any platform-specific features and so may be
- included on any platform.
- - linux/ is specific to Linux.
- - posix/ is specific to Posix (i.e. Linux, BSD, Mac, etc.).
+ shim above the C functions to be implemented by the platform. The entire
+ Open Screen repository can depend on files from api/, though classes
+ defined in api/ can only depend on third_party or platform/base files.
+
+ - base/ contains declarations/definitions of API constructs. Classes homed here
+ shall only depend on platform/api or this folder.
+
+ - impl/ contains the implementation of the standalone use case, namely a
+ self-contained binary using the default implementation of the platform API.
+ Note: people familiar with the old layout may notice that all files from the
+ posix/, linux/, and mac/ directories have been moved here with an OS-specific
+ suffix (e.g. _mac, _posix).
+
+ - test/ contains API implementations used for testing purposes, like the
+ FakeClock or FakeTaskRunner.
diff --git a/platform/api/DEPS b/platform/api/DEPS
new file mode 100644
index 00000000..a8028573
--- /dev/null
+++ b/platform/api/DEPS
@@ -0,0 +1,10 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+include_rules = [
+ '+platform/api',
+ '+platform/base',
+ '+json',
+ '+openssl',
+]
diff --git a/platform/api/event_waiter.h b/platform/api/event_waiter.h
index c35c3147..ff4fead2 100644
--- a/platform/api/event_waiter.h
+++ b/platform/api/event_waiter.h
@@ -7,9 +7,9 @@
#include <vector>
-#include "osp_base/error.h"
#include "platform/api/time.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace platform {
diff --git a/osp_base/export.h b/platform/api/export.h
index b11a7428..782be8aa 100644
--- a/osp_base/export.h
+++ b/platform/api/export.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_EXPORT_H_
-#define OSP_BASE_EXPORT_H_
+#ifndef PLATFORM_API_EXPORT_H_
+#define PLATFORM_API_EXPORT_H_
#if defined(WIN32)
@@ -23,4 +23,4 @@
#endif // defined(WIN32)
-#endif // OSP_BASE_EXPORT_H_
+#endif // PLATFORM_API_EXPORT_H_
diff --git a/platform/api/network_interface.h b/platform/api/network_interface.h
index c3a2acbb..d08afb4f 100644
--- a/platform/api/network_interface.h
+++ b/platform/api/network_interface.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "osp_base/ip_address.h"
+#include "platform/base/ip_address.h"
namespace openscreen {
namespace platform {
diff --git a/platform/api/network_runner.h b/platform/api/network_runner.h
index 730530db..7a1742fc 100644
--- a/platform/api/network_runner.h
+++ b/platform/api/network_runner.h
@@ -10,12 +10,12 @@
#include <functional>
#include <memory>
-#include "osp_base/error.h"
-#include "osp_base/ip_address.h"
#include "platform/api/task_runner.h"
#include "platform/api/time.h"
#include "platform/api/udp_read_callback.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/error.h"
+#include "platform/base/ip_address.h"
namespace openscreen {
namespace platform {
diff --git a/platform/api/network_waiter.h b/platform/api/network_waiter.h
index 31bbaac0..8dec459b 100644
--- a/platform/api/network_waiter.h
+++ b/platform/api/network_waiter.h
@@ -7,9 +7,9 @@
#include <vector>
-#include "osp_base/error.h"
#include "platform/api/time.h"
#include "platform/api/udp_socket.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace platform {
diff --git a/platform/api/tls_socket.h b/platform/api/tls_socket.h
index a45bc150..36fe249d 100644
--- a/platform/api/tls_socket.h
+++ b/platform/api/tls_socket.h
@@ -9,11 +9,11 @@
#include <memory>
#include <string>
-#include "osp_base/error.h"
-#include "osp_base/ip_address.h"
-#include "osp_base/macros.h"
#include "platform/api/network_interface.h"
#include "platform/api/tls_socket_creds.h"
+#include "platform/base/error.h"
+#include "platform/base/ip_address.h"
+#include "platform/base/macros.h"
namespace openscreen {
namespace platform {
diff --git a/platform/api/tls_socket_creds.h b/platform/api/tls_socket_creds.h
index f8eba69f..27bda702 100644
--- a/platform/api/tls_socket_creds.h
+++ b/platform/api/tls_socket_creds.h
@@ -11,7 +11,7 @@
#include <string>
#include <vector>
-#include "osp_base/macros.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/platform/api/udp_read_callback.h b/platform/api/udp_read_callback.h
index 37d9f598..b93c7ace 100644
--- a/platform/api/udp_read_callback.h
+++ b/platform/api/udp_read_callback.h
@@ -9,7 +9,7 @@
#include <cstdint>
#include <memory>
-#include "osp_base/ip_address.h"
+#include "platform/base/ip_address.h"
namespace openscreen {
namespace platform {
diff --git a/platform/api/udp_socket.h b/platform/api/udp_socket.h
index e6481241..7ac90351 100644
--- a/platform/api/udp_socket.h
+++ b/platform/api/udp_socket.h
@@ -9,10 +9,10 @@
#include <functional>
#include <memory>
-#include "osp_base/error.h"
-#include "osp_base/ip_address.h"
-#include "osp_base/macros.h"
#include "platform/api/network_interface.h"
+#include "platform/base/error.h"
+#include "platform/base/ip_address.h"
+#include "platform/base/macros.h"
namespace openscreen {
namespace platform {
diff --git a/platform/base/DEPS b/platform/base/DEPS
new file mode 100644
index 00000000..a359638e
--- /dev/null
+++ b/platform/base/DEPS
@@ -0,0 +1,7 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+include_rules = [
+ '+platform/api',
+]
diff --git a/osp_base/error.cc b/platform/base/error.cc
index 1fbaf974..6a3d5d7b 100644
--- a/osp_base/error.cc
+++ b/platform/base/error.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/error.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp_base/error.h b/platform/base/error.h
index ff09d990..96fa6c55 100644
--- a/osp_base/error.h
+++ b/platform/base/error.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_ERROR_H_
-#define OSP_BASE_ERROR_H_
+#ifndef PLATFORM_BASE_ERROR_H_
+#define PLATFORM_BASE_ERROR_H_
#include <ostream>
#include <string>
#include <utility>
-#include "osp_base/macros.h"
+#include "platform/base/macros.h"
namespace openscreen {
@@ -169,4 +169,4 @@ class ErrorOr {
} // namespace openscreen
-#endif // OSP_BASE_ERROR_H_
+#endif // PLATFORM_BASE_ERROR_H_
diff --git a/osp_base/error_unittest.cc b/platform/base/error_unittest.cc
index 8e633cf8..8a734a31 100644
--- a/osp_base/error_unittest.cc
+++ b/platform/base/error_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/error.h"
+#include "platform/base/error.h"
#include "gtest/gtest.h"
diff --git a/osp_base/ip_address.cc b/platform/base/ip_address.cc
index 479595fe..d55aa9c2 100644
--- a/osp_base/ip_address.cc
+++ b/platform/base/ip_address.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/ip_address.h"
+#include "platform/base/ip_address.h"
#include <cstring>
#include <iomanip>
diff --git a/osp_base/ip_address.h b/platform/base/ip_address.h
index 3462dc0e..32cd2dda 100644
--- a/osp_base/ip_address.h
+++ b/platform/base/ip_address.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_IP_ADDRESS_H_
-#define OSP_BASE_IP_ADDRESS_H_
+#ifndef PLATFORM_BASE_IP_ADDRESS_H_
+#define PLATFORM_BASE_IP_ADDRESS_H_
#include <array>
#include <cstdint>
@@ -11,7 +11,7 @@
#include <string>
#include <type_traits>
-#include "osp_base/error.h"
+#include "platform/base/error.h"
namespace openscreen {
@@ -108,4 +108,4 @@ std::ostream& operator<<(std::ostream& out, const IPEndpoint& endpoint);
} // namespace openscreen
-#endif // OSP_BASE_IP_ADDRESS_H_
+#endif // PLATFORM_BASE_IP_ADDRESS_H_
diff --git a/osp_base/ip_address_unittest.cc b/platform/base/ip_address_unittest.cc
index f1b65394..85fa7abd 100644
--- a/osp_base/ip_address_unittest.cc
+++ b/platform/base/ip_address_unittest.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/ip_address.h"
+#include "platform/base/ip_address.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "osp_base/error.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp_base/location.cc b/platform/base/location.cc
index 93d8bec8..4e3a3684 100644
--- a/osp_base/location.cc
+++ b/platform/base/location.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/location.h"
+#include "platform/base/location.h"
#include "absl/strings/str_cat.h"
-#include "osp_base/macros.h"
#include "platform/api/logging.h"
+#include "platform/base/macros.h"
namespace openscreen {
diff --git a/osp_base/location.h b/platform/base/location.h
index e14fa088..9a3027ba 100644
--- a/osp_base/location.h
+++ b/platform/base/location.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_LOCATION_H_
-#define OSP_BASE_LOCATION_H_
+#ifndef PLATFORM_BASE_LOCATION_H_
+#define PLATFORM_BASE_LOCATION_H_
#include <stddef.h>
@@ -57,4 +57,4 @@ const void* GetProgramCounter();
} // namespace openscreen
-#endif // OSP_BASE_LOCATION_H_
+#endif // PLATFORM_BASE_LOCATION_H_
diff --git a/osp_base/location_unittest.cc b/platform/base/location_unittest.cc
index a3e07b50..786bb108 100644
--- a/osp_base/location_unittest.cc
+++ b/platform/base/location_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/location.h"
+#include "platform/base/location.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
diff --git a/osp_base/macros.h b/platform/base/macros.h
index a8b4fb27..fa1dad70 100644
--- a/osp_base/macros.h
+++ b/platform/base/macros.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_MACROS_H_
-#define OSP_BASE_MACROS_H_
+#ifndef PLATFORM_BASE_MACROS_H_
+#define PLATFORM_BASE_MACROS_H_
// Use this when declaring/defining noexcept move constructors, to work around a
// bug on older versions of g++.
@@ -53,4 +53,4 @@
#define OSP_NOINLINE __attribute__((noinline))
#endif
-#endif // OSP_BASE_MACROS_H_
+#endif // PLATFORM_BASE_MACROS_H_
diff --git a/platform/impl/DEPS b/platform/impl/DEPS
new file mode 100644
index 00000000..82d9363c
--- /dev/null
+++ b/platform/impl/DEPS
@@ -0,0 +1,12 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+include_rules = [
+ '+platform',
+ '+json',
+
+ # BoringSSL includes
+ '-third_party/boringssl',
+ '+openssl'
+]
diff --git a/platform/impl/event_loop.h b/platform/impl/event_loop.h
index 99a4039f..2988b57e 100644
--- a/platform/impl/event_loop.h
+++ b/platform/impl/event_loop.h
@@ -9,9 +9,9 @@
#include <vector>
-#include "osp_base/error.h"
#include "platform/api/event_waiter.h"
#include "platform/api/network_runner.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace platform {
diff --git a/platform/impl/event_waiter_posix.cc b/platform/impl/event_waiter_posix.cc
index ad363d32..5988d496 100644
--- a/platform/impl/event_waiter_posix.cc
+++ b/platform/impl/event_waiter_posix.cc
@@ -7,9 +7,9 @@
#include <algorithm>
#include <vector>
-#include "osp_base/error.h"
#include "platform/api/event_waiter.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
#include "platform/impl/udp_socket_posix.h"
namespace openscreen {
diff --git a/platform/impl/network_interface_linux.cc b/platform/impl/network_interface_linux.cc
index 58c2e790..b4040095 100644
--- a/platform/impl/network_interface_linux.cc
+++ b/platform/impl/network_interface_linux.cc
@@ -22,10 +22,10 @@
#include <cstring>
#include "absl/strings/string_view.h"
-#include "osp_base/ip_address.h"
-#include "osp_base/scoped_pipe.h"
#include "platform/api/logging.h"
#include "platform/api/network_interface.h"
+#include "platform/base/ip_address.h"
+#include "platform/impl/scoped_pipe.h"
namespace openscreen {
namespace platform {
diff --git a/platform/impl/network_interface_mac.cc b/platform/impl/network_interface_mac.cc
index 1da89f66..96050a9d 100644
--- a/platform/impl/network_interface_mac.cc
+++ b/platform/impl/network_interface_mac.cc
@@ -17,10 +17,10 @@
#include <string>
#include <vector>
-#include "osp_base/ip_address.h"
-#include "osp_base/scoped_pipe.h"
#include "platform/api/logging.h"
#include "platform/api/network_interface.h"
+#include "platform/base/ip_address.h"
+#include "platform/impl/scoped_pipe.h"
namespace openscreen {
namespace platform {
diff --git a/platform/impl/network_runner.cc b/platform/impl/network_runner.cc
index 2d9d831a..ca260bad 100644
--- a/platform/impl/network_runner.cc
+++ b/platform/impl/network_runner.cc
@@ -7,7 +7,7 @@
#include <iostream>
#include "platform/api/logging.h"
-#include "platform/impl/task_runner_impl.h"
+#include "platform/impl/task_runner.h"
namespace openscreen {
namespace platform {
diff --git a/platform/impl/network_waiter_posix.cc b/platform/impl/network_waiter_posix.cc
index 255f3db1..84185f92 100644
--- a/platform/impl/network_waiter_posix.cc
+++ b/platform/impl/network_waiter_posix.cc
@@ -9,8 +9,8 @@
#include <algorithm>
#include <vector>
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
#include "platform/impl/network_reader.h"
#include "platform/impl/udp_socket_posix.h"
diff --git a/osp_base/scoped_pipe.h b/platform/impl/scoped_pipe.h
index 1e56f948..36740e79 100644
--- a/osp_base/scoped_pipe.h
+++ b/platform/impl/scoped_pipe.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_SCOPED_PIPE_H_
-#define OSP_BASE_SCOPED_PIPE_H_
+#ifndef PLATFORM_IMPL_SCOPED_PIPE_H_
+#define PLATFORM_IMPL_SCOPED_PIPE_H_
#include <unistd.h>
@@ -68,4 +68,4 @@ using ScopedFd = ScopedPipe<IntFdTraits>;
} // namespace openscreen
-#endif // OSP_BASE_SCOPED_PIPE_H_
+#endif // PLATFORM_IMPL_SCOPED_PIPE_H_
diff --git a/osp_base/scoped_pipe_unittest.cc b/platform/impl/scoped_pipe_unittest.cc
index e23990b1..5aa68452 100644
--- a/osp_base/scoped_pipe_unittest.cc
+++ b/platform/impl/scoped_pipe_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/scoped_pipe.h"
+#include "platform/impl/scoped_pipe.h"
#include <vector>
diff --git a/platform/impl/ssl_context.cc b/platform/impl/ssl_context.cc
index c40bc8d8..2428ed8b 100644
--- a/platform/impl/ssl_context.cc
+++ b/platform/impl/ssl_context.cc
@@ -10,8 +10,8 @@
#include <utility>
#include "openssl/err.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace platform {
diff --git a/platform/impl/ssl_context_unittest.cc b/platform/impl/ssl_context_unittest.cc
index 7ee0285d..fcd8b56f 100644
--- a/platform/impl/ssl_context_unittest.cc
+++ b/platform/impl/ssl_context_unittest.cc
@@ -12,8 +12,8 @@
#include "absl/strings/string_view.h"
#include "gtest/gtest.h"
-#include "osp_base/crypto/openssl_util.h"
-#include "osp_base/error.h"
+#include "platform/base/error.h"
+#include "util/crypto/openssl_util.h"
namespace openscreen {
namespace platform {
diff --git a/platform/impl/task_runner_impl.cc b/platform/impl/task_runner.cc
index 79fa5ea6..89886dc7 100644
--- a/platform/impl/task_runner_impl.cc
+++ b/platform/impl/task_runner.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file
-#include "platform/impl/task_runner_impl.h"
+#include "platform/impl/task_runner.h"
#include "platform/api/logging.h"
diff --git a/platform/impl/task_runner_impl.h b/platform/impl/task_runner.h
index df90da4b..7de22820 100644
--- a/platform/impl/task_runner_impl.h
+++ b/platform/impl/task_runner.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef PLATFORM_IMPL_TASK_RUNNER_IMPL_H_
-#define PLATFORM_IMPL_TASK_RUNNER_IMPL_H_
+#ifndef PLATFORM_IMPL_TASK_RUNNER_H_
+#define PLATFORM_IMPL_TASK_RUNNER_H_
#include <atomic>
#include <condition_variable> // NOLINT
@@ -16,9 +16,9 @@
#include "absl/base/thread_annotations.h"
#include "absl/types/optional.h"
-#include "osp_base/error.h"
#include "platform/api/network_runner.h"
#include "platform/api/time.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace platform {
@@ -129,4 +129,4 @@ class TaskRunnerImpl final : public TaskRunner {
} // namespace platform
} // namespace openscreen
-#endif // PLATFORM_IMPL_TASK_RUNNER_IMPL_H_
+#endif // PLATFORM_IMPL_TASK_RUNNER_H_
diff --git a/platform/impl/task_runner_impl_unittest.cc b/platform/impl/task_runner_unittest.cc
index 17c17caf..71403a0d 100644
--- a/platform/impl/task_runner_impl_unittest.cc
+++ b/platform/impl/task_runner_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "platform/impl/task_runner_impl.h"
+#include "platform/impl/task_runner.h"
#include <atomic>
#include <thread> // NOLINT
@@ -10,7 +10,6 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "platform/api/time.h"
-#include "platform/impl/task_runner_impl.h"
#include "platform/test/fake_clock.h"
namespace openscreen {
diff --git a/platform/impl/udp_socket_posix.cc b/platform/impl/udp_socket_posix.cc
index c8e4b36c..6134b481 100644
--- a/platform/impl/udp_socket_posix.cc
+++ b/platform/impl/udp_socket_posix.cc
@@ -16,8 +16,8 @@
#include <memory>
#include "absl/types/optional.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace platform {
diff --git a/streaming/cast/DEPS b/streaming/cast/DEPS
new file mode 100644
index 00000000..77ab80d7
--- /dev/null
+++ b/streaming/cast/DEPS
@@ -0,0 +1,9 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+include_rules = [
+ # BoringSSL includes
+ '-third_party/boringssl',
+ '+openssl'
+]
diff --git a/streaming/cast/compound_rtcp_builder.cc b/streaming/cast/compound_rtcp_builder.cc
index 72b81833..3337aaaa 100644
--- a/streaming/cast/compound_rtcp_builder.cc
+++ b/streaming/cast/compound_rtcp_builder.cc
@@ -8,10 +8,10 @@
#include <iterator>
#include <limits>
-#include "osp_base/std_util.h"
#include "platform/api/logging.h"
#include "streaming/cast/packet_util.h"
#include "streaming/cast/rtcp_session.h"
+#include "util/std_util.h"
namespace openscreen {
namespace cast_streaming {
diff --git a/streaming/cast/compound_rtcp_parser.cc b/streaming/cast/compound_rtcp_parser.cc
index 0ba0738e..a97a7b3c 100644
--- a/streaming/cast/compound_rtcp_parser.cc
+++ b/streaming/cast/compound_rtcp_parser.cc
@@ -6,10 +6,10 @@
#include <algorithm>
-#include "osp_base/std_util.h"
#include "platform/api/logging.h"
#include "streaming/cast/packet_util.h"
#include "streaming/cast/rtcp_session.h"
+#include "util/std_util.h"
namespace openscreen {
namespace cast_streaming {
diff --git a/streaming/cast/encoded_frame.h b/streaming/cast/encoded_frame.h
index 50ecfa9d..9eb96b9c 100644
--- a/streaming/cast/encoded_frame.h
+++ b/streaming/cast/encoded_frame.h
@@ -10,8 +10,8 @@
#include <chrono>
#include <vector>
-#include "osp_base/macros.h"
#include "platform/api/time.h"
+#include "platform/base/macros.h"
#include "streaming/cast/frame_id.h"
#include "streaming/cast/rtp_time.h"
diff --git a/streaming/cast/frame_crypto.cc b/streaming/cast/frame_crypto.cc
index 5d5d2207..6a14bc97 100644
--- a/streaming/cast/frame_crypto.cc
+++ b/streaming/cast/frame_crypto.cc
@@ -9,8 +9,8 @@
#include "openssl/crypto.h"
#include "openssl/err.h"
#include "openssl/rand.h"
-#include "osp_base/big_endian.h"
-#include "osp_base/crypto/openssl_util.h"
+#include "util/big_endian.h"
+#include "util/crypto/openssl_util.h"
namespace openscreen {
namespace cast_streaming {
diff --git a/streaming/cast/frame_crypto.h b/streaming/cast/frame_crypto.h
index 88efe084..7797fa86 100644
--- a/streaming/cast/frame_crypto.h
+++ b/streaming/cast/frame_crypto.h
@@ -12,7 +12,7 @@
#include <vector>
#include "openssl/aes.h"
-#include "osp_base/macros.h"
+#include "platform/base/macros.h"
#include "streaming/cast/encoded_frame.h"
namespace openscreen {
diff --git a/streaming/cast/packet_util.h b/streaming/cast/packet_util.h
index 895ee74b..c94f8d3e 100644
--- a/streaming/cast/packet_util.h
+++ b/streaming/cast/packet_util.h
@@ -8,8 +8,8 @@
#include <utility>
#include "absl/types/span.h"
-#include "osp_base/big_endian.h"
#include "streaming/cast/ssrc.h"
+#include "util/big_endian.h"
namespace openscreen {
namespace cast_streaming {
diff --git a/streaming/cast/rtp_packetizer.cc b/streaming/cast/rtp_packetizer.cc
index 4def25fb..54ca403d 100644
--- a/streaming/cast/rtp_packetizer.cc
+++ b/streaming/cast/rtp_packetizer.cc
@@ -8,10 +8,10 @@
#include <limits>
#include <random>
-#include "osp_base/big_endian.h"
#include "platform/api/logging.h"
#include "platform/api/time.h"
#include "streaming/cast/packet_util.h"
+#include "util/big_endian.h"
namespace openscreen {
namespace cast_streaming {
diff --git a/streaming/cast/ssrc_unittest.cc b/streaming/cast/ssrc_unittest.cc
index caa848ba..334f5736 100644
--- a/streaming/cast/ssrc_unittest.cc
+++ b/streaming/cast/ssrc_unittest.cc
@@ -7,7 +7,7 @@
#include <vector>
#include "gtest/gtest.h"
-#include "osp_base/std_util.h"
+#include "util/std_util.h"
namespace openscreen {
namespace cast_streaming {
diff --git a/osp_base/BUILD.gn b/util/BUILD.gn
index 51c354f1..65b16c62 100644
--- a/osp_base/BUILD.gn
+++ b/util/BUILD.gn
@@ -4,7 +4,7 @@
import("//build_overrides/build.gni")
-source_set("osp_base") {
+source_set("util") {
sources = [
"alarm.cc",
"alarm.h",
@@ -18,23 +18,12 @@ source_set("osp_base") {
"crypto/secure_hash.h",
"crypto/sha2.cc",
"crypto/sha2.h",
- "error.cc",
- "error.h",
- "export.h",
- "ip_address.cc",
- "ip_address.h",
"json/json_reader.cc",
"json/json_reader.h",
"json/json_writer.cc",
"json/json_writer.h",
- "location.cc",
- "location.h",
- "macros.h",
- "scoped_pipe.h",
+ "std_util.h",
"stringprintf.h",
- "time.h",
- "with_destruction_callback.cc",
- "with_destruction_callback.h",
]
deps = [
@@ -46,7 +35,7 @@ source_set("osp_base") {
configs += [ "../build:allow_build_from_embedder" ]
}
-source_set("osp_base_unittests") {
+source_set("util_unittests") {
testonly = true
sources = [
@@ -55,16 +44,12 @@ source_set("osp_base_unittests") {
"crypto/rsa_private_key_unittest.cc",
"crypto/secure_hash_unittest.cc",
"crypto/sha2_unittest.cc",
- "error_unittest.cc",
- "ip_address_unittest.cc",
"json/json_reader_unittest.cc",
"json/json_writer_unittest.cc",
- "location_unittest.cc",
- "scoped_pipe_unittest.cc",
]
deps = [
- ":osp_base",
+ ":util",
"../third_party/abseil",
"../third_party/boringssl",
"../third_party/googletest:gmock",
diff --git a/util/DEPS b/util/DEPS
new file mode 100644
index 00000000..4410d925
--- /dev/null
+++ b/util/DEPS
@@ -0,0 +1,7 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+include_rules = [
+ '+platform/api',
+]
diff --git a/util/README.md b/util/README.md
new file mode 100644
index 00000000..aa0670d3
--- /dev/null
+++ b/util/README.md
@@ -0,0 +1,8 @@
+# Utility Code
+
+The util/ folder is meant to house core utility classes and logic that can be
+used by everything else in the Open Screen repository. Code here is permitted
+to include platform/api/ -- same as the rest of the repository. Includes things
+like string utils, the JSON serializer, our std_util.h header, and the alarm.
+Classes that are shared by multiple features generally should not be placed
+here, instead favoring the platform/ folder. \ No newline at end of file
diff --git a/osp_base/alarm.cc b/util/alarm.cc
index 7b3bae45..abc06262 100644
--- a/osp_base/alarm.cc
+++ b/util/alarm.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/alarm.h"
+#include "util/alarm.h"
#include "platform/api/logging.h"
diff --git a/osp_base/alarm.h b/util/alarm.h
index 98a46d94..e5e855b8 100644
--- a/osp_base/alarm.h
+++ b/util/alarm.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_ALARM_H_
-#define OSP_BASE_ALARM_H_
+#ifndef UTIL_ALARM_H_
+#define UTIL_ALARM_H_
#include "platform/api/task_runner.h"
#include "platform/api/time.h"
@@ -95,4 +95,4 @@ class Alarm {
} // namespace openscreen
-#endif // OSP_BASE_ALARM_H_
+#endif // UTIL_ALARM_H_
diff --git a/osp_base/alarm_unittest.cc b/util/alarm_unittest.cc
index d7ba78e8..71f570a0 100644
--- a/osp_base/alarm_unittest.cc
+++ b/util/alarm_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/alarm.h"
+#include "util/alarm.h"
#include <algorithm>
diff --git a/osp_base/big_endian.cc b/util/big_endian.cc
index ab1c8d08..d5658900 100644
--- a/osp_base/big_endian.cc
+++ b/util/big_endian.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/big_endian.h"
+#include "util/big_endian.h"
namespace openscreen {
diff --git a/osp_base/big_endian.h b/util/big_endian.h
index d473d6f0..6c94ca5e 100644
--- a/osp_base/big_endian.h
+++ b/util/big_endian.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_BIG_ENDIAN_H_
-#define OSP_BASE_BIG_ENDIAN_H_
+#ifndef UTIL_BIG_ENDIAN_H_
+#define UTIL_BIG_ENDIAN_H_
#include <stdint.h>
@@ -192,4 +192,4 @@ class BigEndianWriter : public BigEndianBuffer<uint8_t> {
} // namespace openscreen
-#endif // OSP_BASE_BIG_ENDIAN_H_
+#endif // UTIL_BIG_ENDIAN_H_
diff --git a/osp_base/big_endian_unittest.cc b/util/big_endian_unittest.cc
index ae289eb8..99b21a1d 100644
--- a/osp_base/big_endian_unittest.cc
+++ b/util/big_endian_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/big_endian.h"
+#include "util/big_endian.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
diff --git a/util/crypto/DEPS b/util/crypto/DEPS
new file mode 100644
index 00000000..a833577b
--- /dev/null
+++ b/util/crypto/DEPS
@@ -0,0 +1,11 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+include_rules = [
+ '+platform/api',
+
+ # BoringSSL includes
+ '-third_party/boringssl',
+ '+openssl'
+]
diff --git a/osp_base/crypto/openssl_util.cc b/util/crypto/openssl_util.cc
index 308d4831..92253b42 100644
--- a/osp_base/crypto/openssl_util.cc
+++ b/util/crypto/openssl_util.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/crypto/openssl_util.h"
+#include "util/crypto/openssl_util.h"
#include <stddef.h>
#include <stdint.h>
diff --git a/osp_base/crypto/openssl_util.h b/util/crypto/openssl_util.h
index 1fef04ff..a713b9f8 100644
--- a/osp_base/crypto/openssl_util.h
+++ b/util/crypto/openssl_util.h
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_CRYPTO_OPENSSL_UTIL_H_
-#define OSP_BASE_CRYPTO_OPENSSL_UTIL_H_
+#ifndef UTIL_CRYPTO_OPENSSL_UTIL_H_
+#define UTIL_CRYPTO_OPENSSL_UTIL_H_
#include <stddef.h>
#include <cstring>
-#include "osp_base/location.h"
-#include "osp_base/macros.h"
+#include "platform/base/location.h"
+#include "platform/base/macros.h"
namespace openscreen {
// Initialize OpenSSL if it isn't already initialized. This must be called
@@ -50,4 +50,4 @@ class OpenSSLErrStackTracer {
} // namespace openscreen
-#endif // OSP_BASE_CRYPTO_OPENSSL_UTIL_H_
+#endif // UTIL_CRYPTO_OPENSSL_UTIL_H_
diff --git a/osp_base/crypto/rsa_private_key.cc b/util/crypto/rsa_private_key.cc
index 0c8cf2a9..7ee12fb9 100644
--- a/osp_base/crypto/rsa_private_key.cc
+++ b/util/crypto/rsa_private_key.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/crypto/rsa_private_key.h"
+#include "util/crypto/rsa_private_key.h"
#include <stdint.h>
@@ -15,8 +15,8 @@
#include "openssl/evp.h"
#include "openssl/mem.h"
#include "openssl/rsa.h"
-#include "osp_base/crypto/openssl_util.h"
#include "platform/api/logging.h"
+#include "util/crypto/openssl_util.h"
namespace openscreen {
RSAPrivateKey::~RSAPrivateKey() = default;
diff --git a/osp_base/crypto/rsa_private_key.h b/util/crypto/rsa_private_key.h
index db18d990..5738954a 100644
--- a/osp_base/crypto/rsa_private_key.h
+++ b/util/crypto/rsa_private_key.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_CRYPTO_RSA_PRIVATE_KEY_H_
-#define OSP_BASE_CRYPTO_RSA_PRIVATE_KEY_H_
+#ifndef UTIL_CRYPTO_RSA_PRIVATE_KEY_H_
+#define UTIL_CRYPTO_RSA_PRIVATE_KEY_H_
#include <stddef.h>
#include <stdint.h>
@@ -12,7 +12,7 @@
#include <vector>
#include "openssl/base.h"
-#include "osp_base/macros.h"
+#include "platform/base/macros.h"
namespace openscreen {
@@ -59,4 +59,4 @@ class RSAPrivateKey {
} // namespace openscreen
-#endif // OSP_BASE_CRYPTO_RSA_PRIVATE_KEY_H_
+#endif // UTIL_CRYPTO_RSA_PRIVATE_KEY_H_
diff --git a/osp_base/crypto/rsa_private_key_unittest.cc b/util/crypto/rsa_private_key_unittest.cc
index 55c89e7b..17cc1de5 100644
--- a/osp_base/crypto/rsa_private_key_unittest.cc
+++ b/util/crypto/rsa_private_key_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/crypto/rsa_private_key.h"
+#include "util/crypto/rsa_private_key.h"
#include <stdint.h>
diff --git a/osp_base/crypto/secure_hash.cc b/util/crypto/secure_hash.cc
index 7aea3f71..14ed726a 100644
--- a/osp_base/crypto/secure_hash.cc
+++ b/util/crypto/secure_hash.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/crypto/secure_hash.h"
+#include "util/crypto/secure_hash.h"
#include <stddef.h>
#include <cstring>
#include "openssl/mem.h"
-#include "osp_base/crypto/openssl_util.h"
#include "platform/api/logging.h"
+#include "util/crypto/openssl_util.h"
namespace openscreen {
diff --git a/osp_base/crypto/secure_hash.h b/util/crypto/secure_hash.h
index 9cf061b9..7c007f96 100644
--- a/osp_base/crypto/secure_hash.h
+++ b/util/crypto/secure_hash.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_CRYPTO_SECURE_HASH_H_
-#define OSP_BASE_CRYPTO_SECURE_HASH_H_
+#ifndef UTIL_CRYPTO_SECURE_HASH_H_
+#define UTIL_CRYPTO_SECURE_HASH_H_
#include <stddef.h>
@@ -12,7 +12,7 @@
#include "openssl/base.h"
#include "openssl/evp.h"
-#include "osp_base/macros.h"
+#include "platform/base/macros.h"
namespace openscreen {
@@ -45,4 +45,4 @@ class SecureHash {
} // namespace openscreen
-#endif // OSP_BASE_CRYPTO_SECURE_HASH_H_
+#endif // UTIL_CRYPTO_SECURE_HASH_H_
diff --git a/osp_base/crypto/secure_hash_unittest.cc b/util/crypto/secure_hash_unittest.cc
index b1a7074d..e7a2be02 100644
--- a/osp_base/crypto/secure_hash_unittest.cc
+++ b/util/crypto/secure_hash_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/crypto/secure_hash.h"
+#include "util/crypto/secure_hash.h"
#include <stddef.h>
#include <stdint.h>
diff --git a/osp_base/crypto/sha2.cc b/util/crypto/sha2.cc
index 256eea19..dc4baa09 100644
--- a/osp_base/crypto/sha2.cc
+++ b/util/crypto/sha2.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/crypto/sha2.h"
+#include "util/crypto/sha2.h"
#include <stddef.h>
#include <memory>
-#include "osp_base/crypto/secure_hash.h"
-#include "osp_base/std_util.h"
+#include "util/crypto/secure_hash.h"
+#include "util/std_util.h"
namespace openscreen {
diff --git a/osp_base/crypto/sha2.h b/util/crypto/sha2.h
index a421a915..59da3453 100644
--- a/osp_base/crypto/sha2.h
+++ b/util/crypto/sha2.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_CRYPTO_SHA2_H_
-#define OSP_BASE_CRYPTO_SHA2_H_
+#ifndef UTIL_CRYPTO_SHA2_H_
+#define UTIL_CRYPTO_SHA2_H_
#include <stddef.h>
@@ -30,4 +30,4 @@ std::string SHA256HashString(absl::string_view str);
} // namespace openscreen
-#endif // OSP_BASE_CRYPTO_SHA2_H_
+#endif // UTIL_CRYPTO_SHA2_H_
diff --git a/osp_base/crypto/sha2_unittest.cc b/util/crypto/sha2_unittest.cc
index 4697f745..57d55348 100644
--- a/osp_base/crypto/sha2_unittest.cc
+++ b/util/crypto/sha2_unittest.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/crypto/sha2.h"
+#include "util/crypto/sha2.h"
#include <stddef.h>
#include <stdint.h>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "osp_base/std_util.h"
+#include "util/std_util.h"
namespace openscreen {
TEST(Sha256Test, Test1) {
diff --git a/util/json/DEPS b/util/json/DEPS
new file mode 100644
index 00000000..2defcf11
--- /dev/null
+++ b/util/json/DEPS
@@ -0,0 +1,8 @@
+# Copyright 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+include_rules = [
+ '+platform/api',
+ '+json'
+]
diff --git a/osp_base/json/json_reader.cc b/util/json/json_reader.cc
index 1750c2ad..a128a367 100644
--- a/osp_base/json/json_reader.cc
+++ b/util/json/json_reader.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/json/json_reader.h"
+#include "util/json/json_reader.h"
#include <memory>
#include <string>
#include "json/value.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace {
diff --git a/osp_base/json/json_reader.h b/util/json/json_reader.h
index be4a5e06..cb7cded0 100644
--- a/osp_base/json/json_reader.h
+++ b/util/json/json_reader.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_JSON_JSON_READER_H_
-#define OSP_BASE_JSON_JSON_READER_H_
+#ifndef UTIL_JSON_JSON_READER_H_
+#define UTIL_JSON_JSON_READER_H_
#include <memory>
@@ -30,4 +30,4 @@ class JsonReader {
} // namespace openscreen
-#endif // OSP_BASE_JSON_JSON_READER_H_ \ No newline at end of file
+#endif // UTIL_JSON_JSON_READER_H_ \ No newline at end of file
diff --git a/osp_base/json/json_reader_unittest.cc b/util/json/json_reader_unittest.cc
index 21729ebf..b94cca13 100644
--- a/osp_base/json/json_reader_unittest.cc
+++ b/util/json/json_reader_unittest.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/json/json_reader.h"
+#include "util/json/json_reader.h"
#include <string>
-#include "osp_base/error.h"
-#include "third_party/googletest/src/googlemock/include/gmock/gmock.h"
-#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "platform/base/error.h"
namespace openscreen {
namespace {
diff --git a/osp_base/json/json_writer.cc b/util/json/json_writer.cc
index 1d3d94f9..c2d01521 100644
--- a/osp_base/json/json_writer.cc
+++ b/util/json/json_writer.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/json/json_writer.h"
+#include "util/json/json_writer.h"
#include <memory>
#include <sstream>
@@ -10,8 +10,8 @@
#include <utility>
#include "json/value.h"
-#include "osp_base/error.h"
#include "platform/api/logging.h"
+#include "platform/base/error.h"
namespace openscreen {
JsonWriter::JsonWriter() {
diff --git a/osp_base/json/json_writer.h b/util/json/json_writer.h
index bad9484a..df37d9a0 100644
--- a/osp_base/json/json_writer.h
+++ b/util/json/json_writer.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_JSON_JSON_WRITER_H_
-#define OSP_BASE_JSON_JSON_WRITER_H_
+#ifndef UTIL_JSON_JSON_WRITER_H_
+#define UTIL_JSON_JSON_WRITER_H_
#include <memory>
#include <string>
@@ -31,4 +31,4 @@ class JsonWriter {
} // namespace openscreen
-#endif // OSP_BASE_JSON_JSON_WRITER_H_
+#endif // UTIL_JSON_JSON_WRITER_H_
diff --git a/osp_base/json/json_writer_unittest.cc b/util/json/json_writer_unittest.cc
index 6a4c00e1..8b75c82e 100644
--- a/osp_base/json/json_writer_unittest.cc
+++ b/util/json/json_writer_unittest.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "osp_base/json/json_writer.h"
+#include "util/json/json_writer.h"
-#include "osp_base/error.h"
-#include "third_party/googletest/src/googlemock/include/gmock/gmock.h"
-#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "platform/base/error.h"
namespace openscreen {
diff --git a/osp_base/std_util.h b/util/std_util.h
index 8a353e87..bd370f8e 100644
--- a/osp_base/std_util.h
+++ b/util/std_util.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_STD_UTIL_H_
-#define OSP_BASE_STD_UTIL_H_
+#ifndef UTIL_STD_UTIL_H_
+#define UTIL_STD_UTIL_H_
#include <map>
#include <string>
@@ -49,4 +49,4 @@ void SortAndDedupeElements(RandomAccessContainer* c) {
} // namespace openscreen
-#endif // OSP_BASE_STD_UTIL_H_
+#endif // UTIL_STD_UTIL_H_
diff --git a/osp_base/stringprintf.h b/util/stringprintf.h
index 3f8616b6..93e5eb93 100644
--- a/osp_base/stringprintf.h
+++ b/util/stringprintf.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef OSP_BASE_STRINGPRINTF_H_
-#define OSP_BASE_STRINGPRINTF_H_
+#ifndef UTIL_STRINGPRINTF_H_
+#define UTIL_STRINGPRINTF_H_
#include <ostream>
@@ -38,4 +38,4 @@ void PrettyPrintAsciiHex(std::ostream& os, It first, It last) {
} // namespace openscreen
-#endif // OSP_BASE_STRINGPRINTF_H_
+#endif // UTIL_STRINGPRINTF_H_