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.
5 #ifndef PPAPI_CPP_PRIVATE_TCP_SERVER_SOCKET_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_TCP_SERVER_SOCKET_PRIVATE_H_
8 #include "ppapi/c/pp_stdint.h"
9 #include "ppapi/c/private/ppb_tcp_server_socket_private.h"
10 #include "ppapi/cpp/resource.h"
14 class CompletionCallback
;
17 class TCPServerSocketPrivate
: public Resource
{
19 explicit TCPServerSocketPrivate(const InstanceHandle
& instance
);
21 // Returns true if the required interface is available.
22 static bool IsAvailable();
24 int32_t Listen(const PP_NetAddress_Private
* addr
,
26 const CompletionCallback
& callback
);
27 // Accepts incoming connection and stores resource of accepted
28 // socket into |socket|. If Accept returns PP_OK_COMPLETIONPENDING,
29 // the memory pointed by |socket| should stay valid until the
30 // |callback| is called or StopListening method is called.
31 int32_t Accept(PP_Resource
* socket
,
32 const CompletionCallback
& callback
);
33 int32_t GetLocalAddress(PP_NetAddress_Private
* addr
);
39 #endif // PPAPI_CPP_PRIVATE_TCP_SERVER_SOCKET_PRIVATE_H_