1 #ifndef SCD_INIT_LISTENER_H
2 #define SCD_INIT_LISTENER_H
6 #include "scd_sock_poller.h"
7 #include "scd_socket.h"
8 #include "scd_simulator.h"
9 #include "scd_in_connector.h"
12 * Accepts incomming connection during initialization and instanciates
13 * a connector that handles the new connection.
15 class scd_init_listener : public scd_sock_ev_handler_if
19 * Constructor. Binds the listener to the specified TCP port on all
20 * available network interfaces.
21 * \param sim the simulator
22 * \param port TCP port to bind to
24 scd_init_listener(scd_simulator &sim, uint16_t port);
27 * Constructor. Binds the listener to the specified TCP port
28 * only on the specified network interface.
29 * \param sim the simulator
30 * \param host IP or domain name of the interface to bind to
31 * \param port TCP port to bind to
33 scd_init_listener(scd_simulator &sim,
34 const std::string &host, uint16_t port);
39 virtual ~scd_init_listener();
42 * Creates the listening socket.
43 * \exception scd_exception if unexpected errors occure
48 * Closes the listening socket.
53 * Removes connectors that finished their job. If the optional argument
54 * hard is true all connectors are destroyed independend if they
55 * have finished or not.
56 * \param hard if true all connectors will be destroyed
58 void cleanup(bool hard = false);
60 /* scd_sock_ev_handler_if */
61 void handle_sock_ev(sock_ev events);
62 const scd_socket& get_sock();
69 std::list<scd_in_connector*>_connectors;