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
//
// DO NOT EDIT.  THIS FILE IS GENERATED FROM ../../../dist/idl/nsIX509CertDB.idl
//


/// `typedef uint32_t  AppTrustedRoot;`
///


pub type AppTrustedRoot = uint32_t;


/// `interface nsIOpenSignedAppFileCallback : nsISupports`
///


// 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 nsIOpenSignedAppFileCallback {
    vtable: *const nsIOpenSignedAppFileCallbackVTable,

    /// 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 nsIOpenSignedAppFileCallback.
unsafe impl XpCom for nsIOpenSignedAppFileCallback {
    const IID: nsIID = nsID(0xfc2b60e5, 0x9a07, 0x47c2,
        [0xa2, 0xcd, 0xb8, 0x3b, 0x68, 0xa6, 0x60, 0xac]);
}

// 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 nsIOpenSignedAppFileCallback {
    #[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 nsIOpenSignedAppFileCallback.
// 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 nsIOpenSignedAppFileCallbackCoerce {
    /// Cheaply cast a value of this type from a `nsIOpenSignedAppFileCallback`.
    fn coerce_from(v: &nsIOpenSignedAppFileCallback) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIOpenSignedAppFileCallbackCoerce for nsIOpenSignedAppFileCallback {
    #[inline]
    fn coerce_from(v: &nsIOpenSignedAppFileCallback) -> &Self {
        v
    }
}

impl nsIOpenSignedAppFileCallback {
    /// Cast this `nsIOpenSignedAppFileCallback` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIOpenSignedAppFileCallbackCoerce>(&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 nsIOpenSignedAppFileCallback {
    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> nsIOpenSignedAppFileCallbackCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIOpenSignedAppFileCallback) -> &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 nsIOpenSignedAppFileCallback
// 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 nsIOpenSignedAppFileCallbackVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* void openSignedAppFileFinished (in nsresult rv, in nsIZipReader aZipReader, in nsIX509Cert aSignerCert); */
    pub OpenSignedAppFileFinished: unsafe extern "system" fn (this: *const nsIOpenSignedAppFileCallback, rv: nsresult, aZipReader: *const nsIZipReader, aSignerCert: *const nsIX509Cert) -> 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 nsIOpenSignedAppFileCallback {


    /// `void openSignedAppFileFinished (in nsresult rv, in nsIZipReader aZipReader, in nsIX509Cert aSignerCert);`
    #[inline]
    pub unsafe fn OpenSignedAppFileFinished(&self, rv: nsresult, aZipReader: *const nsIZipReader, aSignerCert: *const nsIX509Cert) -> nsresult {
        ((*self.vtable).OpenSignedAppFileFinished)(self, rv, aZipReader, aSignerCert)
    }


}


/// `interface nsIVerifySignedDirectoryCallback : nsISupports`
///


// 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 nsIVerifySignedDirectoryCallback {
    vtable: *const nsIVerifySignedDirectoryCallbackVTable,

    /// 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 nsIVerifySignedDirectoryCallback.
unsafe impl XpCom for nsIVerifySignedDirectoryCallback {
    const IID: nsIID = nsID(0xd5f97827, 0x622a, 0x488f,
        [0xbe, 0x08, 0xd8, 0x50, 0x43, 0x2a, 0xc8, 0xec]);
}

// 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 nsIVerifySignedDirectoryCallback {
    #[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 nsIVerifySignedDirectoryCallback.
// 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 nsIVerifySignedDirectoryCallbackCoerce {
    /// Cheaply cast a value of this type from a `nsIVerifySignedDirectoryCallback`.
    fn coerce_from(v: &nsIVerifySignedDirectoryCallback) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIVerifySignedDirectoryCallbackCoerce for nsIVerifySignedDirectoryCallback {
    #[inline]
    fn coerce_from(v: &nsIVerifySignedDirectoryCallback) -> &Self {
        v
    }
}

impl nsIVerifySignedDirectoryCallback {
    /// Cast this `nsIVerifySignedDirectoryCallback` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIVerifySignedDirectoryCallbackCoerce>(&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 nsIVerifySignedDirectoryCallback {
    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> nsIVerifySignedDirectoryCallbackCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIVerifySignedDirectoryCallback) -> &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 nsIVerifySignedDirectoryCallback
