Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1304)

Side by Side Diff: mojo/services/public/interfaces/network/network_service.mojom

Issue 789243002: Restructure public side of network service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "mojo/services/public/interfaces/network/cookie_store.mojom";
8 import "mojo/services/public/interfaces/network/net_address.mojom";
9 import "mojo/services/public/interfaces/network/network_error.mojom";
10 import "mojo/services/public/interfaces/network/tcp_bound_socket.mojom";
11 import "mojo/services/public/interfaces/network/tcp_connected_socket.mojom";
12 import "mojo/services/public/interfaces/network/udp_socket.mojom";
13 import "mojo/services/public/interfaces/network/url_loader.mojom";
14 import "mojo/services/public/interfaces/network/web_socket.mojom";
15
16 // TODO Darin suggfests that this should probably be two classes. One for
17 // high-level origin-build requests like WebSockets and HTTP, and the other for
18 // non-origin-bound low-level stuff like DNS, UDP, and TCP.
19 interface NetworkService {
20 CreateURLLoader(URLLoader& loader);
21
22 GetCookieStore(CookieStore& cookie_store);
23
24 CreateWebSocket(WebSocket& socket);
25
26 // Creates a TCP socket bound to a given local address. This bound socket
27 // can be used for creating a client or server socket on that local address.
28 //
29 // If you want to create a client socket to connect to a server and are in
30 // the common case where you don't care about the local address it's bound
31 // to, use CreateTCPConnectedSocket.
32 //
33 // The local address can specify 0 for the port to specify that the OS should
34 // pick an available port for the given address, or it can pass 0 for the
35 // address and port for the OS to pick both the local address and port. In
36 // all success cases, the resulting local address will be passed to the
37 // callback as bound_to.
38 CreateTCPBoundSocket(NetAddress? local_address,
39 TCPBoundSocket& bound_socket)
40 => (NetworkError result, NetAddress? bound_to);
41
42 // Creates a client socket connected to the given remote address. A local
43 // address and port will be allocated for the connection and passed to the
44 // callback on success.
45 //
46 // If you want control over the local address and port, instead use
47 // CreateTCPBoundSocket.
48 //
49 // IMPORTANT: This does not work yet! We need to add a new parameter to
50 // indicate the protocol type (IPv4 or IPv6) actually be able to create the
51 // right type of socket. We also need to figure out how the client is supposed
52 // to decide between IPv4 and IPv6 on a given system.
53 CreateTCPConnectedSocket(NetAddress remote_address,
54 handle<data_pipe_consumer> send_stream,
55 handle<data_pipe_producer> receive_stream,
56 TCPConnectedSocket& client_socket)
57 => (NetworkError result,
58 NetAddress? local_address);
59
60 CreateUDPSocket(UDPSocket& socket);
61 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698