Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
protobuf_session_creator.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_
20 #define MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_
21 
23 #include "connected_sessions.h"
24 
25 #include <atomic>
26 
27 namespace mir
28 {
29 namespace frontend
30 {
31 class ProtobufIpcFactory;
32 class SessionAuthorizer;
33 
34 namespace detail
35 {
36 struct SocketSession;
37 }
38 
40 {
41 public:
43  std::shared_ptr<ProtobufIpcFactory> const& ipc_factory,
44  std::shared_ptr<SessionAuthorizer> const& session_authorizer);
45  ~ProtobufSessionCreator() noexcept;
46 
47  void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket);
48 
49 private:
50  int next_id();
51 
52  std::shared_ptr<ProtobufIpcFactory> const ipc_factory;
53  std::shared_ptr<SessionAuthorizer> const session_authorizer;
54  std::atomic<int> next_session_id;
55  std::shared_ptr<detail::ConnectedSessions<detail::SocketSession>> const connected_sessions;
56 };
57 }
58 }
59 
60 #endif /* MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013