// 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 nsIVerifySignedDirectoryCallbackVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* void verifySignedDirectoryFinished (in nsresult rv, in nsIX509Cert aSignerCert); */
    pub VerifySignedDirectoryFinished: unsafe extern "system" fn (this: *const nsIVerifySignedDirectoryCallback, rv: nsresult, aSignerCert: *const nsIX509Cert) -> 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 nsIVerifySignedDirectoryCallback {


    /// `void verifySignedDirectoryFinished (in nsresult rv, in nsIX509Cert aSignerCert);`
    #[inline]
    pub unsafe fn VerifySignedDirectoryFinished(&self, rv: nsresult, aSignerCert: *const nsIX509Cert) -> nsresult {
        ((*self.vtable).VerifySignedDirectoryFinished)(self, rv, aSignerCert)
    }


}


/// `interface nsICertVerificationCallback : nsISupports`
///

/// ```text
/// /**
///  * Callback type for use with asyncVerifyCertAtTime.
///  * If aPRErrorCode is PRErrorCodeSuccess (i.e. 0), aVerifiedChain represents the
///  * verified certificate chain determined by asyncVerifyCertAtTime. aHasEVPolicy
///  * represents whether or not the end-entity certificate verified as EV.
///  * If aPRErrorCode is non-zero, it represents the error encountered during
///  * verification. aVerifiedChain is null in that case and aHasEVPolicy has no
///  * meaning.
///  */
/// ```
///

// 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 nsICertVerificationCallback {
    vtable: *const nsICertVerificationCallbackVTable,

    /// 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 nsICertVerificationCallback.
unsafe impl XpCom for nsICertVerificationCallback {
    const IID: nsIID = nsID(0x49e16fc8, 0xefac, 0x4f57,
        [0x83, 0x61, 0x95, 0x6e, 0xf6, 0xb9, 0x60, 0xa4]);
}

// 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 nsICertVerificationCallback {
    #[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 nsICertVerificationCallback.
// 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 nsICertVerificationCallbackCoerce {
    /// Cheaply cast a value of this type from a `nsICertVerificationCallback`.
    fn coerce_from(v: &nsICertVerificationCallback) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsICertVerificationCallbackCoerce for nsICertVerificationCallback {
    #[inline]
    fn coerce_from(v: &nsICertVerificationCallback) -> &Self {
        v
    }
}

impl nsICertVerificationCallback {
    /// Cast this `nsICertVerificationCallback` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsICertVerificationCallbackCoerce>(&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 nsICertVerificationCallback {
    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> nsICertVerificationCallbackCoerce for T {
    #[inline]
    fn coerce_from(v: &nsICertVerificationCallback) -> &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 nsICertVerificationCallback
// 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 nsICertVerificationCallbackVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* void verifyCertFinished (in int32_t aPRErrorCode, in nsIX509CertList aVerifiedChain, in bool aHasEVPolicy); */
    pub VerifyCertFinished: unsafe extern "system" fn (this: *const nsICertVerificationCallback, aPRErrorCode: int32_t, aVerifiedChain: *const nsIX509CertList, aHasEVPolicy: bool) -> 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 nsICertVerificationCallback {


    /// `void verifyCertFinished (in int32_t aPRErrorCode, in nsIX509CertList aVerifiedChain, in bool aHasEVPolicy);`
    #[inline]
    pub unsafe fn VerifyCertFinished(&self, aPRErrorCode: int32_t, aVerifiedChain: *const nsIX509CertList, aHasEVPolicy: bool) -> nsresult {
        ((*self.vtable).VerifyCertFinished)(self, aPRErrorCode, aVerifiedChain, aHasEVPolicy)
    }


}


/// `interface nsIX509CertDB : nsISupports`
///

/// ```text
/// /**
///  * This represents a service to access and manipulate
///  * X.509 certificates stored in a database.
///  */
/// ```
///

// 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 nsIX509CertDB {
    vtable: *const nsIX509CertDBVTable,

    /// 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 nsIX509CertDB.
unsafe impl XpCom for nsIX509CertDB {
    const IID: nsIID = nsID(0x5c16cd9b, 0x5a73, 0x47f1,
        [0xab, 0x0f, 0x11, 0xed, 0xe7, 0x49, 0x5c, 0xce]);
}

// 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 nsIX509CertDB {
    #[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 nsIX509CertDB.
// 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 nsIX509CertDBCoerce {
    /// Cheaply cast a value of this type from a `nsIX509CertDB`.
    fn coerce_from(v: &nsIX509CertDB) -> &Self;
}

// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsIX509CertDBCoerce for nsIX509CertDB {
    #[inline]
    fn coerce_from(v: &nsIX509CertDB) -> &Self {
        v
    }
}

