|  | // Copyright 2022 The Fuchsia Authors. All rights reserved. | 
|  | // Use of this source code is governed by a BSD-style license that can be | 
|  | // found in the LICENSE file. | 
|  |  | 
|  | library fuchsia.net.mdns; | 
|  |  | 
|  | using fuchsia.net; | 
|  |  | 
|  | /// Identifies a host. Host names consist of one or more labels separated by | 
|  | /// '.'s. A host name must not end with a '.'. Labels must each be 63 characters | 
|  | /// or less (not including the separator) and are UTF-8-encoded. A complete host | 
|  | /// name, including separators, must be 255 characters or less. | 
|  | alias host_name = string:255; | 
|  |  | 
|  | /// Identifies a (type of) service being published. Service names consist of | 
|  | /// two labels, both terminated with a '.'. The first label must start with an | 
|  | /// underscore and be 16 characters or less, including the underscore. The | 
|  | /// second label must be either '_tcp' or '_udp'. Labels do not contain '.'s. | 
|  | /// With underscores and terminators, that makes for a maximum of 22 characters. | 
|  | /// Service names are UTF-8-encoded. | 
|  | alias service_name = string:22; | 
|  |  | 
|  | /// Identifies a specific instance of a service being published. Instance names | 
|  | /// consist of a single label, which is at most 63 characters long and which | 
|  | /// contains no '.'s. Instance names are UTF-8-encoded. | 
|  | alias instance_name = string:63; | 
|  |  | 
|  | /// Identifies a subtype of a service. Subtype names consist of a single label, | 
|  | /// which is at most 63 characters long and which contains no '.'s. Subtype | 
|  | /// names are UTF-8-encoded. | 
|  | alias subtype_name = string:63; | 
|  |  | 
|  | /// Provides description relating to a service instance. In typical use, TXT | 
|  | /// strings consist of a key and value separated by '='. TXT strings must be | 
|  | /// at most 255 characters long and are UTF-8-encoded. | 
|  | @available(added=9) | 
|  | alias txt_character_string = vector<uint8>:255; | 
|  |  | 
|  | /// Specifies network media on which a service instance should be published. | 
|  | type Media = strict bits : uint32 { | 
|  | /// Specifies wired interfaces. | 
|  | WIRED = 1; | 
|  |  | 
|  | /// Specifies wireless interfaces. | 
|  | WIRELESS = 2; | 
|  | }; | 
|  |  | 
|  | /// Specifies IP versions on which a service instance should be published. | 
|  | type IpVersions = strict bits : uint32 { | 
|  | /// Specifies IPv4. | 
|  | V4 = 1; | 
|  |  | 
|  | /// Specifies IPv6. | 
|  | V6 = 2; | 
|  | }; | 
|  |  | 
|  | /// Describes a service instance. | 
|  | type ServiceInstance = table { | 
|  | /// The name of the service. | 
|  | 1: service service_name; | 
|  |  | 
|  | /// The name of the service instance. | 
|  | 2: instance instance_name; | 
|  |  | 
|  | /// IPv4 socket address for the service. May be empty. Deprecated: use `addresses`. | 
|  | @available(deprecated=9) | 
|  | @deprecated | 
|  | 3: ipv4_endpoint fuchsia.net.Ipv4SocketAddress; | 
|  |  | 
|  | /// IPv6 socket address for the service. May be empty. Deprecated: use `addresses`. | 
|  | @available(deprecated=9) | 
|  | @deprecated | 
|  | 4: ipv6_endpoint fuchsia.net.Ipv6SocketAddress; | 
|  |  | 
|  | /// Text strings describing the instance. Deprecated: use `text_strings`. | 
|  | @available(deprecated=9) | 
|  | @deprecated | 
|  | 5: text vector<txt_string>:MAX_TEXT_STRINGS; | 
|  |  | 
|  | /// The priority of the SRV resource record for this publication. See | 
|  | /// [RFC6763](https://tools.ietf.org/html/rfc6763) for details. | 
|  | 6: srv_priority uint16; | 
|  |  | 
|  | /// The weight of the SRV resource record for this publication. See | 
|  | /// [RFC6763](https://tools.ietf.org/html/rfc6763) for details. | 
|  | 7: srv_weight uint16; | 
|  |  | 
|  | /// The domain name of the target host. | 
|  | 8: target host_name; | 
|  |  | 
|  | /// The socket addresses for the service instance. | 
|  | @available(added=9) | 
|  | 9: addresses vector<fuchsia.net.SocketAddress>:MAX_ADDRESSES; | 
|  |  | 
|  | /// Text strings describing the instance. | 
|  | @available(added=9) | 
|  | 10: text_strings vector<txt_character_string>:MAX_TEXT_STRINGS; | 
|  | }; | 
|  |  | 
|  | const MAX_TEXT_STRINGS uint32 = 256; | 
|  | const MAX_ADDRESSES uint32 = 64; | 
|  | const MAX_SUBTYPES uint32 = 256; |