objc2_cf_network/generated/
CFHTTPStream.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern "C" {
12    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreamerrordomainhttp?language=objc)
13    pub static kCFStreamErrorDomainHTTP: i32;
14}
15
16/// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/cfstreamerrorhttp?language=objc)
17// NS_ENUM
18#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct CFStreamErrorHTTP(pub c_int);
21impl CFStreamErrorHTTP {
22    #[doc(alias = "kCFStreamErrorHTTPParseFailure")]
23    pub const ParseFailure: Self = Self(-1);
24    #[doc(alias = "kCFStreamErrorHTTPRedirectionLoop")]
25    pub const RedirectionLoop: Self = Self(-2);
26    #[doc(alias = "kCFStreamErrorHTTPBadURL")]
27    pub const BadURL: Self = Self(-3);
28}
29
30#[cfg(feature = "objc2")]
31unsafe impl Encode for CFStreamErrorHTTP {
32    const ENCODING: Encoding = c_int::ENCODING;
33}
34
35#[cfg(feature = "objc2")]
36unsafe impl RefEncode for CFStreamErrorHTTP {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern "C" {
41    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpresponseheader?language=objc)
42    #[deprecated = "Use NSURLSession API for http requests"]
43    pub static kCFStreamPropertyHTTPResponseHeader: &'static CFString;
44}
45
46extern "C" {
47    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpfinalurl?language=objc)
48    #[deprecated = "Use NSURLSession API for http requests"]
49    pub static kCFStreamPropertyHTTPFinalURL: &'static CFString;
50}
51
52extern "C" {
53    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpfinalrequest?language=objc)
54    #[deprecated = "Use NSURLSession API for http requests"]
55    pub static kCFStreamPropertyHTTPFinalRequest: &'static CFString;
56}
57
58extern "C" {
59    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpproxy?language=objc)
60    #[deprecated = "Use NSURLSession API for http requests"]
61    pub static kCFStreamPropertyHTTPProxy: &'static CFString;
62}
63
64extern "C" {
65    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpproxyhost?language=objc)
66    #[deprecated = "Use NSURLSession API for http requests"]
67    pub static kCFStreamPropertyHTTPProxyHost: &'static CFString;
68}
69
70extern "C" {
71    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpproxyport?language=objc)
72    #[deprecated = "Use NSURLSession API for http requests"]
73    pub static kCFStreamPropertyHTTPProxyPort: &'static CFString;
74}
75
76extern "C" {
77    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpsproxyhost?language=objc)
78    #[deprecated = "Use NSURLSession API for http requests"]
79    pub static kCFStreamPropertyHTTPSProxyHost: &'static CFString;
80}
81
82extern "C" {
83    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpsproxyport?language=objc)
84    #[deprecated = "Use NSURLSession API for http requests"]
85    pub static kCFStreamPropertyHTTPSProxyPort: &'static CFString;
86}
87
88extern "C" {
89    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpshouldautoredirect?language=objc)
90    #[deprecated = "Use NSURLSession API for http requests"]
91    pub static kCFStreamPropertyHTTPShouldAutoredirect: &'static CFString;
92}
93
94extern "C" {
95    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttpattemptpersistentconnection?language=objc)
96    #[deprecated = "Use NSURLSession API for http requests"]
97    pub static kCFStreamPropertyHTTPAttemptPersistentConnection: &'static CFString;
98}
99
100extern "C" {
101    /// [Apple's documentation](https://developer.apple.com/documentation/cfnetwork/kcfstreampropertyhttprequestbyteswrittencount?language=objc)
102    #[deprecated = "Use NSURLSession API for http requests"]
103    pub static kCFStreamPropertyHTTPRequestBytesWrittenCount: &'static CFString;
104}
105
106#[cfg(feature = "CFHTTPMessage")]
107#[deprecated = "Use NSURLSession API for http requests"]
108#[inline]
109pub unsafe extern "C-unwind" fn CFReadStreamCreateForHTTPRequest(
110    alloc: Option<&CFAllocator>,
111    request: &CFHTTPMessage,
112) -> CFRetained<CFReadStream> {
113    extern "C-unwind" {
114        fn CFReadStreamCreateForHTTPRequest(
115            alloc: Option<&CFAllocator>,
116            request: &CFHTTPMessage,
117        ) -> Option<NonNull<CFReadStream>>;
118    }
119    let ret = unsafe { CFReadStreamCreateForHTTPRequest(alloc, request) };
120    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
121    unsafe { CFRetained::from_raw(ret) }
122}
123
124#[cfg(feature = "CFHTTPMessage")]
125#[deprecated = "Use NSURLSession API for http requests"]
126#[inline]
127pub unsafe extern "C-unwind" fn CFReadStreamCreateForStreamedHTTPRequest(
128    alloc: Option<&CFAllocator>,
129    request_headers: &CFHTTPMessage,
130    request_body: &CFReadStream,
131) -> CFRetained<CFReadStream> {
132    extern "C-unwind" {
133        fn CFReadStreamCreateForStreamedHTTPRequest(
134            alloc: Option<&CFAllocator>,
135            request_headers: &CFHTTPMessage,
136            request_body: &CFReadStream,
137        ) -> Option<NonNull<CFReadStream>>;
138    }
139    let ret =
140        unsafe { CFReadStreamCreateForStreamedHTTPRequest(alloc, request_headers, request_body) };
141    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
142    unsafe { CFRetained::from_raw(ret) }
143}