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


/// `interface nsIChannel : nsIRequest`
///


// 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 nsIChannel {
    vtable: *const nsIChannelVTable,

    /// 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 nsIChannel.
unsafe impl XpCom for nsIChannel {
    const IID: nsIID = nsID(0x2c389865, 0x23db, 0x4aa7,
        [0x9f, 0xe5, 0x60, 0xcc, 0x7b, 0x00, 0x69, 0x7e]);
}

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

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

impl nsIChannel {
    /// Cast this `nsIChannel` to one of its base interfaces.
    #[inline]
    pub fn coerce<T: nsIChannelCoerce>(&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 nsIChannel {
    type Target = nsIRequest;
    #[inline]
    fn deref(&self) -> &nsIRequest {
        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: nsIRequestCoerce> nsIChannelCoerce for T {
    #[inline]
    fn coerce_from(v: &nsIChannel) -> &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 nsIChannel
// 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 nsIChannelVTable {
    /// We need to include the members from the base interface's vtable at the start
    /// of the VTable definition.
    pub __base: nsIRequestVTable,

    /* attribute nsIURI originalURI; */
    pub GetOriginalURI: unsafe extern "system" fn (this: *const nsIChannel, aOriginalURI: *mut *const nsIURI) -> nsresult,

    /* attribute nsIURI originalURI; */
    pub SetOriginalURI: unsafe extern "system" fn (this: *const nsIChannel, aOriginalURI: *const nsIURI) -> nsresult,

    /* readonly attribute nsIURI URI; */
    pub GetURI: unsafe extern "system" fn (this: *const nsIChannel, aURI: *mut *const nsIURI) -> nsresult,

    /* attribute nsISupports owner; */
    pub GetOwner: unsafe extern "system" fn (this: *const nsIChannel, aOwner: *mut *const nsISupports) -> nsresult,

    /* attribute nsISupports owner; */
    pub SetOwner: unsafe extern "system" fn (this: *const nsIChannel, aOwner: *const nsISupports) -> nsresult,

    /* attribute nsIInterfaceRequestor notificationCallbacks; */
    pub GetNotificationCallbacks: unsafe extern "system" fn (this: *const nsIChannel, aNotificationCallbacks: *mut *const nsIInterfaceRequestor) -> nsresult,

    /* attribute nsIInterfaceRequestor notificationCallbacks; */
    pub SetNotificationCallbacks: unsafe extern "system" fn (this: *const nsIChannel, aNotificationCallbacks: *const nsIInterfaceRequestor) -> nsresult,

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

    /* attribute ACString contentType; */
    pub GetContentType: unsafe extern "system" fn (this: *const nsIChannel, aContentType: &mut ::nsstring::nsACString) -> nsresult,

    /* attribute ACString contentType; */
    pub SetContentType: unsafe extern "system" fn (this: *const nsIChannel, aContentType: &::nsstring::nsACString) -> nsresult,

    /* attribute ACString contentCharset; */
    pub GetContentCharset: unsafe extern "system" fn (this: *const nsIChannel, aContentCharset: &mut ::nsstring::nsACString) -> nsresult,

    /* attribute ACString contentCharset; */
    pub SetContentCharset: unsafe extern "system" fn (this: *const nsIChannel, aContentCharset: &::nsstring::nsACString) -> nsresult,

    /* attribute int64_t contentLength; */
    pub GetContentLength: unsafe extern "system" fn (this: *const nsIChannel, aContentLength: *mut int64_t) -> nsresult,

    /* attribute int64_t contentLength; */
    pub SetContentLength: unsafe extern "system" fn (this: *const nsIChannel, aContentLength: int64_t) -> nsresult,

    /* nsIInputStream open (); */
    pub Open: unsafe extern "system" fn (this: *const nsIChannel, _retval: *mut *const nsIInputStream) -> nsresult,

    /* nsIInputStream open2 (); */
    pub Open2: unsafe extern "system" fn (this: *const nsIChannel, _retval: *mut *const nsIInputStream) -> nsresult,

    /* void asyncOpen (in nsIStreamListener aListener, in nsISupports aContext); */
    pub AsyncOpen: unsafe extern "system" fn (this: *const nsIChannel, aListener: *const nsIStreamListener, aContext: *const nsISupports) -> nsresult,

    /* void asyncOpen2 (in nsIStreamListener aListener); */
    pub AsyncOpen2: unsafe extern "system" fn (this: *const nsIChannel, aListener: *const nsIStreamListener) -> nsresult,

    /* attribute unsigned long contentDisposition; */
    pub GetContentDisposition: unsafe extern "system" fn (this: *const nsIChannel, aContentDisposition: *mut libc::uint32_t) -> nsresult,

    /* attribute unsigned long contentDisposition; */
    pub SetContentDisposition: unsafe extern "system" fn (this: *const nsIChannel, aContentDisposition: libc::uint32_t) -> nsresult,

    /* attribute AString contentDispositionFilename; */
    pub GetContentDispositionFilename: unsafe extern "system" fn (this: *const nsIChannel, aContentDispositionFilename: &mut ::nsstring::nsAString) -> nsresult,

    /* attribute AString contentDispositionFilename; */
    pub SetContentDispositionFilename: unsafe extern "system" fn (this: *const nsIChannel, aContentDispositionFilename: &::nsstring::nsAString) -> nsresult,

    /* readonly attribute ACString contentDispositionHeader; */
    pub GetContentDispositionHeader: unsafe extern "system" fn (this: *const nsIChannel, aContentDispositionHeader: &mut ::nsstring::nsACString) -> nsresult,

    /* attribute nsILoadInfo loadInfo; */
    pub GetLoadInfo: unsafe extern "system" fn (this: *const nsIChannel, aLoadInfo: *mut *const nsILoadInfo) -> nsresult,

    /* attribute nsILoadInfo loadInfo; */
    pub SetLoadInfo: unsafe extern "system" fn (this: *const nsIChannel, aLoadInfo: *const nsILoadInfo) -> nsresult,

    /* readonly attribute bool isDocument; */
    pub GetIsDocument: unsafe extern "system" fn (this: *const nsIChannel, aIsDocument: *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 nsIChannel {
    /// ```text
    /// /**************************************************************************
    ///      * Channel specific load flags:
    ///      *
    ///      * Bits 26-31 are reserved for future use by this interface or one of its
    ///      * derivatives (e.g., see nsICachingChannel).
    ///      */
    /// /**
    ///      * Set (e.g., by the docshell) to indicate whether or not the channel
    ///      * corresponds to a document URI.
    ///      * While setting this flag is sufficient to mark a channel as a document
    ///      * load, _checking_ whether the channel is a document load requires the use
    ///      * of the new channel.isDocument
    ///      */
    /// ```
    ///

    pub const LOAD_DOCUMENT_URI: i64 = 65536;

    /// ```text
    /// /**
    ///      * If the end consumer for this load has been retargeted after discovering
    ///      * its content, this flag will be set:
    ///      */
    /// ```
    ///

    pub const LOAD_RETARGETED_DOCUMENT_URI: i64 = 131072;

    /// ```text
    /// /**
    ///      * This flag is set to indicate that this channel is replacing another
    ///      * channel.  This means that:
    ///      *
    ///      * 1) the stream listener this channel will be notifying was initially
///      *    passed to the asyncOpen method of some other channel
///      *
///      *   and
///      *
///      * 2) this channel's URI is a better identifier of the resource being
///      *    accessed than this channel's originalURI.
///      *
///      * This flag can be set, for example, for redirects or for cases when a
///      * single channel has multiple parts to it (and thus can follow
///      * onStopRequest with another onStartRequest/onStopRequest pair, each pair
///      * for a different request).
///      */
/// ```
///

pub const LOAD_REPLACE: i64 = 262144;

/// ```text
/// /**
///      * Set (e.g., by the docshell) to indicate whether or not the channel
///      * corresponds to an initial document URI load (e.g., link click).
///      */
/// ```
///

pub const LOAD_INITIAL_DOCUMENT_URI: i64 = 524288;

/// ```text
/// /**
///      * Set (e.g., by the URILoader) to indicate whether or not the end consumer
///      * for this load has been determined.
///      */
/// ```
///

pub const LOAD_TARGETED: i64 = 1048576;

/// ```text
/// /**
///      * If this flag is set, the channel should call the content sniffers as
///      * described in nsNetCID.h about NS_CONTENT_SNIFFER_CATEGORY.
///      *
///      * Note: Channels may ignore this flag; however, new channel implementations
///      * should only do so with good reason.
///      */
/// ```
///

pub const LOAD_CALL_CONTENT_SNIFFERS: i64 = 2097152;

/// ```text
/// /**
///      * This flag tells the channel to use URI classifier service to check
///      * the URI when opening the channel.
///      */
/// ```
///

pub const LOAD_CLASSIFY_URI: i64 = 4194304;

/// ```text
/// /**
///      * If this flag is set, the media-type content sniffer will be allowed
///      * to override any server-set content-type. Otherwise it will only
///      * be allowed to override "no content type" and application/octet-stream.
///      */
/// ```
///

pub const LOAD_MEDIA_SNIFFER_OVERRIDES_CONTENT_TYPE: i64 = 8388608;

/// ```text
/// /**
///      * Set to let explicitely provided credentials be used over credentials
///      * we have cached previously. In some situations like form login using HTTP
///      * auth via XMLHttpRequest we need to let consumers override the cached
///      * credentials explicitely. For form login 403 response instead of 401 is
///      * usually used to prevent an auth dialog. But any code other then 401/7
///      * will leave original credentials in the cache and there is then no way
///      * to override them for the same user name.
///      */
/// ```
///

pub const LOAD_EXPLICIT_CREDENTIALS: i64 = 16777216;

/// ```text
/// /**
///      * Set to force bypass of any service worker interception of the channel.
///      */
/// ```
///

pub const LOAD_BYPASS_SERVICE_WORKER: i64 = 33554432;


pub const DISPOSITION_INLINE: i64 = 0;


pub const DISPOSITION_ATTACHMENT: i64 = 1;

/// ```text
/// /**
///  * The nsIChannel interface allows clients to construct "GET" requests for
///  * specific protocols, and manage them in a uniform way.  Once a channel is
///  * created (via nsIIOService::newChannel), parameters for that request may
///  * be set by using the channel attributes, or by QI'ing to a subclass of
///  * nsIChannel for protocol-specific parameters.  Then, the URI can be fetched
///  * by calling nsIChannel::open or nsIChannel::asyncOpen.
///  *
///  * After a request has been completed, the channel is still valid for accessing
///  * protocol-specific results.  For example, QI'ing to nsIHttpChannel allows
///  * response headers to be retrieved for the corresponding http transaction.
///  *
///  * This interface must be used only from the XPCOM main thread.
///  */
/// /**
///      * The original URI used to construct the channel. This is used in
///      * the case of a redirect or URI "resolution" (e.g. resolving a
///      * resource: URI to a file: URI) so that the original pre-redirect
///      * URI can still be obtained.  This is never null.  Attempts to
///      * set it to null must throw.
///      *
///      * NOTE: this is distinctly different from the http Referer (referring URI),
///      * which is typically the page that contained the original URI (accessible
///      * from nsIHttpChannel).
///      */
/// ```
///

/// `attribute nsIURI originalURI;`
#[inline]
pub unsafe fn GetOriginalURI(&self, aOriginalURI: *mut *const nsIURI) -> nsresult {
((*self.vtable).GetOriginalURI)(self, aOriginalURI)
}


/// ```text
/// /**
///  * The nsIChannel interface allows clients to construct "GET" requests for
///  * specific protocols, and manage them in a uniform way.  Once a channel is
///  * created (via nsIIOService::newChannel), parameters for that request may
///  * be set by using the channel attributes, or by QI'ing to a subclass of
///  * nsIChannel for protocol-specific parameters.  Then, the URI can be fetched
///  * by calling nsIChannel::open or nsIChannel::asyncOpen.
///  *
///  * After a request has been completed, the channel is still valid for accessing
///  * protocol-specific results.  For example, QI'ing to nsIHttpChannel allows
///  * response headers to be retrieved for the corresponding http transaction.
///  *
///  * This interface must be used only from the XPCOM main thread.
///  */
/// /**
///      * The original URI used to construct the channel. This is used in
///      * the case of a redirect or URI "resolution" (e.g. resolving a
///      * resource: URI to a file: URI) so that the original pre-redirect
///      * URI can still be obtained.  This is never null.  Attempts to
///      * set it to null must throw.
///      *
///      * NOTE: this is distinctly different from the http Referer (referring URI),
///      * which is typically the page that contained the original URI (accessible
///      * from nsIHttpChannel).
///      */
/// ```
///

/// `attribute nsIURI originalURI;`
#[inline]
pub unsafe fn SetOriginalURI(&self, aOriginalURI: *const nsIURI) -> nsresult {
((*self.vtable).SetOriginalURI)(self, aOriginalURI)
}


/// ```text
/// /**
///      * The URI corresponding to the channel.  Its value is immutable.
///      */
/// ```
///

/// `readonly attribute nsIURI URI;`
#[inline]
pub unsafe fn GetURI(&self, aURI: *mut *const nsIURI) -> nsresult {
((*self.vtable).GetURI)(self, aURI)
}


/// ```text
/// /**
///      * The owner, corresponding to the entity that is responsible for this
///      * channel.  Used by the security manager to grant or deny privileges to
///      * mobile code loaded from this channel.
///      *
///      * NOTE: this is a strong reference to the owner, so if the owner is also
///      * holding a strong reference to the channel, care must be taken to
///      * explicitly drop its reference to the channel.
///      */
/// ```
///

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


/// ```text
/// /**
///      * The owner, corresponding to the entity that is responsible for this
///      * channel.  Used by the security manager to grant or deny privileges to
///      * mobile code loaded from this channel.
///      *
///      * NOTE: this is a strong reference to the owner, so if the owner is also
///      * holding a strong reference to the channel, care must be taken to
///      * explicitly drop its reference to the channel.
///      */
/// ```
///

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


/// ```text
/// /**
///      * The notification callbacks for the channel.  This is set by clients, who
///      * wish to provide a means to receive progress, status and protocol-specific
///      * notifications.  If this value is NULL, the channel implementation may use
///      * the notification callbacks from its load group.  The channel may also
///      * query the notification callbacks from its load group if its notification
///      * callbacks do not supply the requested interface.
///      *
///      * Interfaces commonly requested include: nsIProgressEventSink, nsIPrompt,
///      * and nsIAuthPrompt/nsIAuthPrompt2.
///      *
///      * When the channel is done, it must not continue holding references to
///      * this object.
///      *
///      * NOTE: A channel implementation should take care when "caching" an
///      * interface pointer queried from its notification callbacks.  If the
///      * notification callbacks are changed, then a cached interface pointer may
///      * become invalid and may therefore need to be re-queried.
///      */
/// ```
///

/// `attribute nsIInterfaceRequestor notificationCallbacks;`
#[inline]
pub unsafe fn GetNotificationCallbacks(&self, aNotificationCallbacks: *mut *const nsIInterfaceRequestor) -> nsresult {
((*self.vtable).GetNotificationCallbacks)(self, aNotificationCallbacks)
}


/// ```text
/// /**
///      * The notification callbacks for the channel.  This is set by clients, who
///      * wish to provide a means to receive progress, status and protocol-specific
///      * notifications.  If this value is NULL, the channel implementation may use
///      * the notification callbacks from its load group.  The channel may also
///      * query the notification callbacks from its load group if its notification
///      * callbacks do not supply the requested interface.
///      *
///      * Interfaces commonly requested include: nsIProgressEventSink, nsIPrompt,
///      * and nsIAuthPrompt/nsIAuthPrompt2.
///      *
///      * When the channel is done, it must not continue holding references to
///      * this object.
///      *
///      * NOTE: A channel implementation should take care when "caching" an
///      * interface pointer queried from its notification callbacks.  If the
///      * notification callbacks are changed, then a cached interface pointer may
///      * become invalid and may therefore need to be re-queried.
///      */
/// ```
///

/// `attribute nsIInterfaceRequestor notificationCallbacks;`
#[inline]
pub unsafe fn SetNotificationCallbacks(&self, aNotificationCallbacks: *const nsIInterfaceRequestor) -> nsresult {
((*self.vtable).SetNotificationCallbacks)(self, aNotificationCallbacks)
}


/// ```text
/// /**
///      * Transport-level security information (if any) corresponding to the
///      * channel.
///      *
///      * NOTE: In some circumstances TLS information is propagated onto
///      * non-nsIHttpChannel objects to indicate that their contents were likely
///      * delivered over TLS all the same.  For example, document.open() may
///      * create an nsWyciwygChannel to store the data that will be written to the
///      * document.  In that case, if the caller has TLS information, we propagate
///      * that info onto the nsWyciwygChannel given that it is likely that the
///      * caller will be writing data that was delivered over TLS to the document.
///      */
/// ```
///

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


/// ```text
/// /**
///      * The MIME type of the channel's content if available.
///      *
///      * NOTE: the content type can often be wrongly specified (e.g., wrong file
///      * extension, wrong MIME type, wrong document type stored on a server, etc.),
///      * and the caller most likely wants to verify with the actual data.
///      *
///      * Setting contentType before the channel has been opened provides a hint
///      * to the channel as to what the MIME type is.  The channel may ignore this
///      * hint in deciding on the actual MIME type that it will report.
///      *
///      * Setting contentType after onStartRequest has been fired or after open()
///      * is called will override the type determined by the channel.
///      *
///      * Setting contentType between the time that asyncOpen() is called and the
///      * time when onStartRequest is fired has undefined behavior at this time.
///      *
///      * The value of the contentType attribute is a lowercase string.  A value
///      * assigned to this attribute will be parsed and normalized as follows:
///      *  1- any parameters (delimited with a ';') will be stripped.
///      *  2- if a charset parameter is given, then its value will replace the
///      *     the contentCharset attribute of the channel.
///      *  3- the stripped contentType will be lowercased.
///      * Any implementation of nsIChannel must follow these rules.
///      */
/// ```
///

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


/// ```text
/// /**
///      * The MIME type of the channel's content if available.
///      *
///      * NOTE: the content type can often be wrongly specified (e.g., wrong file
///      * extension, wrong MIME type, wrong document type stored on a server, etc.),
///      * and the caller most likely wants to verify with the actual data.
///      *
///      * Setting contentType before the channel has been opened provides a hint
///      * to the channel as to what the MIME type is.  The channel may ignore this
///      * hint in deciding on the actual MIME type that it will report.
///      *
///      * Setting contentType after onStartRequest has been fired or after open()
///      * is called will override the type determined by the channel.
///      *
///      * Setting contentType between the time that asyncOpen() is called and the
///      * time when onStartRequest is fired has undefined behavior at this time.
///      *
///      * The value of the contentType attribute is a lowercase string.  A value
///      * assigned to this attribute will be parsed and normalized as follows:
///      *  1- any parameters (delimited with a ';') will be stripped.
///      *  2- if a charset parameter is given, then its value will replace the
///      *     the contentCharset attribute of the channel.
///      *  3- the stripped contentType will be lowercased.
///      * Any implementation of nsIChannel must follow these rules.
///      */
/// ```
///

/// `attribute ACString contentType;`
#[inline]
pub unsafe fn SetContentType(&self, aContentType: &::nsstring::nsACString) -> nsresult {
((*self.vtable).SetContentType)(self, aContentType)
}


/// ```text
/// /**
///      * The character set of the channel's content if available and if applicable.
///      * This attribute only applies to textual data.
///      *
///      * The value of the contentCharset attribute is a mixedcase string.
///      */
/// ```
///

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


/// ```text
/// /**
///      * The character set of the channel's content if available and if applicable.
///      * This attribute only applies to textual data.
///      *
///      * The value of the contentCharset attribute is a mixedcase string.
///      */
/// ```
///

/// `attribute ACString contentCharset;`
#[inline]
pub unsafe fn SetContentCharset(&self, aContentCharset: &::nsstring::nsACString) -> nsresult {
((*self.vtable).SetContentCharset)(self, aContentCharset)
}


/// ```text
/// /**
///      * The length of the data associated with the channel if available.  A value
///      * of -1 indicates that the content length is unknown. Note that this is a
///      * 64-bit value and obsoletes the "content-length" property used on some
///      * channels.
///      */
/// ```
///

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


/// ```text
/// /**
///      * The length of the data associated with the channel if available.  A value
///      * of -1 indicates that the content length is unknown. Note that this is a
///      * 64-bit value and obsoletes the "content-length" property used on some
///      * channels.
///      */
/// ```
///

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


/// ```text
/// /**
///      * Synchronously open the channel.
///      *
///      * @return blocking input stream to the channel's data.
///      *
///      * NOTE: nsIChannel implementations are not required to implement this
///      * method.  Moreover, since this method may block the calling thread, it
///      * should not be called on a thread that processes UI events.  Like any
///      * other nsIChannel method it must not be called on any thread other
///      * than the XPCOM main thread.
///      *
///      * NOTE: Implementations should throw NS_ERROR_IN_PROGRESS if the channel
///      * is reopened.
///      */
/// ```
///

/// `nsIInputStream open ();`
#[inline]
pub unsafe fn Open(&self, _retval: *mut *const nsIInputStream) -> nsresult {
((*self.vtable).Open)(self, _retval)
}


/// ```text
/// /**
///      * Performs content security check and calls open()
///      */
/// ```
///

/// `nsIInputStream open2 ();`
#[inline]
pub unsafe fn Open2(&self, _retval: *mut *const nsIInputStream) -> nsresult {
((*self.vtable).Open2)(self, _retval)
}


/// ```text
/// /**
///      * Asynchronously open this channel.  Data is fed to the specified stream
///      * listener as it becomes available.  The stream listener's methods are
///      * called on the thread that calls asyncOpen and are not called until
///      * after asyncOpen returns.  If asyncOpen returns successfully, the
///      * channel promises to call at least onStartRequest and onStopRequest.
///      *
///      * If the nsIRequest object passed to the stream listener's methods is not
///      * this channel, an appropriate onChannelRedirect notification needs to be
///      * sent to the notification callbacks before onStartRequest is called.
///      * Once onStartRequest is called, all following method calls on aListener
///      * will get the request that was passed to onStartRequest.
///      *
///      * If the channel's and loadgroup's notification callbacks do not provide
///      * an nsIChannelEventSink when onChannelRedirect would be called, that's
///      * equivalent to having called onChannelRedirect.
///      *
///      * If asyncOpen returns successfully, the channel is responsible for
///      * keeping itself alive until it has called onStopRequest on aListener or
///      * called onChannelRedirect.
///      *
///      * Implementations are allowed to synchronously add themselves to the
///      * associated load group (if any).
///      *
///      * NOTE: Implementations should throw NS_ERROR_ALREADY_OPENED if the
///      * channel is reopened.
///      *
///      * @param aListener the nsIStreamListener implementation
///      * @param aContext an opaque parameter forwarded to aListener's methods
///      * @see nsIChannelEventSink for onChannelRedirect
///      */
/// ```
///

/// `void asyncOpen (in nsIStreamListener aListener, in nsISupports aContext);`
#[inline]
pub unsafe fn AsyncOpen(&self, aListener: *const nsIStreamListener, aContext: *const nsISupports) -> nsresult {
((*self.vtable).AsyncOpen)(self, aListener, aContext)
}


/// ```text
/// /**
///      * Performs content security check and calls asyncOpen().
///      */
/// ```
///

/// `void asyncOpen2 (in nsIStreamListener aListener);`
#[inline]
pub unsafe fn AsyncOpen2(&self, aListener: *const nsIStreamListener) -> nsresult {
((*self.vtable).AsyncOpen2)(self, aListener)
}


/// ```text
/// /**
///      * Access to the type implied or stated by the Content-Disposition header
///      * if available and if applicable. This allows determining inline versus
///      * attachment.
///      *
///      * Setting contentDisposition provides a hint to the channel about the
///      * disposition.  If a normal Content-Disposition header is present its
///      * value will always be used.  If it is missing the hinted value will
///      * be used if set.
///      *
///      * Implementations should throw NS_ERROR_NOT_AVAILABLE if the header either
///      * doesn't exist for this type of channel or is empty, and return
///      * DISPOSITION_ATTACHMENT if an invalid/noncompliant value is present.
///      */
/// ```
///

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


/// ```text
/// /**
///      * Access to the type implied or stated by the Content-Disposition header
///      * if available and if applicable. This allows determining inline versus
///      * attachment.
///      *
///      * Setting contentDisposition provides a hint to the channel about the
///      * disposition.  If a normal Content-Disposition header is present its
///      * value will always be used.  If it is missing the hinted value will
///      * be used if set.
///      *
///      * Implementations should throw NS_ERROR_NOT_AVAILABLE if the header either
///      * doesn't exist for this type of channel or is empty, and return
///      * DISPOSITION_ATTACHMENT if an invalid/noncompliant value is present.
///      */
/// ```
///

/// `attribute unsigned long contentDisposition;`
#[inline]
pub unsafe fn SetContentDisposition(&self, aContentDisposition: libc::uint32_t) -> nsresult {
((*self.vtable).SetContentDisposition)(self, aContentDisposition)
}


/// ```text
/// /**
///      * Access to the filename portion of the Content-Disposition header if
///      * available and if applicable. This allows getting the preferred filename
///      * without having to parse it out yourself.
///      *
///      * Setting contentDispositionFilename provides a hint to the channel about
///      * the disposition.  If a normal Content-Disposition header is present its
///      * value will always be used.  If it is missing the hinted value will be
///      * used if set.
///      *
///      * Implementations should throw NS_ERROR_NOT_AVAILABLE if the header doesn't
///      * exist for this type of channel, if the header is empty, if the header
///      * doesn't contain a filename portion, or the value of the filename
///      * attribute is empty/missing.
///      */
/// ```
///

/// `attribute AString contentDispositionFilename;`
#[inline]
pub unsafe fn GetContentDispositionFilename(&self, aContentDispositionFilename: &mut ::nsstring::nsAString) -> nsresult {
((*self.vtable).GetContentDispositionFilename)(self, aContentDispositionFilename)
}


/// ```text
/// /**
///      * Access to the filename portion of the Content-Disposition header if
///      * available and if applicable. This allows getting the preferred filename
///      * without having to parse it out yourself.
///      *
///      * Setting contentDispositionFilename provides a hint to the channel about
///      * the disposition.  If a normal Content-Disposition header is present its
///      * value will always be used.  If it is missing the hinted value will be
///      * used if set.
///      *
///      * Implementations should throw NS_ERROR_NOT_AVAILABLE if the header doesn't
///      * exist for this type of channel, if the header is empty, if the header
///      * doesn't contain a filename portion, or the value of the filename
///      * attribute is empty/missing.
///      */
/// ```
///

/// `attribute AString contentDispositionFilename;`
#[inline]
pub unsafe fn SetContentDispositionFilename(&self, aContentDispositionFilename: &::nsstring::nsAString) -> nsresult {
((*self.vtable).SetContentDispositionFilename)(self, aContentDispositionFilename)
}


/// ```text
/// /**
///      * Access to the raw Content-Disposition header if available and applicable.
///      *
///      * Implementations should throw NS_ERROR_NOT_AVAILABLE if the header either
///      * doesn't exist for this type of channel or is empty.
///      *
///      * @deprecated Use contentDisposition/contentDispositionFilename instead.
///      */
/// ```
///

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


/// ```text
/// /**
///      * The LoadInfo object contains information about a network load, why it
///      * was started, and how we plan on using the resulting response.
///      * If a network request is redirected, the new channel will receive a new
///      * LoadInfo object. The new object will contain mostly the same
///      * information as the pre-redirect one, but updated as appropriate.
///      * For detailed information about what parts of LoadInfo are updated on
///      * redirect, see documentation on individual properties.
///      */
/// ```
///

/// `attribute nsILoadInfo loadInfo;`
#[inline]
pub unsafe fn GetLoadInfo(&self, aLoadInfo: *mut *const nsILoadInfo) -> nsresult {
((*self.vtable).GetLoadInfo)(self, aLoadInfo)
}


/// ```text
/// /**
///      * The LoadInfo object contains information about a network load, why it
///      * was started, and how we plan on using the resulting response.
///      * If a network request is redirected, the new channel will receive a new
///      * LoadInfo object. The new object will contain mostly the same
///      * information as the pre-redirect one, but updated as appropriate.
///      * For detailed information about what parts of LoadInfo are updated on
///      * redirect, see documentation on individual properties.
///      */
/// ```
///

/// `attribute nsILoadInfo loadInfo;`
#[inline]
pub unsafe fn SetLoadInfo(&self, aLoadInfo: *const nsILoadInfo) -> nsresult {
((*self.vtable).SetLoadInfo)(self, aLoadInfo)
}


/// ```text
/// /**
///      * Returns true if the channel is used to create a document.
///      * It returns true if the loadFlags have LOAD_DOCUMENT_URI set, or if
///      * LOAD_HTML_OBJECT_DATA is set and the channel has the appropriate
///      * MIME type.
///      * Note: May have the wrong value if called before OnStartRequest as we
///      * don't know the MIME type yet.
///      */
/// ```
///

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


}