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.
6 /* From private/ppb_tcp_server_socket_private.idl,
7 * modified Thu Mar 28 10:31:11 2013.
10 #ifndef PPAPI_C_PRIVATE_PPB_TCP_SERVER_SOCKET_PRIVATE_H_
11 #define PPAPI_C_PRIVATE_PPB_TCP_SERVER_SOCKET_PRIVATE_H_
13 #include "ppapi/c/pp_bool.h"
14 #include "ppapi/c/pp_completion_callback.h"
15 #include "ppapi/c/pp_instance.h"
16 #include "ppapi/c/pp_macros.h"
17 #include "ppapi/c/pp_resource.h"
18 #include "ppapi/c/pp_stdint.h"
19 #include "ppapi/c/private/ppb_net_address_private.h"
21 #define PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_1 \
22 "PPB_TCPServerSocket_Private;0.1"
23 #define PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE \
24 PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_1
28 * This file defines the <code>PPB_TCPServerSocket_Private</code> interface.
33 * @addtogroup Interfaces
37 * The <code>PPB_TCPServerSocket_Private</code> interface provides TCP
38 * server socket operations.
40 struct PPB_TCPServerSocket_Private_0_1
{
42 * Allocates a TCP server socket resource.
44 PP_Resource (*Create
)(PP_Instance instance
);
46 * Determines if a given resource is TCP server socket.
48 PP_Bool (*IsTCPServerSocket
)(PP_Resource resource
);
50 * Binds |tcp_server_socket| to the address given by |addr| and
51 * starts listening. The |backlog| argument defines the maximum
52 * length to which the queue of pending connections may
53 * grow. |callback| is invoked when |tcp_server_socket| is ready to
54 * accept incoming connections or in the case of failure. Returns
55 * PP_ERROR_NOSPACE if socket can't be initialized, or
56 * PP_ERROR_FAILED in the case of Listen failure. Otherwise, returns
59 int32_t (*Listen
)(PP_Resource tcp_server_socket
,
60 const struct PP_NetAddress_Private
* addr
,
62 struct PP_CompletionCallback callback
);
64 * Accepts single connection, creates instance of
65 * PPB_TCPSocket_Private and stores reference to it in
66 * |tcp_socket|. |callback| is invoked when connection is accepted
67 * or in the case of failure. This method can be called only after
68 * successful Listen call on |tcp_server_socket|.
70 int32_t (*Accept
)(PP_Resource tcp_server_socket
,
71 PP_Resource
* tcp_socket
,
72 struct PP_CompletionCallback callback
);
74 * Cancels all pending callbacks reporting PP_ERROR_ABORTED and
75 * closes the socket. Note: this method is implicitly called when
76 * server socket is destroyed.
78 void (*StopListening
)(PP_Resource tcp_server_socket
);
81 typedef struct PPB_TCPServerSocket_Private_0_1 PPB_TCPServerSocket_Private
;
86 #endif /* PPAPI_C_PRIVATE_PPB_TCP_SERVER_SOCKET_PRIVATE_H_ */