| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 module mojo; | |
| 6 | |
| 7 import "network/public/interfaces/cookie_store.mojom"; | |
| 8 import "network/public/interfaces/host_resolver.mojom"; | |
| 9 import "network/public/interfaces/http_server.mojom"; | |
| 10 import "network/public/interfaces/net_address.mojom"; | |
| 11 import "network/public/interfaces/tcp_bound_socket.mojom"; | |
| 12 import "network/public/interfaces/tcp_connected_socket.mojom"; | |
| 13 import "network/public/interfaces/udp_socket.mojom"; | |
| 14 import "network/public/interfaces/url_loader.mojom"; | |
| 15 import "network/public/interfaces/url_loader_interceptor.mojom"; | |
| 16 import "network/public/interfaces/web_socket.mojom"; | |
| 17 import "third_party/mojo/src/mojo/public/interfaces/network/network_error.mojom"
; | |
| 18 | |
| 19 // TODO Darin suggests that this should probably be two classes. One for | |
| 20 // high-level origin-build requests like WebSockets and HTTP, and the other for | |
| 21 // non-origin-bound low-level stuff like DNS, UDP, and TCP. | |
| 22 interface NetworkService { | |
| 23 CreateURLLoader(URLLoader& loader); | |
| 24 | |
| 25 GetCookieStore(CookieStore& cookie_store); | |
| 26 | |
| 27 CreateWebSocket(WebSocket& socket); | |
| 28 | |
| 29 // Creates a TCP socket bound to a given local address. This bound socket | |
| 30 // can be used for creating a client or server socket on that local address. | |
| 31 // | |
| 32 // If you want to create a client socket to connect to a server and are in | |
| 33 // the common case where you don't care about the local address it's bound | |
| 34 // to, use CreateTCPConnectedSocket. | |
| 35 // | |
| 36 // The local address can specify 0 for the port to specify that the OS should | |
| 37 // pick an available port for the given address, or it can pass 0 for the | |
| 38 // address and port for the OS to pick both the local address and port. In | |
| 39 // all success cases, the resulting local address will be passed to the | |
| 40 // callback as bound_to. | |
| 41 CreateTCPBoundSocket(NetAddress? local_address, | |
| 42 TCPBoundSocket& bound_socket) | |
| 43 => (NetworkError result, NetAddress? bound_to); | |
| 44 | |
| 45 // Creates a client socket connected to the given remote address. A local | |
| 46 // address and port will be allocated for the connection and passed to the | |
| 47 // callback on success. | |
| 48 // | |
| 49 // If you want control over the local address and port, instead use | |
| 50 // CreateTCPBoundSocket. | |
| 51 // | |
| 52 // IMPORTANT: This does not work yet! We need to add a new parameter to | |
| 53 // indicate the protocol type (IPv4 or IPv6) actually be able to create the | |
| 54 // right type of socket. We also need to figure out how the client is supposed | |
| 55 // to decide between IPv4 and IPv6 on a given system. | |
| 56 CreateTCPConnectedSocket(NetAddress remote_address, | |
| 57 handle<data_pipe_consumer> send_stream, | |
| 58 handle<data_pipe_producer> receive_stream, | |
| 59 TCPConnectedSocket& client_socket) | |
| 60 => (NetworkError result, | |
| 61 NetAddress? local_address); | |
| 62 | |
| 63 CreateUDPSocket(UDPSocket& socket); | |
| 64 | |
| 65 // Starts an HTTP server running on the given local address. The delegate will | |
| 66 // be notified with incoming connections. | |
| 67 // | |
| 68 // The local address can specify 0 for the port to specify that the OS should | |
| 69 // pick an available port for the given address, or it can pass 0 for the | |
| 70 // address and port for the OS to pick both the local address and port. In | |
| 71 // all success cases, the resulting local address will be passed to the | |
| 72 // callback as bound_to. | |
| 73 CreateHttpServer(NetAddress local_address, | |
| 74 HttpServerDelegate delegate) | |
| 75 => (NetworkError result, | |
| 76 NetAddress? bound_to); | |
| 77 | |
| 78 // Register a new url loader interceptor that will be used on any new | |
| 79 // URLLoader created with the current connection to the network service. | |
| 80 // Interceptors are chained. The last registered interceptor will received the | |
| 81 // requests first and the responses last. | |
| 82 RegisterURLLoaderInterceptor(URLLoaderInterceptorFactory factory); | |
| 83 | |
| 84 // Create a HostResolver that can be used to do ip <-> host lookups. | |
| 85 CreateHostResolver(HostResolver& host_resolver); | |
| 86 }; | |
| OLD | NEW |