aboutsummaryrefslogtreecommitdiff
path: root/mojo/edk/embedder/named_platform_handle_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/edk/embedder/named_platform_handle_utils.h')
-rw-r--r--mojo/edk/embedder/named_platform_handle_utils.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/mojo/edk/embedder/named_platform_handle_utils.h b/mojo/edk/embedder/named_platform_handle_utils.h
new file mode 100644
index 0000000..b767ea0
--- /dev/null
+++ b/mojo/edk/embedder/named_platform_handle_utils.h
@@ -0,0 +1,56 @@
+// Copyright 2016 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 MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_
+#define MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_
+
+#include "build/build_config.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+#if defined(OS_WIN)
+#include "base/strings/string16.h"
+#endif
+
+namespace mojo {
+namespace edk {
+
+struct NamedPlatformHandle;
+
+#if defined(OS_POSIX)
+
+// The maximum length of the name of a unix domain socket. The standard size on
+// linux is 108, mac is 104. To maintain consistency across platforms we
+// standardize on the smaller value.
+const size_t kMaxSocketNameLength = 104;
+
+#endif
+
+struct CreateServerHandleOptions {
+#if defined(OS_WIN)
+ // If true, creating a server handle will fail if another pipe with the same
+ // name exists.
+ bool enforce_uniqueness = true;
+
+ // If non-empty, a security descriptor to use when creating the pipe. If
+ // empty, a default security descriptor will be used. See
+ // kDefaultSecurityDescriptor in named_platform_handle_utils_win.cc.
+ base::string16 security_descriptor;
+#endif
+};
+
+// Creates a client platform handle from |handle|. This may block until |handle|
+// is ready to receive connections.
+MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle
+CreateClientHandle(const NamedPlatformHandle& handle);
+
+// Creates a server platform handle from |handle|.
+MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle
+CreateServerHandle(const NamedPlatformHandle& handle,
+ const CreateServerHandleOptions& options = {});
+
+} // namespace edk
+} // namespace mojo
+
+#endif // MOJO_EDK_EMBEDDER_NAMED_PLATFORM_HANDLE_UTILS_H_