impl nsIX509CertDB {
    /// Cast this `nsIX509CertDB` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIX509CertDBCoerce>(&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 nsIX509CertDB {
    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> nsIX509CertDBCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIX509CertDB) -> &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 nsIX509CertDB
// 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 nsIX509CertDBVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsISupportsVTable,

    /* [must_use] nsIX509Cert findCertByDBKey (in ACString aDBkey); */
    pub FindCertByDBKey: unsafe extern "system" fn (this: *const nsIX509CertDB, aDBkey: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult,

    /* [must_use] nsIX509Cert findCertByEmailAddress (in ACString aEmailAddress); */
    pub FindCertByEmailAddress: unsafe extern "system" fn (this: *const nsIX509CertDB, aEmailAddress: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult,

    /* void importCertificates ([array, size_is (length)] in octet data, in unsigned long length, in unsigned long type, in nsIInterfaceRequestor ctx); */
    pub ImportCertificates: unsafe extern "system" fn (this: *const nsIX509CertDB, data: *mut libc::uint8_t, length: libc::uint32_t, type_: libc::uint32_t, ctx: *const nsIInterfaceRequestor) -> nsresult,

    /* void importEmailCertificate ([array, size_is (length)] in octet data, in unsigned long length, in nsIInterfaceRequestor ctx); */
    pub ImportEmailCertificate: unsafe extern "system" fn (this: *const nsIX509CertDB, data: *mut libc::uint8_t, length: libc::uint32_t, ctx: *const nsIInterfaceRequestor) -> nsresult,

    /* void importUserCertificate ([array, size_is (length)] in octet data, in unsigned long length, in nsIInterfaceRequestor ctx); */
    pub ImportUserCertificate: unsafe extern "system" fn (this: *const nsIX509CertDB, data: *mut libc::uint8_t, length: libc::uint32_t, ctx: *const nsIInterfaceRequestor) -> nsresult,

    /* void deleteCertificate (in nsIX509Cert aCert); */
    pub DeleteCertificate: unsafe extern "system" fn (this: *const nsIX509CertDB, aCert: *const nsIX509Cert) -> nsresult,

    /* [must_use] void setCertTrust (in nsIX509Cert cert, in unsigned long type, in unsigned long trust); */
    pub SetCertTrust: unsafe extern "system" fn (this: *const nsIX509CertDB, cert: *const nsIX509Cert, type_: libc::uint32_t, trust: libc::uint32_t) -> nsresult,

    /* [must_use] void setCertTrustFromString (in nsIX509Cert cert, in ACString trustString); */
    pub SetCertTrustFromString: unsafe extern "system" fn (this: *const nsIX509CertDB, cert: *const nsIX509Cert, trustString: &::nsstring::nsACString) -> nsresult,

    /* [must_use] boolean isCertTrusted (in nsIX509Cert cert, in unsigned long certType, in unsigned long trustType); */
    pub IsCertTrusted: unsafe extern "system" fn (this: *const nsIX509CertDB, cert: *const nsIX509Cert, certType: libc::uint32_t, trustType: libc::uint32_t, _retval: *mut bool) -> nsresult,

    /* [must_use] void importCertsFromFile (in nsIFile aFile, in unsigned long aType); */
    pub ImportCertsFromFile: unsafe extern "system" fn (this: *const nsIX509CertDB, aFile: *const nsIFile, aType: libc::uint32_t) -> nsresult,

    /* [must_use] void importPKCS12File (in nsIFile aFile); */
    pub ImportPKCS12File: unsafe extern "system" fn (this: *const nsIX509CertDB, aFile: *const nsIFile) -> nsresult,

    /* [must_use] void exportPKCS12File (in nsIFile aFile, in unsigned long count, [array, size_is (count)] in nsIX509Cert aCerts); */
    pub ExportPKCS12File: unsafe extern "system" fn (this: *const nsIX509CertDB, aFile: *const nsIFile, count: libc::uint32_t, aCerts: *mut *const nsIX509Cert) -> nsresult,

    /* [must_use] nsIX509Cert constructX509FromBase64 (in ACString base64); */
    pub ConstructX509FromBase64: unsafe extern "system" fn (this: *const nsIX509CertDB, base64: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult,

    /* [must_use] nsIX509Cert constructX509 (in ACString certDER); */
    pub ConstructX509: unsafe extern "system" fn (this: *const nsIX509CertDB, certDER: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult,

    /* [must_use] void openSignedAppFileAsync (in AppTrustedRoot trustedRoot, in nsIFile aJarFile, in nsIOpenSignedAppFileCallback callback); */
    pub OpenSignedAppFileAsync: unsafe extern "system" fn (this: *const nsIX509CertDB, trustedRoot: AppTrustedRoot, aJarFile: *const nsIFile, callback: *const nsIOpenSignedAppFileCallback) -> nsresult,

    /* [must_use] void verifySignedDirectoryAsync (in AppTrustedRoot trustedRoot, in nsIFile aUnpackedDir, in nsIVerifySignedDirectoryCallback callback); */
    pub VerifySignedDirectoryAsync: unsafe extern "system" fn (this: *const nsIX509CertDB, trustedRoot: AppTrustedRoot, aUnpackedDir: *const nsIFile, callback: *const nsIVerifySignedDirectoryCallback) -> nsresult,

    /* [must_use] nsIX509Cert addCert (in ACString certDER, in ACString trust); */
    pub AddCert: unsafe extern "system" fn (this: *const nsIX509CertDB, certDER: &::nsstring::nsACString, trust: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult,

    /* [must_use] int32_t verifyCertAtTime (in nsIX509Cert aCert, in int64_t aUsage, in uint32_t aFlags, in ACString aHostname, in uint64_t aTime, out nsIX509CertList aVerifiedChain, out bool aHasEVPolicy); */
    pub VerifyCertAtTime: unsafe extern "system" fn (this: *const nsIX509CertDB, aCert: *const nsIX509Cert, aUsage: int64_t, aFlags: uint32_t, aHostname: &::nsstring::nsACString, aTime: uint64_t, aVerifiedChain: *mut *const nsIX509CertList, aHasEVPolicy: *mut bool, _retval: *mut int32_t) -> nsresult,

    /* [must_use] int32_t verifyCertNow (in nsIX509Cert aCert, in int64_t aUsage, in uint32_t aFlags, in ACString aHostname, out nsIX509CertList aVerifiedChain, out bool aHasEVPolicy); */
    pub VerifyCertNow: unsafe extern "system" fn (this: *const nsIX509CertDB, aCert: *const nsIX509Cert, aUsage: int64_t, aFlags: uint32_t, aHostname: &::nsstring::nsACString, aVerifiedChain: *mut *const nsIX509CertList, aHasEVPolicy: *mut bool, _retval: *mut int32_t) -> nsresult,

    /* [must_use] void asyncVerifyCertAtTime (in nsIX509Cert aCert, in int64_t aUsage, in uint32_t aFlags, in ACString aHostname, in uint64_t aTime, in nsICertVerificationCallback aCallback); */
    pub AsyncVerifyCertAtTime: unsafe extern "system" fn (this: *const nsIX509CertDB, aCert: *const nsIX509Cert, aUsage: int64_t, aFlags: uint32_t, aHostname: &::nsstring::nsACString, aTime: uint64_t, aCallback: *const nsICertVerificationCallback) -> nsresult,

    /* [must_use] void clearOCSPCache (); */
    pub ClearOCSPCache: unsafe extern "system" fn (this: *const nsIX509CertDB) -> nsresult,

    /* [must_use] nsIX509Cert addCertFromBase64 (in ACString base64, in ACString trust); */
    pub AddCertFromBase64: unsafe extern "system" fn (this: *const nsIX509CertDB, base64: &::nsstring::nsACString, trust: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult,

    /* [must_use] nsIX509CertList getCerts (); */
    pub GetCerts: unsafe extern "system" fn (this: *const nsIX509CertDB, _retval: *mut *const nsIX509CertList) -> nsresult,

    /* [must_use] nsIX509CertList getEnterpriseRoots (); */
    pub GetEnterpriseRoots: unsafe extern "system" fn (this: *const nsIX509CertDB, _retval: *mut *const nsIX509CertList) -> 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 nsIX509CertDB {
    /// ```text
    /// /**
    ///    *  Constants that define which usages a certificate
    ///    *  is trusted for.
    ///    */
    /// ```
    ///

    pub const UNTRUSTED: i64 = 0;


    pub const TRUSTED_SSL: i64 = 1;


    pub const TRUSTED_EMAIL: i64 = 2;

    /// ```text
    /// /**
    ///    *  Verifies the signature on the given JAR file to verify that it has a
    ///    *  valid signature.  To be considered valid, there must be exactly one
    ///    *  signature on the JAR file and that signature must have signed every
    ///    *  entry. Further, the signature must come from a certificate that
    ///    *  is trusted for code signing.
    ///    *
    ///    *  On success, NS_OK, a nsIZipReader, and the trusted certificate that
    ///    *  signed the JAR are returned.
    ///    *
    ///    *  On failure, an error code is returned.
    ///    *
    ///    *  This method returns a nsIZipReader, instead of taking an nsIZipReader
    ///    *  as input, to encourage users of the API to verify the signature as the
    ///    *  first step in opening the JAR.
    ///    */
    /// ```
    ///

    pub const AppXPCShellRoot: i64 = 6;


    pub const AddonsPublicRoot: i64 = 7;


    pub const AddonsStageRoot: i64 = 8;


    pub const PrivilegedPackageRoot: i64 = 9;


    pub const DeveloperImportedRoot: i64 = 10;


    pub const FLAG_LOCAL_ONLY: i64 = 1;


    pub const FLAG_MUST_BE_EV: i64 = 2;

    /// ```text
    /// /**
    ///    *  Will find a certificate based on its dbkey
    ///    *  retrieved by getting the dbKey attribute of
    ///    *  the certificate.
    ///    *
    ///    *  @param aDBkey Database internal key, as obtained using
    ///    *                attribute dbkey in nsIX509Cert.
    ///    */
    /// ```
    ///

    /// `[must_use] nsIX509Cert findCertByDBKey (in ACString aDBkey);`
    #[inline]
    pub unsafe fn FindCertByDBKey(&self, aDBkey: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult {
        ((*self.vtable).FindCertByDBKey)(self, aDBkey, _retval)
    }


    /// ```text
    /// /**
    ///    *  Find a certificate by email address.
    ///    *
    ///    *  @param aEmailAddress The email address to be used as the key
    ///    *                       to find the certificate.
    ///    *
    ///    *  @return The matching certificate if found.
    ///    */
    /// ```
    ///

    /// `[must_use] nsIX509Cert findCertByEmailAddress (in ACString aEmailAddress);`
    #[inline]
    pub unsafe fn FindCertByEmailAddress(&self, aEmailAddress: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult {
        ((*self.vtable).FindCertByEmailAddress)(self, aEmailAddress, _retval)
    }


    /// ```text
    /// /**
    ///    *  Use this to import a stream sent down as a mime type into
    ///    *  the certificate database on the default token.
    ///    *  The stream may consist of one or more certificates.
    ///    *
    ///    *  @param data The raw data to be imported
    ///    *  @param length The length of the data to be imported
    ///    *  @param type The type of the certificate, see constants in nsIX509Cert
    ///    *  @param ctx A UI context.
    ///    */
    /// ```
    ///

    /// `void importCertificates ([array, size_is (length)] in octet data, in unsigned long length, in unsigned long type, in nsIInterfaceRequestor ctx);`
    #[inline]
    pub unsafe fn ImportCertificates(&self, data: *mut libc::uint8_t, length: libc::uint32_t, type_: libc::uint32_t, ctx: *const nsIInterfaceRequestor) -> nsresult {
        ((*self.vtable).ImportCertificates)(self, data, length, type_, ctx)
    }


    /// ```text
    /// /**
    ///    *  Import another person's email certificate into the database.
    ///    *
    ///    *  @param data The raw data to be imported
    ///    *  @param length The length of the data to be imported
    ///    *  @param ctx A UI context.
    ///    */
    /// ```
    ///

    /// `void importEmailCertificate ([array, size_is (length)] in octet data, in unsigned long length, in nsIInterfaceRequestor ctx);`
    #[inline]
    pub unsafe fn ImportEmailCertificate(&self, data: *mut libc::uint8_t, length: libc::uint32_t, ctx: *const nsIInterfaceRequestor) -> nsresult {
        ((*self.vtable).ImportEmailCertificate)(self, data, length, ctx)
    }


    /// ```text
    /// /**
    ///    *  Import a personal certificate into the database, assuming
    ///    *  the database already contains the private key for this certificate.
    ///    *
    ///    *  @param data The raw data to be imported
    ///    *  @param length The length of the data to be imported
    ///    *  @param ctx A UI context.
    ///    */
    /// ```
    ///

    /// `void importUserCertificate ([array, size_is (length)] in octet data, in unsigned long length, in nsIInterfaceRequestor ctx);`
    #[inline]
    pub unsafe fn ImportUserCertificate(&self, data: *mut libc::uint8_t, length: libc::uint32_t, ctx: *const nsIInterfaceRequestor) -> nsresult {
        ((*self.vtable).ImportUserCertificate)(self, data, length, ctx)
    }


    /// ```text
    /// /**
    ///    *  Delete a certificate stored in the database.
    ///    *
    ///    *  @param aCert Delete this certificate.
    ///    */
    /// ```
    ///

    /// `void deleteCertificate (in nsIX509Cert aCert);`
    #[inline]
    pub unsafe fn DeleteCertificate(&self, aCert: *const nsIX509Cert) -> nsresult {
        ((*self.vtable).DeleteCertificate)(self, aCert)
    }


    /// ```text
    /// /**
    ///    *  Modify the trust that is stored and associated to a certificate within
    ///    *  a database. Separate trust is stored for
    ///    *  One call manipulates the trust for one trust type only.
    ///    *  See the trust type constants defined within this interface.
    ///    *
    ///    *  @param cert Change the stored trust of this certificate.
    ///    *  @param type The type of the certificate. See nsIX509Cert.
    ///    *  @param trust A bitmask. The new trust for the possible usages.
    ///    *               See the trust constants defined within this interface.
    ///    */
    /// ```
    ///

    /// `[must_use] void setCertTrust (in nsIX509Cert cert, in unsigned long type, in unsigned long trust);`
    #[inline]
    pub unsafe fn SetCertTrust(&self, cert: *const nsIX509Cert, type_: libc::uint32_t, trust: libc::uint32_t) -> nsresult {
        ((*self.vtable).SetCertTrust)(self, cert, type_, trust)
    }


    /// ```text
    /// /**
    ///    * @param cert        The certificate for which to modify trust.
    ///    * @param trustString decoded by CERT_DecodeTrustString. 3 comma separated
    ///    *                    characters, indicating SSL, Email, and Object signing
    ///    *                    trust. The object signing trust flags are effectively
    ///    *                    ignored by gecko, but they still must be specified (at
        ///    *                    least by a final trailing comma) because this argument
    ///    *                    is passed to CERT_DecodeTrustString.
    ///    */
    /// ```
    ///

    /// `[must_use] void setCertTrustFromString (in nsIX509Cert cert, in ACString trustString);`
    #[inline]
    pub unsafe fn SetCertTrustFromString(&self, cert: *const nsIX509Cert, trustString: &::nsstring::nsACString) -> nsresult {
        ((*self.vtable).SetCertTrustFromString)(self, cert, trustString)
    }


    /// ```text
    /// /**
    ///    *  Query whether a certificate is trusted for a particular use.
    ///    *
    ///    *  @param cert Obtain the stored trust of this certificate.
    ///    *  @param certType The type of the certificate. See nsIX509Cert.
    ///    *  @param trustType A single bit from the usages constants defined
    ///    *                   within this interface.
    ///    *
    ///    *  @return Returns true if the certificate is trusted for the given use.
    ///    */
    /// ```
    ///

    /// `[must_use] boolean isCertTrusted (in nsIX509Cert cert, in unsigned long certType, in unsigned long trustType);`
    #[inline]
    pub unsafe fn IsCertTrusted(&self, cert: *const nsIX509Cert, certType: libc::uint32_t, trustType: libc::uint32_t, _retval: *mut bool) -> nsresult {
        ((*self.vtable).IsCertTrusted)(self, cert, certType, trustType, _retval)
    }


    /// ```text
    /// /**
    ///    *  Import certificate(s) from file
    ///    *
    ///    *  @param aFile Identifies a file that contains the certificate
    ///    *               to be imported.
    ///    *  @param aType Describes the type of certificate that is going to
    ///    *               be imported. See type constants in nsIX509Cert.
    ///    */
    /// ```
    ///

    /// `[must_use] void importCertsFromFile (in nsIFile aFile, in unsigned long aType);`
    #[inline]
    pub unsafe fn ImportCertsFromFile(&self, aFile: *const nsIFile, aType: libc::uint32_t) -> nsresult {
        ((*self.vtable).ImportCertsFromFile)(self, aFile, aType)
    }


    /// ```text
    /// /**
    ///    *  Import a PKCS#12 file containing cert(s) and key(s) into the database.
    ///    *
    ///    *  @param aFile Identifies a file that contains the data to be imported.
    ///    */
    /// ```
    ///

    /// `[must_use] void importPKCS12File (in nsIFile aFile);`
    #[inline]
    pub unsafe fn ImportPKCS12File(&self, aFile: *const nsIFile) -> nsresult {
        ((*self.vtable).ImportPKCS12File)(self, aFile)
    }


    /// ```text
    /// /**
    ///    *  Export a set of certs and keys from the database to a PKCS#12 file.
    ///    *
    ///    *  @param aFile Identifies a file that will be filled with the data to be
    ///    *               exported.
    ///    *  @param count The number of certificates to be exported.
    ///    *  @param aCerts The array of all certificates to be exported.
    ///    */
    /// ```
    ///

    /// `[must_use] void exportPKCS12File (in nsIFile aFile, in unsigned long count, [array, size_is (count)] in nsIX509Cert aCerts);`
    #[inline]
    pub unsafe fn ExportPKCS12File(&self, aFile: *const nsIFile, count: libc::uint32_t, aCerts: *mut *const nsIX509Cert) -> nsresult {
        ((*self.vtable).ExportPKCS12File)(self, aFile, count, aCerts)
    }



    /// `[must_use] nsIX509Cert constructX509FromBase64 (in ACString base64);`
    #[inline]
    pub unsafe fn ConstructX509FromBase64(&self, base64: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult {
        ((*self.vtable).ConstructX509FromBase64)(self, base64, _retval)
    }



    /// `[must_use] nsIX509Cert constructX509 (in ACString certDER);`
    #[inline]
    pub unsafe fn ConstructX509(&self, certDER: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult {
        ((*self.vtable).ConstructX509)(self, certDER, _retval)
    }



    /// `[must_use] void openSignedAppFileAsync (in AppTrustedRoot trustedRoot, in nsIFile aJarFile, in nsIOpenSignedAppFileCallback callback);`
    #[inline]
    pub unsafe fn OpenSignedAppFileAsync(&self, trustedRoot: AppTrustedRoot, aJarFile: *const nsIFile, callback: *const nsIOpenSignedAppFileCallback) -> nsresult {
        ((*self.vtable).OpenSignedAppFileAsync)(self, trustedRoot, aJarFile, callback)
    }


    /// ```text
    /// /**
    ///    * Vestigial implementation of verifying signed unpacked add-ons. trustedRoot
    ///    * and aUnpackedDir are ignored. The callback is always called with
    ///    * NS_ERROR_SIGNED_JAR_NOT_SIGNED and a null signer cert.
    ///    */
    /// ```
    ///

    /// `[must_use] void verifySignedDirectoryAsync (in AppTrustedRoot trustedRoot, in nsIFile aUnpackedDir, in nsIVerifySignedDirectoryCallback callback);`
    #[inline]
    pub unsafe fn VerifySignedDirectoryAsync(&self, trustedRoot: AppTrustedRoot, aUnpackedDir: *const nsIFile, callback: *const nsIVerifySignedDirectoryCallback) -> nsresult {
        ((*self.vtable).VerifySignedDirectoryAsync)(self, trustedRoot, aUnpackedDir, callback)
    }



    /// `[must_use] nsIX509Cert addCert (in ACString certDER, in ACString trust);`
    #[inline]
    pub unsafe fn AddCert(&self, certDER: &::nsstring::nsACString, trust: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult {
        ((*self.vtable).AddCert)(self, certDER, trust, _retval)
    }


    /// ```text
    /// /** Warning: This interface is inteded to use only for testing only as:
    ///    *    1. It can create IO on the main thread.
    ///    *    2. It is in constant change, so in/out can change at any release.
    ///    *
    ///    *  Obtain the verification result for a cert given a particular usage.
    ///    *  On success, the call returns 0, the chain built during verification,
    ///    *  and whether the cert is good for EV usage.
    ///    *  On failure, the call returns the PRErrorCode for the verification failure
    ///    *
    ///    *  @param aCert Obtain the stored trust of this certificate
    ///    *  @param aUsage a integer representing the usage from NSS
    ///    *  @param aFlags flags as described above
    ///    *  @param aHostname the (optional) hostname to verify for
    ///    *  @param aTime the time at which to verify, in seconds since the epoch
    ///    *  @param aVerifiedChain chain of verification up to the root if success
    ///    *  @param aHasEVPolicy bool that signified that the cert was an EV cert
    ///    *  @return 0 if success or the value or the error code for the verification
    ///    *          failure
    ///    */
    /// ```
    ///

    /// `[must_use] int32_t verifyCertAtTime (in nsIX509Cert aCert, in int64_t aUsage, in uint32_t aFlags, in ACString aHostname, in uint64_t aTime, out nsIX509CertList aVerifiedChain, out bool aHasEVPolicy);`
    #[inline]
    pub unsafe fn VerifyCertAtTime(&self, aCert: *const nsIX509Cert, aUsage: int64_t, aFlags: uint32_t, aHostname: &::nsstring::nsACString, aTime: uint64_t, aVerifiedChain: *mut *const nsIX509CertList, aHasEVPolicy: *mut bool, _retval: *mut int32_t) -> nsresult {
        ((*self.vtable).VerifyCertAtTime)(self, aCert, aUsage, aFlags, aHostname, aTime, aVerifiedChain, aHasEVPolicy, _retval)
    }



    /// `[must_use] int32_t verifyCertNow (in nsIX509Cert aCert, in int64_t aUsage, in uint32_t aFlags, in ACString aHostname, out nsIX509CertList aVerifiedChain, out bool aHasEVPolicy);`
    #[inline]
    pub unsafe fn VerifyCertNow(&self, aCert: *const nsIX509Cert, aUsage: int64_t, aFlags: uint32_t, aHostname: &::nsstring::nsACString, aVerifiedChain: *mut *const nsIX509CertList, aHasEVPolicy: *mut bool, _retval: *mut int32_t) -> nsresult {
        ((*self.vtable).VerifyCertNow)(self, aCert, aUsage, aFlags, aHostname, aVerifiedChain, aHasEVPolicy, _retval)
    }


    /// ```text
    /// /**
    ///    * Similar to the above, but asynchronous. As a result, use of this API is not
    ///    * limited to tests.
    ///    */
    /// ```
    ///

    /// `[must_use] void asyncVerifyCertAtTime (in nsIX509Cert aCert, in int64_t aUsage, in uint32_t aFlags, in ACString aHostname, in uint64_t aTime, in nsICertVerificationCallback aCallback);`
    #[inline]
    pub unsafe fn AsyncVerifyCertAtTime(&self, aCert: *const nsIX509Cert, aUsage: int64_t, aFlags: uint32_t, aHostname: &::nsstring::nsACString, aTime: uint64_t, aCallback: *const nsICertVerificationCallback) -> nsresult {
        ((*self.vtable).AsyncVerifyCertAtTime)(self, aCert, aUsage, aFlags, aHostname, aTime, aCallback)
    }



    /// `[must_use] void clearOCSPCache ();`
    #[inline]
    pub unsafe fn ClearOCSPCache(&self, ) -> nsresult {
        ((*self.vtable).ClearOCSPCache)(self, )
    }



    /// `[must_use] nsIX509Cert addCertFromBase64 (in ACString base64, in ACString trust);`
    #[inline]
    pub unsafe fn AddCertFromBase64(&self, base64: &::nsstring::nsACString, trust: &::nsstring::nsACString, _retval: *mut *const nsIX509Cert) -> nsresult {
        ((*self.vtable).AddCertFromBase64)(self, base64, trust, _retval)
    }



    /// `[must_use] nsIX509CertList getCerts ();`
    #[inline]
    pub unsafe fn GetCerts(&self, _retval: *mut *const nsIX509CertList) -> nsresult {
        ((*self.vtable).GetCerts)(self, _retval)
    }



    /// `[must_use] nsIX509CertList getEnterpriseRoots ();`
    #[inline]
    pub unsafe fn GetEnterpriseRoots(&self, _retval: *mut *const nsIX509CertList) -> nsresult {
        ((*self.vtable).GetEnterpriseRoots)(self, _retval)
    }


}