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

Unified Diff: mojo/services/public/interfaces/network/network_service.mojom

Issue 613683006: Add TCP socket mojo interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement network service functions 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/public/interfaces/network/network_service.mojom
diff --git a/mojo/services/public/interfaces/network/network_service.mojom b/mojo/services/public/interfaces/network/network_service.mojom
index 79bfa6e828a20a7cb26271802350aa5d8198237e..78841448dccf895b4725ab2c5c117aa415a2202f 100644
--- a/mojo/services/public/interfaces/network/network_service.mojom
+++ b/mojo/services/public/interfaces/network/network_service.mojom
@@ -3,11 +3,18 @@
// found in the LICENSE file.
import "mojo/services/public/interfaces/network/cookie_store.mojom"
+import "mojo/services/public/interfaces/network/net_address.mojom"
+import "mojo/services/public/interfaces/network/network_error.mojom"
+import "mojo/services/public/interfaces/network/tcp_bound_socket.mojom"
+import "mojo/services/public/interfaces/network/tcp_client_socket.mojom"
import "mojo/services/public/interfaces/network/url_loader.mojom"
import "mojo/services/public/interfaces/network/web_socket.mojom"
module mojo {
+// TODO Darin suggfests that this should probably be two classes. One for
willchan no longer on Chromium 2014/10/06 21:52:39 s/suggfests/suggests/ And I agree with Darin's su
+// high-level origin-build requests like WebSockets and HTTP, and the other for
wtc 2014/10/03 22:37:43 Typo: origin-build => origin-bound
+// non-origin-bound low-level stuff like DNS, UDP, and TCP.
interface NetworkService {
CreateURLLoader(URLLoader&? loader);
@@ -15,7 +22,34 @@ interface NetworkService {
CreateWebSocket(WebSocket& socket);
- // TODO(darin): Add other methods here.
+ // Creates a TCP socket bound to a given local address. This bound socket
+ // can be used for creating a client or server socket on that local address.
+ //
+ // If you want to create a client socket to connect to a server and are in
+ // the common case where you don't care about the local address it's bound
+ // to, use CreateTCPClientSocket.
+ //
+ // The local address can specify 0 for the port to specify that the OS should
+ // pick an available port for the given address, or it can pass 0 for the
+ // address and port for the OS to pick both the local address and port. In
+ // all success cases, the resulting local address will be passed to the
+ // callback as bound_to.
+ CreateTCPBoundSocket(NetAddress local_address,
+ TCPBoundSocket& bound_socket)
+ => (NetworkError result, NetAddress? bound_to);
+
+ // Creates a client socket connected to the given remote address. A local
+ // address and port will be allocated for the connection and passed to the
+ // callback on success.
+ //
+ // If you want control over the local address and port, instead use
+ // CreateTCPBoundSocket.
+ CreateTCPClientSocket(NetAddress remote_address,
+ handle<data_pipe_consumer> send_stream,
+ handle<data_pipe_producer> receive_stream,
+ TCPClientSocket& client_socket)
+ => (NetworkError result,
+ NetAddress? local_address);
wtc 2014/10/03 22:37:43 1. Few applications are interested in the local ad
brettw 2014/10/03 22:54:44 How expensive is this syscall? I did it this way b
willchan no longer on Chromium 2014/10/06 21:52:39 To my knowledge, it's a cheap syscall, but it's st
wtc 2014/10/07 20:47:45 The getsockname system call should be a simple sys
};
}

Powered by Google App Engine
This is Rietveld 408576698