summaryrefslogtreecommitdiffstats
path: root/content/common/p2p_messages.h
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 20:52:34 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 20:52:34 +0000
commit6c54e7e41109a4c5bc638d94d868d5f7c92bc68e (patch)
tree4cfbe30cd4b483e0d10630058fba5cf9100ba13b /content/common/p2p_messages.h
parent098a8eac76a314e4b26a7387e272d69fec518272 (diff)
downloadchromium_src-6c54e7e41109a4c5bc638d94d868d5f7c92bc68e.zip
chromium_src-6c54e7e41109a4c5bc638d94d868d5f7c92bc68e.tar.gz
chromium_src-6c54e7e41109a4c5bc638d94d868d5f7c92bc68e.tar.bz2
P2P Sockets host implementation.
Currently only UDP sockets on Mac and Linux are supported. Also added --enable-p2papi flag. The flags just enables IPC for P2P. BUG=None TEST=None Review URL: http://codereview.chromium.org/6598053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/p2p_messages.h')
-rw-r--r--content/common/p2p_messages.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/content/common/p2p_messages.h b/content/common/p2p_messages.h
new file mode 100644
index 0000000..6ab75df
--- /dev/null
+++ b/content/common/p2p_messages.h
@@ -0,0 +1,62 @@
+// Copyright (c) 2011 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.
+
+// IPC messages for the P2P Transport API.
+
+#ifndef CONTENT_COMMON_P2P_MESSAGES_H_
+#define CONTENT_COMMON_P2P_MESSAGES_H_
+
+#include "content/common/p2p_sockets.h"
+#include "ipc/ipc_message_macros.h"
+
+#define IPC_MESSAGE_START P2PMsgStart
+
+// P2P Socket messages sent from the browser to the renderer.
+
+IPC_MESSAGE_ROUTED2(P2PMsg_OnSocketCreated,
+ int /* socket_id */,
+ P2PSocketAddress /* socket_address */)
+
+IPC_MESSAGE_ROUTED1(P2PMsg_OnError,
+ int /* socket_id */)
+
+IPC_MESSAGE_ROUTED3(P2PMsg_OnDataReceived,
+ int /* socket_id */,
+ P2PSocketAddress /* socket_address */,
+ std::vector<char> /* data */)
+
+// P2P Socket messages sent from the renderer to the browser.
+
+IPC_MESSAGE_ROUTED3(P2PHostMsg_CreateSocket,
+ P2PSocketType /* type */,
+ int /* socket_id */,
+ P2PSocketAddress /* remote_address */)
+
+// TODO(sergeyu): Use shared memory to pass the data.
+IPC_MESSAGE_ROUTED3(P2PHostMsg_Send,
+ int /* socket_id */,
+ P2PSocketAddress /* socket_address */,
+ std::vector<char> /* data */)
+
+IPC_MESSAGE_ROUTED1(P2PHostMsg_DestroySocket,
+ int /* socket_id */)
+
+namespace IPC {
+
+template <>
+struct ParamTraits<P2PSocketAddress> {
+ typedef P2PSocketAddress param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* p);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct SimilarTypeTraits<P2PSocketType> {
+ typedef int Type;
+};
+
+} // namespace IPC
+
+#endif // CONTENT_COMMON_P2P_MESSAGES_H_