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/http_server.mojom"; | |
9 import "network/public/interfaces/net_address.mojom"; | |
10 import "network/public/interfaces/network_error.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/web_socket.mojom"; | |
15 | |
16 // TODO(beng): consider if this should be further reduced to functionality- | |
17 // specific interfaces. | |
18 interface NetworkService { | |
19 // Creates a TCP socket bound to a given local address. This bound socket | |
20 // can be used for creating a client or server socket on that local address. | |
21 // | |
22 // If you want to create a client socket to connect to a server and are in | |
23 // the common case where you don't care about the local address it's bound | |
24 // to, use CreateTCPConnectedSocket. | |
25 // | |
26 // The local address can specify 0 for the port to specify that the OS should | |
27 // pick an available port for the given address, or it can pass 0 for the | |
28 // address and port for the OS to pick both the local address and port. In | |
29 // all success cases, the resulting local address will be passed to the | |
30 // callback as bound_to. | |
31 CreateTCPBoundSocket(NetAddress? local_address, | |
32 TCPBoundSocket& bound_socket) | |
33 => (NetworkError result, NetAddress? bound_to); | |
34 | |
35 // Creates a client socket connected to the given remote address. A local | |
36 // address and port will be allocated for the connection and passed to the | |
37 // callback on success. | |
38 // | |
39 // If you want control over the local address and port, instead use | |
40 // CreateTCPBoundSocket. | |
41 // | |
42 // IMPORTANT: This does not work yet! We need to add a new parameter to | |
43 // indicate the protocol type (IPv4 or IPv6) actually be able to create the | |
44 // right type of socket. We also need to figure out how the client is supposed | |
45 // to decide between IPv4 and IPv6 on a given system. | |
46 CreateTCPConnectedSocket(NetAddress remote_address, | |
47 handle<data_pipe_consumer> send_stream, | |
48 handle<data_pipe_producer> receive_stream, | |
49 TCPConnectedSocket& client_socket) | |
50 => (NetworkError result, | |
51 NetAddress? local_address); | |
52 | |
53 CreateUDPSocket(UDPSocket& socket); | |
54 | |
55 // Starts an HTTP server running on the given local address. The delegate will | |
56 // be notified with incoming connections. | |
57 // | |
58 // The local address can specify 0 for the port to specify that the OS should | |
59 // pick an available port for the given address, or it can pass 0 for the | |
60 // address and port for the OS to pick both the local address and port. In | |
61 // all success cases, the resulting local address will be passed to the | |
62 // callback as bound_to. | |
63 CreateHttpServer(NetAddress local_address, | |
64 HttpServerDelegate delegate) | |
65 => (NetworkError result, | |
66 NetAddress? bound_to); | |
67 | |
68 // Get the mime type (if any) that is associated with the given file. | |
69 GetMimeTypeFromFile(string file_path) => (string mime_type); | |
70 }; | |
OLD | NEW |