From 16f643323064b476d0d66a857b0048dacc8aa52e Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 30 Aug 2018 19:24:17 -0700 Subject: [PATCH] modules/console: Add net listen load and unload cmds. --- modules/console.cc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index c205f0ce5..3ba3323cf 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -2596,6 +2596,52 @@ console_cmd__net__listen(opt &out, const string_view &line) return true; } +bool +console_cmd__net__listen__load(opt &out, const string_view &line) +{ + using prototype = bool (const string_view &); + + static m::import load_listener + { + "s_listen", "load_listener" + }; + + const params params{line, " ", + { + "name", + }}; + + if(load_listener(params.at("name"))) + out << "loaded listener '" << params.at("name") << "'" << std::endl; + else + out << "failed to load listener '" << params.at("name") << "'" << std::endl; + + return true; +} + +bool +console_cmd__net__listen__unload(opt &out, const string_view &line) +{ + using prototype = bool (const string_view &); + + static m::import unload_listener + { + "s_listen", "unload_listener" + }; + + const params params{line, " ", + { + "name", + }}; + + if(unload_listener(params.at("name"))) + out << "unloaded listener '" << params.at("name") << "'" << std::endl; + else + out << "failed to unload listener '" << params.at("name") << "'" << std::endl; + + return true; +} + // // client //