| 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 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 | 8 |
| 9 module mojo { | 9 module mojo { |
| 10 | 10 |
| 11 // Represents a TCP server socket listening for incoming requests. | 11 // Represents a TCP server socket listening for incoming requests. |
| 12 [Client=TCPServerSocketClient] | |
| 13 interface TCPServerSocket { | 12 interface TCPServerSocket { |
| 14 // Accepts an incoming connection request and hooks up a TCPClientSocket for | 13 // Waits for an incoming connection request and hooks up a TCPConnectedSocket |
| 15 // connecting with the remote host. This function is called in reponse to | 14 // for connecting with the remote host. Only one Accept call can be pending |
| 16 // OnConnectionAvailable(). | 15 // at a time. |
| 17 // | 16 // |
| 18 // On success, the address of the remote host will be provided. | 17 // On success, the address of the remote host will be provided. |
| 19 AcceptConnection(handle<data_pipe_consumer> send_stream, | 18 Accept(handle<data_pipe_consumer> send_stream, |
| 20 handle<data_pipe_producer> receive_stream, | 19 handle<data_pipe_producer> receive_stream, |
| 21 TCPClientSocket& client_socket) | 20 TCPConnectedSocket& client_socket) |
| 22 => (NetworkError result, NetAddress? remote_address); | 21 => (NetworkError result, NetAddress? remote_address); |
| 23 }; | 22 }; |
| 24 | 23 |
| 25 interface TCPServerSocketClient { | |
| 26 // Notifies the client that an incoming connection is available. | |
| 27 // | |
| 28 // The client should call AcceptConnection() to accept the request. | |
| 29 OnConnectionAvailable(); | |
| 30 | |
| 31 // TODO(brettw) probably need some error reporting function here. | |
| 32 }; | |
| 33 | |
| 34 } | 24 } |
| OLD | NEW |