dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / scd_in_connector.h
1 #ifndef SCD_IN_CONNECTOR_H
2 #define SCD_IN_CONNECTOR_H
3
4 #include "scd_socket.h"
5 #include "scd_sock_poller.h"
6 #include "scd_simulator.h"
7 #include "scd_command_reader.h"
8
9 /**
10  * Reads a command from a socket handled over by scd_init_listener
11  * and dispatches the connection to either the control or channel manager.
12  * This is used during the initialization phase.
13  */
14 class scd_in_connector : public scd_sock_ev_handler_if
15 {
16 public:
17     /**
18      * Constructor.
19      * \param sim the simulator
20      * \param sock the socket of the connection to read the command from
21      */
22     scd_in_connector(scd_simulator &sim, scd_socket* sock);
23
24     ~scd_in_connector();
25
26     /**
27      * Indicates if this in_connector is still reading the incomming command.
28      * It can be deconstructed when this indicates false.
29      * \return true if this in_connector is still working
30      */
31     bool is_connecting();
32
33     /* scd_sock_ev_handler_if */
34     void handle_sock_ev(sock_ev events);
35     const scd_socket& get_sock();
36
37 private:
38     scd_socket* _socket;
39     scd_simulator &_sim;
40     bool _is_connecting;
41     scd_command_reader _reader;
42
43     void _cleanup();
44 };
45
46 #endif