1use crate::{ffi,Setting};
7#[cfg(feature = "v1_2")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
9use crate::{IPTunnelMode};
10#[cfg(feature = "v1_12")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
12use crate::{IPTunnelFlags};
13use glib::{prelude::*};
14#[cfg(feature = "v1_2")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
16use glib::{signal::{connect_raw, SignalHandlerId},translate::*};
17#[cfg(feature = "v1_2")]
18#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
19use std::{boxed::Box as Box_};
20
21glib::wrapper! {
22 #[doc(alias = "NMSettingIPTunnel")]
145 pub struct SettingIPTunnel(Object<ffi::NMSettingIPTunnel, ffi::NMSettingIPTunnelClass>) @extends Setting;
146
147 match fn {
148 type_ => || ffi::nm_setting_ip_tunnel_get_type(),
149 }
150}
151
152impl SettingIPTunnel {
153 #[cfg(feature = "v1_2")]
159 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
160 #[doc(alias = "nm_setting_ip_tunnel_new")]
161 pub fn new() -> SettingIPTunnel {
162 assert_initialized_main_thread!();
163 unsafe {
164 Setting::from_glib_full(ffi::nm_setting_ip_tunnel_new()).unsafe_cast()
165 }
166 }
167
168 pub fn builder() -> SettingIPTunnelBuilder {
173 SettingIPTunnelBuilder::new()
174 }
175
176
177 #[cfg(feature = "v1_42")]
183 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
184 #[doc(alias = "nm_setting_ip_tunnel_get_encapsulation_limit")]
185 #[doc(alias = "get_encapsulation_limit")]
186 #[doc(alias = "encapsulation-limit")]
187 pub fn encapsulation_limit(&self) -> u32 {
188 unsafe {
189 ffi::nm_setting_ip_tunnel_get_encapsulation_limit(self.to_glib_none().0)
190 }
191 }
192
193 #[cfg(feature = "v1_12")]
199 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
200 #[doc(alias = "nm_setting_ip_tunnel_get_flags")]
201 #[doc(alias = "get_flags")]
202 pub fn flags(&self) -> IPTunnelFlags {
203 unsafe {
204 from_glib(ffi::nm_setting_ip_tunnel_get_flags(self.to_glib_none().0))
205 }
206 }
207
208 #[cfg(feature = "v1_42")]
214 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
215 #[doc(alias = "nm_setting_ip_tunnel_get_flow_label")]
216 #[doc(alias = "get_flow_label")]
217 #[doc(alias = "flow-label")]
218 pub fn flow_label(&self) -> u32 {
219 unsafe {
220 ffi::nm_setting_ip_tunnel_get_flow_label(self.to_glib_none().0)
221 }
222 }
223
224 #[cfg(feature = "v1_42")]
230 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
231 #[doc(alias = "nm_setting_ip_tunnel_get_fwmark")]
232 #[doc(alias = "get_fwmark")]
233 pub fn fwmark(&self) -> u32 {
234 unsafe {
235 ffi::nm_setting_ip_tunnel_get_fwmark(self.to_glib_none().0)
236 }
237 }
238
239 #[cfg(feature = "v1_2")]
245 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
246 #[doc(alias = "nm_setting_ip_tunnel_get_input_key")]
247 #[doc(alias = "get_input_key")]
248 #[doc(alias = "input-key")]
249 pub fn input_key(&self) -> glib::GString {
250 unsafe {
251 from_glib_none(ffi::nm_setting_ip_tunnel_get_input_key(self.to_glib_none().0))
252 }
253 }
254
255 #[cfg(feature = "v1_2")]
261 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
262 #[doc(alias = "nm_setting_ip_tunnel_get_local")]
263 #[doc(alias = "get_local")]
264 pub fn local(&self) -> glib::GString {
265 unsafe {
266 from_glib_none(ffi::nm_setting_ip_tunnel_get_local(self.to_glib_none().0))
267 }
268 }
269
270 #[cfg(feature = "v1_2")]
276 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
277 #[doc(alias = "nm_setting_ip_tunnel_get_mode")]
278 #[doc(alias = "get_mode")]
279 pub fn mode(&self) -> IPTunnelMode {
280 unsafe {
281 from_glib(ffi::nm_setting_ip_tunnel_get_mode(self.to_glib_none().0))
282 }
283 }
284
285 #[cfg(feature = "v1_2")]
291 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
292 #[doc(alias = "nm_setting_ip_tunnel_get_mtu")]
293 #[doc(alias = "get_mtu")]
294 pub fn mtu(&self) -> u32 {
295 unsafe {
296 ffi::nm_setting_ip_tunnel_get_mtu(self.to_glib_none().0)
297 }
298 }
299
300 #[cfg(feature = "v1_2")]
306 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
307 #[doc(alias = "nm_setting_ip_tunnel_get_output_key")]
308 #[doc(alias = "get_output_key")]
309 #[doc(alias = "output-key")]
310 pub fn output_key(&self) -> glib::GString {
311 unsafe {
312 from_glib_none(ffi::nm_setting_ip_tunnel_get_output_key(self.to_glib_none().0))
313 }
314 }
315
316 #[cfg(feature = "v1_2")]
322 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
323 #[doc(alias = "nm_setting_ip_tunnel_get_parent")]
324 #[doc(alias = "get_parent")]
325 pub fn parent(&self) -> glib::GString {
326 unsafe {
327 from_glib_none(ffi::nm_setting_ip_tunnel_get_parent(self.to_glib_none().0))
328 }
329 }
330
331 #[cfg(feature = "v1_2")]
337 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
338 #[doc(alias = "nm_setting_ip_tunnel_get_path_mtu_discovery")]
339 #[doc(alias = "get_path_mtu_discovery")]
340 #[doc(alias = "path-mtu-discovery")]
341 pub fn is_path_mtu_discovery(&self) -> bool {
342 unsafe {
343 from_glib(ffi::nm_setting_ip_tunnel_get_path_mtu_discovery(self.to_glib_none().0))
344 }
345 }
346
347 #[cfg(feature = "v1_2")]
353 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
354 #[doc(alias = "nm_setting_ip_tunnel_get_remote")]
355 #[doc(alias = "get_remote")]
356 pub fn remote(&self) -> glib::GString {
357 unsafe {
358 from_glib_none(ffi::nm_setting_ip_tunnel_get_remote(self.to_glib_none().0))
359 }
360 }
361
362 #[cfg(feature = "v1_2")]
368 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
369 #[doc(alias = "nm_setting_ip_tunnel_get_tos")]
370 #[doc(alias = "get_tos")]
371 pub fn tos(&self) -> u32 {
372 unsafe {
373 ffi::nm_setting_ip_tunnel_get_tos(self.to_glib_none().0)
374 }
375 }
376
377 #[cfg(feature = "v1_2")]
383 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
384 #[doc(alias = "nm_setting_ip_tunnel_get_ttl")]
385 #[doc(alias = "get_ttl")]
386 pub fn ttl(&self) -> u32 {
387 unsafe {
388 ffi::nm_setting_ip_tunnel_get_ttl(self.to_glib_none().0)
389 }
390 }
391
392 #[cfg(not(feature = "v1_42"))]
393 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_42"))))]
394 #[doc(alias = "encapsulation-limit")]
395 pub fn encapsulation_limit(&self) -> u32 {
396 ObjectExt::property(self, "encapsulation-limit")
397 }
398
399 #[cfg(feature = "v1_2")]
403 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
404 #[doc(alias = "encapsulation-limit")]
405 pub fn set_encapsulation_limit(&self, encapsulation_limit: u32) {
406 ObjectExt::set_property(self,"encapsulation-limit", encapsulation_limit)
407 }
408
409 #[cfg(feature = "v1_12")]
415 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
416 pub fn set_flags(&self, flags: u32) {
417 ObjectExt::set_property(self,"flags", flags)
418 }
419
420 #[cfg(not(feature = "v1_42"))]
421 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_42"))))]
422 #[doc(alias = "flow-label")]
423 pub fn flow_label(&self) -> u32 {
424 ObjectExt::property(self, "flow-label")
425 }
426
427 #[cfg(feature = "v1_2")]
430 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
431 #[doc(alias = "flow-label")]
432 pub fn set_flow_label(&self, flow_label: u32) {
433 ObjectExt::set_property(self,"flow-label", flow_label)
434 }
435
436 #[cfg(feature = "v1_42")]
439 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
440 pub fn set_fwmark(&self, fwmark: u32) {
441 ObjectExt::set_property(self,"fwmark", fwmark)
442 }
443
444 #[cfg(feature = "v1_2")]
447 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
448 #[doc(alias = "input-key")]
449 pub fn set_input_key(&self, input_key: Option<&str>) {
450 ObjectExt::set_property(self,"input-key", input_key)
451 }
452
453 #[cfg(feature = "v1_2")]
456 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
457 pub fn set_local(&self, local: Option<&str>) {
458 ObjectExt::set_property(self,"local", local)
459 }
460
461 #[cfg(feature = "v1_2")]
467 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
468 pub fn set_mode(&self, mode: u32) {
469 ObjectExt::set_property(self,"mode", mode)
470 }
471
472 #[cfg(feature = "v1_2")]
475 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
476 pub fn set_mtu(&self, mtu: u32) {
477 ObjectExt::set_property(self,"mtu", mtu)
478 }
479
480 #[cfg(feature = "v1_2")]
483 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
484 #[doc(alias = "output-key")]
485 pub fn set_output_key(&self, output_key: Option<&str>) {
486 ObjectExt::set_property(self,"output-key", output_key)
487 }
488
489 #[cfg(feature = "v1_2")]
493 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
494 pub fn set_parent(&self, parent: Option<&str>) {
495 ObjectExt::set_property(self,"parent", parent)
496 }
497
498 #[cfg(feature = "v1_2")]
500 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
501 #[doc(alias = "path-mtu-discovery")]
502 pub fn set_path_mtu_discovery(&self, path_mtu_discovery: bool) {
503 ObjectExt::set_property(self,"path-mtu-discovery", path_mtu_discovery)
504 }
505
506 #[cfg(feature = "v1_2")]
509 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
510 pub fn set_remote(&self, remote: Option<&str>) {
511 ObjectExt::set_property(self,"remote", remote)
512 }
513
514 #[cfg(feature = "v1_2")]
517 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
518 pub fn set_tos(&self, tos: u32) {
519 ObjectExt::set_property(self,"tos", tos)
520 }
521
522 #[cfg(feature = "v1_2")]
525 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
526 pub fn set_ttl(&self, ttl: u32) {
527 ObjectExt::set_property(self,"ttl", ttl)
528 }
529
530 #[cfg(feature = "v1_2")]
531 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
532 #[doc(alias = "encapsulation-limit")]
533 pub fn connect_encapsulation_limit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
534 unsafe extern "C" fn notify_encapsulation_limit_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
535 let f: &F = &*(f as *const F);
536 f(&from_glib_borrow(this))
537 }
538 unsafe {
539 let f: Box_<F> = Box_::new(f);
540 connect_raw(self.as_ptr() as *mut _, c"notify::encapsulation-limit".as_ptr() as *const _,
541 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_encapsulation_limit_trampoline::<F> as *const ())), Box_::into_raw(f))
542 }
543 }
544
545 #[cfg(feature = "v1_12")]
546 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
547 #[doc(alias = "flags")]
548 pub fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
549 unsafe extern "C" fn notify_flags_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
550 let f: &F = &*(f as *const F);
551 f(&from_glib_borrow(this))
552 }
553 unsafe {
554 let f: Box_<F> = Box_::new(f);
555 connect_raw(self.as_ptr() as *mut _, c"notify::flags".as_ptr() as *const _,
556 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
557 }
558 }
559
560 #[cfg(feature = "v1_2")]
561 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
562 #[doc(alias = "flow-label")]
563 pub fn connect_flow_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
564 unsafe extern "C" fn notify_flow_label_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
565 let f: &F = &*(f as *const F);
566 f(&from_glib_borrow(this))
567 }
568 unsafe {
569 let f: Box_<F> = Box_::new(f);
570 connect_raw(self.as_ptr() as *mut _, c"notify::flow-label".as_ptr() as *const _,
571 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_flow_label_trampoline::<F> as *const ())), Box_::into_raw(f))
572 }
573 }
574
575 #[cfg(feature = "v1_42")]
576 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
577 #[doc(alias = "fwmark")]
578 pub fn connect_fwmark_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
579 unsafe extern "C" fn notify_fwmark_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
580 let f: &F = &*(f as *const F);
581 f(&from_glib_borrow(this))
582 }
583 unsafe {
584 let f: Box_<F> = Box_::new(f);
585 connect_raw(self.as_ptr() as *mut _, c"notify::fwmark".as_ptr() as *const _,
586 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_fwmark_trampoline::<F> as *const ())), Box_::into_raw(f))
587 }
588 }
589
590 #[cfg(feature = "v1_2")]
591 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
592 #[doc(alias = "input-key")]
593 pub fn connect_input_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
594 unsafe extern "C" fn notify_input_key_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
595 let f: &F = &*(f as *const F);
596 f(&from_glib_borrow(this))
597 }
598 unsafe {
599 let f: Box_<F> = Box_::new(f);
600 connect_raw(self.as_ptr() as *mut _, c"notify::input-key".as_ptr() as *const _,
601 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_input_key_trampoline::<F> as *const ())), Box_::into_raw(f))
602 }
603 }
604
605 #[cfg(feature = "v1_2")]
606 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
607 #[doc(alias = "local")]
608 pub fn connect_local_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
609 unsafe extern "C" fn notify_local_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
610 let f: &F = &*(f as *const F);
611 f(&from_glib_borrow(this))
612 }
613 unsafe {
614 let f: Box_<F> = Box_::new(f);
615 connect_raw(self.as_ptr() as *mut _, c"notify::local".as_ptr() as *const _,
616 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_local_trampoline::<F> as *const ())), Box_::into_raw(f))
617 }
618 }
619
620 #[cfg(feature = "v1_2")]
621 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
622 #[doc(alias = "mode")]
623 pub fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
624 unsafe extern "C" fn notify_mode_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
625 let f: &F = &*(f as *const F);
626 f(&from_glib_borrow(this))
627 }
628 unsafe {
629 let f: Box_<F> = Box_::new(f);
630 connect_raw(self.as_ptr() as *mut _, c"notify::mode".as_ptr() as *const _,
631 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mode_trampoline::<F> as *const ())), Box_::into_raw(f))
632 }
633 }
634
635 #[cfg(feature = "v1_2")]
636 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
637 #[doc(alias = "mtu")]
638 pub fn connect_mtu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
639 unsafe extern "C" fn notify_mtu_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
640 let f: &F = &*(f as *const F);
641 f(&from_glib_borrow(this))
642 }
643 unsafe {
644 let f: Box_<F> = Box_::new(f);
645 connect_raw(self.as_ptr() as *mut _, c"notify::mtu".as_ptr() as *const _,
646 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mtu_trampoline::<F> as *const ())), Box_::into_raw(f))
647 }
648 }
649
650 #[cfg(feature = "v1_2")]
651 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
652 #[doc(alias = "output-key")]
653 pub fn connect_output_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
654 unsafe extern "C" fn notify_output_key_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
655 let f: &F = &*(f as *const F);
656 f(&from_glib_borrow(this))
657 }
658 unsafe {
659 let f: Box_<F> = Box_::new(f);
660 connect_raw(self.as_ptr() as *mut _, c"notify::output-key".as_ptr() as *const _,
661 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_output_key_trampoline::<F> as *const ())), Box_::into_raw(f))
662 }
663 }
664
665 #[cfg(feature = "v1_2")]
666 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
667 #[doc(alias = "parent")]
668 pub fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
669 unsafe extern "C" fn notify_parent_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
670 let f: &F = &*(f as *const F);
671 f(&from_glib_borrow(this))
672 }
673 unsafe {
674 let f: Box_<F> = Box_::new(f);
675 connect_raw(self.as_ptr() as *mut _, c"notify::parent".as_ptr() as *const _,
676 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_parent_trampoline::<F> as *const ())), Box_::into_raw(f))
677 }
678 }
679
680 #[cfg(feature = "v1_2")]
681 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
682 #[doc(alias = "path-mtu-discovery")]
683 pub fn connect_path_mtu_discovery_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
684 unsafe extern "C" fn notify_path_mtu_discovery_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
685 let f: &F = &*(f as *const F);
686 f(&from_glib_borrow(this))
687 }
688 unsafe {
689 let f: Box_<F> = Box_::new(f);
690 connect_raw(self.as_ptr() as *mut _, c"notify::path-mtu-discovery".as_ptr() as *const _,
691 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_path_mtu_discovery_trampoline::<F> as *const ())), Box_::into_raw(f))
692 }
693 }
694
695 #[cfg(feature = "v1_2")]
696 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
697 #[doc(alias = "remote")]
698 pub fn connect_remote_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
699 unsafe extern "C" fn notify_remote_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
700 let f: &F = &*(f as *const F);
701 f(&from_glib_borrow(this))
702 }
703 unsafe {
704 let f: Box_<F> = Box_::new(f);
705 connect_raw(self.as_ptr() as *mut _, c"notify::remote".as_ptr() as *const _,
706 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_remote_trampoline::<F> as *const ())), Box_::into_raw(f))
707 }
708 }
709
710 #[cfg(feature = "v1_2")]
711 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
712 #[doc(alias = "tos")]
713 pub fn connect_tos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
714 unsafe extern "C" fn notify_tos_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
715 let f: &F = &*(f as *const F);
716 f(&from_glib_borrow(this))
717 }
718 unsafe {
719 let f: Box_<F> = Box_::new(f);
720 connect_raw(self.as_ptr() as *mut _, c"notify::tos".as_ptr() as *const _,
721 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_tos_trampoline::<F> as *const ())), Box_::into_raw(f))
722 }
723 }
724
725 #[cfg(feature = "v1_2")]
726 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
727 #[doc(alias = "ttl")]
728 pub fn connect_ttl_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
729 unsafe extern "C" fn notify_ttl_trampoline<F: Fn(&SettingIPTunnel) + 'static>(this: *mut ffi::NMSettingIPTunnel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
730 let f: &F = &*(f as *const F);
731 f(&from_glib_borrow(this))
732 }
733 unsafe {
734 let f: Box_<F> = Box_::new(f);
735 connect_raw(self.as_ptr() as *mut _, c"notify::ttl".as_ptr() as *const _,
736 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ttl_trampoline::<F> as *const ())), Box_::into_raw(f))
737 }
738 }
739}
740
741#[cfg(feature = "v1_2")]
742#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
743impl Default for SettingIPTunnel {
744 fn default() -> Self {
745 Self::new()
746 }
747 }
748
749#[must_use = "The builder must be built to be used"]
754pub struct SettingIPTunnelBuilder {
755 builder: glib::object::ObjectBuilder<'static, SettingIPTunnel>,
756 }
757
758 impl SettingIPTunnelBuilder {
759 fn new() -> Self {
760 Self { builder: glib::object::Object::builder() }
761 }
762
763 #[cfg(feature = "v1_2")]
767 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
768 pub fn encapsulation_limit(self, encapsulation_limit: u32) -> Self {
769 Self { builder: self.builder.property("encapsulation-limit", encapsulation_limit), }
770 }
771
772 #[cfg(feature = "v1_12")]
778 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
779 pub fn flags(self, flags: u32) -> Self {
780 Self { builder: self.builder.property("flags", flags), }
781 }
782
783 #[cfg(feature = "v1_2")]
786 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
787 pub fn flow_label(self, flow_label: u32) -> Self {
788 Self { builder: self.builder.property("flow-label", flow_label), }
789 }
790
791 #[cfg(feature = "v1_42")]
794 #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
795 pub fn fwmark(self, fwmark: u32) -> Self {
796 Self { builder: self.builder.property("fwmark", fwmark), }
797 }
798
799 #[cfg(feature = "v1_2")]
802 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
803 pub fn input_key(self, input_key: impl Into<glib::GString>) -> Self {
804 Self { builder: self.builder.property("input-key", input_key.into()), }
805 }
806
807 #[cfg(feature = "v1_2")]
810 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
811 pub fn local(self, local: impl Into<glib::GString>) -> Self {
812 Self { builder: self.builder.property("local", local.into()), }
813 }
814
815 #[cfg(feature = "v1_2")]
821 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
822 pub fn mode(self, mode: u32) -> Self {
823 Self { builder: self.builder.property("mode", mode), }
824 }
825
826 #[cfg(feature = "v1_2")]
829 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
830 pub fn mtu(self, mtu: u32) -> Self {
831 Self { builder: self.builder.property("mtu", mtu), }
832 }
833
834 #[cfg(feature = "v1_2")]
837 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
838 pub fn output_key(self, output_key: impl Into<glib::GString>) -> Self {
839 Self { builder: self.builder.property("output-key", output_key.into()), }
840 }
841
842 #[cfg(feature = "v1_2")]
846 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
847 pub fn parent(self, parent: impl Into<glib::GString>) -> Self {
848 Self { builder: self.builder.property("parent", parent.into()), }
849 }
850
851 #[cfg(feature = "v1_2")]
853 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
854 pub fn path_mtu_discovery(self, path_mtu_discovery: bool) -> Self {
855 Self { builder: self.builder.property("path-mtu-discovery", path_mtu_discovery), }
856 }
857
858 #[cfg(feature = "v1_2")]
861 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
862 pub fn remote(self, remote: impl Into<glib::GString>) -> Self {
863 Self { builder: self.builder.property("remote", remote.into()), }
864 }
865
866 #[cfg(feature = "v1_2")]
869 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
870 pub fn tos(self, tos: u32) -> Self {
871 Self { builder: self.builder.property("tos", tos), }
872 }
873
874 #[cfg(feature = "v1_2")]
877 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
878 pub fn ttl(self, ttl: u32) -> Self {
879 Self { builder: self.builder.property("ttl", ttl), }
880 }
881
882 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
885 pub fn build(self) -> SettingIPTunnel {
886assert_initialized_main_thread!();
887 self.builder.build() }
888}