diff options
Diffstat (limited to 'Swiften/Examples/LinkLocalTool/main.cpp')
-rw-r--r-- | Swiften/Examples/LinkLocalTool/main.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/Swiften/Examples/LinkLocalTool/main.cpp b/Swiften/Examples/LinkLocalTool/main.cpp index 4f87810..a853f0e 100644 --- a/Swiften/Examples/LinkLocalTool/main.cpp +++ b/Swiften/Examples/LinkLocalTool/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -9,41 +9,41 @@ #include <iostream> #include <Swiften/EventLoop/SimpleEventLoop.h> -#include <Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h> -#include <Swiften/LinkLocal/DNSSD/DNSSDQuerier.h> #include <Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h> +#include <Swiften/LinkLocal/DNSSD/DNSSDQuerier.h> #include <Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h> +#include <Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h> using namespace Swift; int main(int argc, char* argv[]) { - if (argc < 2) { - std::cerr << "Invalid parameters" << std::endl; - return -1; - } - - SimpleEventLoop eventLoop; - PlatformDNSSDQuerierFactory factory(&eventLoop); - boost::shared_ptr<DNSSDQuerier> querier = factory.createQuerier(); - querier->start(); - - if (std::string(argv[1]) == "browse") { - boost::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); - browseQuery->startBrowsing(); - eventLoop.run(); - browseQuery->stopBrowsing(); - } - else if (std::string(argv[1]) == "resolve-service") { - if (argc < 5) { - std::cerr << "Invalid parameters" << std::endl; - return -1; - } - boost::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(DNSSDServiceID(argv[2], argv[3], argv[4])); - resolveQuery->start(); - eventLoop.run(); - std::cerr << "Done running" << std::endl; - resolveQuery->stop(); - } - - querier->stop(); + if (argc < 2) { + std::cerr << "Invalid parameters" << std::endl; + return -1; + } + + SimpleEventLoop eventLoop; + PlatformDNSSDQuerierFactory factory(&eventLoop); + std::shared_ptr<DNSSDQuerier> querier = factory.createQuerier(); + querier->start(); + + if (std::string(argv[1]) == "browse") { + std::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); + browseQuery->startBrowsing(); + eventLoop.run(); + browseQuery->stopBrowsing(); + } + else if (std::string(argv[1]) == "resolve-service") { + if (argc < 5) { + std::cerr << "Invalid parameters" << std::endl; + return -1; + } + std::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(DNSSDServiceID(argv[2], argv[3], argv[4])); + resolveQuery->start(); + eventLoop.run(); + std::cerr << "Done running" << std::endl; + resolveQuery->stop(); + } + + querier->stop(); } |