Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: mojo/services/network/tcp_bound_socket_impl.h

Issue 634713002: Implement parts of the Mojo TCP interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/services/network/tcp_bound_socket_impl.h
diff --git a/mojo/services/network/tcp_bound_socket_impl.h b/mojo/services/network/tcp_bound_socket_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..5fb1bf30ea4d93a4004a8f0cd647d360b9da31a6
--- /dev/null
+++ b/mojo/services/network/tcp_bound_socket_impl.h
@@ -0,0 +1,43 @@
+// Copyright 2014 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 MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_
+#define MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "mojo/public/cpp/bindings/interface_impl.h"
+#include "mojo/services/public/interfaces/network/tcp_bound_socket.mojom.h"
+#include "net/socket/tcp_socket.h"
+
+namespace mojo {
+
+class TCPBoundSocketImpl : public InterfaceImpl<TCPBoundSocket> {
+ public:
+ TCPBoundSocketImpl();
+ virtual ~TCPBoundSocketImpl();
+
+ int Bind(NetAddressPtr local_address);
+
+ // Returns the local address associated with this socket. This should only
+ // be called after Bind has succeeded.
+ NetAddressPtr GetLocalAddress() const;
+
+ // TCPBoundSocket.
+ virtual void StartListening(
+ InterfaceRequest<TCPServerSocket> server,
+ const Callback<void(NetworkErrorPtr)>& callback) override;
+ virtual void Connect(
+ NetAddressPtr remote_address,
+ ScopedDataPipeConsumerHandle send_stream,
+ ScopedDataPipeProducerHandle receive_stream,
+ InterfaceRequest<TCPConnectedSocket> client_socket,
+ const Callback<void(NetworkErrorPtr)>& callback) override;
+
+ private:
+ scoped_ptr<net::TCPSocket> socket_;
+};
+
+} // namespace mojo
+
+#endif // MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_

Powered by Google App Engine
This is Rietveld 408576698