From: Tomek Mrugalski Date: Fri, 11 May 2012 12:43:22 +0000 (+0200) Subject: [1651] Support for shutdown command implemented. X-Git-Tag: trac2351_base~239 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77db6312d871bda380dade0f5312f9342f0de918;p=thirdparty%2Fkea.git [1651] Support for shutdown command implemented. --- diff --git a/src/bin/dhcp4/dhcp4.spec b/src/bin/dhcp4/dhcp4.spec index 8061fd2261..98df3a9cab 100644 --- a/src/bin/dhcp4/dhcp4.spec +++ b/src/bin/dhcp4/dhcp4.spec @@ -9,6 +9,12 @@ "item_default": "eth0" } ], - "commands": [] + "commands": [ + { + "command_name": "shutdown", + "command_description": "Shut down DHCPv4 server", + "command_args": [] + } + ] } } diff --git a/src/bin/dhcp4/main.cc b/src/bin/dhcp4/main.cc index bea06ae10f..cdd920c369 100644 --- a/src/bin/dhcp4/main.cc +++ b/src/bin/dhcp4/main.cc @@ -67,7 +67,7 @@ usage() { ConstElementPtr dhcp4_config_handler(ConstElementPtr new_config) { - cout << "#### dhcp4: Received new config:" << new_config->str() << endl; + cout << "b10-dhcp4: Received new config:" << new_config->str() << endl; ConstElementPtr answer = isc::config::createAnswer(0, "All good here. Thanks for sending config."); return (answer); @@ -75,7 +75,7 @@ dhcp4_config_handler(ConstElementPtr new_config) { ConstElementPtr dhcp4_command_handler(const string& command, ConstElementPtr args) { - cout << "#### dhcp4: Received new command: [" << command << "], args=" + cout << "b10-dhcp4: Received new command: [" << command << "], args=" << args->str() << endl; ConstElementPtr answer = isc::config::createAnswer(0, "All good here. Thanks for asking."); @@ -96,7 +96,7 @@ void establish_session() { specfile = string(DHCP4_SPECFILE_LOCATION); } - cout << "#### specfile=" << specfile << endl; + cout << "b10-dhcp4: my specfile is " << specfile << endl; IOService io_service; @@ -105,8 +105,14 @@ void establish_session() { config_session = new ModuleCCSession(specfile, *cc_session, dhcp4_config_handler, dhcp4_command_handler, false); + cout << "b10-dhcp4: hasQueuedMsgs()=" << config_session->hasQueuedMsgs() << endl; - cout << "#### hasQueuedMsgs()=" << config_session->hasQueuedMsgs() << endl; + config_session->start(); + cout << "b10-dhcp4: After session start." << endl; + + cout << "b10-dhcp4: About to call io_service.run()" << endl; + io_service.run(); + cout << "b10-dhcp4: Returned from io_service.run()" << endl; } int