Question.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * Question.h
8  *
9  ****/
10 
11 #pragma once
12 
13 #include <Data/LinkedObjectList.h>
14 #include "Name.h"
15 #include "Resource.h"
16 
17 namespace mDNS
18 {
19 class Message;
20 struct Packet;
21 
25 class Question : public LinkedObjectTemplate<Question>
26 {
27 public:
30 
31  Question(Message& message) : message(message)
32  {
33  }
34 
35  bool parse(Packet& pkt);
36 
40  Name getName() const
41  {
42  return Name(message, namePtr);
43  }
44 
49 
53  uint16_t getClass() const;
54 
58  bool isUnicastReply() const;
59 
61  {
62  return message;
63  }
64 
65  // Writing
66  uint16_t init(uint16_t namePtr, const String& name, ResourceType type, uint16_t qclass, bool unicast);
67 
68 private:
69  Message& message;
70  uint16_t namePtr;
71  uint16_t nameLen;
72 };
73 
74 } // namespace mDNS
Definition: LinkedObjectList.h:90
Base class template for linked items with type casting.
Definition: LinkedObject.h:62
The String class.
Definition: WString.h:137
Encapsulates a message packet for flexible introspection.
Definition: MDNS/src/include/Network/Mdns/Message.h:29
Encoded DNS name.
Definition: Name.h:38
A single mDNS Question.
Definition: Question.h:26
bool isUnicastReply() const
Whether reply should be unicast or multicast.
bool parse(Packet &pkt)
Question(Message &message)
Definition: Question.h:31
uint16_t init(uint16_t namePtr, const String &name, ResourceType type, uint16_t qclass, bool unicast)
uint16_t getClass() const
ResourceRecord Class: Normally the value 1 for Internet (“IN”)
Message & getMessage() const
Definition: Question.h:60
Name getName() const
Object, domain or zone name.
Definition: Question.h:40
Resource::Type getType() const
ResourceRecord type.
Type
Definition: Resource.h:41
Definition: Answer.h:18
Helper class for reading/writing packet content.
Definition: Packet.h:18