---
name: "libnvmf_tid_get_canonical-libnvme3"
section: "2"
platform: "linux"
package: "nvme-cli"
version: "3.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libnvmf_tid_get_canonical-libnvme3"
---

# libnvmf\_tid\_get\_canonical-libnvme3(2)

Return the canonical string form of a TID.

## NAME

libnvmf\_tid\_get\_canonical - Return the canonical string form of a TID.

## SYNOPSIS

**const char \* libnvmf\_tid\_get\_canonical** **(const struct libnvmf\_tid \*tid** *);*

## ARGUMENTS

- tid

  The transport ID.

## DESCRIPTION

Returns a deterministic, fixed-field-order semicolon-separated key=value string (e.g. "transport=tcp;traddr=1.2.3.4;trsvcid=8009").  Only non-NULL fields are included.  The string is lazily computed and cached; it is invalidated by any identity change.

The fixed field order makes the output independent of the order fields were set, so the same logical TID always yields the same canonical string. This is the stable primitive libnvme provides for naming a connection; a caller that wants a compact hash (e.g. for a systemd unit name) derives it from this string itself -- libnvme does not hash it.

The constructors store numeric addresses in one form: IPv6 is compressed, and an IPv4-mapped IPv6 address ("::ffff:1.2.3.4") becomes the IPv4 address ("1.2.3.4").  So two spellings of one numeric address yield the same canonical string.

## RETURN

Cached canonical string, or NULL on allocation failure.
