1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit NetworkKit 19 */ 20 21import { AsyncCallback, Callback } from './@ohos.base'; 22import connection from './@ohos.net.connection'; 23import Context from './application/Context'; 24 25/** 26 * Provides interfaces to discover DNS based services on a local network over Multicast DNS. 27 * @namespace mdns 28 * @syscap SystemCapability.Communication.NetManager.MDNS 29 * @since 10 30 */ 31/** 32 * Provides interfaces to discover DNS based services on a local network over Multicast DNS. 33 * @namespace mdns 34 * @syscap SystemCapability.Communication.NetManager.MDNS 35 * @atomicservice 36 * @since 11 37 */ 38declare namespace mdns { 39 /** 40 * Get a network address. 41 * @syscap SystemCapability.Communication.NetManager.Core 42 * @since 10 43 */ 44 /** 45 * Get a network address. 46 * @typedef { connection.NetAddress } 47 * @syscap SystemCapability.Communication.NetManager.Core 48 * @atomicservice 49 * @since 12 50 */ 51 type NetAddress = connection.NetAddress; 52 53 /** 54 * Adds an mDNS service. 55 * @param { Context } context - Indicates the context of application or capability. 56 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 57 * @param { AsyncCallback<LocalServiceInfo> } callback - the callback of addLocalService. 58 * @throws { BusinessError } 401 - Parameter error. 59 * @throws { BusinessError } 2100002 - Failed to connect to the service. 60 * @throws { BusinessError } 2100003 - System internal error. 61 * @throws { BusinessError } 2204003 - Callback duplicated. 62 * @throws { BusinessError } 2204008 - Failed to delete the service instance. 63 * @throws { BusinessError } 2204010 - Failed to send the message. 64 * @syscap SystemCapability.Communication.NetManager.MDNS 65 * @since 10 66 */ 67 /** 68 * Adds an mDNS service. 69 * @param { Context } context - Indicates the context of application or capability. 70 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 71 * @param { AsyncCallback<LocalServiceInfo> } callback - the callback of addLocalService. 72 * @throws { BusinessError } 401 - Parameter error. 73 * @throws { BusinessError } 2100002 - Failed to connect to the service. 74 * @throws { BusinessError } 2100003 - System internal error. 75 * @throws { BusinessError } 2204003 - Callback duplicated. 76 * @throws { BusinessError } 2204008 - Failed to delete the service instance. 77 * @throws { BusinessError } 2204010 - Failed to send the message. 78 * @syscap SystemCapability.Communication.NetManager.MDNS 79 * @atomicservice 80 * @since 11 81 */ 82 function addLocalService(context: Context, serviceInfo: LocalServiceInfo, 83 callback: AsyncCallback<LocalServiceInfo>): void; 84 85 /** 86 * Adds an mDNS service. 87 * @param { Context } context - Indicates the context of application or capability. 88 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 89 * @returns { Promise<LocalServiceInfo> } The promise returned by the function. 90 * @throws { BusinessError } 401 - Parameter error. 91 * @throws { BusinessError } 2100002 - Failed to connect to the service. 92 * @throws { BusinessError } 2100003 - System internal error. 93 * @throws { BusinessError } 2204003 - Callback duplicated. 94 * @throws { BusinessError } 2204008 - Failed to delete the service instance. 95 * @throws { BusinessError } 2204010 - Failed to send the message. 96 * @syscap SystemCapability.Communication.NetManager.MDNS 97 * @since 10 98 */ 99 /** 100 * Adds an mDNS service. 101 * @param { Context } context - Indicates the context of application or capability. 102 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 103 * @returns { Promise<LocalServiceInfo> } The promise returned by the function. 104 * @throws { BusinessError } 401 - Parameter error. 105 * @throws { BusinessError } 2100002 - Failed to connect to the service. 106 * @throws { BusinessError } 2100003 - System internal error. 107 * @throws { BusinessError } 2204003 - Callback duplicated. 108 * @throws { BusinessError } 2204008 - Failed to delete the service instance. 109 * @throws { BusinessError } 2204010 - Failed to send the message. 110 * @syscap SystemCapability.Communication.NetManager.MDNS 111 * @atomicservice 112 * @since 11 113 */ 114 function addLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise<LocalServiceInfo>; 115 116 /** 117 * Removes an mDNS service. 118 * @param { Context } context - Indicates the context of application or capability. 119 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 120 * @param { AsyncCallback<LocalServiceInfo> } callback - the callback of removeLocalService. 121 * @throws { BusinessError } 401 - Parameter error. 122 * @throws { BusinessError } 2100002 - Failed to connect to the service. 123 * @throws { BusinessError } 2100003 - System internal error. 124 * @throws { BusinessError } 2204002 - Callback not found. 125 * @throws { BusinessError } 2204008 - Failed to delete the service instance. 126 * @throws { BusinessError } 2204010 - Failed to send the message. 127 * @syscap SystemCapability.Communication.NetManager.MDNS 128 * @since 10 129 */ 130 /** 131 * Removes an mDNS service. 132 * @param { Context } context - Indicates the context of application or capability. 133 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 134 * @param { AsyncCallback<LocalServiceInfo> } callback - the callback of removeLocalService. 135 * @throws { BusinessError } 401 - Parameter error. 136 * @throws { BusinessError } 2100002 - Failed to connect to the service. 137 * @throws { BusinessError } 2100003 - System internal error. 138 * @throws { BusinessError } 2204002 - Callback not found. 139 * @throws { BusinessError } 2204008 - Failed to delete the service instance. 140 * @throws { BusinessError } 2204010 - Failed to send the message. 141 * @syscap SystemCapability.Communication.NetManager.MDNS 142 * @atomicservice 143 * @since 11 144 */ 145 function removeLocalService(context: Context, serviceInfo: LocalServiceInfo, 146 callback: AsyncCallback<LocalServiceInfo>): void; 147 148 /** 149 * Removes an mDNS service. 150 * @param { Context } context - Indicates the context of application or capability. 151 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 152 * @returns { Promise<LocalServiceInfo> } The promise returned by the function. 153 * @throws { BusinessError } 401 - Parameter error. 154 * @throws { BusinessError } 2100002 - Failed to connect to the service. 155 * @throws { BusinessError } 2100003 - System internal error. 156 * @throws { BusinessError } 2204002 - Callback not found. 157 * @throws { BusinessError } 2204008 - Failed to delete the service instance. 158 * @throws { BusinessError } 2204010 - Failed to send the message. 159 * @syscap SystemCapability.Communication.NetManager.MDNS 160 * @since 10 161 */ 162 /** 163 * Removes an mDNS service. 164 * @param { Context } context - Indicates the context of application or capability. 165 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 166 * @returns { Promise<LocalServiceInfo> } The promise returned by the function. 167 * @throws { BusinessError } 401 - Parameter error. 168 * @throws { BusinessError } 2100002 - Failed to connect to the service. 169 * @throws { BusinessError } 2100003 - System internal error. 170 * @throws { BusinessError } 2204002 - Callback not found. 171 * @throws { BusinessError } 2204008 - Failed to delete the service instance. 172 * @throws { BusinessError } 2204010 - Failed to send the message. 173 * @syscap SystemCapability.Communication.NetManager.MDNS 174 * @atomicservice 175 * @since 11 176 */ 177 function removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise<LocalServiceInfo>; 178 179 /** 180 * Create an mDNS based discovery service with context and serviceType. 181 * @param { Context } context - Indicates the context of application or capability. 182 * @param { string } serviceType - The service type being discovered. 183 * @returns { DiscoveryService } the DiscoveryService of the createDiscoveryService. 184 * @throws { BusinessError } 401 - Parameter error. 185 * @syscap SystemCapability.Communication.NetManager.MDNS 186 * @since 10 187 */ 188 /** 189 * Create an mDNS based discovery service with context and serviceType. 190 * @param { Context } context - Indicates the context of application or capability. 191 * @param { string } serviceType - The service type being discovered. 192 * @returns { DiscoveryService } the DiscoveryService of the createDiscoveryService. 193 * @throws { BusinessError } 401 - Parameter error. 194 * @syscap SystemCapability.Communication.NetManager.MDNS 195 * @atomicservice 196 * @since 11 197 */ 198 function createDiscoveryService(context: Context, serviceType: string): DiscoveryService; 199 200 /** 201 * Resolves an mDNS service. 202 * @param { Context } context - Indicates the context of application or capability. 203 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 204 * @param { AsyncCallback<LocalServiceInfo> } callback - the callback of resolveLocalService. 205 * @throws { BusinessError } 401 - Parameter error. 206 * @throws { BusinessError } 2100002 - Failed to connect to the service. 207 * @throws { BusinessError } 2100003 - System internal error. 208 * @throws { BusinessError } 2204003 - Callback duplicated. 209 * @throws { BusinessError } 2204006 - Request timeout. 210 * @throws { BusinessError } 2204010 - Failed to send the message. 211 * @syscap SystemCapability.Communication.NetManager.MDNS 212 * @since 10 213 */ 214 /** 215 * Resolves an mDNS service. 216 * @param { Context } context - Indicates the context of application or capability. 217 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 218 * @param { AsyncCallback<LocalServiceInfo> } callback - the callback of resolveLocalService. 219 * @throws { BusinessError } 401 - Parameter error. 220 * @throws { BusinessError } 2100002 - Failed to connect to the service. 221 * @throws { BusinessError } 2100003 - System internal error. 222 * @throws { BusinessError } 2204003 - Callback duplicated. 223 * @throws { BusinessError } 2204006 - Request timeout. 224 * @throws { BusinessError } 2204010 - Failed to send the message. 225 * @syscap SystemCapability.Communication.NetManager.MDNS 226 * @atomicservice 227 * @since 11 228 */ 229 function resolveLocalService(context: Context, serviceInfo: LocalServiceInfo, 230 callback: AsyncCallback<LocalServiceInfo>): void; 231 232 /** 233 * Resolves an mDNS service. 234 * @param { Context } context - Indicates the context of application or capability. 235 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 236 * @returns { Promise<LocalServiceInfo> } The promise returned by the function. 237 * @throws { BusinessError } 401 - Parameter error. 238 * @throws { BusinessError } 2100002 - Failed to connect to the service. 239 * @throws { BusinessError } 2100003 - System internal error. 240 * @throws { BusinessError } 2204003 - Callback duplicated. 241 * @throws { BusinessError } 2204006 - Request timeout. 242 * @throws { BusinessError } 2204010 - Failed to send the message. 243 * @syscap SystemCapability.Communication.NetManager.MDNS 244 * @since 10 245 */ 246 /** 247 * Resolves an mDNS service. 248 * @param { Context } context - Indicates the context of application or capability. 249 * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} 250 * @returns { Promise<LocalServiceInfo> } The promise returned by the function. 251 * @throws { BusinessError } 401 - Parameter error. 252 * @throws { BusinessError } 2100002 - Failed to connect to the service. 253 * @throws { BusinessError } 2100003 - System internal error. 254 * @throws { BusinessError } 2204003 - Callback duplicated. 255 * @throws { BusinessError } 2204006 - Request timeout. 256 * @throws { BusinessError } 2204010 - Failed to send the message. 257 * @syscap SystemCapability.Communication.NetManager.MDNS 258 * @atomicservice 259 * @since 11 260 */ 261 function resolveLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise<LocalServiceInfo>; 262 263 /** 264 * Defines a DiscoveryService object for discovering mDNS services of the specified type. 265 * @interface DiscoveryService 266 * @syscap SystemCapability.Communication.NetManager.MDNS 267 * @since 10 268 */ 269 /** 270 * Defines a DiscoveryService object for discovering mDNS services of the specified type. 271 * @interface DiscoveryService 272 * @syscap SystemCapability.Communication.NetManager.MDNS 273 * @atomicservice 274 * @since 11 275 */ 276 export interface DiscoveryService { 277 /** 278 * Enables listening for discoveryStart events of mDNS services. 279 * @param { 'discoveryStart' } type - Indicates Event name. 280 * @param { Callback<{ serviceInfo: LocalServiceInfo, errorCode?: MdnsError }> } callback - the callback used to return the result. 281 * @syscap SystemCapability.Communication.NetManager.MDNS 282 * @since 10 283 */ 284 /** 285 * Enables listening for discoveryStart events of mDNS services. 286 * @param { 'discoveryStart' } type - Indicates Event name. 287 * @param { Callback<DiscoveryEventInfo> } callback - the callback used to return the result. 288 * @syscap SystemCapability.Communication.NetManager.MDNS 289 * @atomicservice 290 * @since 11 291 */ 292 on(type: 'discoveryStart', callback: Callback<DiscoveryEventInfo>): void; 293 294 /** 295 * Cancels listening for discoveryStart events of mDNS services. 296 * @param { 'discoveryStart' } type - Indicates Event name. 297 * @param { Callback<{ serviceInfo: LocalServiceInfo, errorCode?: MdnsError }> } callback - the callback used to return the result. 298 * @syscap SystemCapability.Communication.NetManager.MDNS 299 * @since 10 300 */ 301 /** 302 * Cancels listening for discoveryStart events of mDNS services. 303 * @param { 'discoveryStart' } type - Indicates Event name. 304 * @param { Callback<DiscoveryEventInfo> } callback - the callback used to return the result. 305 * @syscap SystemCapability.Communication.NetManager.MDNS 306 * @atomicservice 307 * @since 11 308 */ 309 off(type: 'discoveryStart', callback?: Callback<DiscoveryEventInfo>): void; 310 311 /** 312 * Enables listening for discoveryStop events of mDNS services. 313 * @param { 'discoveryStop' } type - Indicates Event name. 314 * @param { Callback<{ serviceInfo: LocalServiceInfo, errorCode?: MdnsError }> } callback - the callback used to return the result. 315 * @syscap SystemCapability.Communication.NetManager.MDNS 316 * @since 10 317 */ 318 /** 319 * Enables listening for discoveryStop events of mDNS services. 320 * @param { 'discoveryStop' } type - Indicates Event name. 321 * @param { Callback<DiscoveryEventInfo> } callback - the callback used to return the result. 322 * @syscap SystemCapability.Communication.NetManager.MDNS 323 * @atomicservice 324 * @since 11 325 */ 326 on(type: 'discoveryStop', callback: Callback<DiscoveryEventInfo>): void; 327 328 /** 329 * Cancels listening for discoveryStop events of mDNS services. 330 * @param { 'discoveryStop' } type - Indicates Event name. 331 * @param { Callback<{ serviceInfo: LocalServiceInfo, errorCode?: MdnsError }> } callback - the callback used to return the result. 332 * @syscap SystemCapability.Communication.NetManager.MDNS 333 * @since 10 334 */ 335 /** 336 * Cancels listening for discoveryStop events of mDNS services. 337 * @param { 'discoveryStop' } type - Indicates Event name. 338 * @param { Callback<DiscoveryEventInfo> } callback - the callback used to return the result. 339 * @syscap SystemCapability.Communication.NetManager.MDNS 340 * @atomicservice 341 * @since 11 342 */ 343 off(type: 'discoveryStop', callback?: Callback<DiscoveryEventInfo>): void; 344 345 /** 346 * Enables listening for serviceFound events of mDNS services. 347 * @param { 'serviceFound' } type - Indicates Event name. 348 * @param { Callback<LocalServiceInfo> } callback - the callback used to return the result. 349 * @syscap SystemCapability.Communication.NetManager.MDNS 350 * @since 10 351 */ 352 /** 353 * Enables listening for serviceFound events of mDNS services. 354 * @param { 'serviceFound' } type - Indicates Event name. 355 * @param { Callback<LocalServiceInfo> } callback - the callback used to return the result. 356 * @syscap SystemCapability.Communication.NetManager.MDNS 357 * @atomicservice 358 * @since 11 359 */ 360 on(type: 'serviceFound', callback: Callback<LocalServiceInfo>): void; 361 362 /** 363 * Cancels listening for serviceFound events of mDNS services. 364 * @param { 'serviceFound' } type - Indicates Event name. 365 * @param { Callback<LocalServiceInfo> } callback - the callback used to return the result. 366 * @syscap SystemCapability.Communication.NetManager.MDNS 367 * @since 10 368 */ 369 /** 370 * Cancels listening for serviceFound events of mDNS services. 371 * @param { 'serviceFound' } type - Indicates Event name. 372 * @param { Callback<LocalServiceInfo> } callback - the callback used to return the result. 373 * @syscap SystemCapability.Communication.NetManager.MDNS 374 * @atomicservice 375 * @since 11 376 */ 377 off(type: 'serviceFound', callback?: Callback<LocalServiceInfo>): void; 378 379 /** 380 * Enables listening for serviceLost events of mDNS services. 381 * @param { 'serviceLost' } type - Indicates Event name. 382 * @param { Callback<LocalServiceInfo> } callback - the callback used to return the result. 383 * @syscap SystemCapability.Communication.NetManager.MDNS 384 * @since 10 385 */ 386 /** 387 * Enables listening for serviceLost events of mDNS services. 388 * @param { 'serviceLost' } type - Indicates Event name. 389 * @param { Callback<LocalServiceInfo> } callback - the callback used to return the result. 390 * @syscap SystemCapability.Communication.NetManager.MDNS 391 * @atomicservice 392 * @since 11 393 */ 394 on(type: 'serviceLost', callback: Callback<LocalServiceInfo>): void; 395 396 /** 397 * Cancels listening for serviceLost events of mDNS services. 398 * @param { 'serviceLost' } type - Indicates Event name. 399 * @param { Callback<LocalServiceInfo> } callback - the callback used to return the result. 400 * @syscap SystemCapability.Communication.NetManager.MDNS 401 * @since 10 402 */ 403 /** 404 * Cancels listening for serviceLost events of mDNS services. 405 * @param { 'serviceLost' } type - Indicates Event name. 406 * @param { Callback<LocalServiceInfo> } callback - the callback used to return the result. 407 * @syscap SystemCapability.Communication.NetManager.MDNS 408 * @atomicservice 409 * @since 11 410 */ 411 off(type: 'serviceLost', callback?: Callback<LocalServiceInfo>): void; 412 413 /** 414 * Starts searching for mDNS services on the LAN. 415 * @syscap SystemCapability.Communication.NetManager.MDNS 416 * @since 10 417 */ 418 /** 419 * Starts searching for mDNS services on the LAN. 420 * @syscap SystemCapability.Communication.NetManager.MDNS 421 * @atomicservice 422 * @since 11 423 */ 424 startSearchingMDNS(): void; 425 426 /** 427 * Stops searching for mDNS services on the LAN. 428 * @syscap SystemCapability.Communication.NetManager.MDNS 429 * @since 10 430 */ 431 /** 432 * Stops searching for mDNS services on the LAN. 433 * @syscap SystemCapability.Communication.NetManager.MDNS 434 * @atomicservice 435 * @since 11 436 */ 437 stopSearchingMDNS(): void; 438 } 439 440 /** 441 * Defines the mDNS service information. 442 * @interface LocalServiceInfo 443 * @syscap SystemCapability.Communication.NetManager.MDNS 444 * @since 10 445 */ 446 /** 447 * Defines the mDNS service information. 448 * @interface LocalServiceInfo 449 * @syscap SystemCapability.Communication.NetManager.MDNS 450 * @atomicservice 451 * @since 11 452 */ 453 export interface LocalServiceInfo { 454 /** 455 * Service type. Use an underscore (_) as the prefix, for example, _http._tcp. 456 * @type {string} 457 * @syscap SystemCapability.Communication.NetManager.MDNS 458 * @since 10 459 */ 460 /** 461 * Service type. Use an underscore (_) as the prefix, for example, _http._tcp. 462 * @type {string} 463 * @syscap SystemCapability.Communication.NetManager.MDNS 464 * @atomicservice 465 * @since 11 466 */ 467 serviceType: string; 468 /** 469 * Service name. 470 * @type {string} 471 * @syscap SystemCapability.Communication.NetManager.MDNS 472 * @since 10 473 */ 474 /** 475 * Service name. 476 * @type {string} 477 * @syscap SystemCapability.Communication.NetManager.MDNS 478 * @atomicservice 479 * @since 11 480 */ 481 serviceName: string; 482 /** 483 * Port number. 484 * @type {?number} 485 * @syscap SystemCapability.Communication.NetManager.MDNS 486 * @since 10 487 */ 488 /** 489 * Port number. 490 * @type {?number} 491 * @syscap SystemCapability.Communication.NetManager.MDNS 492 * @atomicservice 493 * @since 11 494 */ 495 port?: number; 496 /** 497 * IP address of the host. 498 * @type {?NetAddress} 499 * @syscap SystemCapability.Communication.NetManager.MDNS 500 * @since 10 501 */ 502 /** 503 * IP address of the host. 504 * @type {?NetAddress} 505 * @syscap SystemCapability.Communication.NetManager.MDNS 506 * @atomicservice 507 * @since 11 508 */ 509 host?: NetAddress; 510 /** 511 * DNS-SD TXT record pairs. 512 * @type {?Array<ServiceAttribute>} 513 * @syscap SystemCapability.Communication.NetManager.MDNS 514 * @since 10 515 */ 516 /** 517 * DNS-SD TXT record pairs. 518 * @type {?Array<ServiceAttribute>} 519 * @syscap SystemCapability.Communication.NetManager.MDNS 520 * @atomicservice 521 * @since 11 522 */ 523 serviceAttribute?: Array<ServiceAttribute>; 524 } 525 526 /** 527 * Defines the mDNS service attribute information. 528 * @interface ServiceAttribute 529 * @syscap SystemCapability.Communication.NetManager.MDNS 530 * @since 10 531 */ 532 /** 533 * Defines the mDNS service attribute information. 534 * @interface ServiceAttribute 535 * @syscap SystemCapability.Communication.NetManager.MDNS 536 * @atomicservice 537 * @since 11 538 */ 539 export interface ServiceAttribute { 540 /** 541 * TXT record key. 542 * @type {string} 543 * @syscap SystemCapability.Communication.NetManager.MDNS 544 * @since 10 545 */ 546 /** 547 * TXT record key. 548 * @type {string} 549 * @syscap SystemCapability.Communication.NetManager.MDNS 550 * @atomicservice 551 * @since 11 552 */ 553 key: string; 554 555 /** 556 * TXT record value. 557 * @type {Array<number>} 558 * @syscap SystemCapability.Communication.NetManager.MDNS 559 * @since 10 560 */ 561 /** 562 * TXT record value. 563 * @type {Array<number>} 564 * @syscap SystemCapability.Communication.NetManager.MDNS 565 * @atomicservice 566 * @since 11 567 */ 568 value: Array<number>; 569 } 570 571 /** 572 * Defines the discovery events information of mDNS services. 573 * @interface DiscoveryEventInfo 574 * @syscap SystemCapability.Communication.NetManager.MDNS 575 * @atomicservice 576 * @since 11 577 */ 578 export interface DiscoveryEventInfo { 579 /** 580 * Information about the mDNS service. 581 * @type {LocalServiceInfo} 582 * @syscap SystemCapability.Communication.NetManager.MDNS 583 * @atomicservice 584 * @since 11 585 */ 586 serviceInfo: LocalServiceInfo; 587 588 /** 589 * The mDNS error information. 590 * @type {?MdnsError} 591 * @syscap SystemCapability.Communication.NetManager.MDNS 592 * @atomicservice 593 * @since 11 594 */ 595 errorCode?: MdnsError; 596 } 597 598 /** 599 * Defines the mDNS error information. 600 * @enum {number} 601 * @syscap SystemCapability.Communication.NetManager.MDNS 602 * @since 10 603 */ 604 /** 605 * Defines the mDNS error information. 606 * @enum {number} 607 * @syscap SystemCapability.Communication.NetManager.MDNS 608 * @atomicservice 609 * @since 11 610 */ 611 export enum MdnsError { 612 /** 613 * Indicates that the operation failed due to internal error. 614 * @syscap SystemCapability.Communication.NetManager.MDNS 615 * @since 10 616 */ 617 /** 618 * Indicates that the operation failed due to internal error. 619 * @syscap SystemCapability.Communication.NetManager.MDNS 620 * @atomicservice 621 * @since 11 622 */ 623 INTERNAL_ERROR = 0, 624 625 /** 626 * Indicates that the operation failed because it is already active. 627 * @syscap SystemCapability.Communication.NetManager.MDNS 628 * @since 10 629 */ 630 /** 631 * Indicates that the operation failed because it is already active. 632 * @syscap SystemCapability.Communication.NetManager.MDNS 633 * @atomicservice 634 * @since 11 635 */ 636 ALREADY_ACTIVE = 1, 637 638 /** 639 * <p>Indicates that the operation failed because the maximum outstanding 640 * requests from the applications have reached.</p> 641 * @syscap SystemCapability.Communication.NetManager.MDNS 642 * @since 10 643 */ 644 /** 645 * <p>Indicates that the operation failed because the maximum outstanding 646 * requests from the applications have reached.</p> 647 * @syscap SystemCapability.Communication.NetManager.MDNS 648 * @atomicservice 649 * @since 11 650 */ 651 MAX_LIMIT = 2 652 } 653} 654 655/** 656 * @since 10 657 */ 658export default mdns; 659