OpenZWave Library: DNSThread.h Source File

| OpenZWave Library 1.6.0

DNSThread.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // DNSThread.h
4 //
5 // Async DNS Lookups
6 //
7 // Copyright (c) 2016 Justin Hammond <justin@dynam.ac>
8 //
9 // SOFTWARE NOTICE AND LICENSE
10 //
11 // This file is part of OpenZWave.
12 //
13 // OpenZWave is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU Lesser General Public License as published
15 // by the Free Software Foundation, either version 3 of the License,
16 // or (at your option) any later version.
17 //
18 // OpenZWave is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public License
24 // along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
25 //
26 //-----------------------------------------------------------------------------
27
28 #ifndef _DNSThread_H
29 #define _DNSThread_H
30
31 #include <string>
32 #include <map>
33 #include <list>
34
35 #include "Defs.h"
36 #include "Driver.h"
37 #include "platform/Event.h"
38 #include "platform/Mutex.h"
39 #include "platform/TimeStamp.h"
40 #include "platform/DNS.h"
41
42 namespace OpenZWave
43 {
44 class Event;
45 class Mutex;
46 class Controller;
47 class Thread;
48
49
50 enum LookupType {
51 DNS_Lookup_ConfigRevision = 1
52 };
53
54 struct DNSLookup {
55 uint8 NodeID;
56 string lookup;
57 string result;
58 DNSError status;
59 LookupType type;
60
61 };
62
63
67 class OPENZWAVE_EXPORT DNSThread
68 {
69 friend class Driver;
70 private:
71 DNSThread(Driver *);
72 virtual ~DNSThread();
73
77 static void DNSThreadEntryPoint( Event* _exitEvent, void* _context );
81 void DNSThreadProc( Event* _exitEvent );
82
83 /* submit a Request to the DNS List */
84 bool sendRequest(DNSLookup *);
85
86 /* process the most recent request recieved */
87 void processResult();
88
89 Driver* m_driver;
90 Mutex* m_dnsMutex;
91 list<DNSLookup *> m_dnslist;
92 list<DNSLookup *> m_dnslistinprogress;
93 Event* m_dnsRequestEvent;
94 DNS m_dnsresolver;
95
96
97 }; /* class DNSThread */
98 } /* namespace OpenZWave */
99
100
101 #endif
DNS.h
Driver.h
uint8
unsigned char uint8
Definition: Defs.h:89
OpenZWave::DNS
Implements platform-independent DNS lookup Operations.
Definition: DNS.h:57
OpenZWave::Mutex
Implements a platform-independent mutex–for serializing access to a shared resource.
Definition: Mutex.h:41
OpenZWave::DNSLookup::status
DNSError status
Definition: DNSThread.h:58
OpenZWave::DNSThread
the DNSThread provides Async DNS lookups for checking revision numbers of Config Files against the of...
Definition: DNSThread.h:68
Event.h
OpenZWave::LookupType
LookupType
Definition: DNSThread.h:50
OpenZWave::DNSLookup::lookup
string lookup
Definition: DNSThread.h:56
Mutex.h
OpenZWave::DNSLookup::NodeID
uint8 NodeID
Definition: DNSThread.h:55
OpenZWave::DNSLookup::type
LookupType type
Definition: DNSThread.h:59
OPENZWAVE_EXPORT
#define OPENZWAVE_EXPORT
Definition: Defs.h:51
OpenZWave::DNSLookup
Definition: DNSThread.h:54
OpenZWave::Driver
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:65
OpenZWave::DNS_Lookup_ConfigRevision
@ DNS_Lookup_ConfigRevision
Definition: DNSThread.h:51
OpenZWave::DNSError
DNSError
Return codes for DNS lookups.
Definition: DNS.h:45
OpenZWave::Event
Platform-independent definition of event objects.
Definition: Event.h:41
Defs.h
TimeStamp.h
OpenZWave
Definition: Bitfield.h:35
OpenZWave::DNSLookup::result
string result
Definition: DNSThread.h:57