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

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

Issue 634713002: Implement parts of the Mojo TCP interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing file in gyp Created 6 years, 2 months 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
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/net_address.mojom" 5 import "mojo/services/public/interfaces/network/net_address.mojom"
6 import "mojo/services/public/interfaces/network/network_error.mojom" 6 import "mojo/services/public/interfaces/network/network_error.mojom"
7 import "mojo/services/public/interfaces/network/tcp_client_socket.mojom" 7 import "mojo/services/public/interfaces/network/tcp_connected_socket.mojom"
8 import "mojo/services/public/interfaces/network/tcp_server_socket.mojom" 8 import "mojo/services/public/interfaces/network/tcp_server_socket.mojom"
9 9
10 module mojo { 10 module mojo {
11 11
12 // Represents a TCP socket that is bound to a local address and port, but 12 // Represents a TCP socket that is bound to a local address and port, but
13 // is not yet in a listening or connected state. 13 // is not yet in a listening or connected state.
14 // 14 //
15 // A bound socket can be used to create a server socket listening on the 15 // A bound socket can be used to create a server socket listening on the
16 // local address, or it can be used to create a client socket by connecting to 16 // local address, or it can be used to create a client socket by connecting to
17 // a remote host. 17 // a remote host. Once StartListening or Connect is called on the bound socket,
18 // ownership of the underlying socket will be transferred to the connected or
19 // server socket, and the bound socket may be closed.
18 interface TCPBoundSocket { 20 interface TCPBoundSocket {
19 // Puts the socket into server mode, awaiting incoming connections. 21 // Puts the socket into server mode, awaiting incoming connections.
20 // 22 //
21 // Once this function is called, neither StartListening nor Connect can be 23 // Once this function is called, neither StartListening nor Connect can be
22 // used on this socket again. 24 // used on this socket again.
23 StartListening(TCPServerSocket& server); 25 StartListening(TCPServerSocket& server) => (NetworkError result);
24 26
25 // Puts this socket into client mode by connecting to a remote host. If you 27 // Puts this socket into client mode by connecting to a remote host. If you
26 // do not care about the local address or port, you can call 28 // do not care about the local address or port, you can call
27 // NetworkService.CreateTCPClientSocket to connect directly and skip the 29 // NetworkService.CreateTCPConnectedSocket to connect directly and skip the
28 // "bound" state. 30 // "bound" state.
29 // 31 //
30 // Once this function is called, neither StartListening nor Connect can be 32 // Once this function is called, neither StartListening nor Connect can be
31 // used on this socket again. 33 // used on this socket again.
32 Connect(NetAddress remote_address, 34 Connect(NetAddress remote_address,
33 handle<data_pipe_consumer> send_stream, 35 handle<data_pipe_consumer> send_stream,
34 handle<data_pipe_producer> receive_stream, 36 handle<data_pipe_producer> receive_stream,
35 TCPClientSocket& client_socket) 37 TCPConnectedSocket& client_socket)
36 => (NetworkError result); 38 => (NetworkError result);
37 }; 39 };
38 40
39 } 41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698