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


/// `interface nsICacheEntry : 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 nsICacheEntry {
    vtable: *const nsICacheEntryVTable,

    /// 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 nsICacheEntry.
unsafe impl XpCom for nsICacheEntry {
    const IID: nsIID = nsID(0x607c2a2c, 0x0a48, 0x40b9,
        [0xa9, 0x56, 0x8c, 0xf2, 0xbb, 0x98, 0x57, 0xcf]);
}

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

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

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

    /* readonly attribute ACString key; */
    pub GetKey: unsafe extern "system" fn (this: *const nsICacheEntry, aKey: &mut ::nsstring::nsACString) -> nsresult,

    /* readonly attribute uint64_t cacheEntryId; */
    pub GetCacheEntryId: unsafe extern "system" fn (this: *const nsICacheEntry, aCacheEntryId: *mut uint64_t) -> nsresult,

    /* readonly attribute boolean persistent; */
    pub GetPersistent: unsafe extern "system" fn (this: *const nsICacheEntry, aPersistent: *mut bool) -> nsresult,

    /* readonly attribute long fetchCount; */
    pub GetFetchCount: unsafe extern "system" fn (this: *const nsICacheEntry, aFetchCount: *mut libc::int32_t) -> nsresult,

    /* readonly attribute uint32_t lastFetched; */
    pub GetLastFetched: unsafe extern "system" fn (this: *const nsICacheEntry, aLastFetched: *mut uint32_t) -> nsresult,

    /* readonly attribute uint32_t lastModified; */
    pub GetLastModified: unsafe extern "system" fn (this: *const nsICacheEntry, aLastModified: *mut uint32_t) -> nsresult,

    /* readonly attribute uint32_t expirationTime; */
    pub GetExpirationTime: unsafe extern "system" fn (this: *const nsICacheEntry, aExpirationTime: *mut uint32_t) -> nsresult,

    /* void setExpirationTime (in uint32_t expirationTime); */
    pub SetExpirationTime: unsafe extern "system" fn (this: *const nsICacheEntry, expirationTime: uint32_t) -> nsresult,

    /* readonly attribute uint64_t onStartTime; */
    pub GetOnStartTime: unsafe extern "system" fn (this: *const nsICacheEntry, aOnStartTime: *mut uint64_t) -> nsresult,

    /* readonly attribute uint64_t onStopTime; */
    pub GetOnStopTime: unsafe extern "system" fn (this: *const nsICacheEntry, aOnStopTime: *mut uint64_t) -> nsresult,

    /* void setNetworkTimes (in uint64_t onStartTime, in uint64_t onStopTime); */
    pub SetNetworkTimes: unsafe extern "system" fn (this: *const nsICacheEntry, onStartTime: uint64_t, onStopTime: uint64_t) -> nsresult,

    /* void forceValidFor (in unsigned long aSecondsToTheFuture); */
    pub ForceValidFor: unsafe extern "system" fn (this: *const nsICacheEntry, aSecondsToTheFuture: libc::uint32_t) -> nsresult,

    /* readonly attribute boolean isForcedValid; */
    pub GetIsForcedValid: unsafe extern "system" fn (this: *const nsICacheEntry, aIsForcedValid: *mut bool) -> nsresult,

    /* nsIInputStream openInputStream (in long long offset); */
    pub OpenInputStream: unsafe extern "system" fn (this: *const nsICacheEntry, offset: libc::int64_t, _retval: *mut *const nsIInputStream) -> nsresult,

    /* nsIOutputStream openOutputStream (in long long offset); */
    pub OpenOutputStream: unsafe extern "system" fn (this: *const nsICacheEntry, offset: libc::int64_t, _retval: *mut *const nsIOutputStream) -> nsresult,

    /* attribute int64_t predictedDataSize; */
    pub GetPredictedDataSize: unsafe extern "system" fn (this: *const nsICacheEntry, aPredictedDataSize: *mut int64_t) -> nsresult,

    /* attribute int64_t predictedDataSize; */
    pub SetPredictedDataSize: unsafe extern "system" fn (this: *const nsICacheEntry, aPredictedDataSize: int64_t) -> nsresult,

    /* attribute nsISupports securityInfo; */
    pub GetSecurityInfo: unsafe extern "system" fn (this: *const nsICacheEntry, aSecurityInfo: *mut *const nsISupports) -> nsresult,

    /* attribute nsISupports securityInfo; */
    pub SetSecurityInfo: unsafe extern "system" fn (this: *const nsICacheEntry, aSecurityInfo: *const nsISupports) -> nsresult,

    /* readonly attribute unsigned long storageDataSize; */
    pub GetStorageDataSize: unsafe extern "system" fn (this: *const nsICacheEntry, aStorageDataSize: *mut libc::uint32_t) -> nsresult,

    /* void asyncDoom (in nsICacheEntryDoomCallback listener); */
    pub AsyncDoom: unsafe extern "system" fn (this: *const nsICacheEntry, listener: *const nsICacheEntryDoomCallback) -> nsresult,

    /* string getMetaDataElement (in string key); */
    pub GetMetaDataElement: unsafe extern "system" fn (this: *const nsICacheEntry, key: *const libc::c_char, _retval: *mut *const libc::c_char) -> nsresult,

    /* void setMetaDataElement (in string key, in string value); */
    pub SetMetaDataElement: unsafe extern "system" fn (this: *const nsICacheEntry, key: *const libc::c_char, value: *const libc::c_char) -> nsresult,

    /* void visitMetaData (in nsICacheEntryMetaDataVisitor visitor); */
    pub VisitMetaData: unsafe extern "system" fn (this: *const nsICacheEntry, visitor: *const nsICacheEntryMetaDataVisitor) -> nsresult,

    /* void metaDataReady (); */
    pub MetaDataReady: unsafe extern "system" fn (this: *const nsICacheEntry) -> nsresult,

    /* void setValid (); */
    pub SetValid: unsafe extern "system" fn (this: *const nsICacheEntry) -> nsresult,

    /* void dismiss (); */
    pub Dismiss: unsafe extern "system" fn (this: *const nsICacheEntry) -> nsresult,

    /* readonly attribute uint32_t diskStorageSizeInKB; */
    pub GetDiskStorageSizeInKB: unsafe extern "system" fn (this: *const nsICacheEntry, aDiskStorageSizeInKB: *mut uint32_t) -> nsresult,

    /* nsICacheEntry recreate ([optional] in boolean aMemoryOnly); */
    pub Recreate: unsafe extern "system" fn (this: *const nsICacheEntry, aMemoryOnly: bool, _retval: *mut *const nsICacheEntry) -> nsresult,

    /* readonly attribute long long dataSize; */
    pub GetDataSize: unsafe extern "system" fn (this: *const nsICacheEntry, aDataSize: *mut libc::int64_t) -> nsresult,

    /* readonly attribute long long altDataSize; */
    pub GetAltDataSize: unsafe extern "system" fn (this: *const nsICacheEntry, aAltDataSize: *mut libc::int64_t) -> nsresult,

    /* nsIOutputStream openAlternativeOutputStream (in ACString type); */
    pub OpenAlternativeOutputStream: unsafe extern "system" fn (this: *const nsICacheEntry, type_: &::nsstring::nsACString, _retval: *mut *const nsIOutputStream) -> nsresult,

    /* nsIInputStream openAlternativeInputStream (in ACString type); */
    pub OpenAlternativeInputStream: unsafe extern "system" fn (this: *const nsICacheEntry, type_: &::nsstring::nsACString, _retval: *mut *const nsIInputStream) -> nsresult,

    /* readonly attribute nsILoadContextInfo loadContextInfo; */
    pub GetLoadContextInfo: unsafe extern "system" fn (this: *const nsICacheEntry, aLoadContextInfo: *mut *const nsILoadContextInfo) -> nsresult,

    /* void close (); */
    pub Close: unsafe extern "system" fn (this: *const nsICacheEntry) -> nsresult,

    /* void markValid (); */
    pub MarkValid: unsafe extern "system" fn (this: *const nsICacheEntry) -> nsresult,

    /* void maybeMarkValid (); */
    pub MaybeMarkValid: unsafe extern "system" fn (this: *const nsICacheEntry) -> nsresult,

    /* boolean hasWriteAccess (in boolean aWriteAllowed); */
    pub HasWriteAccess: unsafe extern "system" fn (this: *const nsICacheEntry, aWriteAllowed: bool, _retval: *mut 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 nsICacheEntry {
    /// ```text
    /// /**
    ///    * Placeholder for the initial value of expiration time.
    ///    */
    /// ```
    ///

    pub const NO_EXPIRATION_TIME: i64 = 4294967295;

    /// ```text
    /// /**
    ///    * Get the key identifying the cache entry.
    ///    */
    /// ```
    ///

    /// `readonly attribute ACString key;`
    #[inline]
    pub unsafe fn GetKey(&self, aKey: &mut ::nsstring::nsACString) -> nsresult {
        ((*self.vtable).GetKey)(self, aKey)
    }


    /// ```text
    /// /**
    ///    * The unique ID for every nsICacheEntry instance, which can be used to check
    ///    * whether two pieces of information are from the same nsICacheEntry instance.
    ///    */
    /// ```
    ///

    /// `readonly attribute uint64_t cacheEntryId;`
    #[inline]
    pub unsafe fn GetCacheEntryId(&self, aCacheEntryId: *mut uint64_t) -> nsresult {
        ((*self.vtable).GetCacheEntryId)(self, aCacheEntryId)
    }


    /// ```text
    /// /**
    ///    * Whether the entry is memory/only or persisted to disk.
    ///    * Note: private browsing entries are reported as persistent for consistency
    ///    * while are not actually persisted to disk.
    ///    */
    /// ```
    ///

    /// `readonly attribute boolean persistent;`
    #[inline]
    pub unsafe fn GetPersistent(&self, aPersistent: *mut bool) -> nsresult {
        ((*self.vtable).GetPersistent)(self, aPersistent)
    }


    /// ```text
    /// /**
    ///    * Get the number of times the cache entry has been opened.
    ///    */
    /// ```
    ///

    /// `readonly attribute long fetchCount;`
    #[inline]
    pub unsafe fn GetFetchCount(&self, aFetchCount: *mut libc::int32_t) -> nsresult {
        ((*self.vtable).GetFetchCount)(self, aFetchCount)
    }


    /// ```text
    /// /**
    ///    * Get the last time the cache entry was opened (in seconds since the Epoch).
    ///    */
    /// ```
    ///

    /// `readonly attribute uint32_t lastFetched;`
    #[inline]
    pub unsafe fn GetLastFetched(&self, aLastFetched: *mut uint32_t) -> nsresult {
        ((*self.vtable).GetLastFetched)(self, aLastFetched)
    }


    /// ```text
    /// /**
    ///    * Get the last time the cache entry was modified (in seconds since the Epoch).
    ///    */
    /// ```
    ///

    /// `readonly attribute uint32_t lastModified;`
    #[inline]
    pub unsafe fn GetLastModified(&self, aLastModified: *mut uint32_t) -> nsresult {
        ((*self.vtable).GetLastModified)(self, aLastModified)
    }


    /// ```text
    /// /**
    ///    * Get the expiration time of the cache entry (in seconds since the Epoch).
    ///    */
    /// ```
    ///

    /// `readonly attribute uint32_t expirationTime;`
    #[inline]
    pub unsafe fn GetExpirationTime(&self, aExpirationTime: *mut uint32_t) -> nsresult {
        ((*self.vtable).GetExpirationTime)(self, aExpirationTime)
    }


    /// ```text
    /// /**
    ///    * Set the time at which the cache entry should be considered invalid (in
        ///    * seconds since the Epoch).
    ///    */
    /// ```
    ///

    /// `void setExpirationTime (in uint32_t expirationTime);`
    #[inline]
    pub unsafe fn SetExpirationTime(&self, expirationTime: uint32_t) -> nsresult {
        ((*self.vtable).SetExpirationTime)(self, expirationTime)
    }


    /// ```text
    /// /**
    ///    * Get the last network response times for onStartReqeust/onStopRequest (in ms).
    ///    * @throws
    ///    *    - NS_ERROR_NOT_AVAILABLE if onStartTime/onStopTime does not exist.
    ///    */
    /// ```
    ///

    /// `readonly attribute uint64_t onStartTime;`
    #[inline]
    pub unsafe fn GetOnStartTime(&self, aOnStartTime: *mut uint64_t) -> nsresult {
        ((*self.vtable).GetOnStartTime)(self, aOnStartTime)
    }



    /// `readonly attribute uint64_t onStopTime;`
    #[inline]
    pub unsafe fn GetOnStopTime(&self, aOnStopTime: *mut uint64_t) -> nsresult {
        ((*self.vtable).GetOnStopTime)(self, aOnStopTime)
    }


    /// ```text
    /// /**
    ///    * Set the network response times for onStartReqeust/onStopRequest (in ms).
    ///    */
    /// ```
    ///

    /// `void setNetworkTimes (in uint64_t onStartTime, in uint64_t onStopTime);`
    #[inline]
    pub unsafe fn SetNetworkTimes(&self, onStartTime: uint64_t, onStopTime: uint64_t) -> nsresult {
        ((*self.vtable).SetNetworkTimes)(self, onStartTime, onStopTime)
    }


    /// ```text
    /// /**
    ///    * This method is intended to override the per-spec cache validation
    ///    * decisions for a duration specified in seconds. The current state can
    ///    * be examined with isForcedValid (see below). This value is not persisted,
    ///    * so it will not survive session restart. Cache entries that are forced valid
    ///    * will not be evicted from the cache for the duration of forced validity.
    ///    * This means that there is a potential problem if the number of forced valid
    ///    * entries grows to take up more space than the cache size allows.
    ///    *
    ///    * NOTE: entries that have been forced valid will STILL be ignored by HTTP
    ///    * channels if they have expired AND the resource in question requires
    ///    * validation after expiring. This is to avoid using known-stale content.
    ///    *
    ///    * @param aSecondsToTheFuture
    ///    *        the number of seconds the default cache validation behavior will be
    ///    *        overridden before it returns to normal
    ///    */
    /// ```
    ///

    /// `void forceValidFor (in unsigned long aSecondsToTheFuture);`
    #[inline]
    pub unsafe fn ForceValidFor(&self, aSecondsToTheFuture: libc::uint32_t) -> nsresult {
        ((*self.vtable).ForceValidFor)(self, aSecondsToTheFuture)
    }


    /// ```text
    /// /**
    ///    * The state variable for whether this entry is currently forced valid.
    ///    * Defaults to false for normal cache validation behavior, and will return
    ///    * true if the number of seconds set by forceValidFor() has yet to be reached.
    ///    */
    /// ```
    ///

    /// `readonly attribute boolean isForcedValid;`
    #[inline]
    pub unsafe fn GetIsForcedValid(&self, aIsForcedValid: *mut bool) -> nsresult {
        ((*self.vtable).GetIsForcedValid)(self, aIsForcedValid)
    }


    /// ```text
    /// /**
    ///    * Open blocking input stream to cache data.  Use the stream transport
    ///    * service to asynchronously read this stream on a background thread.
    ///    * The returned stream MAY implement nsISeekableStream.
    ///    *
    ///    * @param offset
    ///    *        read starting from this offset into the cached data.  an offset
    ///    *        beyond the end of the stream has undefined consequences.
    ///    *
    ///    * @return non-blocking, buffered input stream.
    ///    */
    /// ```
    ///

    /// `nsIInputStream openInputStream (in long long offset);`
    #[inline]
    pub unsafe fn OpenInputStream(&self, offset: libc::int64_t, _retval: *mut *const nsIInputStream) -> nsresult {
        ((*self.vtable).OpenInputStream)(self, offset, _retval)
    }


    /// ```text
    /// /**
    ///    * Open non-blocking output stream to cache data.  The returned stream
    ///    * MAY implement nsISeekableStream.
    ///    *
    ///    * If opening an output stream to existing cached data, the data will be
    ///    * truncated to the specified offset.
    ///    *
    ///    * @param offset
    ///    *        write starting from this offset into the cached data.  an offset
    ///    *        beyond the end of the stream has undefined consequences.
    ///    *
    ///    * @return blocking, buffered output stream.
    ///    */
    /// ```
    ///

    /// `nsIOutputStream openOutputStream (in long long offset);`
    #[inline]
    pub unsafe fn OpenOutputStream(&self, offset: libc::int64_t, _retval: *mut *const nsIOutputStream) -> nsresult {
        ((*self.vtable).OpenOutputStream)(self, offset, _retval)
    }


    /// ```text
    /// /**
    ///     * Stores the Content-Length specified in the HTTP header for this
    ///     * entry. Checked before we write to the cache entry, to prevent ever
    ///     * taking up space in the cache for an entry that we know up front
    ///     * is going to have to be evicted anyway. See bug 588507.
    ///     */
    /// ```
    ///

    /// `attribute int64_t predictedDataSize;`
    #[inline]
    pub unsafe fn GetPredictedDataSize(&self, aPredictedDataSize: *mut int64_t) -> nsresult {
        ((*self.vtable).GetPredictedDataSize)(self, aPredictedDataSize)
    }


    /// ```text
    /// /**
    ///     * Stores the Content-Length specified in the HTTP header for this
    ///     * entry. Checked before we write to the cache entry, to prevent ever
    ///     * taking up space in the cache for an entry that we know up front
    ///     * is going to have to be evicted anyway. See bug 588507.
    ///     */
    /// ```
    ///

    /// `attribute int64_t predictedDataSize;`
    #[inline]
    pub unsafe fn SetPredictedDataSize(&self, aPredictedDataSize: int64_t) -> nsresult {
        ((*self.vtable).SetPredictedDataSize)(self, aPredictedDataSize)
    }


    /// ```text
    /// /**
    ///    * Get/set security info on the cache entry for this descriptor.
    ///    */
    /// ```
    ///

    /// `attribute nsISupports securityInfo;`
    #[inline]
    pub unsafe fn GetSecurityInfo(&self, aSecurityInfo: *mut *const nsISupports) -> nsresult {
        ((*self.vtable).GetSecurityInfo)(self, aSecurityInfo)
    }


    /// ```text
    /// /**
    ///    * Get/set security info on the cache entry for this descriptor.
    ///    */
    /// ```
    ///

    /// `attribute nsISupports securityInfo;`
    #[inline]
    pub unsafe fn SetSecurityInfo(&self, aSecurityInfo: *const nsISupports) -> nsresult {
        ((*self.vtable).SetSecurityInfo)(self, aSecurityInfo)
    }


    /// ```text
    /// /**
    ///    * Get the size of the cache entry data, as stored. This may differ
    ///    * from the entry's dataSize, if the entry is compressed.
    ///    */
    /// ```
    ///

    /// `readonly attribute unsigned long storageDataSize;`
    #[inline]
    pub unsafe fn GetStorageDataSize(&self, aStorageDataSize: *mut libc::uint32_t) -> nsresult {
        ((*self.vtable).GetStorageDataSize)(self, aStorageDataSize)
    }


    /// ```text
    /// /**
    ///    * Asynchronously doom an entry. Listener will be notified about the status
    ///    * of the operation. Null may be passed if caller doesn't care about the
    ///    * result.
    ///    */
    /// ```
    ///

    /// `void asyncDoom (in nsICacheEntryDoomCallback listener);`
    #[inline]
    pub unsafe fn AsyncDoom(&self, listener: *const nsICacheEntryDoomCallback) -> nsresult {
        ((*self.vtable).AsyncDoom)(self, listener)
    }


    /// ```text
    /// /**
    ///    * Methods for accessing meta data.  Meta data is a table of key/value
    ///    * string pairs.  The strings do not have to conform to any particular
    ///    * charset, but they must be null terminated.
    ///    */
    /// ```
    ///

    /// `string getMetaDataElement (in string key);`
    #[inline]
    pub unsafe fn GetMetaDataElement(&self, key: *const libc::c_char, _retval: *mut *const libc::c_char) -> nsresult {
        ((*self.vtable).GetMetaDataElement)(self, key, _retval)
    }



    /// `void setMetaDataElement (in string key, in string value);`
    #[inline]
    pub unsafe fn SetMetaDataElement(&self, key: *const libc::c_char, value: *const libc::c_char) -> nsresult {
        ((*self.vtable).SetMetaDataElement)(self, key, value)
    }


    /// ```text
    /// /**
    ///    * Obtain the list of metadata keys this entry keeps.
    ///    *
    ///    * NOTE: The callback is invoked under the CacheFile's lock.  It means
    ///    * there should not be made any calls to the entry from the visitor and
    ///    * if the values need to be processed somehow, it's better to cache them
    ///    * and process outside the callback.
    ///    */
    /// ```
    ///

    /// `void visitMetaData (in nsICacheEntryMetaDataVisitor visitor);`
    #[inline]
    pub unsafe fn VisitMetaData(&self, visitor: *const nsICacheEntryMetaDataVisitor) -> nsresult {
        ((*self.vtable).VisitMetaData)(self, visitor)
    }


    /// ```text
    /// /**
    ///    * Claims that all metadata on this entry are up-to-date and this entry
    ///    * now can be delivered to other waiting consumers.
    ///    *
    ///    * We need such method since metadata must be delivered synchronously.
    ///    */
    /// ```
    ///

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


    /// ```text
    /// /**
    ///    * Called by consumer upon 304/206 response from the server.  This marks
    ///    * the entry content as positively revalidated.
    ///    * Consumer uses this method after the consumer has returned ENTRY_NEEDS_REVALIDATION
    ///    * result from onCacheEntryCheck and after successfull revalidation with the server.
    ///    */
    /// ```
    ///

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


    /// ```text
    /// /**
    ///    * Explicitly tell the cache backend this consumer is no longer going to modify
    ///    * this cache entry data or metadata.  In case the consumer was responsible to
    ///    * either of writing the cache entry or revalidating it, calling this method
    ///    * reverts the state to initial (as never written) or as not-validated and
    ///    * immediately notifies the next consumer in line waiting for this entry.
    ///    * This is the way to prevent deadlocks when someone else than the responsible
    ///    * channel references the cache entry being in a non-written or revalidating
    ///    * state.
    ///    */
    /// ```
    ///

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


    /// ```text
    /// /**
    ///    * Returns the size in kilobytes used to store the cache entry on disk.
    ///    */
    /// ```
    ///

    /// `readonly attribute uint32_t diskStorageSizeInKB;`
    #[inline]
    pub unsafe fn GetDiskStorageSizeInKB(&self, aDiskStorageSizeInKB: *mut uint32_t) -> nsresult {
        ((*self.vtable).GetDiskStorageSizeInKB)(self, aDiskStorageSizeInKB)
    }


    /// ```text
    /// /**
    ///    * Doom this entry and open a new, empty, entry for write.  Consumer has
    ///    * to exchange the entry this method is called on for the newly created.
    ///    * Used on 200 responses to conditional requests.
    ///    *
    ///    * @param aMemoryOnly
    ///    *    - whether the entry is to be created as memory/only regardless how
    ///    *      the entry being recreated persistence is set
    ///    * @returns
    ///    *    - an entry that can be used to write to
    ///    * @throws
    ///    *    - NS_ERROR_NOT_AVAILABLE when the entry cannot be from some reason
    ///    *      recreated for write
    ///    */
    /// ```
    ///

    /// `nsICacheEntry recreate ([optional] in boolean aMemoryOnly);`
    #[inline]
    pub unsafe fn Recreate(&self, aMemoryOnly: bool, _retval: *mut *const nsICacheEntry) -> nsresult {
        ((*self.vtable).Recreate)(self, aMemoryOnly, _retval)
    }


    /// ```text
    /// /**
    ///    * Returns the length of data this entry holds.
    ///    * @throws
    ///    *    NS_ERROR_IN_PROGRESS when the write is still in progress.
    ///    */
    /// ```
    ///

    /// `readonly attribute long long dataSize;`
    #[inline]
    pub unsafe fn GetDataSize(&self, aDataSize: *mut libc::int64_t) -> nsresult {
        ((*self.vtable).GetDataSize)(self, aDataSize)
    }


    /// ```text
    /// /**
    ///   * Returns the length of data this entry holds.
    ///   * @throws
    ///   *    - NS_ERROR_IN_PROGRESS when a write is still in progress (either real
        ///                               content or alt data).
    ///   *    - NS_ERROR_NOT_AVAILABLE if alt data does not exist.
    ///   */
    /// ```
    ///

    /// `readonly attribute long long altDataSize;`
    #[inline]
    pub unsafe fn GetAltDataSize(&self, aAltDataSize: *mut libc::int64_t) -> nsresult {
        ((*self.vtable).GetAltDataSize)(self, aAltDataSize)
    }


    /// ```text
    /// /**
    ///    * Opens and returns an output stream that a consumer may use to save an
    ///    * alternate representation of the data.
    ///    * @throws
    ///    *    - NS_ERROR_NOT_AVAILABLE if the real data hasn't been written.
    ///    *    - NS_ERROR_IN_PROGRESS when the writing regular content or alt-data to
    ///    *      the cache entry is still in progress.
    ///    *
    ///    * If there is alt-data already saved, it will be overwritten.
    ///    */
    /// ```
    ///

    /// `nsIOutputStream openAlternativeOutputStream (in ACString type);`
    #[inline]
    pub unsafe fn OpenAlternativeOutputStream(&self, type_: &::nsstring::nsACString, _retval: *mut *const nsIOutputStream) -> nsresult {
        ((*self.vtable).OpenAlternativeOutputStream)(self, type_, _retval)
    }


    /// ```text
    /// /**
    ///    * Opens and returns an input stream that can be used to read the alternative
    ///    * representation previously saved in the cache.
    ///    * If this call is made while writing alt-data is still in progress, it is
    ///    * still possible to read content from the input stream as it's being written.
    ///    * @throws
    ///    *    - NS_ERROR_NOT_AVAILABLE if the alt-data representation doesn't exist at
    ///    *      all or if alt-data of the given type doesn't exist.
    ///    */
    /// ```
    ///

    /// `nsIInputStream openAlternativeInputStream (in ACString type);`
    #[inline]
    pub unsafe fn OpenAlternativeInputStream(&self, type_: &::nsstring::nsACString, _retval: *mut *const nsIInputStream) -> nsresult {
        ((*self.vtable).OpenAlternativeInputStream)(self, type_, _retval)
    }


    /// ```text
    /// /**
    ///    * Get the nsILoadContextInfo of the cache entry
    ///    */
    /// ```
    ///

    /// `readonly attribute nsILoadContextInfo loadContextInfo;`
    #[inline]
    pub unsafe fn GetLoadContextInfo(&self, aLoadContextInfo: *mut *const nsILoadContextInfo) -> nsresult {
        ((*self.vtable).GetLoadContextInfo)(self, aLoadContextInfo)
    }


    /// ```text
    /// /****************************************************************************
    ///    * The following methods might be added to some nsICacheEntryInternal
    ///    * interface since we want to remove them as soon as the old cache backend is
    ///    * completely removed.
    ///    */
    /// /**
    ///    * @deprecated
    ///    * FOR BACKWARD COMPATIBILITY ONLY
    ///    * When the old cache backend is eventually removed, this method
    ///    * can be removed too.
    ///    *
    ///    * In the new backend: this method is no-op
    ///    * In the old backend: this method delegates to nsICacheEntryDescriptor.close()
    ///    */
    /// ```
    ///

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


    /// ```text
    /// /**
    ///    * @deprecated
    ///    * FOR BACKWARD COMPATIBILITY ONLY
    ///    * Marks the entry as valid so that others can use it and get only readonly
    ///    * access when the entry is held by the 1st writer.
    ///    */
    /// ```
    ///

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


    /// ```text
    /// /**
    ///    * @deprecated
    ///    * FOR BACKWARD COMPATIBILITY ONLY
    ///    * Marks the entry as valid when write access is acquired.
    ///    */
    /// ```
    ///

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


    /// ```text
    /// /**
    ///    * @deprecated
    ///    * FOR BACKWARD COMPATIBILITY ONLY / KINDA HACK
    ///    * @param aWriteAllowed
    ///    *    Consumer indicates whether write to the entry is allowed for it.
    ///    *    Depends on implementation how the flag is handled.
    ///    * @returns
    ///    *    true when write access is acquired for this entry,
    ///    *    false otherwise
    ///    */
    /// ```
    ///

    /// `boolean hasWriteAccess (in boolean aWriteAllowed);`
    #[inline]
    pub unsafe fn HasWriteAccess(&self, aWriteAllowed: bool, _retval: *mut bool) -> nsresult {
        ((*self.vtable).HasWriteAccess)(self, aWriteAllowed, _retval)
    }


}


/// `interface nsICacheEntryMetaDataVisitor : 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 nsICacheEntryMetaDataVisitor {
    vtable: *const nsICacheEntryMetaDataVisitorVTable,

    /// 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 nsICacheEntryMetaDataVisitor.
unsafe impl XpCom for nsICacheEntryMetaDataVisitor {
    const IID: nsIID = nsID(0xfea3e276, 0x6ba5, 0x4ceb,
        [0xa5, 0x81, 0x80, 0x7d, 0x1f, 0x43, 0xf6, 0xd0]);
}

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

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

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

    /* void onMetaDataElement (in string key, in string value); */
    pub OnMetaDataElement: unsafe extern "system" fn (this: *const nsICacheEntryMetaDataVisitor, key: *const libc::c_char, value: *const libc::c_char) -> 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 nsICacheEntryMetaDataVisitor {

    /// ```text
    /// /**
    ///  * Argument for nsICacheEntry.visitMetaData, provides access to all metadata
    ///  * keys and values stored on the entry.
    ///  */
    /// /**
    ///    * Called over each key / value pair.
    ///    */
    /// ```
    ///

    /// `void onMetaDataElement (in string key, in string value);`
    #[inline]
    pub unsafe fn OnMetaDataElement(&self, key: *const libc::c_char, value: *const libc::c_char) -> nsresult {
        ((*self.vtable).OnMetaDataElement)(self, key, value)
    }


}