| 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" | 6 import "mojo/services/public/interfaces/network/net_address.mojom" |
| 7 import "mojo/services/public/interfaces/network/network_error.mojom" | 7 import "mojo/services/public/interfaces/network/network_error.mojom" |
| 8 import "mojo/services/public/interfaces/network/tcp_bound_socket.mojom" | 8 import "mojo/services/public/interfaces/network/tcp_bound_socket.mojom" |
| 9 import "mojo/services/public/interfaces/network/tcp_client_socket.mojom" | 9 import "mojo/services/public/interfaces/network/tcp_connected_socket.mojom" |
| 10 import "mojo/services/public/interfaces/network/url_loader.mojom" | 10 import "mojo/services/public/interfaces/network/url_loader.mojom" |
| 11 import "mojo/services/public/interfaces/network/web_socket.mojom" | 11 import "mojo/services/public/interfaces/network/web_socket.mojom" |
| 12 | 12 |
| 13 module mojo { | 13 module mojo { |
| 14 | 14 |
| 15 // TODO Darin suggfests that this should probably be two classes. One for | 15 // TODO Darin suggfests that this should probably be two classes. One for |
| 16 // high-level origin-build requests like WebSockets and HTTP, and the other for | 16 // high-level origin-build requests like WebSockets and HTTP, and the other for |
| 17 // non-origin-bound low-level stuff like DNS, UDP, and TCP. | 17 // non-origin-bound low-level stuff like DNS, UDP, and TCP. |
| 18 interface NetworkService { | 18 interface NetworkService { |
| 19 CreateURLLoader(URLLoader&? loader); | 19 CreateURLLoader(URLLoader&? loader); |
| 20 | 20 |
| 21 GetCookieStore(CookieStore&? cookie_store); | 21 GetCookieStore(CookieStore&? cookie_store); |
| 22 | 22 |
| 23 CreateWebSocket(WebSocket& socket); | 23 CreateWebSocket(WebSocket& socket); |
| 24 | 24 |
| 25 // Creates a TCP socket bound to a given local address. This bound socket | 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. | 26 // can be used for creating a client or server socket on that local address. |
| 27 // | 27 // |
| 28 // If you want to create a client socket to connect to a server and are in | 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 | 29 // the common case where you don't care about the local address it's bound |
| 30 // to, use CreateTCPClientSocket. | 30 // to, use CreateTCPConnectedSocket. |
| 31 // | 31 // |
| 32 // The local address can specify 0 for the port to specify that the OS should | 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 | 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 | 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 | 35 // all success cases, the resulting local address will be passed to the |
| 36 // callback as bound_to. | 36 // callback as bound_to. |
| 37 CreateTCPBoundSocket(NetAddress local_address, | 37 CreateTCPBoundSocket(NetAddress? local_address, |
| 38 TCPBoundSocket& bound_socket) | 38 TCPBoundSocket& bound_socket) |
| 39 => (NetworkError result, NetAddress? bound_to); | 39 => (NetworkError result, NetAddress? bound_to); |
| 40 | 40 |
| 41 // Creates a client socket connected to the given remote address. A local | 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 | 42 // address and port will be allocated for the connection and passed to the |
| 43 // callback on success. | 43 // callback on success. |
| 44 // | 44 // |
| 45 // If you want control over the local address and port, instead use | 45 // If you want control over the local address and port, instead use |
| 46 // CreateTCPBoundSocket. | 46 // CreateTCPBoundSocket. |
| 47 CreateTCPClientSocket(NetAddress remote_address, | 47 CreateTCPConnectedSocket(NetAddress remote_address, |
| 48 handle<data_pipe_consumer> send_stream, | 48 handle<data_pipe_consumer> send_stream, |
| 49 handle<data_pipe_producer> receive_stream, | 49 handle<data_pipe_producer> receive_stream, |
| 50 TCPClientSocket& client_socket) | 50 TCPConnectedSocket& client_socket) |
| 51 => (NetworkError result, | 51 => (NetworkError result, |
| 52 NetAddress? local_address); | 52 NetAddress? local_address); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } | 55 } |
| OLD | NEW |