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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::{bitflags::bitflags, prelude::*, translate::*};

bitflags! {
    /// Indicates if a message should or shouldn't be cached.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "SoupCacheability")]
    pub struct Cacheability: u32 {
        /// The message should be cached
        #[doc(alias = "SOUP_CACHE_CACHEABLE")]
        const CACHEABLE = ffi::SOUP_CACHE_CACHEABLE as _;
        /// The message shouldn't be cached
        #[doc(alias = "SOUP_CACHE_UNCACHEABLE")]
        const UNCACHEABLE = ffi::SOUP_CACHE_UNCACHEABLE as _;
        /// The messages cache should be invalidated
        #[doc(alias = "SOUP_CACHE_INVALIDATES")]
        const INVALIDATES = ffi::SOUP_CACHE_INVALIDATES as _;
        /// The messages cache should be updated
        #[doc(alias = "SOUP_CACHE_VALIDATES")]
        const VALIDATES = ffi::SOUP_CACHE_VALIDATES as _;
    }
}

#[doc(hidden)]
impl IntoGlib for Cacheability {
    type GlibType = ffi::SoupCacheability;

    #[inline]
    fn into_glib(self) -> ffi::SoupCacheability {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::SoupCacheability> for Cacheability {
    #[inline]
    unsafe fn from_glib(value: ffi::SoupCacheability) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for Cacheability {
    #[inline]
    #[doc(alias = "soup_cacheability_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::soup_cacheability_get_type()) }
    }
}

impl glib::HasParamSpec for Cacheability {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

impl glib::value::ValueType for Cacheability {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for Cacheability {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for Cacheability {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<Cacheability> for glib::Value {
    #[inline]
    fn from(v: Cacheability) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// Represents the parsed value of the "Expect" header.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "SoupExpectation")]
    pub struct Expectation: u32 {
        /// any unrecognized expectation
        #[doc(alias = "SOUP_EXPECTATION_UNRECOGNIZED")]
        const UNRECOGNIZED = ffi::SOUP_EXPECTATION_UNRECOGNIZED as _;
        /// "100-continue"
        #[doc(alias = "SOUP_EXPECTATION_CONTINUE")]
        const CONTINUE = ffi::SOUP_EXPECTATION_CONTINUE as _;
    }
}

#[doc(hidden)]
impl IntoGlib for Expectation {
    type GlibType = ffi::SoupExpectation;

    #[inline]
    fn into_glib(self) -> ffi::SoupExpectation {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::SoupExpectation> for Expectation {
    #[inline]
    unsafe fn from_glib(value: ffi::SoupExpectation) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for Expectation {
    #[inline]
    #[doc(alias = "soup_expectation_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::soup_expectation_get_type()) }
    }
}

impl glib::HasParamSpec for Expectation {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

impl glib::value::ValueType for Expectation {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for Expectation {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for Expectation {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<Expectation> for glib::Value {
    #[inline]
    fn from(v: Expectation) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// Various flags that can be set on a #SoupMessage to alter its
    /// behavior.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "SoupMessageFlags")]
    pub struct MessageFlags: u32 {
        /// The session should not follow redirect
        ///   (3xx) responses received by this message.
        #[doc(alias = "SOUP_MESSAGE_NO_REDIRECT")]
        const NO_REDIRECT = ffi::SOUP_MESSAGE_NO_REDIRECT as _;
        /// Requests that the message should be
        ///   sent on a newly-created connection, not reusing an existing
        ///   persistent connection. Note that messages with non-idempotent
        ///   [`method`][struct@crate::Message#method]s behave this way by default, unless
        ///   #SOUP_MESSAGE_IDEMPOTENT is set.
        #[doc(alias = "SOUP_MESSAGE_NEW_CONNECTION")]
        const NEW_CONNECTION = ffi::SOUP_MESSAGE_NEW_CONNECTION as _;
        /// The message is considered idempotent,
        ///   regardless its [`method`][struct@crate::Message#method], and allows reuse of existing
        ///   idle connections, instead of always requiring a new one, unless
        ///   #SOUP_MESSAGE_NEW_CONNECTION is set.
        #[doc(alias = "SOUP_MESSAGE_IDEMPOTENT")]
        const IDEMPOTENT = ffi::SOUP_MESSAGE_IDEMPOTENT as _;
        /// The [`AuthManager`][crate::AuthManager] should not use
        ///   the credentials cache for this message, neither to use cached credentials
        ///   to automatically authenticate this message nor to cache the credentials
        ///   after the message is successfully authenticated. This applies to both server
        ///   and proxy authentication. Note that [`authenticate`][struct@crate::Message#authenticate] signal will
        ///   be emitted, if you want to disable authentication for a message use
        ///   [`Message::disable_feature()`][crate::Message::disable_feature()] passing #SOUP_TYPE_AUTH_MANAGER instead.
        #[doc(alias = "SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE")]
        const DO_NOT_USE_AUTH_CACHE = ffi::SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE as _;
        /// Metrics will be collected for this message.
        #[doc(alias = "SOUP_MESSAGE_COLLECT_METRICS")]
        const COLLECT_METRICS = ffi::SOUP_MESSAGE_COLLECT_METRICS as _;
    }
}

#[doc(hidden)]
impl IntoGlib for MessageFlags {
    type GlibType = ffi::SoupMessageFlags;

    #[inline]
    fn into_glib(self) -> ffi::SoupMessageFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::SoupMessageFlags> for MessageFlags {
    #[inline]
    unsafe fn from_glib(value: ffi::SoupMessageFlags) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for MessageFlags {
    #[inline]
    #[doc(alias = "soup_message_flags_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::soup_message_flags_get_type()) }
    }
}

impl glib::HasParamSpec for MessageFlags {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

impl glib::value::ValueType for MessageFlags {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for MessageFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for MessageFlags {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<MessageFlags> for glib::Value {
    #[inline]
    fn from(v: MessageFlags) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// Options to pass to [`ServerExt::listen()`][crate::prelude::ServerExt::listen()], etc.
    ///
    /// [`IPV4_ONLY`][Self::IPV4_ONLY] and [`IPV6_ONLY`][Self::IPV6_ONLY]
    /// only make sense with [`ServerExt::listen_all()`][crate::prelude::ServerExt::listen_all()] and
    /// [`ServerExt::listen_local()`][crate::prelude::ServerExt::listen_local()], not plain [`ServerExt::listen()`][crate::prelude::ServerExt::listen()] (which
    /// simply listens on whatever kind of socket you give it). And you
    /// cannot specify both of them in a single call.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "SoupServerListenOptions")]
    pub struct ServerListenOptions: u32 {
        /// Listen for https connections rather
        ///   than plain http.
        #[doc(alias = "SOUP_SERVER_LISTEN_HTTPS")]
        const HTTPS = ffi::SOUP_SERVER_LISTEN_HTTPS as _;
        /// Only listen on IPv4 interfaces.
        #[doc(alias = "SOUP_SERVER_LISTEN_IPV4_ONLY")]
        const IPV4_ONLY = ffi::SOUP_SERVER_LISTEN_IPV4_ONLY as _;
        /// Only listen on IPv6 interfaces.
        #[doc(alias = "SOUP_SERVER_LISTEN_IPV6_ONLY")]
        const IPV6_ONLY = ffi::SOUP_SERVER_LISTEN_IPV6_ONLY as _;
    }
}

#[doc(hidden)]
impl IntoGlib for ServerListenOptions {
    type GlibType = ffi::SoupServerListenOptions;

    #[inline]
    fn into_glib(self) -> ffi::SoupServerListenOptions {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::SoupServerListenOptions> for ServerListenOptions {
    #[inline]
    unsafe fn from_glib(value: ffi::SoupServerListenOptions) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for ServerListenOptions {
    #[inline]
    #[doc(alias = "soup_server_listen_options_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::soup_server_listen_options_get_type()) }
    }
}

impl glib::HasParamSpec for ServerListenOptions {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

impl glib::value::ValueType for ServerListenOptions {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for ServerListenOptions {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for ServerListenOptions {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<ServerListenOptions> for glib::Value {
    #[inline]
    fn from(v: ServerListenOptions) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}