1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143
// // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIDNSServiceDiscovery.idl // /// `interface nsIDNSServiceInfo : nsISupports` /// /// ```text /// /** /// * Service information /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIDNSServiceInfo { vtable: *const nsIDNSServiceInfoVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIDNSServiceInfo. unsafe impl XpCom for nsIDNSServiceInfo { const IID: nsIID = nsID(0x670ed0f9, 0x2fa5, 0x4544, [0xbf, 0x1e, 0xea, 0x58, 0xac, 0x17, 0x93, 0x74]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIDNSServiceInfo { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIDNSServiceInfo. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIDNSServiceInfoCoerce { /// Cheaply cast a value of this type from a `nsIDNSServiceInfo`. fn coerce_from(v: &nsIDNSServiceInfo) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIDNSServiceInfoCoerce for nsIDNSServiceInfo { #[inline] fn coerce_from(v: &nsIDNSServiceInfo) -> &Self { v } } impl nsIDNSServiceInfo { /// Cast this `nsIDNSServiceInfo` to one of its base interfaces. #[inline] pub fn coerce<T: nsIDNSServiceInfoCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIDNSServiceInfo { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIDNSServiceInfoCoerce for T { #[inline] fn coerce_from(v: &nsIDNSServiceInfo) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIDNSServiceInfo // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIDNSServiceInfoVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* attribute AUTF8String host; */ pub GetHost: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aHost: &mut ::nsstring::nsACString) -> nsresult, /* attribute AUTF8String host; */ pub SetHost: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aHost: &::nsstring::nsACString) -> nsresult, /* attribute AUTF8String address; */ pub GetAddress: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aAddress: &mut ::nsstring::nsACString) -> nsresult, /* attribute AUTF8String address; */ pub SetAddress: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aAddress: &::nsstring::nsACString) -> nsresult, /* attribute unsigned short port; */ pub GetPort: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aPort: *mut libc::uint16_t) -> nsresult, /* attribute unsigned short port; */ pub SetPort: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aPort: libc::uint16_t) -> nsresult, /* attribute AUTF8String serviceName; */ pub GetServiceName: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aServiceName: &mut ::nsstring::nsACString) -> nsresult, /* attribute AUTF8String serviceName; */ pub SetServiceName: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aServiceName: &::nsstring::nsACString) -> nsresult, /* attribute AUTF8String serviceType; */ pub GetServiceType: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aServiceType: &mut ::nsstring::nsACString) -> nsresult, /* attribute AUTF8String serviceType; */ pub SetServiceType: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aServiceType: &::nsstring::nsACString) -> nsresult, /* attribute AUTF8String domainName; */ pub GetDomainName: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aDomainName: &mut ::nsstring::nsACString) -> nsresult, /* attribute AUTF8String domainName; */ pub SetDomainName: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aDomainName: &::nsstring::nsACString) -> nsresult, /* attribute nsIPropertyBag2 attributes; */ pub GetAttributes: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aAttributes: *mut *const nsIPropertyBag2) -> nsresult, /* attribute nsIPropertyBag2 attributes; */ pub SetAttributes: unsafe extern "system" fn (this: *const nsIDNSServiceInfo, aAttributes: *const nsIPropertyBag2) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIDNSServiceInfo { /// ```text /// /** /// * The host name of the service. (E.g. "Android.local.") /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String host;` #[inline] pub unsafe fn GetHost(&self, aHost: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetHost)(self, aHost) } /// ```text /// /** /// * The host name of the service. (E.g. "Android.local.") /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String host;` #[inline] pub unsafe fn SetHost(&self, aHost: &::nsstring::nsACString) -> nsresult { ((*self.vtable).SetHost)(self, aHost) } /// ```text /// /** /// * The IP address of the service. /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String address;` #[inline] pub unsafe fn GetAddress(&self, aAddress: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetAddress)(self, aAddress) } /// ```text /// /** /// * The IP address of the service. /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String address;` #[inline] pub unsafe fn SetAddress(&self, aAddress: &::nsstring::nsACString) -> nsresult { ((*self.vtable).SetAddress)(self, aAddress) } /// ```text /// /** /// * The port number of the service. (E.g. 80) /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute unsigned short port;` #[inline] pub unsafe fn GetPort(&self, aPort: *mut libc::uint16_t) -> nsresult { ((*self.vtable).GetPort)(self, aPort) } /// ```text /// /** /// * The port number of the service. (E.g. 80) /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute unsigned short port;` #[inline] pub unsafe fn SetPort(&self, aPort: libc::uint16_t) -> nsresult { ((*self.vtable).SetPort)(self, aPort) } /// ```text /// /** /// * The service name of the service for display. (E.g. "My TV") /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String serviceName;` #[inline] pub unsafe fn GetServiceName(&self, aServiceName: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetServiceName)(self, aServiceName) } /// ```text /// /** /// * The service name of the service for display. (E.g. "My TV") /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String serviceName;` #[inline] pub unsafe fn SetServiceName(&self, aServiceName: &::nsstring::nsACString) -> nsresult { ((*self.vtable).SetServiceName)(self, aServiceName) } /// ```text /// /** /// * The type of the service. (E.g. "_http._tcp") /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String serviceType;` #[inline] pub unsafe fn GetServiceType(&self, aServiceType: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetServiceType)(self, aServiceType) } /// ```text /// /** /// * The type of the service. (E.g. "_http._tcp") /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String serviceType;` #[inline] pub unsafe fn SetServiceType(&self, aServiceType: &::nsstring::nsACString) -> nsresult { ((*self.vtable).SetServiceType)(self, aServiceType) } /// ```text /// /** /// * The domain name of the service. (E.g. "local.") /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String domainName;` #[inline] pub unsafe fn GetDomainName(&self, aDomainName: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetDomainName)(self, aDomainName) } /// ```text /// /** /// * The domain name of the service. (E.g. "local.") /// * @throws NS_ERROR_NOT_INITIALIZED when getting unset value. /// */ /// ``` /// /// `attribute AUTF8String domainName;` #[inline] pub unsafe fn SetDomainName(&self, aDomainName: &::nsstring::nsACString) -> nsresult { ((*self.vtable).SetDomainName)(self, aDomainName) } /// ```text /// /** /// * The attributes of the service. /// */ /// ``` /// /// `attribute nsIPropertyBag2 attributes;` #[inline] pub unsafe fn GetAttributes(&self, aAttributes: *mut *const nsIPropertyBag2) -> nsresult { ((*self.vtable).GetAttributes)(self, aAttributes) } /// ```text /// /** /// * The attributes of the service. /// */ /// ``` /// /// `attribute nsIPropertyBag2 attributes;` #[inline] pub unsafe fn SetAttributes(&self, aAttributes: *const nsIPropertyBag2) -> nsresult { ((*self.vtable).SetAttributes)(self, aAttributes) } } /// `interface nsIDNSServiceDiscoveryListener : nsISupports` /// /// ```text /// /** /// * The callback interface for service discovery /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIDNSServiceDiscoveryListener { vtable: *const nsIDNSServiceDiscoveryListenerVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIDNSServiceDiscoveryListener. unsafe impl XpCom for nsIDNSServiceDiscoveryListener { const IID: nsIID = nsID(0x3025b7f2, 0x97bb, 0x435b, [0xb4, 0x3d, 0x26, 0x73, 0x1b, 0x3f, 0x5f, 0xc4]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIDNSServiceDiscoveryListener { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIDNSServiceDiscoveryListener. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIDNSServiceDiscoveryListenerCoerce { /// Cheaply cast a value of this type from a `nsIDNSServiceDiscoveryListener`. fn coerce_from(v: &nsIDNSServiceDiscoveryListener) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIDNSServiceDiscoveryListenerCoerce for nsIDNSServiceDiscoveryListener { #[inline] fn coerce_from(v: &nsIDNSServiceDiscoveryListener) -> &Self { v } } impl nsIDNSServiceDiscoveryListener { /// Cast this `nsIDNSServiceDiscoveryListener` to one of its base interfaces. #[inline] pub fn coerce<T: nsIDNSServiceDiscoveryListenerCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIDNSServiceDiscoveryListener { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIDNSServiceDiscoveryListenerCoerce for T { #[inline] fn coerce_from(v: &nsIDNSServiceDiscoveryListener) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIDNSServiceDiscoveryListener // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIDNSServiceDiscoveryListenerVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void onDiscoveryStarted (in AUTF8String aServiceType); */ pub OnDiscoveryStarted: unsafe extern "system" fn (this: *const nsIDNSServiceDiscoveryListener, aServiceType: &::nsstring::nsACString) -> nsresult, /* void onDiscoveryStopped (in AUTF8String aServiceType); */ pub OnDiscoveryStopped: unsafe extern "system" fn (this: *const nsIDNSServiceDiscoveryListener, aServiceType: &::nsstring::nsACString) -> nsresult, /* void onServiceFound (in nsIDNSServiceInfo aServiceInfo); */ pub OnServiceFound: unsafe extern "system" fn (this: *const nsIDNSServiceDiscoveryListener, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult, /* void onServiceLost (in nsIDNSServiceInfo aServiceInfo); */ pub OnServiceLost: unsafe extern "system" fn (this: *const nsIDNSServiceDiscoveryListener, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult, /* void onStartDiscoveryFailed (in AUTF8String aServiceType, in long aErrorCode); */ pub OnStartDiscoveryFailed: unsafe extern "system" fn (this: *const nsIDNSServiceDiscoveryListener, aServiceType: &::nsstring::nsACString, aErrorCode: libc::int32_t) -> nsresult, /* void onStopDiscoveryFailed (in AUTF8String aServiceType, in long aErrorCode); */ pub OnStopDiscoveryFailed: unsafe extern "system" fn (this: *const nsIDNSServiceDiscoveryListener, aServiceType: &::nsstring::nsACString, aErrorCode: libc::int32_t) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIDNSServiceDiscoveryListener { /// ```text /// /** /// * Callback when the discovery begins. /// * @param aServiceType /// * the service type of |startDiscovery|. /// */ /// ``` /// /// `void onDiscoveryStarted (in AUTF8String aServiceType);` #[inline] pub unsafe fn OnDiscoveryStarted(&self, aServiceType: &::nsstring::nsACString) -> nsresult { ((*self.vtable).OnDiscoveryStarted)(self, aServiceType) } /// ```text /// /** /// * Callback when the discovery ends. /// * @param aServiceType /// * the service type of |startDiscovery|. /// */ /// ``` /// /// `void onDiscoveryStopped (in AUTF8String aServiceType);` #[inline] pub unsafe fn OnDiscoveryStopped(&self, aServiceType: &::nsstring::nsACString) -> nsresult { ((*self.vtable).OnDiscoveryStopped)(self, aServiceType) } /// ```text /// /** /// * Callback when the a service is found. /// * @param aServiceInfo /// * the info about the found service, where |serviceName|, |aServiceType|, and |domainName| are set. /// */ /// ``` /// /// `void onServiceFound (in nsIDNSServiceInfo aServiceInfo);` #[inline] pub unsafe fn OnServiceFound(&self, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult { ((*self.vtable).OnServiceFound)(self, aServiceInfo) } /// ```text /// /** /// * Callback when the a service is lost. /// * @param aServiceInfo /// * the info about the lost service, where |serviceName|, |aServiceType|, and |domainName| are set. /// */ /// ``` /// /// `void onServiceLost (in nsIDNSServiceInfo aServiceInfo);` #[inline] pub unsafe fn OnServiceLost(&self, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult { ((*self.vtable).OnServiceLost)(self, aServiceInfo) } /// ```text /// /** /// * Callback when the discovery cannot start. /// * @param aServiceType /// * the service type of |startDiscovery|. /// * @param aErrorCode /// * the error code. /// */ /// ``` /// /// `void onStartDiscoveryFailed (in AUTF8String aServiceType, in long aErrorCode);` #[inline] pub unsafe fn OnStartDiscoveryFailed(&self, aServiceType: &::nsstring::nsACString, aErrorCode: libc::int32_t) -> nsresult { ((*self.vtable).OnStartDiscoveryFailed)(self, aServiceType, aErrorCode) } /// ```text /// /** /// * Callback when the discovery cannot stop. /// * @param aServiceType /// * the service type of |startDiscovery|. /// * @param aErrorCode /// * the error code. /// */ /// ``` /// /// `void onStopDiscoveryFailed (in AUTF8String aServiceType, in long aErrorCode);` #[inline] pub unsafe fn OnStopDiscoveryFailed(&self, aServiceType: &::nsstring::nsACString, aErrorCode: libc::int32_t) -> nsresult { ((*self.vtable).OnStopDiscoveryFailed)(self, aServiceType, aErrorCode) } } /// `interface nsIDNSRegistrationListener : nsISupports` /// /// ```text /// /** /// * The callback interface for service registration /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIDNSRegistrationListener { vtable: *const nsIDNSRegistrationListenerVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIDNSRegistrationListener. unsafe impl XpCom for nsIDNSRegistrationListener { const IID: nsIID = nsID(0xe165e4be, 0xabf4, 0x4963, [0xa6, 0x6d, 0xed, 0x3c, 0xa1, 0x16, 0xe5, 0xe4]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIDNSRegistrationListener { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIDNSRegistrationListener. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIDNSRegistrationListenerCoerce { /// Cheaply cast a value of this type from a `nsIDNSRegistrationListener`. fn coerce_from(v: &nsIDNSRegistrationListener) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIDNSRegistrationListenerCoerce for nsIDNSRegistrationListener { #[inline] fn coerce_from(v: &nsIDNSRegistrationListener) -> &Self { v } } impl nsIDNSRegistrationListener { /// Cast this `nsIDNSRegistrationListener` to one of its base interfaces. #[inline] pub fn coerce<T: nsIDNSRegistrationListenerCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIDNSRegistrationListener { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIDNSRegistrationListenerCoerce for T { #[inline] fn coerce_from(v: &nsIDNSRegistrationListener) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIDNSRegistrationListener // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIDNSRegistrationListenerVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void onServiceRegistered (in nsIDNSServiceInfo aServiceInfo); */ pub OnServiceRegistered: unsafe extern "system" fn (this: *const nsIDNSRegistrationListener, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult, /* void onServiceUnregistered (in nsIDNSServiceInfo aServiceInfo); */ pub OnServiceUnregistered: unsafe extern "system" fn (this: *const nsIDNSRegistrationListener, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult, /* void onRegistrationFailed (in nsIDNSServiceInfo aServiceInfo, in long aErrorCode); */ pub OnRegistrationFailed: unsafe extern "system" fn (this: *const nsIDNSRegistrationListener, aServiceInfo: *const nsIDNSServiceInfo, aErrorCode: libc::int32_t) -> nsresult, /* void onUnregistrationFailed (in nsIDNSServiceInfo aServiceInfo, in long aErrorCode); */ pub OnUnregistrationFailed: unsafe extern "system" fn (this: *const nsIDNSRegistrationListener, aServiceInfo: *const nsIDNSServiceInfo, aErrorCode: libc::int32_t) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIDNSRegistrationListener { pub const ERROR_SERVICE_NOT_RUNNING: i64 = -65563; /// ```text /// /** /// * Callback when the service is registered successfully. /// * @param aServiceInfo /// * the info about the registered service, /// * where |serviceName|, |aServiceType|, and |domainName| are set. /// */ /// ``` /// /// `void onServiceRegistered (in nsIDNSServiceInfo aServiceInfo);` #[inline] pub unsafe fn OnServiceRegistered(&self, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult { ((*self.vtable).OnServiceRegistered)(self, aServiceInfo) } /// ```text /// /** /// * Callback when the service is unregistered successfully. /// * @param aServiceInfo /// * the info about the unregistered service. /// */ /// ``` /// /// `void onServiceUnregistered (in nsIDNSServiceInfo aServiceInfo);` #[inline] pub unsafe fn OnServiceUnregistered(&self, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult { ((*self.vtable).OnServiceUnregistered)(self, aServiceInfo) } /// ```text /// /** /// * Callback when the service cannot be registered. /// * @param aServiceInfo /// * the info about the service to be registered. /// * @param aErrorCode /// * the error code. /// */ /// ``` /// /// `void onRegistrationFailed (in nsIDNSServiceInfo aServiceInfo, in long aErrorCode);` #[inline] pub unsafe fn OnRegistrationFailed(&self, aServiceInfo: *const nsIDNSServiceInfo, aErrorCode: libc::int32_t) -> nsresult { ((*self.vtable).OnRegistrationFailed)(self, aServiceInfo, aErrorCode) } /// ```text /// /** /// * Callback when the service cannot be unregistered. /// * @param aServiceInfo /// * the info about the registered service. /// * @param aErrorCode /// * the error code. /// */ /// ``` /// /// `void onUnregistrationFailed (in nsIDNSServiceInfo aServiceInfo, in long aErrorCode);` #[inline] pub unsafe fn OnUnregistrationFailed(&self, aServiceInfo: *const nsIDNSServiceInfo, aErrorCode: libc::int32_t) -> nsresult { ((*self.vtable).OnUnregistrationFailed)(self, aServiceInfo, aErrorCode) } } /// `interface nsIDNSServiceResolveListener : nsISupports` /// /// ```text /// /** /// * The callback interface for service resolve /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIDNSServiceResolveListener { vtable: *const nsIDNSServiceResolveListenerVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIDNSServiceResolveListener. unsafe impl XpCom for nsIDNSServiceResolveListener { const IID: nsIID = nsID(0x24ee6408, 0x648e, 0x421d, [0xac, 0xcf, 0xc6, 0xe5, 0xad, 0xec, 0xcf, 0x97]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIDNSServiceResolveListener { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIDNSServiceResolveListener. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIDNSServiceResolveListenerCoerce { /// Cheaply cast a value of this type from a `nsIDNSServiceResolveListener`. fn coerce_from(v: &nsIDNSServiceResolveListener) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIDNSServiceResolveListenerCoerce for nsIDNSServiceResolveListener { #[inline] fn coerce_from(v: &nsIDNSServiceResolveListener) -> &Self { v } } impl nsIDNSServiceResolveListener { /// Cast this `nsIDNSServiceResolveListener` to one of its base interfaces. #[inline] pub fn coerce<T: nsIDNSServiceResolveListenerCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIDNSServiceResolveListener { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIDNSServiceResolveListenerCoerce for T { #[inline] fn coerce_from(v: &nsIDNSServiceResolveListener) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIDNSServiceResolveListener // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIDNSServiceResolveListenerVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void onServiceResolved (in nsIDNSServiceInfo aServiceInfo); */ pub OnServiceResolved: unsafe extern "system" fn (this: *const nsIDNSServiceResolveListener, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult, /* void onResolveFailed (in nsIDNSServiceInfo aServiceInfo, in long aErrorCode); */ pub OnResolveFailed: unsafe extern "system" fn (this: *const nsIDNSServiceResolveListener, aServiceInfo: *const nsIDNSServiceInfo, aErrorCode: libc::int32_t) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIDNSServiceResolveListener { /// ```text /// /** /// * Callback when the service is resolved successfully. /// * @param aServiceInfo /// * the info about the resolved service, where |host| and |port| are set. /// */ /// ``` /// /// `void onServiceResolved (in nsIDNSServiceInfo aServiceInfo);` #[inline] pub unsafe fn OnServiceResolved(&self, aServiceInfo: *const nsIDNSServiceInfo) -> nsresult { ((*self.vtable).OnServiceResolved)(self, aServiceInfo) } /// ```text /// /** /// * Callback when the service cannot be resolved. /// * @param aServiceInfo /// * the info about the service to be resolved. /// * @param aErrorCode /// * the error code. /// */ /// ``` /// /// `void onResolveFailed (in nsIDNSServiceInfo aServiceInfo, in long aErrorCode);` #[inline] pub unsafe fn OnResolveFailed(&self, aServiceInfo: *const nsIDNSServiceInfo, aErrorCode: libc::int32_t) -> nsresult { ((*self.vtable).OnResolveFailed)(self, aServiceInfo, aErrorCode) } } /// `interface nsIDNSServiceDiscovery : nsISupports` /// /// ```text /// /** /// * The interface for DNS service discovery/registration/resolve /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIDNSServiceDiscovery { vtable: *const nsIDNSServiceDiscoveryVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIDNSServiceDiscovery. unsafe impl XpCom for nsIDNSServiceDiscovery { const IID: nsIID = nsID(0x6487899b, 0xbeb1, 0x455a, [0xba, 0x65, 0xe4, 0xfd, 0x46, 0x50, 0x66, 0xd7]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIDNSServiceDiscovery { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIDNSServiceDiscovery. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIDNSServiceDiscoveryCoerce { /// Cheaply cast a value of this type from a `nsIDNSServiceDiscovery`. fn coerce_from(v: &nsIDNSServiceDiscovery) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIDNSServiceDiscoveryCoerce for nsIDNSServiceDiscovery { #[inline] fn coerce_from(v: &nsIDNSServiceDiscovery) -> &Self { v } } impl nsIDNSServiceDiscovery { /// Cast this `nsIDNSServiceDiscovery` to one of its base interfaces. #[inline] pub fn coerce<T: nsIDNSServiceDiscoveryCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIDNSServiceDiscovery { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIDNSServiceDiscoveryCoerce for T { #[inline] fn coerce_from(v: &nsIDNSServiceDiscovery) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIDNSServiceDiscovery // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIDNSServiceDiscoveryVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* nsICancelable startDiscovery (in AUTF8String aServiceType, in nsIDNSServiceDiscoveryListener aListener); */ pub StartDiscovery: unsafe extern "system" fn (this: *const nsIDNSServiceDiscovery, aServiceType: &::nsstring::nsACString, aListener: *const nsIDNSServiceDiscoveryListener, _retval: *mut *const nsICancelable) -> nsresult, /* nsICancelable registerService (in nsIDNSServiceInfo aServiceInfo, in nsIDNSRegistrationListener aListener); */ pub RegisterService: unsafe extern "system" fn (this: *const nsIDNSServiceDiscovery, aServiceInfo: *const nsIDNSServiceInfo, aListener: *const nsIDNSRegistrationListener, _retval: *mut *const nsICancelable) -> nsresult, /* void resolveService (in nsIDNSServiceInfo aServiceInfo, in nsIDNSServiceResolveListener aListener); */ pub ResolveService: unsafe extern "system" fn (this: *const nsIDNSServiceDiscovery, aServiceInfo: *const nsIDNSServiceInfo, aListener: *const nsIDNSServiceResolveListener) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIDNSServiceDiscovery { /// ```text /// /** /// * Browse for instances of a service. /// * @param aServiceType /// * the service type to be discovered, E.g. "_http._tcp". /// * @param aListener /// * callback interface for discovery notifications. /// * @return An object that can be used to cancel the service discovery. /// */ /// ``` /// /// `nsICancelable startDiscovery (in AUTF8String aServiceType, in nsIDNSServiceDiscoveryListener aListener);` #[inline] pub unsafe fn StartDiscovery(&self, aServiceType: &::nsstring::nsACString, aListener: *const nsIDNSServiceDiscoveryListener, _retval: *mut *const nsICancelable) -> nsresult { ((*self.vtable).StartDiscovery)(self, aServiceType, aListener, _retval) } /// ```text /// /** /// * Register a service that is discovered via |startDiscovery| and |resolveService| calls. /// * @param aServiceInfo /// * the service information to be registered. /// * |port| and |aServiceType| are required attributes. /// * @param aListener /// * callback interface for registration notifications. /// * @return An object that can be used to cancel the service registration. /// */ /// ``` /// /// `nsICancelable registerService (in nsIDNSServiceInfo aServiceInfo, in nsIDNSRegistrationListener aListener);` #[inline] pub unsafe fn RegisterService(&self, aServiceInfo: *const nsIDNSServiceInfo, aListener: *const nsIDNSRegistrationListener, _retval: *mut *const nsICancelable) -> nsresult { ((*self.vtable).RegisterService)(self, aServiceInfo, aListener, _retval) } /// ```text /// /** /// * Resolve a service name discovered via |startDiscovery| to a target host name, port number. /// * @param aServiceInfo /// * the service information to be registered. /// * |serviceName|, |aServiceType|, and |domainName| are required attributes as reported to the |onServiceFound| callback. /// * @param aListener /// * callback interface for registration notifications. /// */ /// ``` /// /// `void resolveService (in nsIDNSServiceInfo aServiceInfo, in nsIDNSServiceResolveListener aListener);` #[inline] pub unsafe fn ResolveService(&self, aServiceInfo: *const nsIDNSServiceInfo, aListener: *const nsIDNSServiceResolveListener) -> nsresult { ((*self.vtable).ResolveService)(self, aServiceInfo, aListener) } }