Pepper_31_C++_interfaces
tcp_server_socket_private.h
Go to the documentation of this file.
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.
4 
5 #ifndef PPAPI_CPP_PRIVATE_TCP_SERVER_SOCKET_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_TCP_SERVER_SOCKET_PRIVATE_H_
7 
8 #include "ppapi/c/pp_stdint.h"
9 #include "ppapi/c/private/ppb_tcp_server_socket_private.h"
10 #include "ppapi/cpp/resource.h"
11 
12 namespace pp {
13 
14 class CompletionCallback;
15 class InstanceHandle;
16 
18  public:
19  explicit TCPServerSocketPrivate(const InstanceHandle& instance);
20 
21  // Returns true if the required interface is available.
22  static bool IsAvailable();
23 
24  int32_t Listen(const PP_NetAddress_Private* addr,
25  int32_t backlog,
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);
34  void StopListening();
35 };
36 
37 } // namespace pp
38 
39 #endif // PPAPI_CPP_PRIVATE_TCP_SERVER_SOCKET_PRIVATE_H_
int32_t Listen(const PP_NetAddress_Private *addr, int32_t backlog, const CompletionCallback &callback)
int32_t GetLocalAddress(PP_NetAddress_Private *addr)
TCPServerSocketPrivate(const InstanceHandle &instance)
int32_t Accept(PP_Resource *socket, const CompletionCallback &callback)
A reference counted module resource.
Definition: resource.h:18