Torc  0.1
torcbonjourwindows.cpp
Go to the documentation of this file.
1 /* Class TorcBonjourWindows
2 *
3 * Copyright (C) Mark Kendall 2015-18
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 // Qt
21 #include <QMap>
22 
23 // Torc
24 #include "torclogging.h"
25 #include "torcbonjour.h"
26 
27 TorcBonjour* gBonjour = nullptr;
28 QMutex* gBonjourLock = new QMutex(QMutex::Recursive);
29 
31 {
32  QMutexLocker locker(gBonjourLock);
33  if (gBonjour)
34  return gBonjour;
35 
36  gBonjour = new TorcBonjour();
37  return gBonjour;
38 }
39 
41 {
42 }
43 
45 {
46  QMutexLocker locker(gBonjourLock);
47  delete gBonjour;
48  gBonjour = nullptr;
49 }
50 
51 QByteArray TorcBonjour::MapToTxtRecord(const QMap<QByteArray, QByteArray> &)
52 {
53  QByteArray result;
54  return result;
55 }
56 
57 QMap<QByteArray,QByteArray> TorcBonjour::TxtRecordToMap(const QByteArray &)
58 {
59  QMap<QByteArray,QByteArray> result;
60  return result;
61 }
62 
64  : m_suspended(false),
65  m_serviceLock(QMutex::Recursive),
66  m_services(),
67  m_discoveredLock(QMutex::Recursive),
68  m_discoveredServices()
69 {
70 }
71 
73 {
74 }
75 
76 quint32 TorcBonjour::Register(quint16, const QByteArray &, const QByteArray &,
77  const QMap<QByteArray, QByteArray> &, quint32)
78 {
79  return 0;
80 }
81 
82 quint32 TorcBonjour::Browse(const QByteArray &, quint32)
83 {
84  return 0;
85 }
86 
88 {
89 }
90 
92 {
93 }
94 
95 void TorcBonjour::HostLookup(const QHostInfo &)
96 {
97 }
98 
99 void TorcBonjour::SuspendPriv(bool)
100 {
101 }
102 
void Deregister(quint32 Reference)
Cancel a Bonjour service registration or browse request.
static QByteArray MapToTxtRecord(const QMap< QByteArray, QByteArray > &Map)
Serialises a QMap into a Bonjour Txt record format.
void socketReadyRead(int Socket)
Read from a socket.
quint32 Browse(const QByteArray &Type, quint32 Reference=0)
Search for a service advertised via Bonjour.
QMutex * gBonjourLock
Lock around access to gBonjour.
static QMap< QByteArray, QByteArray > TxtRecordToMap(const QByteArray &TxtRecord)
Extracts a QMap from a properly formatted Bonjour Txt record.
static void TearDown(void)
Destroys the global TorcBonjour singleton.
quint32 Register(quint16 Port, const QByteArray &Type, const QByteArray &Name, const QMap< QByteArray, QByteArray > &TxtRecords, quint32 Reference=0)
TorcBonjour * gBonjour
Global TorcBonjour singleton.
static TorcBonjour * Instance(void)
Returns the global TorcBonjour singleton.
Advertises and searches for services via Bonjour (aka Zero Configuration Networking/Avahi) ...
Definition: torcbonjour.h:65
static void Suspend(bool Suspend)
Suspends all Bonjour activities.