MythTV master
portchecker.h
Go to the documentation of this file.
1
2// Copyright (c) 2017 MythTV Developers <mythtv-dev@mythtv.org>
3//
4// This is part of MythTV (https://www.mythtv.org)
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 2 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//
20// You should have received a copy of the GNU General Public License
21// along with this program. If not, see <http://www.gnu.org/licenses/>.
22//
24
25#ifndef PORTCHECKER_H_
26#define PORTCHECKER_H_
27
28#include <QObject>
29#include <QString>
30
31#include "mythbaseexp.h"
32#include "mythchrono.h"
33
44class MBASE_PUBLIC PortChecker : public QObject
45{
46 Q_OBJECT
47
48 public:
49 PortChecker() = default;
50 ~PortChecker() override = default;
51 bool checkPort(QString &host, int port, std::chrono::milliseconds timeLimit=30s,
52 bool linkLocalOnly=false);
53
54 static bool resolveLinkLocal(QString &host, int port,
55 std::chrono::milliseconds timeLimit=30s);
56
57 public slots:
58 void cancelPortCheck(void);
59
60 private:
61 bool m_cancelCheck {false};
62 static void processEvents(void);
63};
64
65#endif
66
67/* vim: set expandtab tabstop=4 shiftwidth=4: */
Small class to handle TCP port checking and finding link-local context.
Definition: portchecker.h:45
~PortChecker() override=default
PortChecker()=default
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15