Protocol.Dns.ResourceRecord (expcap v0.1.2) View Source

A parsed DNS resource record

Link to this section Summary

Functions

The dclass name of this packet

Prints rdata to a human readable string. Very few rr types are supported.

Reads an answer from the 'data' and returns a tuple of the resource record and remaining bytes.

Returns a list of the answers (resource records) in this section of the DNS packet. The section may be the answer, authoritative or additional sections, this code is generic so it doesn't care which section is being read.

Returns a list of the answers (resource records) in this section of the DNS packet. The section may be the answer, authoritative or additional sections, this code is generic so it doesn't care which section is being read.

Reads the 'len' number of bytes from the binary and returns a tuple of the bytes read the remaining bytes.

Returns the list of questions in the DNS packet and answer, authoritative and additional sections. Finally, the tuple returned contains the remaining bytes if there are any.

Reads a label (such as 'ns1.google.com'). It technically reads one label at a time and recurs until the end of the label is reached.

Reads a name from the data and returns a tuple of the name read and the reamining bytes that have not been read yet.

Reads a name (label or offset) from the data and returns a tuple with the name read and the remaining bytes not yet read.

Reads the offset position and then returns the label at the offset in the entire 'message'. Returns a tuple of the label read and the remaining bytes not yet read.

Reads a DNS question from the 'data'. Returns a tuple of the question and the remaining bytes.

Returns a tuple with the list of the questions in this DNS packet and a binary of the remaining bytes that have not yet been read.

Returns a tuple with the list of the questions in this DNS packet and a binary of the remaining bytes that have not yet been read.

The rr type

Link to this section Types

Specs

t() :: %Protocol.Dns.ResourceRecord{
  class: non_neg_integer(),
  name: String.t(),
  rdata: binary(),
  rdlen: non_neg_integer(),
  ttl: non_neg_integer(),
  type: non_neg_integer()
}

Link to this section Functions

Specs

class_name(non_neg_integer()) :: :IN | :CH | :""

The dclass name of this packet

Specs

rdata_string(binary()) :: String.t()

Prints rdata to a human readable string. Very few rr types are supported.

Link to this function

read_answer(message, data)

View Source

Specs

read_answer(binary(), binary()) :: {t(), binary()}

Reads an answer from the 'data' and returns a tuple of the resource record and remaining bytes.

Link to this function

read_answers(answer_count, message, data)

View Source

Specs

read_answers(non_neg_integer(), binary(), binary()) :: {[t()], binary()}

Returns a list of the answers (resource records) in this section of the DNS packet. The section may be the answer, authoritative or additional sections, this code is generic so it doesn't care which section is being read.

Link to this function

read_answers(answer_count, message, data, acc)

View Source

Specs

read_answers(0, binary(), binary(), list()) :: {[t()], binary()}
read_answers(non_neg_integer(), binary(), binary(), list()) :: {[t()], binary()}

Returns a list of the answers (resource records) in this section of the DNS packet. The section may be the answer, authoritative or additional sections, this code is generic so it doesn't care which section is being read.

Specs

read_bytes(binary(), non_neg_integer()) :: {binary(), binary()}

Reads the 'len' number of bytes from the binary and returns a tuple of the bytes read the remaining bytes.

Link to this function

read_dns(header, message, data)

View Source

Specs

read_dns(Protocol.Dns.Header.t(), binary(), binary()) ::
  {[Protocol.Dns.Question.t()], [t()], [t()], [t()], binary()}

Returns the list of questions in the DNS packet and answer, authoritative and additional sections. Finally, the tuple returned contains the remaining bytes if there are any.

Link to this function

read_label(message, data, acc, at_end)

View Source

Specs

read_label(binary(), binary(), list(), boolean()) :: {String.t(), binary()}

Reads a label (such as 'ns1.google.com'). It technically reads one label at a time and recurs until the end of the label is reached.

Link to this function

read_name(message, data)

View Source

Specs

read_name(binary(), binary()) :: {String.t(), binary()}

Reads a name from the data and returns a tuple of the name read and the reamining bytes that have not been read yet.

Link to this function

read_name(message, data, acc, at_end)

View Source

Specs

read_name(binary(), binary(), list(), boolean()) :: {String.t(), binary()}

Reads a name (label or offset) from the data and returns a tuple with the name read and the remaining bytes not yet read.

Link to this function

read_offset(message, data, acc)

View Source

Specs

read_offset(binary(), binary(), list()) :: {String.t(), binary()}

Reads the offset position and then returns the label at the offset in the entire 'message'. Returns a tuple of the label read and the remaining bytes not yet read.

Link to this function

read_question(message, data)

View Source

Specs

read_question(binary(), binary()) :: {Protocol.Dns.Question.t(), binary()}

Reads a DNS question from the 'data'. Returns a tuple of the question and the remaining bytes.

Link to this function

read_questions(question_count, message, data)

View Source

Specs

read_questions(non_neg_integer(), binary(), binary()) ::
  {[Protocol.Dns.Question.t()], binary()}

Returns a tuple with the list of the questions in this DNS packet and a binary of the remaining bytes that have not yet been read.

Link to this function

read_questions(question_count, message, data, acc)

View Source

Specs

read_questions(0, binary(), binary(), list()) ::
  {[Protocol.Dns.Question.t()], binary()}
read_questions(non_neg_integer(), binary(), binary(), list()) ::
  {[Protocol.Dns.Question.t()], binary()}

Returns a tuple with the list of the questions in this DNS packet and a binary of the remaining bytes that have not yet been read.

Specs

type_name(non_neg_integer()) :: :atom

The rr type