1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ipc_listensocket_h
8 #define mozilla_ipc_listensocket_h
11 #include "mozilla/ipc/SocketBase.h"
16 class ConnectionOrientedSocket
;
18 class UnixSocketConnector
;
20 class ListenSocket
: public SocketBase
23 virtual ~ListenSocket();
29 * Starts a task on the socket that will try to accept a new connection
30 * in a non-blocking manner.
32 * @param aConnector Connector object for socket-type-specific functions
33 * @param aCOSocket The connection-oriented socket for handling the
34 * accepted connection.
36 * @return true on listen started, false otherwise
38 bool Listen(UnixSocketConnector
* aConnector
,
39 ConnectionOrientedSocket
* aCOSocket
);
42 * Starts a task on the socket that will try to accept a new connection
43 * in a non-blocking manner. This method re-uses a previously created
46 * @param aCOSocket The connection-oriented socket for handling the
47 * accepted connection.
49 * @return true on listen started, false otherwise
51 bool Listen(ConnectionOrientedSocket
* aCOSocket
);
54 * Queues the internal representation of socket for deletion. Can be called
60 * Get the current sockaddr for the socket
62 void GetSocketAddr(nsAString
& aAddrStr
);
66 // Legacy interface from |SocketBase|; should be replaced by |Close|.
67 void CloseSocket() MOZ_OVERRIDE
76 } // namepsace mozilla
78 #endif // mozilla_ipc_listensocket_h