| Index: net/socket/unix_domain_socket_posix.h
|
| diff --git a/net/socket/unix_domain_socket_posix.h b/net/socket/unix_domain_socket_posix.h
|
| index 98d0c11a6487b828214fc38eb8781537025866c4..aa38e1ed7e113643c63e2b681c461968e40102ec 100644
|
| --- a/net/socket/unix_domain_socket_posix.h
|
| +++ b/net/socket/unix_domain_socket_posix.h
|
| @@ -2,17 +2,19 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef NET_SOCKET_UNIX_DOMAIN_SOCKET_POSIX_H_
|
| -#define NET_SOCKET_UNIX_DOMAIN_SOCKET_POSIX_H_
|
| +#ifndef NET_SOCKET_UNIX_DOMAIN_LISTEN_SOCKET_POSIX_H_
|
| +#define NET_SOCKET_UNIX_DOMAIN_LISTEN_SOCKET_POSIX_H_
|
|
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| #include "base/callback_forward.h"
|
| #include "base/compiler_specific.h"
|
| +#include "base/macros.h"
|
| #include "build/build_config.h"
|
| #include "net/base/net_export.h"
|
| #include "net/socket/stream_listen_socket.h"
|
| +#include "net/socket/unix_domain_server_socket_posix.h"
|
|
|
| #if defined(OS_ANDROID) || defined(OS_LINUX)
|
| // Feature only supported on Linux currently. This lets the Unix Domain Socket
|
| @@ -23,23 +25,15 @@
|
| namespace net {
|
|
|
| // Unix Domain Socket Implementation. Supports abstract namespaces on Linux.
|
| -class NET_EXPORT UnixDomainSocket : public StreamListenSocket {
|
| +class NET_EXPORT UnixDomainListenSocket : public StreamListenSocket {
|
| public:
|
| - virtual ~UnixDomainSocket();
|
| + typedef UnixDomainServerSocket::AuthCallback AuthCallback;
|
|
|
| - // Callback that returns whether the already connected client, identified by
|
| - // its process |user_id| and |group_id|, is allowed to keep the connection
|
| - // open. Note that the socket is closed immediately in case the callback
|
| - // returns false.
|
| - typedef base::Callback<bool (uid_t user_id, gid_t group_id)> AuthCallback;
|
| + virtual ~UnixDomainListenSocket();
|
|
|
| - // Returns an authentication callback that always grants access for
|
| - // convenience in case you don't want to use authentication.
|
| - static AuthCallback NoAuthentication();
|
| -
|
| - // Note that the returned UnixDomainSocket instance does not take ownership of
|
| - // |del|.
|
| - static scoped_ptr<UnixDomainSocket> CreateAndListen(
|
| + // Note that the returned UnixDomainListenSocket instance does not take
|
| + // ownership of |del|.
|
| + static scoped_ptr<UnixDomainListenSocket> CreateAndListen(
|
| const std::string& path,
|
| StreamListenSocket::Delegate* del,
|
| const AuthCallback& auth_callback);
|
| @@ -48,7 +42,8 @@ class NET_EXPORT UnixDomainSocket : public StreamListenSocket {
|
| // Same as above except that the created socket uses the abstract namespace
|
| // which is a Linux-only feature. If |fallback_path| is not empty,
|
| // make the second attempt with the provided fallback name.
|
| - static scoped_ptr<UnixDomainSocket> CreateAndListenWithAbstractNamespace(
|
| + static scoped_ptr<UnixDomainListenSocket>
|
| + CreateAndListenWithAbstractNamespace(
|
| const std::string& path,
|
| const std::string& fallback_path,
|
| StreamListenSocket::Delegate* del,
|
| @@ -56,35 +51,34 @@ class NET_EXPORT UnixDomainSocket : public StreamListenSocket {
|
| #endif
|
|
|
| private:
|
| - UnixDomainSocket(SocketDescriptor s,
|
| - StreamListenSocket::Delegate* del,
|
| - const AuthCallback& auth_callback);
|
| + UnixDomainListenSocket(SocketDescriptor s,
|
| + StreamListenSocket::Delegate* del,
|
| + const AuthCallback& auth_callback);
|
|
|
| - static scoped_ptr<UnixDomainSocket> CreateAndListenInternal(
|
| + static scoped_ptr<UnixDomainListenSocket> CreateAndListenInternal(
|
| const std::string& path,
|
| const std::string& fallback_path,
|
| StreamListenSocket::Delegate* del,
|
| const AuthCallback& auth_callback,
|
| bool use_abstract_namespace);
|
|
|
| - static SocketDescriptor CreateAndBind(const std::string& path,
|
| - bool use_abstract_namespace);
|
| -
|
| // StreamListenSocket:
|
| virtual void Accept() OVERRIDE;
|
|
|
| AuthCallback auth_callback_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(UnixDomainSocket);
|
| + DISALLOW_COPY_AND_ASSIGN(UnixDomainListenSocket);
|
| };
|
|
|
| -// Factory that can be used to instantiate UnixDomainSocket.
|
| -class NET_EXPORT UnixDomainSocketFactory : public StreamListenSocketFactory {
|
| +// Factory that can be used to instantiate UnixDomainListenSocket.
|
| +class NET_EXPORT UnixDomainListenSocketFactory
|
| + : public StreamListenSocketFactory {
|
| public:
|
| // Note that this class does not take ownership of the provided delegate.
|
| - UnixDomainSocketFactory(const std::string& path,
|
| - const UnixDomainSocket::AuthCallback& auth_callback);
|
| - virtual ~UnixDomainSocketFactory();
|
| + UnixDomainListenSocketFactory(
|
| + const std::string& path,
|
| + const UnixDomainListenSocket::AuthCallback& auth_callback);
|
| + virtual ~UnixDomainListenSocketFactory();
|
|
|
| // StreamListenSocketFactory:
|
| virtual scoped_ptr<StreamListenSocket> CreateAndListen(
|
| @@ -92,35 +86,35 @@ class NET_EXPORT UnixDomainSocketFactory : public StreamListenSocketFactory {
|
|
|
| protected:
|
| const std::string path_;
|
| - const UnixDomainSocket::AuthCallback auth_callback_;
|
| + const UnixDomainListenSocket::AuthCallback auth_callback_;
|
|
|
| private:
|
| - DISALLOW_COPY_AND_ASSIGN(UnixDomainSocketFactory);
|
| + DISALLOW_COPY_AND_ASSIGN(UnixDomainListenSocketFactory);
|
| };
|
|
|
| #if defined(SOCKET_ABSTRACT_NAMESPACE_SUPPORTED)
|
| -// Use this factory to instantiate UnixDomainSocket using the abstract
|
| +// Use this factory to instantiate UnixDomainListenSocket using the abstract
|
| // namespace feature (only supported on Linux).
|
| -class NET_EXPORT UnixDomainSocketWithAbstractNamespaceFactory
|
| - : public UnixDomainSocketFactory {
|
| +class NET_EXPORT UnixDomainListenSocketWithAbstractNamespaceFactory
|
| + : public UnixDomainListenSocketFactory {
|
| public:
|
| - UnixDomainSocketWithAbstractNamespaceFactory(
|
| + UnixDomainListenSocketWithAbstractNamespaceFactory(
|
| const std::string& path,
|
| const std::string& fallback_path,
|
| - const UnixDomainSocket::AuthCallback& auth_callback);
|
| - virtual ~UnixDomainSocketWithAbstractNamespaceFactory();
|
| + const UnixDomainListenSocket::AuthCallback& auth_callback);
|
| + virtual ~UnixDomainListenSocketWithAbstractNamespaceFactory();
|
|
|
| - // UnixDomainSocketFactory:
|
| + // UnixDomainListenSocketFactory:
|
| virtual scoped_ptr<StreamListenSocket> CreateAndListen(
|
| StreamListenSocket::Delegate* delegate) const OVERRIDE;
|
|
|
| private:
|
| std::string fallback_path_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(UnixDomainSocketWithAbstractNamespaceFactory);
|
| + DISALLOW_COPY_AND_ASSIGN(UnixDomainListenSocketWithAbstractNamespaceFactory);
|
| };
|
| #endif
|
|
|
| } // namespace net
|
|
|
| -#endif // NET_SOCKET_UNIX_DOMAIN_SOCKET_POSIX_H_
|
| +#endif // NET_SOCKET_UNIX_DOMAIN_LISTEN_SOCKET_POSIX_H_
|
|
|