nm-rs 0.1.3

Rust bindings for the libnm library.
Documentation
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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir
// from gtk-girs (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::ffi;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct IPRoutingRule(Shared<ffi::NMIPRoutingRule>);

    match fn {
        ref => |ptr| ffi::nm_ip_routing_rule_ref(ptr),
        unref => |ptr| ffi::nm_ip_routing_rule_unref(ptr),
        type_ => || ffi::nm_ip_routing_rule_get_type(),
    }
}

impl IPRoutingRule {
    /// ## `addr_family`
    /// the address family of the routing rule. Must be either
    ///   `AF_INET` (2) or `AF_INET6` (10).
    ///
    /// # Returns
    ///
    /// a newly created rule instance with the
    ///   provided address family. The instance is unsealed.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_new")]
    pub fn new(addr_family: i32) -> IPRoutingRule {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::nm_ip_routing_rule_new(addr_family)) }
    }

    /// ## `other`
    /// the other #NMIPRoutingRule instance to compare
    ///
    /// # Returns
    ///
    /// zero, a positive, or a negative integer to indicate
    ///   equality or how the arguments compare.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_cmp")]
    pub fn cmp(&self, other: Option<&IPRoutingRule>) -> i32 {
        unsafe { ffi::nm_ip_routing_rule_cmp(self.to_glib_none().0, other.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the set action.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_action")]
    #[doc(alias = "get_action")]
    pub fn action(&self) -> u8 {
        unsafe { ffi::nm_ip_routing_rule_get_action(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the address family of the rule. Either `AF_INET` or `AF_INET6`.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_addr_family")]
    #[doc(alias = "get_addr_family")]
    pub fn addr_family(&self) -> i32 {
        unsafe { ffi::nm_ip_routing_rule_get_addr_family(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the destination port end setting.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_destination_port_end")]
    #[doc(alias = "get_destination_port_end")]
    pub fn destination_port_end(&self) -> u16 {
        unsafe { ffi::nm_ip_routing_rule_get_destination_port_end(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the destination port start setting.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_destination_port_start")]
    #[doc(alias = "get_destination_port_start")]
    pub fn destination_port_start(&self) -> u16 {
        unsafe { ffi::nm_ip_routing_rule_get_destination_port_start(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the set from/src parameter or
    ///   [`None`], if no value is set.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_from")]
    #[doc(alias = "get_from")]
    pub fn from(&self) -> glib::GString {
        unsafe { from_glib_none(ffi::nm_ip_routing_rule_get_from(self.to_glib_none().0)) }
    }

    ///
    /// # Returns
    ///
    /// the set prefix length for the from/src parameter.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_from_len")]
    #[doc(alias = "get_from_len")]
    pub fn from_len(&self) -> u8 {
        unsafe { ffi::nm_ip_routing_rule_get_from_len(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the fwmark setting.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_fwmark")]
    #[doc(alias = "get_fwmark")]
    pub fn fwmark(&self) -> u32 {
        unsafe { ffi::nm_ip_routing_rule_get_fwmark(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the fwmask setting.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_fwmask")]
    #[doc(alias = "get_fwmask")]
    pub fn fwmask(&self) -> u32 {
        unsafe { ffi::nm_ip_routing_rule_get_fwmask(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the set iifname or [`None`] if unset.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_iifname")]
    #[doc(alias = "get_iifname")]
    pub fn iifname(&self) -> glib::GString {
        unsafe { from_glib_none(ffi::nm_ip_routing_rule_get_iifname(self.to_glib_none().0)) }
    }

    ///
    /// # Returns
    ///
    /// the "invert" setting of the rule.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_invert")]
    #[doc(alias = "get_invert")]
    pub fn inverts(&self) -> bool {
        unsafe { from_glib(ffi::nm_ip_routing_rule_get_invert(self.to_glib_none().0)) }
    }

    ///
    /// # Returns
    ///
    /// the ipproto of the rule.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_ipproto")]
    #[doc(alias = "get_ipproto")]
    pub fn ipproto(&self) -> u8 {
        unsafe { ffi::nm_ip_routing_rule_get_ipproto(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the set oifname or [`None`] if unset.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_oifname")]
    #[doc(alias = "get_oifname")]
    pub fn oifname(&self) -> glib::GString {
        unsafe { from_glib_none(ffi::nm_ip_routing_rule_get_oifname(self.to_glib_none().0)) }
    }

    ///
    /// # Returns
    ///
    /// the priority. A valid priority is in the range from
    ///   0 to `G_MAXUINT32`. If unset, -1 is returned.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_priority")]
    #[doc(alias = "get_priority")]
    pub fn priority(&self) -> i64 {
        unsafe { ffi::nm_ip_routing_rule_get_priority(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the source port end setting.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_source_port_end")]
    #[doc(alias = "get_source_port_end")]
    pub fn source_port_end(&self) -> u16 {
        unsafe { ffi::nm_ip_routing_rule_get_source_port_end(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the source port start setting.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_source_port_start")]
    #[doc(alias = "get_source_port_start")]
    pub fn source_port_start(&self) -> u16 {
        unsafe { ffi::nm_ip_routing_rule_get_source_port_start(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the suppress_prefixlength of the rule. -1 means that the value is unset.
    #[cfg(feature = "v1_20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
    #[doc(alias = "nm_ip_routing_rule_get_suppress_prefixlength")]
    #[doc(alias = "get_suppress_prefixlength")]
    pub fn suppress_prefixlength(&self) -> i32 {
        unsafe { ffi::nm_ip_routing_rule_get_suppress_prefixlength(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the set table.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_table")]
    #[doc(alias = "get_table")]
    pub fn table(&self) -> u32 {
        unsafe { ffi::nm_ip_routing_rule_get_table(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the set to/dst parameter or
    ///   [`None`], if no value is set.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_to")]
    #[doc(alias = "get_to")]
    pub fn to(&self) -> glib::GString {
        unsafe { from_glib_none(ffi::nm_ip_routing_rule_get_to(self.to_glib_none().0)) }
    }

    ///
    /// # Returns
    ///
    /// the set prefix length for the to/dst parameter.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_to_len")]
    #[doc(alias = "get_to_len")]
    pub fn to_len(&self) -> u8 {
        unsafe { ffi::nm_ip_routing_rule_get_to_len(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// the tos of the rule.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_get_tos")]
    #[doc(alias = "get_tos")]
    pub fn tos(&self) -> u8 {
        unsafe { ffi::nm_ip_routing_rule_get_tos(self.to_glib_none().0) }
    }

    ///
    /// # Returns
    ///
    /// [`true`] if a uid range is set.
    ///
    /// This API was wrongly introduced in the header files for 1.32, but the
    /// symbols were not exported. The API only works since 1.34 and newer.
    ///
    /// ## `out_range_start`
    /// returns the start of the range
    ///   or 0 if the range is not set.
    ///
    /// ## `out_range_end`
    /// returns the end of the range
    ///   or 0 if the range is not set.
    #[cfg(feature = "v1_34")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
    #[doc(alias = "nm_ip_routing_rule_get_uid_range")]
    #[doc(alias = "get_uid_range")]
    pub fn uid_range(&self) -> Option<(u32, u32)> {
        unsafe {
            let mut out_range_start = std::mem::MaybeUninit::uninit();
            let mut out_range_end = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::nm_ip_routing_rule_get_uid_range(
                self.to_glib_none().0,
                out_range_start.as_mut_ptr(),
                out_range_end.as_mut_ptr(),
            ));
            if ret {
                Some((out_range_start.assume_init(), out_range_end.assume_init()))
            } else {
                None
            }
        }
    }

    ///
    /// # Returns
    ///
    /// whether @self is sealed. Once sealed, an instance
    ///   cannot be modified nor unsealed.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_is_sealed")]
    pub fn is_sealed(&self) -> bool {
        unsafe { from_glib(ffi::nm_ip_routing_rule_is_sealed(self.to_glib_none().0)) }
    }

    /// Since 1.42, ref-counting of #NMIPRoutingRule is thread-safe.
    ///
    /// # Returns
    ///
    /// a newly created rule instance with
    ///   the same settings as @self. Note that the instance will
    ///   always be unsealed.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_new_clone")]
    #[must_use]
    pub fn new_clone(&self) -> IPRoutingRule {
        unsafe { from_glib_full(ffi::nm_ip_routing_rule_new_clone(self.to_glib_none().0)) }
    }

    /// Seals the routing rule. Afterwards, the instance can no longer be
    /// modified, and it is a bug to call any of the accessors that would
    /// modify the rule. If @self was already sealed, this has no effect.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_seal")]
    pub fn seal(&self) {
        unsafe {
            ffi::nm_ip_routing_rule_seal(self.to_glib_none().0);
        }
    }

    /// Note that currently only certain actions are allowed. nm_ip_routing_rule_validate()
    /// will reject unsupported actions as invalid.
    /// ## `action`
    /// the action to set
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_action")]
    pub fn set_action(&self, action: u8) {
        unsafe {
            ffi::nm_ip_routing_rule_set_action(self.to_glib_none().0, action);
        }
    }

    /// ## `start`
    /// the start port to set.
    /// ## `end`
    /// the end port to set.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_destination_port")]
    pub fn set_destination_port(&self, start: u16, end: u16) {
        unsafe {
            ffi::nm_ip_routing_rule_set_destination_port(self.to_glib_none().0, start, end);
        }
    }

    /// Setting invalid values is accepted, but will later fail
    /// during nm_ip_routing_rule_validate().
    /// ## `from`
    /// the from/src address to set.
    ///   The address family must match.
    /// ## `len`
    /// the corresponding prefix length of the address.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_from")]
    pub fn set_from(&self, from: Option<&str>) {
        if let Some(s) = from {
            let len = s.len() as _;
            unsafe {
                ffi::nm_ip_routing_rule_set_from(self.to_glib_none().0, s.to_glib_none().0, len);
            }
        }
    }

    /// ## `fwmark`
    /// the fwmark
    /// ## `fwmask`
    /// the fwmask
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_fwmark")]
    pub fn set_fwmark(&self, fwmark: u32, fwmask: u32) {
        unsafe {
            ffi::nm_ip_routing_rule_set_fwmark(self.to_glib_none().0, fwmark, fwmask);
        }
    }

    /// The name supports C backslash escaping for non-UTF-8 characters.
    /// Note that nm_ip_routing_rule_from_string() too uses backslash
    /// escaping when tokenizing the words by whitespace. So, in string
    /// representation you'd get double backslashes.
    /// ## `iifname`
    /// the iifname to set or [`None`] to unset.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_iifname")]
    pub fn set_iifname(&self, iifname: Option<&str>) {
        unsafe {
            ffi::nm_ip_routing_rule_set_iifname(self.to_glib_none().0, iifname.to_glib_none().0);
        }
    }

    /// ## `invert`
    /// the new value to set
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_invert")]
    pub fn set_invert(&self, invert: bool) {
        unsafe {
            ffi::nm_ip_routing_rule_set_invert(self.to_glib_none().0, invert.into_glib());
        }
    }

    /// ## `ipproto`
    /// the ipproto to set
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_ipproto")]
    pub fn set_ipproto(&self, ipproto: u8) {
        unsafe {
            ffi::nm_ip_routing_rule_set_ipproto(self.to_glib_none().0, ipproto);
        }
    }

    /// The name supports C backslash escaping for non-UTF-8 characters.
    /// Note that nm_ip_routing_rule_from_string() too uses backslash
    /// escaping when tokenizing the words by whitespace. So, in string
    /// representation you'd get double backslashes.
    /// ## `oifname`
    /// the oifname to set or [`None`] to unset.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_oifname")]
    pub fn set_oifname(&self, oifname: Option<&str>) {
        unsafe {
            ffi::nm_ip_routing_rule_set_oifname(self.to_glib_none().0, oifname.to_glib_none().0);
        }
    }

    /// A valid priority ranges from 0 to `G_MAXUINT32`. "-1" is also allowed
    /// to reset the priority. It is a bug calling this function with any
    /// other value.
    /// ## `priority`
    /// the priority to set
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_priority")]
    pub fn set_priority(&self, priority: i64) {
        unsafe {
            ffi::nm_ip_routing_rule_set_priority(self.to_glib_none().0, priority);
        }
    }

    /// ## `start`
    /// the start port to set.
    /// ## `end`
    /// the end port to set.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_source_port")]
    pub fn set_source_port(&self, start: u16, end: u16) {
        unsafe {
            ffi::nm_ip_routing_rule_set_source_port(self.to_glib_none().0, start, end);
        }
    }

    /// ## `suppress_prefixlength`
    /// the suppress_prefixlength to set. The value -1 means
    ///   unset.
    #[cfg(feature = "v1_20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
    #[doc(alias = "nm_ip_routing_rule_set_suppress_prefixlength")]
    pub fn set_suppress_prefixlength(&self, suppress_prefixlength: i32) {
        unsafe {
            ffi::nm_ip_routing_rule_set_suppress_prefixlength(
                self.to_glib_none().0,
                suppress_prefixlength,
            );
        }
    }

    /// ## `table`
    /// the table to set
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_table")]
    pub fn set_table(&self, table: u32) {
        unsafe {
            ffi::nm_ip_routing_rule_set_table(self.to_glib_none().0, table);
        }
    }

    /// Setting invalid values is accepted, but will later fail
    /// during nm_ip_routing_rule_validate().
    /// ## `to`
    /// the to/dst address to set.
    ///   The address family must match.
    /// ## `len`
    /// the corresponding prefix length of the address.
    ///   If @to is [`None`], this valid is ignored.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_to")]
    pub fn set_to(&self, to: Option<&str>) {
        if let Some(s) = to {
            let len = s.len() as _;
            unsafe {
                ffi::nm_ip_routing_rule_set_to(self.to_glib_none().0, s.to_glib_none().0, len);
            }
        }
    }

    /// ## `tos`
    /// the tos to set
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_set_tos")]
    pub fn set_tos(&self, tos: u8) {
        unsafe {
            ffi::nm_ip_routing_rule_set_tos(self.to_glib_none().0, tos);
        }
    }

    /// For a valid range, start must be less or equal to end.
    /// If set to an invalid range, the range gets unset.
    ///
    /// This API was wrongly introduced in the header files for 1.32, but the
    /// symbols were not exported. The API only works since 1.34 and newer.
    /// ## `uid_range_start`
    /// the uid_range start to set.
    /// ## `uid_range_end`
    /// the uid_range start to set.
    #[cfg(feature = "v1_34")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
    #[doc(alias = "nm_ip_routing_rule_set_uid_range")]
    pub fn set_uid_range(&self, uid_range_start: u32, uid_range_end: u32) {
        unsafe {
            ffi::nm_ip_routing_rule_set_uid_range(
                self.to_glib_none().0,
                uid_range_start,
                uid_range_end,
            );
        }
    }

    //#[cfg(feature = "v1_18")]
    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    //#[doc(alias = "nm_ip_routing_rule_to_string")]
    //pub fn to_string(&self, to_string_flags: IPRoutingRuleAsStringFlags, extra_args: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }) -> Result<glib::GString, glib::Error> {
    //    unsafe { TODO: call ffi:nm_ip_routing_rule_to_string() }
    //}

    ///
    /// # Returns
    ///
    /// [`true`] if the rule validates.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "nm_ip_routing_rule_validate")]
    pub fn validate(&self) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::nm_ip_routing_rule_validate(self.to_glib_none().0, &mut error);
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    //#[cfg(feature = "v1_18")]
    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    //#[doc(alias = "nm_ip_routing_rule_from_string")]
    //pub fn from_string(str: &str, to_string_flags: IPRoutingRuleAsStringFlags, extra_args: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }) -> Result<IPRoutingRule, glib::Error> {
    //    unsafe { TODO: call ffi:nm_ip_routing_rule_from_string() }
    //}
}