ArnLib  4.0.x
Active Registry Network
ArnDiscoverConnect.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2022 Michael Wiklund.
2 // All rights reserved.
3 // Contact: arnlib@wiklunden.se
4 //
5 // This file is part of the ArnLib - Active Registry Network.
6 // Parts of ArnLib depend on Qt and/or other libraries that have their own
7 // licenses. Usage of these other libraries is subject to their respective
8 // license agreements.
9 //
10 // GNU Lesser General Public License Usage
11 // This file may be used under the terms of the GNU Lesser General Public
12 // License version 2.1 as published by the Free Software Foundation and
13 // appearing in the file LICENSE_LGPL.txt included in the packaging of this
14 // file. In addition, as a special exception, you may use the rights described
15 // in the Nokia Qt LGPL Exception version 1.1, included in the file
16 // LGPL_EXCEPTION.txt in this package.
17 //
18 // GNU General Public License Usage
19 // Alternatively, this file may be used under the terms of the GNU General Public
20 // License version 3.0 as published by the Free Software Foundation and appearing
21 // in the file LICENSE_GPL.txt included in the packaging of this file.
22 //
23 // Other Usage
24 // Alternatively, this file may be used in accordance with the terms and conditions
25 // contained in a signed written agreement between you and Michael Wiklund.
26 //
27 // This program is distributed in the hope that it will be useful, but WITHOUT ANY
28 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
29 // PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
30 //
31 
32 #ifndef ARNDISCOVERCONNECT_HPP
33 #define ARNDISCOVERCONNECT_HPP
34 
35 #include "ArnDiscover.hpp"
36 #include "ArnItem.hpp"
37 
38 class ArnDiscoverConnectorPrivate;
39 class ArnClient;
40 class QTimer;
41 class QTime;
42 
43 
45 
75 class ArnDiscoverConnector : public QObject
76 {
77  Q_OBJECT
78  Q_DECLARE_PRIVATE(ArnDiscoverConnector)
79 
80 public:
81  ArnDiscoverConnector( ArnClient& client, const QString& id);
83 
85 
89  void clearDirectHosts();
90 
92 
97  void addToDirectHosts( const QString& arnHost, quint16 port = 0);
98 
100 
106  void setResolver( ArnDiscoverResolver* resolver);
107 
109 
112  void start();
113 
115 
118  QString id() const;
119 
121 
124  QString service() const;
125 
127 
130  int directHostPrio() const;
131 
133 
140 
142 
145  int discoverHostPrio() const;
146 
148 
155 
157 
160  int resolveRefreshTimeout() const;
161 
163 
172 
174 
177  bool externalClientConnect() const;
178 
180 
190 
191 public slots:
193 
204  void setService( const QString& service);
205 
206 signals:
208 
219  void clientReadyToConnect( ArnClient* arnClient, const QString& id);
220 
222 protected:
223  ArnDiscoverConnector( ArnDiscoverConnectorPrivate& dd, QObject* parent,
224  ArnClient& client, const QString& id);
225  ArnDiscoverConnectorPrivate* const d_ptr;
227 
228 private slots:
229  void doClientConnectChanged( int stat, int curPrio);
230  void doClientConnectRequest( int reqCode);
232  void postSetupClient();
233  void doClientConnectChange( const QString& arnHost, quint16 port);
234  void doClientDirHostChanged();
236  void postSetupResolver();
237  void doClientServicetChanged();
238  void doClientResolvChanged( int index, ArnDiscoverInfo::State state);
239 
240 private:
241  void doClientReadyToConnect( ArnClient* arnClient, const QString& id);
242 };
243 
244 
245 #endif // ARNDISCOVERCONNECT_HPP
void clearDirectHosts()
Clear the direct host connection list.
int directHostPrio() const
Return the priority for direct hosts
int discoverHostPrio() const
Return the priority for discovered hosts
QString id() const
Return the identifier for this connector.
void setResolver(ArnDiscoverResolver *resolver)
Set the ArnDiscoverResolver to be used.
State of Arn discover browse data. Can be tested by relative order.
Definition: ArnDiscover.hpp:79
void clientReadyToConnect(ArnClient *arnClient, const QString &id)
Signal for external client connection.
void setService(const QString &service)
Set the service name for the connection.
void addToDirectHosts(const QString &arnHost, quint16 port=0)
Add an Arn Server to the direct host connection list.
QString service() const
Returns the service name for this connection.
bool externalClientConnect() const
Return the external client connect mode.
Class for connecting to an Arn Server.
Definition: ArnClient.hpp:104
void setDirectHostPrio(int directHostPrio)
Set the priority for direct hosts
An automatic client discover connector.
void setDiscoverHostPrio(int discoverHostPrio)
Set the priority for discovered hosts
void setResolveRefreshTimeout(int resolveRefreshTimeout)
Set the resolv refresh period.
void start()
Start connector.
int resolveRefreshTimeout() const
Return the resolv refresh period.
void setExternalClientConnect(bool externalClientConnect)
Set the external client connect mode.
Resolv an Arn service.
ArnDiscoverConnector(ArnClient &client, const QString &id)