| 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 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
| 6 module mojo; | 6 module mojo; |
| 7 | 7 |
| 8 import "mojo/public/interfaces/network/network_error.mojom"; | 8 import "mojo/public/interfaces/network/network_error.mojom"; |
| 9 import "network/interfaces/cookie_store.mojom"; | 9 import "network/interfaces/cookie_store.mojom"; |
| 10 import "network/interfaces/host_resolver.mojom"; | 10 import "network/interfaces/host_resolver.mojom"; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // | 33 // |
| 34 // If you want to create a client socket to connect to a server and are in | 34 // If you want to create a client socket to connect to a server and are in |
| 35 // the common case where you don't care about the local address it's bound | 35 // the common case where you don't care about the local address it's bound |
| 36 // to, use CreateTCPConnectedSocket. | 36 // to, use CreateTCPConnectedSocket. |
| 37 // | 37 // |
| 38 // The local address can specify 0 for the port to specify that the OS should | 38 // The local address can specify 0 for the port to specify that the OS should |
| 39 // pick an available port for the given address, or it can pass 0 for the | 39 // pick an available port for the given address, or it can pass 0 for the |
| 40 // address and port for the OS to pick both the local address and port. In | 40 // address and port for the OS to pick both the local address and port. In |
| 41 // all success cases, the resulting local address will be passed to the | 41 // all success cases, the resulting local address will be passed to the |
| 42 // callback as bound_to. | 42 // callback as bound_to. |
| 43 CreateTCPBoundSocket(NetAddress? local_address, | 43 CreateTCPBoundSocket(NetAddress? local_address, TCPBoundSocket& bound_socket)
=> (NetworkError result, NetAddress? bound_to); |
| 44 TCPBoundSocket& bound_socket) | |
| 45 => (NetworkError result, NetAddress? bound_to); | |
| 46 | 44 |
| 47 // Creates a client socket connected to the given remote address. A local | 45 // Creates a client socket connected to the given remote address. A local |
| 48 // address and port will be allocated for the connection and passed to the | 46 // address and port will be allocated for the connection and passed to the |
| 49 // callback on success. | 47 // callback on success. |
| 50 // | 48 // |
| 51 // If you want control over the local address and port, instead use | 49 // If you want control over the local address and port, instead use |
| 52 // CreateTCPBoundSocket. | 50 // CreateTCPBoundSocket. |
| 53 // | 51 // |
| 54 // IMPORTANT: This does not work yet! We need to add a new parameter to | 52 // IMPORTANT: This does not work yet! We need to add a new parameter to |
| 55 // indicate the protocol type (IPv4 or IPv6) actually be able to create the | 53 // indicate the protocol type (IPv4 or IPv6) actually be able to create the |
| 56 // right type of socket. We also need to figure out how the client is supposed | 54 // right type of socket. We also need to figure out how the client is supposed |
| 57 // to decide between IPv4 and IPv6 on a given system. | 55 // to decide between IPv4 and IPv6 on a given system. |
| 58 CreateTCPConnectedSocket(NetAddress remote_address, | 56 CreateTCPConnectedSocket(NetAddress remote_address, handle<data_pipe_consumer>
send_stream, handle<data_pipe_producer> receive_stream, TCPConnectedSocket& cli
ent_socket) => (NetworkError result, NetAddress? local_address); |
| 59 handle<data_pipe_consumer> send_stream, | |
| 60 handle<data_pipe_producer> receive_stream, | |
| 61 TCPConnectedSocket& client_socket) | |
| 62 => (NetworkError result, | |
| 63 NetAddress? local_address); | |
| 64 | 57 |
| 65 CreateUDPSocket(UDPSocket& socket); | 58 CreateUDPSocket(UDPSocket& socket); |
| 66 | 59 |
| 67 // Starts an HTTP server running on the given local address. The delegate will | 60 // Starts an HTTP server running on the given local address. The delegate will |
| 68 // be notified with incoming connections. | 61 // be notified with incoming connections. |
| 69 // | 62 // |
| 70 // The local address can specify 0 for the port to specify that the OS should | 63 // The local address can specify 0 for the port to specify that the OS should |
| 71 // pick an available port for the given address, or it can pass 0 for the | 64 // pick an available port for the given address, or it can pass 0 for the |
| 72 // address and port for the OS to pick both the local address and port. In | 65 // address and port for the OS to pick both the local address and port. In |
| 73 // all success cases, the resulting local address will be passed to the | 66 // all success cases, the resulting local address will be passed to the |
| 74 // callback as bound_to. | 67 // callback as bound_to. |
| 75 CreateHttpServer(NetAddress local_address, | 68 CreateHttpServer(NetAddress local_address, HttpServerDelegate delegate) => (Ne
tworkError result, NetAddress? bound_to); |
| 76 HttpServerDelegate delegate) | |
| 77 => (NetworkError result, | |
| 78 NetAddress? bound_to); | |
| 79 | 69 |
| 80 // Register a new url loader interceptor that will be used on any new | 70 // Register a new url loader interceptor that will be used on any new |
| 81 // URLLoader created with the current connection to the network service. | 71 // URLLoader created with the current connection to the network service. |
| 82 // Interceptors are chained. The last registered interceptor will received the | 72 // Interceptors are chained. The last registered interceptor will received the |
| 83 // requests first and the responses last. | 73 // requests first and the responses last. |
| 84 RegisterURLLoaderInterceptor(URLLoaderInterceptorFactory factory); | 74 RegisterURLLoaderInterceptor(URLLoaderInterceptorFactory factory); |
| 85 | 75 |
| 86 // Create a HostResolver that can be used to do ip <-> host lookups. | 76 // Create a HostResolver that can be used to do ip <-> host lookups. |
| 87 CreateHostResolver(HostResolver& host_resolver); | 77 CreateHostResolver(HostResolver& host_resolver); |
| 88 }; | 78 }; |
| OLD | NEW |