|
Async 1.8.0
|
A class for representing a SRV DNS resource record. More...
#include <AsyncDnsResourceRecord.h>
Public Types | |
| using | Prio = unsigned int |
| using | Weight = unsigned int |
| using | Port = unsigned int |
| using | Target = std::string |
Public Types inherited from Async::DnsResourceRecordCRTP< DnsResourceRecordSRV > | |
| using | List |
| The type for a list of resource records. | |
Public Types inherited from Async::DnsResourceRecord | |
| enum class | Type { ANY , A , PTR , CNAME , SRV , A , PTR , CNAME , SRV } |
| The record type. More... | |
| enum class | Class { IN , IN } |
| The record class. More... | |
| enum class | Type { ANY , A , PTR , CNAME , SRV , A , PTR , CNAME , SRV } |
| enum class | Class { IN , IN } |
| using | Name = std::string |
| using | Ttl = uint32_t |
| using | List = std::vector<std::unique_ptr<DnsResourceRecord>> |
| The type for a list of resource records. | |
Public Member Functions | |
| DnsResourceRecordSRV (const Name &name, Ttl ttl, Prio prio, Weight weight, Port port, const Target &target) | |
| Constructor. | |
| virtual bool | operator== (const DnsResourceRecordSRV &other) const |
| Equality comparison operator. | |
| virtual std::string | toString (void) const |
| The string representation of this record. | |
| void | setPrio (Prio prio) |
| Set the prio for this record. | |
| Prio | prio (void) const |
| The prio for this record. | |
| void | setWeight (Weight weight) |
| Set the weight for this record. | |
| Weight | weight (void) const |
| The weight for this record. | |
| void | setPort (Port port) |
| Set the network port for this record. | |
| Port | port (void) const |
| The network port for this record. | |
| void | setTarget (const Target &target) |
| Set the FQDN for this record. | |
| const Target & | target (void) const |
| The FQDN for this record. | |
| DnsResourceRecordSRV (const std::string &name, uint32_t ttl, unsigned int prio, unsigned int weight, unsigned int port, const std::string &target) | |
| ~DnsResourceRecordSRV (void) | |
| virtual const Type | type (void) const |
| The type of record. | |
| virtual std::string | toString (void) const |
| The string representation of this record. | |
| void | setPrio (unsigned int prio) |
| unsigned int | prio (void) const |
| void | setWeight (unsigned int weight) |
| unsigned int | weight (void) const |
| void | setPort (unsigned int port) |
| unsigned int | port (void) const |
| void | setTarget (const std::string &target) |
| const std::string & | target (void) const |
Public Member Functions inherited from Async::DnsResourceRecordCRTP< DnsResourceRecordSRV > | |
| DnsResourceRecordCRTP (const Name &name, Ttl ttl) | |
| Constructor. | |
| virtual DnsResourceRecord * | clone (void) const |
| Clone this class. | |
| virtual bool | operator== (const DnsResourceRecord &other) const |
| Equality comparison operator. | |
Public Member Functions inherited from Async::DnsResourceRecord | |
| DnsResourceRecord (const Name &name, Ttl ttl) | |
| Constructor. | |
| virtual | ~DnsResourceRecord (void) |
| Destructor. | |
| Class | classId (void) const |
| The DNS class for the record. | |
| const char * | classStr (void) const |
| The DNS class for the record as a string. | |
| const std::string & | typeStr (void) const |
| The type of record as a string. | |
| void | setName (const Name &name) |
| Set the name for this record. | |
| const Name & | name (void) const |
| The name of this record. | |
| void | setTtl (Ttl ttl) |
| Set the TTL for this record. | |
| Ttl | ttl (void) const |
| The TTL for this record. | |
| DnsResourceRecord (const std::string &name, uint32_t ttl) | |
| Default constructor. | |
| DnsResourceRecord (const DnsResourceRecord &)=delete | |
| Disallow copy construction. | |
| DnsResourceRecord & | operator= (const DnsResourceRecord &)=delete |
| Disallow copy assignment. | |
| virtual | ~DnsResourceRecord (void) |
| Destructor. | |
| Class | classId (void) const |
| A_brief_member_function_description. | |
| const char * | classStr (void) const |
| const std::string & | typeStr (void) const |
| void | setName (const std::string &name) |
| const std::string & | name (void) const |
| void | setTtl (uint32_t ttl) |
| uint32_t | ttl (void) const |
Static Public Member Functions | |
| static const Type | staticType (void) |
| The type for this specific class. | |
| static const Type | staticType (void) |
Static Public Member Functions inherited from Async::DnsResourceRecord | |
| static const Type | staticType (void) |
| The type for this specific class. | |
| static const std::string & | typeToString (Type type) |
| The type for this specific class represented as a string. | |
| static const std::string & | typeToString (Type type) |
Additional Inherited Members | |
Static Public Attributes inherited from Async::DnsResourceRecord | |
| static constexpr Ttl | MAX_TTL = 0x7fffffff |
| The maximum allowed value for a TTL. | |
A class for representing a SRV DNS resource record.
This class represents an SRV DNS resource record. One or more resource records is the result of performing a DNS query. This specific resource record maps a service name to information for that service.
This is one of the more advanced resource record types. A query for this type of resource record often return multiple entries. Each entry contain information about priority, weight, port and target.
Priority: The priority of the target host, lower value means more preferred. Weight: A relative weight for records with the same priority, higher value means higher chance of getting picked. Port: the TCP or UDP port on which the service is to be found. Target: the canonical hostname of the machine providing the service, ending in a dot.
An example of SRV records in textual form that might be found in a zone file might be the following:
_sip._tcp.example.com. 86400 IN SRV 0 60 5060 sipserver1.example.com. _sip._tcp.example.com. 86400 IN SRV 0 40 5060 sipserver2.example.com. _sip._tcp.example.com. 86400 IN SRV 1 100 5061 sipserver-backup.example.com.
The client should choose sipserver1 or sipserver2 first. Sipserver1 should be chosen 60% of the time and sipserver2 should be chosen 40% of the time. If none of the two first servers are reachable the client should try to connect to sipserver-backup.
Definition at line 275 of file AsyncResourceRecord.h.
| using Async::DnsResourceRecordSRV::Port = unsigned int |
Definition at line 585 of file AsyncDnsResourceRecord.h.
| using Async::DnsResourceRecordSRV::Prio = unsigned int |
Definition at line 583 of file AsyncDnsResourceRecord.h.
| using Async::DnsResourceRecordSRV::Target = std::string |
Definition at line 586 of file AsyncDnsResourceRecord.h.
| using Async::DnsResourceRecordSRV::Weight = unsigned int |
Definition at line 584 of file AsyncDnsResourceRecord.h.
|
inline |
Constructor.
| name | The name of this record |
| ttl | The time-to-live, in seconds, for this record |
| prio | The priority for this record |
| weight | The weight for this record |
| port | The network port for this record |
| target | The FQDN associaated with this record name |
Definition at line 602 of file AsyncDnsResourceRecord.h.
|
inline |
Definition at line 280 of file AsyncResourceRecord.h.
|
inline |
Definition at line 285 of file AsyncResourceRecord.h.
|
inlinevirtual |
Equality comparison operator.
| other | The other resource record to comapare to |
NOTE: The TTL is not used in the comparison.
Implements Async::DnsResourceRecordCRTP< DnsResourceRecordSRV >.
Definition at line 614 of file AsyncDnsResourceRecord.h.
References Async::DnsResourceRecord::operator==(), port(), prio(), target(), and weight().
|
inline |
The network port for this record.
Definition at line 669 of file AsyncDnsResourceRecord.h.
Referenced by operator==(), setPort(), setPort(), and toString().
|
inline |
Definition at line 303 of file AsyncResourceRecord.h.
|
inline |
The prio for this record.
Definition at line 645 of file AsyncDnsResourceRecord.h.
Referenced by operator==(), setPrio(), setPrio(), and toString().
|
inline |
Definition at line 297 of file AsyncResourceRecord.h.
|
inline |
Set the network port for this record.
| port | The new network port number |
Definition at line 663 of file AsyncDnsResourceRecord.h.
References port().
|
inline |
Definition at line 302 of file AsyncResourceRecord.h.
References port().
|
inline |
Set the prio for this record.
| prio | The new priority for this record (lower mean higher prio) |
Definition at line 639 of file AsyncDnsResourceRecord.h.
References prio().
|
inline |
Definition at line 296 of file AsyncResourceRecord.h.
References prio().
|
inline |
Definition at line 305 of file AsyncResourceRecord.h.
References target().
|
inline |
Set the FQDN for this record.
| target | The new FQDN for this record |
Definition at line 675 of file AsyncDnsResourceRecord.h.
References target().
|
inline |
Definition at line 299 of file AsyncResourceRecord.h.
References weight().
|
inline |
Set the weight for this record.
| weight | The new weight for this record |
Definition at line 651 of file AsyncDnsResourceRecord.h.
References weight().
|
inlinestatic |
The type for this specific class.
Definition at line 591 of file AsyncDnsResourceRecord.h.
References Async::DnsResourceRecord::SRV.
Referenced by type().
|
inlinestatic |
Definition at line 278 of file AsyncResourceRecord.h.
References Async::DnsResourceRecord::SRV.
|
inline |
The FQDN for this record.
Definition at line 681 of file AsyncDnsResourceRecord.h.
Referenced by operator==(), setTarget(), setTarget(), and toString().
|
inline |
Definition at line 306 of file AsyncResourceRecord.h.
|
inlinevirtual |
The string representation of this record.
Reimplemented from Async::DnsResourceRecord.
Definition at line 627 of file AsyncDnsResourceRecord.h.
References port(), prio(), target(), Async::DnsResourceRecord::toString(), and weight().
|
inlinevirtual |
The string representation of this record.
Reimplemented from Async::DnsResourceRecord.
Definition at line 288 of file AsyncResourceRecord.h.
References port(), prio(), target(), Async::DnsResourceRecord::toString(), and weight().
|
inlinevirtual |
The type of record.
Reimplemented from Async::DnsResourceRecordCRTP< DnsResourceRecordSRV >.
Definition at line 287 of file AsyncResourceRecord.h.
References staticType().
|
inline |
The weight for this record.
Definition at line 657 of file AsyncDnsResourceRecord.h.
Referenced by operator==(), setWeight(), setWeight(), and toString().
|
inline |
Definition at line 300 of file AsyncResourceRecord.h.