container-device-interfacetags.cncf.io/container-device-interface/pkg/parser Index | Files

package parser

import "tags.cncf.io/container-device-interface/pkg/parser"

Index

Functions

func IsAlphaNumeric

func IsAlphaNumeric(c rune) bool

IsAlphaNumeric reports whether the rune is a letter or digit.

func IsDigit

func IsDigit(c rune) bool

IsDigit reports whether the rune is a digit.

func IsLetter

func IsLetter(c rune) bool

IsLetter reports whether the rune is a letter.

func IsQualifiedName

func IsQualifiedName(device string) bool

IsQualifiedName tests if a device name is qualified.

func ParseDevice

func ParseDevice(device string) (string, string, string)

ParseDevice tries to split a device name into vendor, class, and name. If this fails, for instance in the case of unqualified device names, ParseDevice returns an empty vendor and class together with name set to the verbatim input.

func ParseQualifiedName

func ParseQualifiedName(device string) (string, string, string, error)

ParseQualifiedName splits a qualified name into device vendor, class, and name. If the device fails to parse as a qualified name, or if any of the split components fail to pass syntax validation, vendor and class are returned as empty, together with the verbatim input as the name and an error describing the reason for failure.

func ParseQualifier

func ParseQualifier(kind string) (string, string)

ParseQualifier splits a device qualifier into vendor and class. The syntax for a device qualifier is

"<vendor>/<class>"

If parsing fails, an empty vendor and the class set to the verbatim input is returned.

func QualifiedName

func QualifiedName(vendor, class, name string) string

QualifiedName returns the qualified name for a device. The syntax for a qualified device names is

"<vendor>/<class>=<name>".

A valid vendor and class name may contain the following runes:

'A'-'Z', 'a'-'z', '0'-'9', '.', '-', '_'.

A valid device name may contain the following runes:

'A'-'Z', 'a'-'z', '0'-'9', '-', '_', '.', ':'

func ValidateClassName

func ValidateClassName(class string) error

ValidateClassName checks the validity of class name. A class name may contain the following ASCII characters:

func ValidateDeviceName

func ValidateDeviceName(name string) error

ValidateDeviceName checks the validity of a device name. A device name may contain the following ASCII characters:

func ValidateVendorName

func ValidateVendorName(vendor string) error

ValidateVendorName checks the validity of a vendor name. A vendor name may contain the following ASCII characters:

Source Files

parser.go

Version
v1.0.1 (latest)
Published
Mar 22, 2025
Platform
js/wasm
Imports
2 packages
Last checked
now

Tools for package owners.