Bumping manifests a=b2g-bump
[gecko.git] / ipc / unixsocket / ListenSocket.h
blob3352b9430cff1e5d69d68076eb5e0fbbed0ddd20
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
10 #include "nsString.h"
11 #include "mozilla/ipc/SocketBase.h"
13 namespace mozilla {
14 namespace ipc {
16 class ConnectionOrientedSocket;
17 class ListenSocketIO;
18 class UnixSocketConnector;
20 class ListenSocket : public SocketBase
22 protected:
23 virtual ~ListenSocket();
25 public:
26 ListenSocket();
28 /**
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);
41 /**
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
44 * listen socket.
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);
53 /**
54 * Queues the internal representation of socket for deletion. Can be called
55 * from main thread.
57 void Close();
59 /**
60 * Get the current sockaddr for the socket
62 void GetSocketAddr(nsAString& aAddrStr);
64 private:
66 // Legacy interface from |SocketBase|; should be replaced by |Close|.
67 void CloseSocket() MOZ_OVERRIDE
69 Close();
72 ListenSocketIO* mIO;
75 } // namespace ipc
76 } // namepsace mozilla
78 #endif // mozilla_ipc_listensocket_h