1 /* Copyright (c) 2012 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.
7 * This file defines the <code>PPB_TCPServerSocket_Private</code> interface.
15 * The <code>PPB_TCPServerSocket_Private</code> interface provides TCP
16 * server socket operations.
18 interface PPB_TCPServerSocket_Private
{
20 * Allocates a TCP server socket resource.
22 PP_Resource Create
([in] PP_Instance instance
);
25 * Determines if a given resource is TCP server socket.
27 PP_Bool IsTCPServerSocket
([in] PP_Resource resource
);
30 * Binds |tcp_server_socket| to the address given by |addr| and
31 * starts listening. The |backlog| argument defines the maximum
32 * length to which the queue of pending connections may
33 * grow. |callback| is invoked when |tcp_server_socket| is ready to
34 * accept incoming connections or in the case of failure. Returns
35 * PP_ERROR_NOSPACE if socket can't be initialized, or
36 * PP_ERROR_FAILED in the case of Listen failure. Otherwise, returns
39 int32_t Listen
([in] PP_Resource tcp_server_socket
,
40 [in] PP_NetAddress_Private addr
,
42 [in] PP_CompletionCallback
callback);
45 * Accepts single connection, creates instance of
46 * PPB_TCPSocket_Private and stores reference to it in
47 * |tcp_socket|. |callback| is invoked when connection is accepted
48 * or in the case of failure. This method can be called only after
49 * succesfull Listen call on |tcp_server_socket|.
51 int32_t Accept
([in] PP_Resource tcp_server_socket
,
52 [out] PP_Resource tcp_socket
,
53 [in] PP_CompletionCallback
callback);
56 * Cancels all pending callbacks reporting PP_ERROR_ABORTED and
57 * closes the socket. Note: this method is implicitly called when
58 * server socket is destroyed.
60 void StopListening
([in] PP_Resource tcp_server_socket
);