Module: Nesser
- Defined in:
- lib/nesser/logger.rb,
lib/nesser.rb,
lib/nesser/version.rb,
lib/nesser/transaction.rb,
lib/nesser/dns_exception.rb,
lib/nesser/packets/answer.rb,
lib/nesser/packets/packer.rb,
lib/nesser/packets/packet.rb,
lib/nesser/packets/question.rb,
lib/nesser/packets/rr_types.rb,
lib/nesser/packets/unpacker.rb,
lib/nesser/packets/constants.rb
Overview
constants.rb Created June 20, 2017 By Ron Bowes
See: LICENSE.md
A bunch of constants used with DNS - some of them for the protocol, others for error checking the outgoing messages.
Defined Under Namespace
Classes: A, AAAA, Answer, CNAME, DnsException, Logger, MX, NS, Nesser, PTR, Packer, Packet, Question, RRUnknown, SOA, TXT, Transaction, Unpacker
Constant Summary collapse
- VERSION =
"0.0.8"
- MAX_RECURSION_DEPTH =
Max recursion depth for parsing names
16
- LEGAL_CHARACTERS =
These restrictions are from RFC 952
( ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a + ['-', '.', '@', '_'] )
- MAX_SEGMENT_LENGTH =
63
- MAX_TOTAL_LENGTH =
253
- CLS_IN =
DNS classes - I only define IN (Internet) because I don’t even know what to do with others.
0x0001
- CLSES =
Internet
{ CLS_IN => "IN", }
- QR_QUERY =
Request / response
0x0000
- QR_RESPONSE =
0x0001
- QRS =
{ QR_QUERY => "QUERY", QR_RESPONSE => "RESPONSE", }
- RCODE_SUCCESS =
Return codes
0x0000
- RCODE_FORMAT_ERROR =
0x0001
- RCODE_SERVER_FAILURE =
:servfail
0x0002
- RCODE_NAME_ERROR =
:NXDomain
0x0003
- RCODE_NOT_IMPLEMENTED =
0x0004
- RCODE_REFUSED =
0x0005
- RCODES =
{ RCODE_SUCCESS => ":NoError (RCODE_SUCCESS)", RCODE_FORMAT_ERROR => ":FormErr (RCODE_FORMAT_ERROR)", RCODE_SERVER_FAILURE => ":ServFail (RCODE_SERVER_FAILURE)", RCODE_NAME_ERROR => ":NXDomain (RCODE_NAME_ERROR)", RCODE_NOT_IMPLEMENTED => ":NotImp (RCODE_NOT_IMPLEMENTED)", RCODE_REFUSED => ":Refused (RCODE_REFUSED)", }
- OPCODE_QUERY =
Opcodes - only QUERY is typically used
0x0000
- OPCODE_IQUERY =
0x0800
- OPCODE_STATUS =
0x1000
- OPCODES =
{ OPCODE_QUERY => "OPCODE_QUERY", OPCODE_IQUERY => "OPCODE_IQUERY", OPCODE_STATUS => "OPCODE_STATUS", }
- TYPE_A =
The types that we support
0x0001
- TYPE_NS =
0x0002
- TYPE_CNAME =
0x0005
- TYPE_SOA =
0x0006
- TYPE_PTR =
0x000c
- TYPE_MX =
0x000f
- TYPE_TXT =
0x0010
- TYPE_AAAA =
0x001c
- TYPE_ANY =
0x00FF
- TYPES =
{ TYPE_A => "A", TYPE_NS => "NS", TYPE_CNAME => "CNAME", TYPE_SOA => "SOA", TYPE_PTR => "PTR", TYPE_MX => "MX", TYPE_TXT => "TXT", TYPE_AAAA => "AAAA", TYPE_ANY => "ANY", }
- FLAG_AA =
The DNS flags
0x0008
- FLAG_TC =
Authoritative answer
0x0004
- FLAG_RD =
Truncated
0x0002
- FLAG_RA =
Recursion desired
0x0001
Class Method Summary collapse
-
.FLAGS(flags) ⇒ Object
This converts a set of flags, as an integer, into a string.
Class Method Details
.FLAGS(flags) ⇒ Object
This converts a set of flags, as an integer, into a string
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/nesser/packets/constants.rb', line 98 def self.FLAGS(flags) result = [] if((flags & FLAG_AA) == FLAG_AA) result << "AA" end if((flags & FLAG_TC) == FLAG_TC) result << "TC" end if((flags & FLAG_RD) == FLAG_RD) result << "RD" end if((flags & FLAG_RA) == FLAG_RA) result << "RA" end return result.join("|") end |