Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import "mojo/services/public/interfaces/network/cookie_store.mojom" | 5 import "mojo/services/public/interfaces/network/cookie_store.mojom" |
| 6 import "mojo/services/public/interfaces/network/net_address.mojom" | |
| 7 import "mojo/services/public/interfaces/network/network_error.mojom" | |
| 8 import "mojo/services/public/interfaces/network/tcp_bound_socket.mojom" | |
| 9 import "mojo/services/public/interfaces/network/tcp_client_socket.mojom" | |
| 6 import "mojo/services/public/interfaces/network/url_loader.mojom" | 10 import "mojo/services/public/interfaces/network/url_loader.mojom" |
| 7 import "mojo/services/public/interfaces/network/web_socket.mojom" | 11 import "mojo/services/public/interfaces/network/web_socket.mojom" |
| 8 | 12 |
| 9 module mojo { | 13 module mojo { |
| 10 | 14 |
| 15 // 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
| |
| 16 // 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
| |
| 17 // non-origin-bound low-level stuff like DNS, UDP, and TCP. | |
| 11 interface NetworkService { | 18 interface NetworkService { |
| 12 CreateURLLoader(URLLoader&? loader); | 19 CreateURLLoader(URLLoader&? loader); |
| 13 | 20 |
| 14 GetCookieStore(CookieStore&? cookie_store); | 21 GetCookieStore(CookieStore&? cookie_store); |
| 15 | 22 |
| 16 CreateWebSocket(WebSocket& socket); | 23 CreateWebSocket(WebSocket& socket); |
| 17 | 24 |
| 18 // TODO(darin): Add other methods here. | 25 // Creates a TCP socket bound to a given local address. This bound socket |
| 26 // can be used for creating a client or server socket on that local address. | |
| 27 // | |
| 28 // If you want to create a client socket to connect to a server and are in | |
| 29 // the common case where you don't care about the local address it's bound | |
| 30 // to, use CreateTCPClientSocket. | |
| 31 // | |
| 32 // The local address can specify 0 for the port to specify that the OS should | |
| 33 // pick an available port for the given address, or it can pass 0 for the | |
| 34 // address and port for the OS to pick both the local address and port. In | |
| 35 // all success cases, the resulting local address will be passed to the | |
| 36 // callback as bound_to. | |
| 37 CreateTCPBoundSocket(NetAddress local_address, | |
| 38 TCPBoundSocket& bound_socket) | |
| 39 => (NetworkError result, NetAddress? bound_to); | |
| 40 | |
| 41 // Creates a client socket connected to the given remote address. A local | |
| 42 // address and port will be allocated for the connection and passed to the | |
| 43 // callback on success. | |
| 44 // | |
| 45 // If you want control over the local address and port, instead use | |
| 46 // CreateTCPBoundSocket. | |
| 47 CreateTCPClientSocket(NetAddress remote_address, | |
| 48 handle<data_pipe_consumer> send_stream, | |
| 49 handle<data_pipe_producer> receive_stream, | |
| 50 TCPClientSocket& client_socket) | |
| 51 => (NetworkError result, | |
| 52 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
| |
| 19 }; | 53 }; |
| 20 | 54 |
| 21 } | 55 } |
| OLD | NEW |