Move UdpPacket from platform/api to platform/base.
Also, add the other explicit std::vector constructors.
Bug: openscreen:77
Change-Id: I14c8416ddbb23bb6baeec78af39c383d2b3de654
Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/1904887
Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
Commit-Queue: Yuri Wiitala <miu@chromium.org>
diff --git a/platform/api/udp_packet.h b/platform/api/udp_packet.h
deleted file mode 100644
index 41877ac..0000000
--- a/platform/api/udp_packet.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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
-
-#ifndef PLATFORM_API_UDP_PACKET_H_
-#define PLATFORM_API_UDP_PACKET_H_
-
-#include <utility>
-#include <vector>
-
-#include "platform/api/logging.h"
-#include "platform/base/ip_address.h"
-
-namespace openscreen {
-namespace platform {
-
-class UdpSocket;
-
-static constexpr size_t kUdpMaxPacketSize = 1 << 16;
-
-class UdpPacket : public std::vector<uint8_t> {
- public:
- explicit UdpPacket(size_t size) : std::vector<uint8_t>(size) {
- OSP_DCHECK(size <= kUdpMaxPacketSize);
- }
- UdpPacket() : UdpPacket(0) {}
- UdpPacket(UdpPacket&& other) = default;
- UdpPacket& operator=(UdpPacket&& other) = default;
-
- const IPEndpoint& source() const { return source_; }
- void set_source(IPEndpoint endpoint) { source_ = std::move(endpoint); }
-
- const IPEndpoint& destination() const { return destination_; }
- void set_destination(IPEndpoint endpoint) {
- destination_ = std::move(endpoint);
- }
-
- UdpSocket* socket() const { return socket_; }
- void set_socket(UdpSocket* socket) { socket_ = socket; }
-
- private:
- IPEndpoint source_ = {};
- IPEndpoint destination_ = {};
- UdpSocket* socket_ = nullptr;
-
- OSP_DISALLOW_COPY_AND_ASSIGN(UdpPacket);
-};
-
-} // namespace platform
-} // namespace openscreen
-
-#endif // PLATFORM_API_UDP_PACKET_H_
diff --git a/platform/api/udp_socket.h b/platform/api/udp_socket.h
index f5d462a..cc75e83 100644
--- a/platform/api/udp_socket.h
+++ b/platform/api/udp_socket.h
@@ -12,10 +12,10 @@
#include <mutex>
#include "platform/api/network_interface.h"
-#include "platform/api/udp_packet.h"
#include "platform/base/error.h"
#include "platform/base/ip_address.h"
#include "platform/base/macros.h"
+#include "platform/base/udp_packet.h"
namespace openscreen {
namespace platform {