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