A Universal Naming Convention (UNC) string is used to specify the location of resources such as shared files or devices.
For RPC implementations, this type is declared as follows:
typedef STRING UNC;
There are three UNC schemes based on namespace selectors: filespace selector, Win32API selector, and device selector. Only the filespace selector is parsed for on-wire traffic, the other two pass opaque BLOBs to the consuming entity. The filespace selector is a null-terminated Unicode character string in the following ABNF syntax:
UNC = "\\" host-name "\" share-name [ "\" object-name ] host-name = "[" IPv6address ']" / IPv4address / reg-name ; IPv6address, IPv4address, and reg-name as specified in [RFC3986] share-name = 1*80pchar pchar = %x20-21 / %x23-29 / %x2D-2E / %x30-39 / %x40-5A / %x5E-7B / %x7D-FF object-name = *path-name [ "\" file-name ] path-name = 1*255pchar file-name = 1*255fchar [ ":" stream-name [ ":" stream-type ] ] fchar = %x20-21 / %x23-29 / %x2B-2E / %x30-39 / %x3B / %x3D / %x40-5B / %x5D-7B / %x7D-FF stream-name = *schar schar = %x01-2E / %x30-39 / %x3B-5B /%x5D-FF stream-type = 1*schar
host-name: The host name of a server or the domain name of a domain hosting resource, using the syntax of IPv6address, IPv4address, and reg-name as specified in[RFC3986],. The host-name string MUST be a NetBIOS name as specified in [MS-NBTE] section 2.2.1, a fully qualified domain name (FQDN) as specified in [RFC1035] and [RFC1123], or an IPv4 address as specified in [RFC1123] section 2.1 or an IPv6 address as specified in [RFC4291] section 2.2.
share-name: The name of a share or a resource to be accessed. The format of this name depends on the actual file server protocol that is used to access the share. Examples of file server protocols include SMB (as specified in [MS-SMB]), NFS (as specified in [RFC3530]), and NCP (as specified in [NOVELL]).
object-name: The name of an object; this name depends on the actual resource accessed.
The notation "[\object-name]*" indicates that zero or more object names exist in the path, and each object-name is separated from the immediately preceding object-name with a backslash path separator. In a UNC path used to access files and directories in an SMB share, for example, object-name can be the name of a file or a directory. The host-name, share-name, and object-name are referred to as "pathname components" or "path components". A valid UNC path consists of two or more path components. The host-name is referred to as the "first pathname component", the share-name as the "second pathname component", and so on. The last component of the path is also referred to as the "leaf component". The protocol that is used to access the resource, and the type of resource that is being accessed, define the size and valid characters for a path component. The only limitations that a Distributed File System (DFS) places on path components are that they MUST be at least one character in length and MUST NOT contain a backslash or null.
path-name: One or more pathname components separated by the "\" backslash character. All pathname components other than the last pathname component denote directories or reparse points.
file-name: The "leaf component" of the path, optionally followed by a ":" colon character and a stream-name , optionally followed by a ":" colon character and a stream type. The stream-name, if specified, MAY be zero-length only if stream-type is also specified; otherwise, it MUST be at least one character. The stream-type, if specified, MUST be at least one character.