63 lines
2.0 KiB
C++
63 lines
2.0 KiB
C++
/*
|
|
PIP - Platform Independent Primitives
|
|
PICloud dispatcher
|
|
Andrey Bychkov work.a.b@yandex.ru, Ivan Pelipenko peri4ko@yandex.ru
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "pip.h"
|
|
#include "picrypt.h"
|
|
#include "dispatcherserver.h"
|
|
|
|
|
|
using namespace PICoutManipulators;
|
|
|
|
PIEthernet::Address addr = PIEthernet::Address("0.0.0.0", 10101);
|
|
|
|
void usage() {
|
|
piCout << Bold << "PIP Cloud Dispatcher";
|
|
piCout << Cyan << "Version" << Bold << PIPVersion() << NewLine;
|
|
piCout << Green << Bold << "Usage:" << Default << "\"picloud [-h] [-i <ip>] [-p <port>]\"" << NewLine;
|
|
piCout << Green << Bold << "Details:";
|
|
piCout << "-h --help " << Green << "- display this message and exit";
|
|
piCout << "-i --ip " << Green << "- listen address, default \"0.0.0.0\"";
|
|
piCout << "-p --port " << Green << "- listen port, default 10101";
|
|
}
|
|
|
|
|
|
int main (int argc, char * argv[]) {
|
|
PICrypt::hash("");
|
|
PICLI cli(argc, argv);
|
|
cli.addArgument("help");
|
|
cli.addArgument("ip", true);
|
|
cli.addArgument("port", true);
|
|
|
|
if (cli.hasArgument("help")) {
|
|
usage();
|
|
return 0;
|
|
}
|
|
if (cli.hasArgument("ip"))
|
|
addr.setIP(cli.argumentValue("ip"));
|
|
if (cli.hasArgument("port"))
|
|
addr.setPort(cli.argumentValue("port").toInt());
|
|
DispatcherServer server(addr);
|
|
PIKbdListener ls;
|
|
ls.enableExitCapture(PIKbdListener::F10);
|
|
ls.start();
|
|
WAIT_FOR_EXIT
|
|
return 0;
|
|
}
|
|
|