---
name: "dnsjit.core.object.dns.label"
section: "3"
platform: "linux"
package: "dnsjit"
version: "1.5.0-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/dnsjit.core.object.dns.label"
---

# dnsjit.core.object.dns.label(3)

Container of a DNS label

## NAME

dnsjit.core.object.dns.label - Container of a DNS label

## DESCRIPTION

The object that describes a DNS label. To extract a domain name label first check that *have\_dn* is set, then use *offset + 1* to indicate where in the payload the label start and *length* for how many bytes long it is.

### Attributes

- is\_end

  - have\_length

  Set if there is a length.

- have\_offset

  Set if there is an offset.

- have\_extension\_bits

  Set if there is extension bits.

- have\_dn

  Set if the label contained a domain name.

- extension\_bits

  The extension bits.

- length

  The length of the domain name.

- offset

  If *have\_dn* is set then this contains the offset within the payload to where this label start otherwise it contains the offset to another label.

### Functions

- **Label.new**(size)

  Create a new array of labels.

- **Label.tostring**(dns, labels, num\_labels, offset\_labels)

  Returns labels as a string and an offset to the next label. Takes argument *labels*, an array of labels returned by any of the parse functions, and *num\_labels*, number of labels in the array. Optional *offset\_labels* can be used to skip labels at the start. The return string may be nil if the first label was an offset. The return offset may be nil if the last label was an extension bits or end marker.

- **Label.torfc1035**(dns, labels, num\_labels, offset\_labels)

  Returns a RFC1035 domain name of the labels and an offset to the next label. Takes argument *labels*, an array of labels returned by any of the parse functions, and *num\_labels*, number of labels in the array. Optional *offset\_labels* can be used to skip labels at the start. The return string may be nil if the first label was an offset. The return offset may be nil if the last label was an extension bits or end marker.

- **Label.tooffstr**(dns, labels, num\_labels, offset\_labels)

  Returns labels as a string which also includes a textual notation of the offset in the form of *\<offset\>label*. Takes argument *labels*, an array of labels returned by any of the parse functions, and *num\_labels*, number of labels in the array. Optional *offset\_labels* can be used to skip labels at the start.

## SEE ALSO

[**dnsjit.core.object.dns**(3)](/dnsjit.core.object.dns/3.md)

## AUTHORS and CONTRIBUTORS

Jerry Lundström (DNS-OARC), Tomáš Křížek (CZ.NIC), Petr Špaček (ISC)

Maintained by DNS-OARC

*https://www.dns-oarc.net/*

## BUGS

For issues and feature requests please use:

*https://github.com/DNS-OARC/dnsjit/issues*

For question and help please use:

*admin@dns-oarc.net*
