wiki:Doc/panc/stdtpl/types

Version 3 (modified by /O=GRID-FR/C=FR/O=CNRS/OU=LAL/CN=Charles Loomis, 16 years ago) (diff)

--

pan/types Template

Machine configuration often need type definitions for things like host names, URLs, port numbers and the like. These occur in most machine configuration and the associated type definitions have been provided in the 'pan/types' template. You can use these types by including this template in your machine configuraton:

  include { 'pan/types' };

Each of the defined types has an associated validation function that can be used in the construction of other types. The sections below give the name of the type and the associated validation function.

Date-Related Types

type_asndate, is_asndate(string)

This type implements a date/time format consistent with ASN.1 typically used by LDAP. The actual specification is the "GeneralizedTime" format as specified on page 38 of the X.208 ITU-T recommendation and references within. Examples include:

20040825120123Z
20040825120123+0100
20040825120123,5
20040825120123.5
20040825120123.5-0123

type_isodate, is_isodate(string)

This type implements a date/time format consistent with the W3C use of the datetime format. (See the document][http://www.w3.org/TR/NOTE-datetime?.) This is a subset of the ISO8601 specification. This type allows a short form with just a complete date or a full date/time. For the time (if given) only the fractions of a second field is optional. Examples include:

2004-08-25
2004-08-25T12:32:00.01+05:00
2004-08-25T12:32:00Z

Network-Related Types

type_hwaddr, is_hwaddr(string)

The hardware address is a series of six bytes encoded as hex values and separated with a colon or a hyphen. Within a value you must use a consistent separator. Both upper and lower-case hex digits are accepted. Examples:

00:D0:59:33:F6:30
00-D0-59-33-F6-30

type_ipv4, is_ipv4(string)

IPv4 address in dotted-decimal notation. Examples:

127.0.0.1
208.77.188.166

type_ipv6, is_ipv6(string)

IPv6 address in usual notation with colon-separated fields.

type_ip, is_ip(string)

A value that is either a valid IPv4 or IPv6 network address.

Hostname-Related Types

type_fqdn, is_fqdn(string)

A fully-qualified domain name. Each part of the domain name is separated by a period. The individual parts must begin with a letter or digit, end with a letter or digit, and may contain letters, digits, or hyphens in the middle. The relevant RFC's for host name syntax are 952, 1053, and 1123 (section 2.1).

type_hostname, is_hostname(string)

Values that are either a valid raw IP address (v4 or v6) or a fully-qualified domain name.

type_shorthostname, is_shorthostname(string)

A string that is a valid name for a host and that does not contain the domain.

type_port, is_port(long)

A long value that is a valid port number (i.e. in the range [0, 65535]).

type_hostport, is_hostport(string)

A value of the form "hostname:port". The individual component are verified to be also correct.