HDLC-Daemon
HdlcdServerHandlerCollection.h
Go to the documentation of this file.
1 
22 #ifndef HDLCD_SERVER_HANDLER_COLLECTION_H
23 #define HDLCD_SERVER_HANDLER_COLLECTION_H
24 
25 #include <memory>
26 #include <list>
27 #include <boost/asio.hpp>
29 class HdlcdServerHandler;
30 
31 class HdlcdServerHandlerCollection: public std::enable_shared_from_this<HdlcdServerHandlerCollection> {
32 public:
33  // CTOR and resetter
34  HdlcdServerHandlerCollection(boost::asio::io_service& a_IOService, std::shared_ptr<SerialPortHandlerCollection> a_SerialPortHandlerCollection, uint16_t a_TcpPortNbr);
35  void Shutdown();
36 
37  // Self-registering and -deregistering of HDLCd server handler objects
38  void RegisterHdlcdServerHandler (std::shared_ptr<HdlcdServerHandler> a_HdlcdServerHandler);
39  void DeregisterHdlcdServerHandler(std::shared_ptr<HdlcdServerHandler> a_HdlcdServerHandler);
40 
41 private:
42  // Internal helpers
43  void DoAccept();
44 
45  // Members
46  boost::asio::io_service& m_IOService;
47  std::shared_ptr<SerialPortHandlerCollection> m_SerialPortHandlerCollection;
48  std::list<std::shared_ptr<HdlcdServerHandler>> m_HdlcdServerHandlerList;
49 
50  // Accept incoming TCP connections
51  boost::asio::ip::tcp::tcp::acceptor m_TcpAcceptor;
52  boost::asio::ip::tcp::tcp::socket m_TcpSocket;
53 };
54 
55 #endif // HDLCD_SERVER_HANDLER_COLLECTION_H
HdlcdServerHandlerCollection(boost::asio::io_service &a_IOService, std::shared_ptr< SerialPortHandlerCollection > a_SerialPortHandlerCollection, uint16_t a_TcpPortNbr)
void RegisterHdlcdServerHandler(std::shared_ptr< HdlcdServerHandler > a_HdlcdServerHandler)
void DeregisterHdlcdServerHandler(std::shared_ptr< HdlcdServerHandler > a_HdlcdServerHandler)