共用方式為


2.2.57 UNC

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  
    ; IPv4address, and reg-name are as specified in [RFC3986], see following for IPV6
 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 IPv4address, and reg-name as specified in [RFC3986], or an IPV6 address. 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], an IPv4 address as specified in [RFC1123] section 2.1, or a string formed from the IPV6 address.

An IPV6 address host-name is formed by substituting hyphens for the colons and appending ".ipv6-literal.net". For example, the IPV6 address 2001:DB8:D87:FFFF:CCAA:132B:1:221B becomes 2001-DB8-D87-FFFF-CCAA-132B-1-221B.ipv6-literal.net.

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.