Repository navigation
Expand file tree
/
Copy pathDNSThread.h
More file actions
105 lines (91 loc) · 2.58 KB
/
Copy pathDNSThread.h
File metadata and controls
105 lines (91 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//-----------------------------------------------------------------------------
//
// DNSThread.h
//
// Async DNS Lookups
//
// Copyright (c) 2016 Justin Hammond <justin@dynam.ac>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave 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.
//
// OpenZWave 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 OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _DNSThread_H
#define _DNSThread_H
#include <string>
#include <map>
#include <list>
#include "Defs.h"
#include "Driver.h"
#include "platform/Event.h"
#include "platform/Mutex.h"
#include "platform/TimeStamp.h"
#include "platform/DNS.h"
namespace OpenZWave
{
namespace Internal
{
namespace Platform
{
class Event;
class Mutex;
class Thread;
}
enum LookupType
{
DNS_Lookup_ConfigRevision = 1
};
struct DNSLookup
{
uint8 NodeID;
string lookup;
string result;
Internal::Platform::DNSError status;
LookupType type;
};
/** \brief the DNSThread provides Async DNS lookups for checking revision numbers of
* Config Files against the official database
*/
class OPENZWAVE_EXPORT DNSThread
{
friend class OpenZWave::Driver;
private:
DNSThread(Driver *);
virtual ~DNSThread();
/**
* Entry point for DNSThread
*/
static void DNSThreadEntryPoint(Internal::Platform::Event* _exitEvent, void* _context);
/**
* DNSThreadProc for DNSThread. This is where all the "action" takes place.
*/
void DNSThreadProc(Internal::Platform::Event* _exitEvent);
/* submit a Request to the DNS List */
bool sendRequest(DNSLookup *);
/* process the most recent request recieved */
void processResult();
Driver* m_driver;
Internal::Platform::Mutex* m_dnsMutex;
list<DNSLookup *> m_dnslist;
list<DNSLookup *> m_dnslistinprogress;
Internal::Platform::Event* m_dnsRequestEvent;
Internal::Platform::DNS m_dnsresolver;
};
/* class DNSThread */
} // namespace Internal
} /* namespace OpenZWave */
#endif