summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/dev/tcp_socket_dev.h
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/cpp/dev/tcp_socket_dev.h')
-rw-r--r--ppapi/cpp/dev/tcp_socket_dev.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/ppapi/cpp/dev/tcp_socket_dev.h b/ppapi/cpp/dev/tcp_socket_dev.h
new file mode 100644
index 0000000..16d7dee
--- /dev/null
+++ b/ppapi/cpp/dev/tcp_socket_dev.h
@@ -0,0 +1,53 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_
+#define PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_
+
+#include "ppapi/c/dev/ppb_tcp_socket_dev.h"
+#include "ppapi/cpp/dev/net_address_dev.h"
+#include "ppapi/cpp/pass_ref.h"
+#include "ppapi/cpp/resource.h"
+
+namespace pp {
+
+class CompletionCallback;
+class InstanceHandle;
+
+class TCPSocket_Dev: public Resource {
+ public:
+ TCPSocket_Dev();
+
+ explicit TCPSocket_Dev(const InstanceHandle& instance);
+
+ TCPSocket_Dev(PassRef, PP_Resource resource);
+
+ TCPSocket_Dev(const TCPSocket_Dev& other);
+
+ virtual ~TCPSocket_Dev();
+
+ TCPSocket_Dev& operator=(const TCPSocket_Dev& other);
+
+ // Returns true if the required interface is available.
+ static bool IsAvailable();
+
+ int32_t Connect(const NetAddress_Dev& addr,
+ const CompletionCallback& callback);
+ NetAddress_Dev GetLocalAddress() const;
+ NetAddress_Dev GetRemoteAddress() const;
+ int32_t Read(char* buffer,
+ int32_t bytes_to_read,
+ const CompletionCallback& callback);
+ int32_t Write(const char* buffer,
+ int32_t bytes_to_write,
+ const CompletionCallback& callback);
+ void Close();
+ int32_t SetOption(PP_TCPSocket_Option_Dev name,
+ const Var& value,
+ const CompletionCallback& callback);
+};
+
+} // namespace pp
+
+#endif // PPAPI_CPP_DEV_TCP_SOCKET_DEV_H_