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
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
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
// 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

#[cfg(feature = "v1_52")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
use crate::SettingIP4DhcpIpv6OnlyPreferred;
use crate::{IPAddress, IPRoute, Setting, SettingIPConfig, ffi};
#[cfg(feature = "v1_42")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
use crate::{SettingIP4LinkLocal, Ternary};
use glib::{
    prelude::*,
    signal::{SignalHandlerId, connect_raw},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    /// IPv4 Settings
    ///
    /// ## Properties
    ///
    ///
    /// #### `dhcp-client-id`
    ///  A string sent to the DHCP server to identify the local machine which the
    /// DHCP server may use to customize the DHCP lease and options.
    /// When the property is a hex string ('aa:bb:cc') it is interpreted as a
    /// binary client ID, in which case the first byte is assumed to be the
    /// 'type' field as per RFC 2132 section 9.14 and the remaining bytes may be
    /// an hardware address (e.g. '01:xx:xx:xx:xx:xx:xx' where 1 is the Ethernet
    /// ARP type and the rest is a MAC address).
    /// If the property is not a hex string it is considered as a
    /// non-hardware-address client ID and the 'type' field is set to 0.
    ///
    /// The special values "mac" and "perm-mac" are supported, which use the
    /// current or permanent MAC address of the device to generate a client identifier
    /// with type ethernet (01). Currently, these options only work for ethernet
    /// type of links.
    ///
    /// The special value "ipv6-duid" uses the DUID from "ipv6.dhcp-duid" property as
    /// an RFC4361-compliant client identifier. As IAID it uses "ipv4.dhcp-iaid"
    /// and falls back to "ipv6.dhcp-iaid" if unset.
    ///
    /// The special value "duid" generates a RFC4361-compliant client identifier based
    /// on "ipv4.dhcp-iaid" and uses a DUID generated by hashing /etc/machine-id.
    ///
    /// The special value "stable" is supported to generate a type 0 client identifier based
    /// on the stable-id (see connection.stable-id) and a per-host key. If you set the
    /// stable-id, you may want to include the "${DEVICE}" or "${MAC}" specifier to get a
    /// per-device key.
    ///
    /// The special value "none" prevents any client identifier from being sent. Note that
    /// this is normally not recommended.
    ///
    /// If unset, a globally configured default from NetworkManager.conf is
    /// used. If still unset, the default depends on the DHCP plugin. The
    /// internal dhcp client will default to "mac" and the dhclient plugin will
    /// try to use one from its config file if present, or won't sent any
    /// client-id otherwise.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-fqdn`
    ///  If the #NMSettingIPConfig:dhcp-send-hostname property is [`true`], then the
    /// specified FQDN will be sent to the DHCP server when acquiring a lease. This
    /// property and #NMSettingIPConfig:dhcp-hostname are mutually exclusive and
    /// cannot be set at the same time.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-ipv6-only-preferred`
    ///  Controls the "IPv6-Only Preferred" DHCPv4 option (RFC 8925).
    ///
    /// When set to [`SettingIP4DhcpIpv6OnlyPreferred::Yes`][crate::SettingIP4DhcpIpv6OnlyPreferred::Yes], the host adds the
    /// option to the parameter request list; if the DHCP server sends the option back,
    /// the host stops the DHCP client for the time interval specified in the option.
    ///
    /// Enable this feature if the host supports an IPv6-only mode, i.e. either all
    /// applications are IPv6-only capable or there is a form of 464XLAT deployed.
    ///
    /// When set to [`SettingIP4DhcpIpv6OnlyPreferred::Default`][crate::SettingIP4DhcpIpv6OnlyPreferred::Default], the actual value
    /// is looked up in the global configuration; if not specified, it defaults to
    /// [`SettingIP4DhcpIpv6OnlyPreferred::No`][crate::SettingIP4DhcpIpv6OnlyPreferred::No].
    ///
    /// If the connection has IPv6 method set to "disabled", this property does not
    /// have effect and the "IPv6-Only Preferred" option is always disabled.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-vendor-class-identifier`
    ///  The Vendor Class Identifier DHCP option (60).
    /// Special characters in the data string may be escaped using C-style escapes,
    /// nevertheless this property cannot contain nul bytes.
    /// If the per-profile value is unspecified (the default),
    /// a global connection default gets consulted.
    /// If still unspecified, the DHCP option is not sent to the server.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `link-local`
    ///  Enable and disable the IPv4 link-local configuration independently of the
    /// ipv4.method configuration. This allows a link-local address (169.254.x.y/16)
    /// to be obtained in addition to other addresses, such as those manually
    /// configured or obtained from a DHCP server.
    ///
    /// When set to "auto", the value is dependent on "ipv4.method".
    /// When set to "default", it honors the global connection default, before
    /// falling back to "auto". Note that if "ipv4.method" is "disabled", then
    /// link local addressing is always disabled too. The default is "default".
    /// Since 1.52, when set to "fallback", a link-local address is obtained
    /// if no other IPv4 address is set.
    ///
    /// Readable | Writeable
    /// <details><summary><h4>SettingIPConfig</h4></summary>
    ///
    ///
    /// #### `addresses`
    ///  Array of IP addresses.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `auto-route-ext-gw`
    ///  VPN connections will default to add the route automatically unless this
    /// setting is set to [`false`].
    ///
    /// For other connection types, adding such an automatic route is currently
    /// not supported and setting this to [`true`] has no effect.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dad-timeout`
    ///  Maximum timeout in milliseconds used to check for the presence of duplicate
    /// IP addresses on the network.  If an address conflict is detected, the
    /// activation will fail. The property is currently implemented only for IPv4.
    ///
    /// A zero value means that no duplicate address detection is performed, -1 means
    /// the default value (either the value configured globally in NetworkManger.conf
    /// or 200ms).  A value greater than zero is a timeout in milliseconds.  Note that
    /// the time intervals are subject to randomization as per RFC 5227 and so the
    /// actual duration can be between half and the full time specified in this
    /// property.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-dscp`
    ///  Specifies the value for the DSCP field (traffic class) of the IP header. When
    /// empty, the global default value is used; if no global default is specified, it is
    /// assumed to be "CS0". Allowed values are: "CS0", "CS4" and "CS6".
    ///
    /// The property is currently valid only for IPv4, and it is supported only by the
    /// "internal" DHCP plugin.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-hostname`
    ///  If the #NMSettingIPConfig:dhcp-send-hostname property is [`true`], then the
    /// specified name will be sent to the DHCP server when acquiring a lease.
    /// This property and #NMSettingIP4Config:dhcp-fqdn are mutually exclusive and
    /// cannot be set at the same time.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-hostname-flags`
    ///  Flags for the DHCP hostname and FQDN.
    ///
    /// Currently, this property only includes flags to control the FQDN flags
    /// set in the DHCP FQDN option. Supported FQDN flags are
    /// [`DhcpHostnameFlags::FQDN_SERV_UPDATE`][crate::DhcpHostnameFlags::FQDN_SERV_UPDATE],
    /// [`DhcpHostnameFlags::FQDN_ENCODED`][crate::DhcpHostnameFlags::FQDN_ENCODED] and
    /// [`DhcpHostnameFlags::FQDN_NO_UPDATE`][crate::DhcpHostnameFlags::FQDN_NO_UPDATE].  When no FQDN flag is set and
    /// [`DhcpHostnameFlags::FQDN_CLEAR_FLAGS`][crate::DhcpHostnameFlags::FQDN_CLEAR_FLAGS] is set, the DHCP FQDN option will
    /// contain no flag. Otherwise, if no FQDN flag is set and
    /// [`DhcpHostnameFlags::FQDN_CLEAR_FLAGS`][crate::DhcpHostnameFlags::FQDN_CLEAR_FLAGS] is not set, the standard FQDN flags
    /// are set in the request:
    /// [`DhcpHostnameFlags::FQDN_SERV_UPDATE`][crate::DhcpHostnameFlags::FQDN_SERV_UPDATE],
    /// [`DhcpHostnameFlags::FQDN_ENCODED`][crate::DhcpHostnameFlags::FQDN_ENCODED] for IPv4 and
    /// [`DhcpHostnameFlags::FQDN_SERV_UPDATE`][crate::DhcpHostnameFlags::FQDN_SERV_UPDATE] for IPv6.
    ///
    /// When this property is set to the default value [`DhcpHostnameFlags::NONE`][crate::DhcpHostnameFlags::NONE],
    /// a global default is looked up in NetworkManager configuration. If that value
    /// is unset or also [`DhcpHostnameFlags::NONE`][crate::DhcpHostnameFlags::NONE], then the standard FQDN flags
    /// described above are sent in the DHCP requests.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-iaid`
    ///  A string containing the "Identity Association Identifier" (IAID) used by
    /// the DHCP client. The string can be a 32-bit number (either decimal,
    /// hexadecimal or as colon separated hexadecimal numbers). Alternatively
    /// it can be set to the special values "mac", "perm-mac", "ifname" or
    /// "stable". When set to "mac" (or "perm-mac"), the last 4 bytes of the
    /// current (or permanent) MAC address are used as IAID. When set to
    /// "ifname", the IAID is computed by hashing the interface name. The
    /// special value "stable" can be used to generate an IAID based on the
    /// stable-id (see connection.stable-id), a per-host key and the interface
    /// name. When the property is unset, the value from global configuration is
    /// used; if no global default is set then the IAID is assumed to be
    /// "ifname".
    ///
    /// For DHCPv4, the IAID is only used with "ipv4.dhcp-client-id"
    /// values "duid" and "ipv6-duid" to generate the client-id.
    ///
    /// For DHCPv6, note that at the moment this property is
    /// only supported by the "internal" DHCPv6 plugin. The "dhclient" DHCPv6
    /// plugin always derives the IAID from the MAC address.
    ///
    /// The actually used DHCPv6 IAID for a currently activated interface is
    /// exposed in the lease information of the device.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-reject-servers`
    ///  Array of servers from which DHCP offers must be rejected. This property
    /// is useful to avoid getting a lease from misconfigured or rogue servers.
    ///
    /// For DHCPv4, each element must be an IPv4 address, optionally
    /// followed by a slash and a prefix length (e.g. "192.168.122.0/24").
    ///
    /// This property is currently not implemented for DHCPv6.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-send-hostname`
    ///  Since 1.52 this property is deprecated and is only used as fallback value
    /// for #NMSettingIPConfig:dhcp-send-hostname-v2 if it's set to 'default'.
    /// This is only done to avoid breaking existing configurations, the new
    /// property should be used from now on.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-send-hostname-v2`
    ///  If [`true`], a hostname is sent to the DHCP server when acquiring a lease.
    /// Some DHCP servers use this hostname to update DNS databases, essentially
    /// providing a static hostname for the computer.  If the
    /// #NMSettingIPConfig:dhcp-hostname property is [`None`] and this property is
    /// [`true`], the current persistent hostname of the computer is sent.
    ///
    /// The default value is [`Ternary::Default`][crate::Ternary::Default]. In this case the global value
    /// from NetworkManager configuration is looked up. If it's not set, the value
    /// from #NMSettingIPConfig:dhcp-send-hostname, which defaults to [`true`], is
    /// used for backwards compatibility. In the future this will change and, in
    /// absence of a global default, it will always fallback to [`true`].
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-send-release`
    ///  Whether the DHCP client will send RELEASE message when
    /// bringing the connection down. The default value is [`Ternary::Default`][crate::Ternary::Default].
    /// When the default value is specified, then the global value from NetworkManager
    /// configuration is looked up, if not set, it is considered as [`false`].
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dhcp-timeout`
    ///  A timeout for a DHCP transaction in seconds. If zero (the default), a
    /// globally configured default is used. If still unspecified, a device specific
    /// timeout is used (usually 45 seconds).
    ///
    /// Set to 2147483647 (MAXINT32) for infinity.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dns`
    ///  Array of DNS servers.
    ///
    /// Each server can be specified either as a plain IP address (optionally followed
    /// by a "#" and the SNI server name for DNS over TLS) or with a URI syntax.
    ///
    /// When it is specified as an URI, the following forms are supported:
    /// dns+udp://ADDRESS[:PORT], dns+tls://ADDRESS[:PORT][#SERVERNAME] .
    ///
    /// When using the URI syntax, IPv6 addresses must be enclosed in square
    /// brackets ('[', ']').
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dns-options`
    ///  Array of DNS options to be added to resolv.conf.
    ///
    /// [`None`] means that the options are unset and left at the default.
    /// In this case NetworkManager will use default options. This is
    /// distinct from an empty list of properties.
    ///
    /// The following options are directly added to resolv.conf: "attempts",
    ///  "debug", "edns0",
    /// "inet6", "ip6-bytestring", "ip6-dotint", "ndots", "no-aaaa",
    /// "no-check-names", "no-ip6-dotint", "no-reload", "no-tld-query",
    /// "rotate", "single-request", "single-request-reopen", "timeout",
    /// "trust-ad", "use-vc". See the resolv.conf(5) man page for a
    /// detailed description of these options.
    ///
    /// In addition, NetworkManager supports the special options "_no-add-edns0"
    /// and "_no-add-trust-ad". They are not added to resolv.conf, and can be
    /// used to prevent the automatic addition of options "edns0" and "trust-ad"
    /// when using caching DNS plugins (see below).
    ///
    /// The "trust-ad" setting is only honored if the profile contributes
    /// name servers to resolv.conf, and if all contributing profiles have
    /// "trust-ad" enabled.
    ///
    /// When using a caching DNS plugin (dnsmasq or systemd-resolved in
    /// NetworkManager.conf) then "edns0" and "trust-ad" are automatically
    /// added, unless "_no-add-edns0" and "_no-add-trust-ad" are present.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dns-priority`
    ///  DNS servers priority.
    ///
    /// The relative priority for DNS servers specified by this setting.  A lower
    /// numerical value is better (higher priority).
    ///
    /// Negative values have the special effect of excluding other configurations
    /// with a greater numerical priority value; so in presence of at least one negative
    /// priority, only DNS servers from connections with the lowest priority value will be used.
    /// To avoid all DNS leaks, set the priority of the profile that should be used
    /// to the most negative value of all active connections profiles.
    ///
    /// Zero selects a globally configured default value. If the latter is missing
    /// or zero too, it defaults to 50 for VPNs (including WireGuard) and 100 for
    /// other connections.
    ///
    /// Note that the priority is to order DNS settings for multiple active
    /// connections.  It does not disambiguate multiple DNS servers within the
    /// same connection profile.
    ///
    /// When multiple devices have configurations with the same priority, VPNs will be
    /// considered first, then devices with the best (lowest metric) default
    /// route and then all other devices.
    ///
    /// When using dns=default, servers with higher priority will be on top of
    /// resolv.conf. To prioritize a given server over another one within the
    /// same connection, just specify them in the desired order.
    /// Note that commonly the resolver tries name servers in /etc/resolv.conf
    /// in the order listed, proceeding with the next server in the list
    /// on failure. See for example the "rotate" option of the dns-options setting.
    /// If there are any negative DNS priorities, then only name servers from
    /// the devices with that lowest priority will be considered.
    ///
    /// When using a DNS resolver that supports Conditional Forwarding or
    /// Split DNS (with dns=dnsmasq or dns=systemd-resolved settings), each connection
    /// is used to query domains in its search list. The search domains determine which
    /// name servers to ask, and the DNS priority is used to prioritize
    /// name servers based on the domain.  Queries for domains not present in any
    /// search list are routed through connections having the '~.' special wildcard
    /// domain, which is added automatically to connections with the default route
    /// (or can be added manually).  When multiple connections specify the same domain, the
    /// one with the best priority (lowest numerical value) wins.  If a sub domain
    /// is configured on another interface it will be accepted regardless the priority,
    /// unless parent domain on the other interface has a negative priority, which causes
    /// the sub domain to be shadowed.
    /// With Split DNS one can avoid undesired DNS leaks by properly configuring
    /// DNS priorities and the search domains, so that only name servers of the desired
    /// interface are configured.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `dns-search`
    ///  List of DNS search domains. Domains starting with a tilde ('~')
    /// are considered 'routing' domains and are used only to decide the
    /// interface over which a query must be forwarded; they are not used
    /// to complete unqualified host names.
    ///
    /// When using a DNS plugin that supports Conditional Forwarding or
    /// Split DNS, then the search domains specify which name servers to
    /// query. This makes the behavior different from running with plain
    /// /etc/resolv.conf. For more information see also the dns-priority setting.
    ///
    /// When set on a profile that also enabled DHCP, the DNS search list
    /// received automatically (option 119 for DHCPv4 and option 24 for DHCPv6)
    /// gets merged with the manual list. This can be prevented by setting
    /// "ignore-auto-dns". Note that if no DNS searches are configured, the
    /// fallback will be derived from the domain from DHCP (option 15).
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `forwarding`
    ///  Whether to configure sysctl interface-specific forwarding. When enabled, the interface
    /// will act as a router to forward the packet from one interface to another. When set to
    /// [`SettingIPConfigForwarding::Default`][crate::SettingIPConfigForwarding::Default], the value from global configuration is used;
    /// if no global default is defined, [`SettingIPConfigForwarding::Auto`][crate::SettingIPConfigForwarding::Auto] will be used.
    /// The #NMSettingIPConfig:forwarding property is ignored when #NMSettingIPConfig:method
    /// is set to "shared", because forwarding is always enabled in this case.
    /// The accepted values are:
    ///   [`SettingIPConfigForwarding::Default`][crate::SettingIPConfigForwarding::Default]: use global default.
    ///   [`SettingIPConfigForwarding::No`][crate::SettingIPConfigForwarding::No]: disabled.
    ///   [`SettingIPConfigForwarding::Yes`][crate::SettingIPConfigForwarding::Yes]: enabled.
    ///   [`SettingIPConfigForwarding::Auto`][crate::SettingIPConfigForwarding::Auto]: enable if any shared connection is active,
    ///        use kernel default otherwise.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `gateway`
    ///  The gateway associated with this configuration. This is only meaningful
    /// if #NMSettingIPConfig:addresses is also set.
    ///
    /// Setting the gateway causes NetworkManager to configure a standard default route
    /// with the gateway as next hop. This is ignored if #NMSettingIPConfig:never-default
    /// is set. An alternative is to configure the default route explicitly with a manual
    /// route and /0 as prefix length.
    ///
    /// Note that the gateway usually conflicts with routing that NetworkManager configures
    /// for WireGuard interfaces, so usually it should not be set in that case. See
    /// #NMSettingWireGuard:ip4-auto-default-route.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `ignore-auto-dns`
    ///  When #NMSettingIPConfig:method is set to "auto" and this property to
    /// [`true`], automatically configured name servers and search domains are
    /// ignored and only name servers and search domains specified in the
    /// #NMSettingIPConfig:dns and #NMSettingIPConfig:dns-search properties, if
    /// any, are used.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `ignore-auto-routes`
    ///  When #NMSettingIPConfig:method is set to "auto" and this property to
    /// [`true`], automatically configured routes are ignored and only routes
    /// specified in the #NMSettingIPConfig:routes property, if any, are used.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `may-fail`
    ///  If [`true`], allow overall network configuration to proceed even if the
    /// configuration specified by this property times out.  Note that at least
    /// one IP configuration must succeed or overall network configuration will
    /// still fail.  For example, in IPv6-only networks, setting this property to
    /// [`true`] on the #NMSettingIP4Config allows the overall network configuration
    /// to succeed if IPv4 configuration fails but IPv6 configuration completes
    /// successfully.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `method`
    ///  IP configuration method.
    ///
    /// #NMSettingIP4Config and #NMSettingIP6Config both support "disabled",
    /// "auto", "manual", and "link-local". See the subclass-specific
    /// documentation for other values.
    ///
    /// In general, for the "auto" method, properties such as
    /// #NMSettingIPConfig:dns and #NMSettingIPConfig:routes specify information
    /// that is added on to the information returned from automatic
    /// configuration.  The #NMSettingIPConfig:ignore-auto-routes and
    /// #NMSettingIPConfig:ignore-auto-dns properties modify this behavior.
    ///
    /// For methods that imply no upstream network, such as "shared" or
    /// "link-local", these properties must be empty.
    ///
    /// For IPv4 method "shared", the IP subnet can be configured by adding one
    /// manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the
    /// shared method must be configured on the interface which shares the internet
    /// to a subnet, not on the uplink which is shared.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `never-default`
    ///  If [`true`], this connection will never be the default connection for this
    /// IP type, meaning it will never be assigned the default route by
    /// NetworkManager.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `replace-local-rule`
    ///  Connections will default to keep the autogenerated priority 0 local rule
    /// unless this setting is set to [`true`].
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `required-timeout`
    ///  The minimum time interval in milliseconds for which dynamic IP configuration
    /// should be tried before the connection succeeds.
    ///
    /// This property is useful for example if both IPv4 and IPv6 are enabled and
    /// are allowed to fail. Normally the connection succeeds as soon as one of
    /// the two address families completes; by setting a required timeout for
    /// e.g. IPv4, one can ensure that even if IP6 succeeds earlier than IPv4,
    /// NetworkManager waits some time for IPv4 before the connection becomes
    /// active.
    ///
    /// Note that if #NMSettingIPConfig:may-fail is FALSE for the same address
    /// family, this property has no effect as NetworkManager needs to wait for
    /// the full DHCP timeout.
    ///
    /// A zero value means that no required timeout is present, -1 means the
    /// default value (either configuration ipvx.required-timeout override or
    /// zero).
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `route-metric`
    ///  The default metric for routes that don't explicitly specify a metric.
    /// The default value -1 means that the metric is chosen automatically
    /// based on the device type.
    /// The metric applies to dynamic routes, manual (static) routes that
    /// don't have an explicit metric setting, address prefix routes, and
    /// the default route.
    /// Note that for IPv6, the kernel accepts zero (0) but coerces it to
    /// 1024 (user default). Hence, setting this property to zero effectively
    /// mean setting it to 1024.
    /// For IPv4, zero is a regular value for the metric.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `route-table`
    ///  Enable policy routing (source routing) and set the routing table used when adding routes.
    ///
    /// This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes
    /// and static routes. But note that static routes can individually overwrite the setting
    /// by explicitly specifying a non-zero routing table.
    ///
    /// If the table setting is left at zero, it is eligible to be overwritten via global
    /// configuration. If the property is zero even after applying the global configuration
    /// value, policy routing is disabled for the address family of this connection.
    ///
    /// Policy routing disabled means that NetworkManager will add all routes to the main
    /// table (except static routes that explicitly configure a different table). Additionally,
    /// NetworkManager will not delete any extraneous routes from tables except the main table.
    /// This is to preserve backward compatibility for users who manage routing tables outside
    /// of NetworkManager.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `routed-dns`
    ///  Whether to add routes for DNS servers. When enabled, NetworkManager adds a route
    /// for each DNS server that is associated with this connection either statically
    /// (defined in the connection profile) or dynamically (for example, retrieved via
    /// DHCP). The route guarantees that the DNS server is reached via this interface. When
    /// set to [`SettingIPConfigRoutedDns::Default`][crate::SettingIPConfigRoutedDns::Default], the value from global
    /// configuration is used; if no global default is defined, this feature is disabled.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `routes`
    ///  Array of IP routes.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `shared-dhcp-lease-time`
    ///  This option allows you to specify a custom DHCP lease time for the shared connection
    /// method in seconds. The value should be either a number between 120 and 31536000 (one year)
    /// If this option is not specified, 3600 (one hour) is used.
    ///
    /// Special values are 0 for default value of 1 hour and 2147483647 (MAXINT32) for infinite lease time.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `shared-dhcp-range`
    ///  This option allows you to specify a custom DHCP range for the shared connection
    /// method. The value is expected to be in `<START_ADDRESS>,<END_ADDRESS>` format.
    /// The range should be part of network set by ipv4.address option and it should
    /// not contain network address or broadcast address. If this option is not specified,
    /// the DHCP range will be automatically determined based on the interface address.
    /// The range will be selected to be adjacent to the interface address, either before
    /// or after it, with the larger possible range being preferred. The range will be
    /// adjusted to fill the available address space, except for networks with a prefix
    /// length greater than 24, which will be treated as if they have a prefix length of 24.
    ///
    /// Readable | Writeable
    /// </details>
    /// <details><summary><h4>Setting</h4></summary>
    ///
    ///
    /// #### `name`
    ///  The setting's name, which uniquely identifies the setting within the
    /// connection.  Each setting type has a name unique to that type, for
    /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
    ///
    /// Readable
    /// </details>
    ///
    /// # Implements
    ///
    /// [`SettingIPConfigExt`][trait@crate::prelude::SettingIPConfigExt], [`SettingExt`][trait@crate::prelude::SettingExt]
    #[doc(alias = "NMSettingIP4Config")]
    pub struct SettingIP4Config(Object<ffi::NMSettingIP4Config, ffi::NMSettingIP4ConfigClass>) @extends SettingIPConfig, Setting;

    match fn {
        type_ => || ffi::nm_setting_ip4_config_get_type(),
    }
}

impl SettingIP4Config {
    /// Creates a new #NMSettingIP4Config object with default values.
    ///
    /// # Returns
    ///
    /// the new empty #NMSettingIP4Config object
    #[doc(alias = "nm_setting_ip4_config_new")]
    pub fn new() -> SettingIP4Config {
        assert_initialized_main_thread!();
        unsafe { Setting::from_glib_full(ffi::nm_setting_ip4_config_new()).unsafe_cast() }
    }

    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`SettingIP4Config`] objects.
    ///
    /// This method returns an instance of [`SettingIP4ConfigBuilder`](crate::builders::SettingIP4ConfigBuilder) which can be used to create [`SettingIP4Config`] objects.
    pub fn builder() -> SettingIP4ConfigBuilder {
        SettingIP4ConfigBuilder::new()
    }

    /// Returns the value contained in the #NMSettingIP4Config:dhcp-client-id
    /// property.
    ///
    /// # Returns
    ///
    /// the configured Client ID to send to the DHCP server when requesting
    /// addresses via DHCP.
    #[doc(alias = "nm_setting_ip4_config_get_dhcp_client_id")]
    #[doc(alias = "get_dhcp_client_id")]
    #[doc(alias = "dhcp-client-id")]
    pub fn dhcp_client_id(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nm_setting_ip4_config_get_dhcp_client_id(
                self.to_glib_none().0,
            ))
        }
    }

    /// Returns the value contained in the #NMSettingIP4Config:dhcp-fqdn
    /// property.
    ///
    /// # Returns
    ///
    /// the configured FQDN to send to the DHCP server
    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    #[doc(alias = "nm_setting_ip4_config_get_dhcp_fqdn")]
    #[doc(alias = "get_dhcp_fqdn")]
    #[doc(alias = "dhcp-fqdn")]
    pub fn dhcp_fqdn(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nm_setting_ip4_config_get_dhcp_fqdn(
                self.to_glib_none().0,
            ))
        }
    }

    /// Returns the value in the #NMSettingIP4Config:dhcp-ipv6-only-preferred
    /// property.
    ///
    /// # Returns
    ///
    /// the DHCP IPv6-only preferred property value
    #[cfg(feature = "v1_52")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
    #[doc(alias = "nm_setting_ip4_config_get_dhcp_ipv6_only_preferred")]
    #[doc(alias = "get_dhcp_ipv6_only_preferred")]
    #[doc(alias = "dhcp-ipv6-only-preferred")]
    pub fn dhcp_ipv6_only_preferred(&self) -> SettingIP4DhcpIpv6OnlyPreferred {
        unsafe {
            from_glib(ffi::nm_setting_ip4_config_get_dhcp_ipv6_only_preferred(
                self.to_glib_none().0,
            ))
        }
    }

    /// Returns the value contained in the #NMSettingIP4Config:dhcp_vendor_class_identifier
    /// property.
    ///
    /// # Returns
    ///
    /// the vendor class identifier option to send to the DHCP server
    #[cfg(feature = "v1_28")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
    #[doc(alias = "nm_setting_ip4_config_get_dhcp_vendor_class_identifier")]
    #[doc(alias = "get_dhcp_vendor_class_identifier")]
    #[doc(alias = "dhcp-vendor-class-identifier")]
    pub fn dhcp_vendor_class_identifier(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nm_setting_ip4_config_get_dhcp_vendor_class_identifier(
                self.to_glib_none().0,
            ))
        }
    }

    /// Returns the value contained in the #NMSettingIP4Config:link_local
    /// property.
    ///
    /// # Returns
    ///
    /// the link-local configuration
    #[cfg(feature = "v1_42")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
    #[doc(alias = "nm_setting_ip4_config_get_link_local")]
    #[doc(alias = "get_link_local")]
    #[doc(alias = "link-local")]
    pub fn link_local(&self) -> SettingIP4LinkLocal {
        unsafe {
            from_glib(ffi::nm_setting_ip4_config_get_link_local(
                self.to_glib_none().0,
            ))
        }
    }

    /// A string sent to the DHCP server to identify the local machine which the
    /// DHCP server may use to customize the DHCP lease and options.
    /// When the property is a hex string ('aa:bb:cc') it is interpreted as a
    /// binary client ID, in which case the first byte is assumed to be the
    /// 'type' field as per RFC 2132 section 9.14 and the remaining bytes may be
    /// an hardware address (e.g. '01:xx:xx:xx:xx:xx:xx' where 1 is the Ethernet
    /// ARP type and the rest is a MAC address).
    /// If the property is not a hex string it is considered as a
    /// non-hardware-address client ID and the 'type' field is set to 0.
    ///
    /// The special values "mac" and "perm-mac" are supported, which use the
    /// current or permanent MAC address of the device to generate a client identifier
    /// with type ethernet (01). Currently, these options only work for ethernet
    /// type of links.
    ///
    /// The special value "ipv6-duid" uses the DUID from "ipv6.dhcp-duid" property as
    /// an RFC4361-compliant client identifier. As IAID it uses "ipv4.dhcp-iaid"
    /// and falls back to "ipv6.dhcp-iaid" if unset.
    ///
    /// The special value "duid" generates a RFC4361-compliant client identifier based
    /// on "ipv4.dhcp-iaid" and uses a DUID generated by hashing /etc/machine-id.
    ///
    /// The special value "stable" is supported to generate a type 0 client identifier based
    /// on the stable-id (see connection.stable-id) and a per-host key. If you set the
    /// stable-id, you may want to include the "${DEVICE}" or "${MAC}" specifier to get a
    /// per-device key.
    ///
    /// The special value "none" prevents any client identifier from being sent. Note that
    /// this is normally not recommended.
    ///
    /// If unset, a globally configured default from NetworkManager.conf is
    /// used. If still unset, the default depends on the DHCP plugin. The
    /// internal dhcp client will default to "mac" and the dhclient plugin will
    /// try to use one from its config file if present, or won't sent any
    /// client-id otherwise.
    #[doc(alias = "dhcp-client-id")]
    pub fn set_dhcp_client_id(&self, dhcp_client_id: Option<&str>) {
        ObjectExt::set_property(self, "dhcp-client-id", dhcp_client_id)
    }

    /// If the #NMSettingIPConfig:dhcp-send-hostname property is [`true`], then the
    /// specified FQDN will be sent to the DHCP server when acquiring a lease. This
    /// property and #NMSettingIPConfig:dhcp-hostname are mutually exclusive and
    /// cannot be set at the same time.
    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    #[doc(alias = "dhcp-fqdn")]
    pub fn set_dhcp_fqdn(&self, dhcp_fqdn: Option<&str>) {
        ObjectExt::set_property(self, "dhcp-fqdn", dhcp_fqdn)
    }

    /// Controls the "IPv6-Only Preferred" DHCPv4 option (RFC 8925).
    ///
    /// When set to [`SettingIP4DhcpIpv6OnlyPreferred::Yes`][crate::SettingIP4DhcpIpv6OnlyPreferred::Yes], the host adds the
    /// option to the parameter request list; if the DHCP server sends the option back,
    /// the host stops the DHCP client for the time interval specified in the option.
    ///
    /// Enable this feature if the host supports an IPv6-only mode, i.e. either all
    /// applications are IPv6-only capable or there is a form of 464XLAT deployed.
    ///
    /// When set to [`SettingIP4DhcpIpv6OnlyPreferred::Default`][crate::SettingIP4DhcpIpv6OnlyPreferred::Default], the actual value
    /// is looked up in the global configuration; if not specified, it defaults to
    /// [`SettingIP4DhcpIpv6OnlyPreferred::No`][crate::SettingIP4DhcpIpv6OnlyPreferred::No].
    ///
    /// If the connection has IPv6 method set to "disabled", this property does not
    /// have effect and the "IPv6-Only Preferred" option is always disabled.
    #[cfg(feature = "v1_52")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
    #[doc(alias = "dhcp-ipv6-only-preferred")]
    pub fn set_dhcp_ipv6_only_preferred(&self, dhcp_ipv6_only_preferred: i32) {
        ObjectExt::set_property(self, "dhcp-ipv6-only-preferred", dhcp_ipv6_only_preferred)
    }

    /// The Vendor Class Identifier DHCP option (60).
    /// Special characters in the data string may be escaped using C-style escapes,
    /// nevertheless this property cannot contain nul bytes.
    /// If the per-profile value is unspecified (the default),
    /// a global connection default gets consulted.
    /// If still unspecified, the DHCP option is not sent to the server.
    #[cfg(feature = "v1_28")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
    #[doc(alias = "dhcp-vendor-class-identifier")]
    pub fn set_dhcp_vendor_class_identifier(&self, dhcp_vendor_class_identifier: Option<&str>) {
        ObjectExt::set_property(
            self,
            "dhcp-vendor-class-identifier",
            dhcp_vendor_class_identifier,
        )
    }

    #[cfg(not(feature = "v1_42"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_42"))))]
    #[doc(alias = "link-local")]
    pub fn link_local(&self) -> i32 {
        ObjectExt::property(self, "link-local")
    }

    /// Enable and disable the IPv4 link-local configuration independently of the
    /// ipv4.method configuration. This allows a link-local address (169.254.x.y/16)
    /// to be obtained in addition to other addresses, such as those manually
    /// configured or obtained from a DHCP server.
    ///
    /// When set to "auto", the value is dependent on "ipv4.method".
    /// When set to "default", it honors the global connection default, before
    /// falling back to "auto". Note that if "ipv4.method" is "disabled", then
    /// link local addressing is always disabled too. The default is "default".
    /// Since 1.52, when set to "fallback", a link-local address is obtained
    /// if no other IPv4 address is set.
    #[cfg(feature = "v1_40")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_40")))]
    #[doc(alias = "link-local")]
    pub fn set_link_local(&self, link_local: i32) {
        ObjectExt::set_property(self, "link-local", link_local)
    }

    #[doc(alias = "dhcp-client-id")]
    pub fn connect_dhcp_client_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_dhcp_client_id_trampoline<
            F: Fn(&SettingIP4Config) + 'static,
        >(
            this: *mut ffi::NMSettingIP4Config,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::dhcp-client-id".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_dhcp_client_id_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    #[doc(alias = "dhcp-fqdn")]
    pub fn connect_dhcp_fqdn_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_dhcp_fqdn_trampoline<F: Fn(&SettingIP4Config) + 'static>(
            this: *mut ffi::NMSettingIP4Config,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::dhcp-fqdn".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_dhcp_fqdn_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_52")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
    #[doc(alias = "dhcp-ipv6-only-preferred")]
    pub fn connect_dhcp_ipv6_only_preferred_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_dhcp_ipv6_only_preferred_trampoline<
            F: Fn(&SettingIP4Config) + 'static,
        >(
            this: *mut ffi::NMSettingIP4Config,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::dhcp-ipv6-only-preferred".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_dhcp_ipv6_only_preferred_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_28")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
    #[doc(alias = "dhcp-vendor-class-identifier")]
    pub fn connect_dhcp_vendor_class_identifier_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_dhcp_vendor_class_identifier_trampoline<
            F: Fn(&SettingIP4Config) + 'static,
        >(
            this: *mut ffi::NMSettingIP4Config,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::dhcp-vendor-class-identifier".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_dhcp_vendor_class_identifier_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_40")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_40")))]
    #[doc(alias = "link-local")]
    pub fn connect_link_local_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_link_local_trampoline<F: Fn(&SettingIP4Config) + 'static>(
            this: *mut ffi::NMSettingIP4Config,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::link-local".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_link_local_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl Default for SettingIP4Config {
    fn default() -> Self {
        Self::new()
    }
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`SettingIP4Config`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct SettingIP4ConfigBuilder {
    builder: glib::object::ObjectBuilder<'static, SettingIP4Config>,
}

impl SettingIP4ConfigBuilder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    /// A string sent to the DHCP server to identify the local machine which the
    /// DHCP server may use to customize the DHCP lease and options.
    /// When the property is a hex string ('aa:bb:cc') it is interpreted as a
    /// binary client ID, in which case the first byte is assumed to be the
    /// 'type' field as per RFC 2132 section 9.14 and the remaining bytes may be
    /// an hardware address (e.g. '01:xx:xx:xx:xx:xx:xx' where 1 is the Ethernet
    /// ARP type and the rest is a MAC address).
    /// If the property is not a hex string it is considered as a
    /// non-hardware-address client ID and the 'type' field is set to 0.
    ///
    /// The special values "mac" and "perm-mac" are supported, which use the
    /// current or permanent MAC address of the device to generate a client identifier
    /// with type ethernet (01). Currently, these options only work for ethernet
    /// type of links.
    ///
    /// The special value "ipv6-duid" uses the DUID from "ipv6.dhcp-duid" property as
    /// an RFC4361-compliant client identifier. As IAID it uses "ipv4.dhcp-iaid"
    /// and falls back to "ipv6.dhcp-iaid" if unset.
    ///
    /// The special value "duid" generates a RFC4361-compliant client identifier based
    /// on "ipv4.dhcp-iaid" and uses a DUID generated by hashing /etc/machine-id.
    ///
    /// The special value "stable" is supported to generate a type 0 client identifier based
    /// on the stable-id (see connection.stable-id) and a per-host key. If you set the
    /// stable-id, you may want to include the "${DEVICE}" or "${MAC}" specifier to get a
    /// per-device key.
    ///
    /// The special value "none" prevents any client identifier from being sent. Note that
    /// this is normally not recommended.
    ///
    /// If unset, a globally configured default from NetworkManager.conf is
    /// used. If still unset, the default depends on the DHCP plugin. The
    /// internal dhcp client will default to "mac" and the dhclient plugin will
    /// try to use one from its config file if present, or won't sent any
    /// client-id otherwise.
    pub fn dhcp_client_id(self, dhcp_client_id: impl Into<glib::GString>) -> Self {
        Self {
            builder: self
                .builder
                .property("dhcp-client-id", dhcp_client_id.into()),
        }
    }

    /// If the #NMSettingIPConfig:dhcp-send-hostname property is [`true`], then the
    /// specified FQDN will be sent to the DHCP server when acquiring a lease. This
    /// property and #NMSettingIPConfig:dhcp-hostname are mutually exclusive and
    /// cannot be set at the same time.
    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    pub fn dhcp_fqdn(self, dhcp_fqdn: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("dhcp-fqdn", dhcp_fqdn.into()),
        }
    }

    /// Controls the "IPv6-Only Preferred" DHCPv4 option (RFC 8925).
    ///
    /// When set to [`SettingIP4DhcpIpv6OnlyPreferred::Yes`][crate::SettingIP4DhcpIpv6OnlyPreferred::Yes], the host adds the
    /// option to the parameter request list; if the DHCP server sends the option back,
    /// the host stops the DHCP client for the time interval specified in the option.
    ///
    /// Enable this feature if the host supports an IPv6-only mode, i.e. either all
    /// applications are IPv6-only capable or there is a form of 464XLAT deployed.
    ///
    /// When set to [`SettingIP4DhcpIpv6OnlyPreferred::Default`][crate::SettingIP4DhcpIpv6OnlyPreferred::Default], the actual value
    /// is looked up in the global configuration; if not specified, it defaults to
    /// [`SettingIP4DhcpIpv6OnlyPreferred::No`][crate::SettingIP4DhcpIpv6OnlyPreferred::No].
    ///
    /// If the connection has IPv6 method set to "disabled", this property does not
    /// have effect and the "IPv6-Only Preferred" option is always disabled.
    #[cfg(feature = "v1_52")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
    pub fn dhcp_ipv6_only_preferred(self, dhcp_ipv6_only_preferred: i32) -> Self {
        Self {
            builder: self
                .builder
                .property("dhcp-ipv6-only-preferred", dhcp_ipv6_only_preferred),
        }
    }

    /// The Vendor Class Identifier DHCP option (60).
    /// Special characters in the data string may be escaped using C-style escapes,
    /// nevertheless this property cannot contain nul bytes.
    /// If the per-profile value is unspecified (the default),
    /// a global connection default gets consulted.
    /// If still unspecified, the DHCP option is not sent to the server.
    #[cfg(feature = "v1_28")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
    pub fn dhcp_vendor_class_identifier(
        self,
        dhcp_vendor_class_identifier: impl Into<glib::GString>,
    ) -> Self {
        Self {
            builder: self.builder.property(
                "dhcp-vendor-class-identifier",
                dhcp_vendor_class_identifier.into(),
            ),
        }
    }

    /// Enable and disable the IPv4 link-local configuration independently of the
    /// ipv4.method configuration. This allows a link-local address (169.254.x.y/16)
    /// to be obtained in addition to other addresses, such as those manually
    /// configured or obtained from a DHCP server.
    ///
    /// When set to "auto", the value is dependent on "ipv4.method".
    /// When set to "default", it honors the global connection default, before
    /// falling back to "auto". Note that if "ipv4.method" is "disabled", then
    /// link local addressing is always disabled too. The default is "default".
    /// Since 1.52, when set to "fallback", a link-local address is obtained
    /// if no other IPv4 address is set.
    #[cfg(feature = "v1_40")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_40")))]
    pub fn link_local(self, link_local: i32) -> Self {
        Self {
            builder: self.builder.property("link-local", link_local),
        }
    }

    /// Array of IP addresses.
    pub fn addresses(self, addresses: &[&IPAddress]) -> Self {
        Self {
            builder: self.builder.property(
                "addresses",
                addresses
                    .iter()
                    .map(|address| address.to_value())
                    .collect::<glib::ValueArray>(),
            ),
        }
    }

    /// VPN connections will default to add the route automatically unless this
    /// setting is set to [`false`].
    ///
    /// For other connection types, adding such an automatic route is currently
    /// not supported and setting this to [`true`] has no effect.
    #[cfg(feature = "v1_42")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_42")))]
    pub fn auto_route_ext_gw(self, auto_route_ext_gw: Ternary) -> Self {
        Self {
            builder: self
                .builder
                .property("auto-route-ext-gw", auto_route_ext_gw),
        }
    }

    /// Maximum timeout in milliseconds used to check for the presence of duplicate
    /// IP addresses on the network.  If an address conflict is detected, the
    /// activation will fail. The property is currently implemented only for IPv4.
    ///
    /// A zero value means that no duplicate address detection is performed, -1 means
    /// the default value (either the value configured globally in NetworkManger.conf
    /// or 200ms).  A value greater than zero is a timeout in milliseconds.  Note that
    /// the time intervals are subject to randomization as per RFC 5227 and so the
    /// actual duration can be between half and the full time specified in this
    /// property.
    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    pub fn dad_timeout(self, dad_timeout: i32) -> Self {
        Self {
            builder: self.builder.property("dad-timeout", dad_timeout),
        }
    }

    /// Specifies the value for the DSCP field (traffic class) of the IP header. When
    /// empty, the global default value is used; if no global default is specified, it is
    /// assumed to be "CS0". Allowed values are: "CS0", "CS4" and "CS6".
    ///
    /// The property is currently valid only for IPv4, and it is supported only by the
    /// "internal" DHCP plugin.
    #[cfg(feature = "v1_46")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
    pub fn dhcp_dscp(self, dhcp_dscp: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("dhcp-dscp", dhcp_dscp.into()),
        }
    }

    /// If the #NMSettingIPConfig:dhcp-send-hostname property is [`true`], then the
    /// specified name will be sent to the DHCP server when acquiring a lease.
    /// This property and #NMSettingIP4Config:dhcp-fqdn are mutually exclusive and
    /// cannot be set at the same time.
    pub fn dhcp_hostname(self, dhcp_hostname: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("dhcp-hostname", dhcp_hostname.into()),
        }
    }

    /// Flags for the DHCP hostname and FQDN.
    ///
    /// Currently, this property only includes flags to control the FQDN flags
    /// set in the DHCP FQDN option. Supported FQDN flags are
    /// [`DhcpHostnameFlags::FQDN_SERV_UPDATE`][crate::DhcpHostnameFlags::FQDN_SERV_UPDATE],
    /// [`DhcpHostnameFlags::FQDN_ENCODED`][crate::DhcpHostnameFlags::FQDN_ENCODED] and
    /// [`DhcpHostnameFlags::FQDN_NO_UPDATE`][crate::DhcpHostnameFlags::FQDN_NO_UPDATE].  When no FQDN flag is set and
    /// [`DhcpHostnameFlags::FQDN_CLEAR_FLAGS`][crate::DhcpHostnameFlags::FQDN_CLEAR_FLAGS] is set, the DHCP FQDN option will
    /// contain no flag. Otherwise, if no FQDN flag is set and
    /// [`DhcpHostnameFlags::FQDN_CLEAR_FLAGS`][crate::DhcpHostnameFlags::FQDN_CLEAR_FLAGS] is not set, the standard FQDN flags
    /// are set in the request:
    /// [`DhcpHostnameFlags::FQDN_SERV_UPDATE`][crate::DhcpHostnameFlags::FQDN_SERV_UPDATE],
    /// [`DhcpHostnameFlags::FQDN_ENCODED`][crate::DhcpHostnameFlags::FQDN_ENCODED] for IPv4 and
    /// [`DhcpHostnameFlags::FQDN_SERV_UPDATE`][crate::DhcpHostnameFlags::FQDN_SERV_UPDATE] for IPv6.
    ///
    /// When this property is set to the default value [`DhcpHostnameFlags::NONE`][crate::DhcpHostnameFlags::NONE],
    /// a global default is looked up in NetworkManager configuration. If that value
    /// is unset or also [`DhcpHostnameFlags::NONE`][crate::DhcpHostnameFlags::NONE], then the standard FQDN flags
    /// described above are sent in the DHCP requests.
    #[cfg(feature = "v1_22")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
    pub fn dhcp_hostname_flags(self, dhcp_hostname_flags: u32) -> Self {
        Self {
            builder: self
                .builder
                .property("dhcp-hostname-flags", dhcp_hostname_flags),
        }
    }

    /// A string containing the "Identity Association Identifier" (IAID) used by
    /// the DHCP client. The string can be a 32-bit number (either decimal,
    /// hexadecimal or as colon separated hexadecimal numbers). Alternatively
    /// it can be set to the special values "mac", "perm-mac", "ifname" or
    /// "stable". When set to "mac" (or "perm-mac"), the last 4 bytes of the
    /// current (or permanent) MAC address are used as IAID. When set to
    /// "ifname", the IAID is computed by hashing the interface name. The
    /// special value "stable" can be used to generate an IAID based on the
    /// stable-id (see connection.stable-id), a per-host key and the interface
    /// name. When the property is unset, the value from global configuration is
    /// used; if no global default is set then the IAID is assumed to be
    /// "ifname".
    ///
    /// For DHCPv4, the IAID is only used with "ipv4.dhcp-client-id"
    /// values "duid" and "ipv6-duid" to generate the client-id.
    ///
    /// For DHCPv6, note that at the moment this property is
    /// only supported by the "internal" DHCPv6 plugin. The "dhclient" DHCPv6
    /// plugin always derives the IAID from the MAC address.
    ///
    /// The actually used DHCPv6 IAID for a currently activated interface is
    /// exposed in the lease information of the device.
    #[cfg(feature = "v1_22")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
    pub fn dhcp_iaid(self, dhcp_iaid: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("dhcp-iaid", dhcp_iaid.into()),
        }
    }

    /// Array of servers from which DHCP offers must be rejected. This property
    /// is useful to avoid getting a lease from misconfigured or rogue servers.
    ///
    /// For DHCPv4, each element must be an IPv4 address, optionally
    /// followed by a slash and a prefix length (e.g. "192.168.122.0/24").
    ///
    /// This property is currently not implemented for DHCPv6.
    #[cfg(feature = "v1_28")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
    pub fn dhcp_reject_servers(self, dhcp_reject_servers: impl Into<glib::StrV>) -> Self {
        Self {
            builder: self
                .builder
                .property("dhcp-reject-servers", dhcp_reject_servers.into()),
        }
    }

    /// Since 1.52 this property is deprecated and is only used as fallback value
    /// for #NMSettingIPConfig:dhcp-send-hostname-v2 if it's set to 'default'.
    /// This is only done to avoid breaking existing configurations, the new
    /// property should be used from now on.
    /// use the new version of dhcp-send-hostname instead.
    #[cfg_attr(feature = "v1_52", deprecated = "Since 1.52")]
    pub fn dhcp_send_hostname(self, dhcp_send_hostname: bool) -> Self {
        Self {
            builder: self
                .builder
                .property("dhcp-send-hostname", dhcp_send_hostname),
        }
    }

    /// If [`true`], a hostname is sent to the DHCP server when acquiring a lease.
    /// Some DHCP servers use this hostname to update DNS databases, essentially
    /// providing a static hostname for the computer.  If the
    /// #NMSettingIPConfig:dhcp-hostname property is [`None`] and this property is
    /// [`true`], the current persistent hostname of the computer is sent.
    ///
    /// The default value is [`Ternary::Default`][crate::Ternary::Default]. In this case the global value
    /// from NetworkManager configuration is looked up. If it's not set, the value
    /// from #NMSettingIPConfig:dhcp-send-hostname, which defaults to [`true`], is
    /// used for backwards compatibility. In the future this will change and, in
    /// absence of a global default, it will always fallback to [`true`].
    #[cfg(feature = "v1_52")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
    pub fn dhcp_send_hostname_v2(self, dhcp_send_hostname_v2: i32) -> Self {
        Self {
            builder: self
                .builder
                .property("dhcp-send-hostname-v2", dhcp_send_hostname_v2),
        }
    }

    /// Whether the DHCP client will send RELEASE message when
    /// bringing the connection down. The default value is [`Ternary::Default`][crate::Ternary::Default].
    /// When the default value is specified, then the global value from NetworkManager
    /// configuration is looked up, if not set, it is considered as [`false`].
    #[cfg(feature = "v1_48")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_48")))]
    pub fn dhcp_send_release(self, dhcp_send_release: Ternary) -> Self {
        Self {
            builder: self
                .builder
                .property("dhcp-send-release", dhcp_send_release),
        }
    }

    /// A timeout for a DHCP transaction in seconds. If zero (the default), a
    /// globally configured default is used. If still unspecified, a device specific
    /// timeout is used (usually 45 seconds).
    ///
    /// Set to 2147483647 (MAXINT32) for infinity.
    pub fn dhcp_timeout(self, dhcp_timeout: i32) -> Self {
        Self {
            builder: self.builder.property("dhcp-timeout", dhcp_timeout),
        }
    }

    /// Array of DNS servers.
    ///
    /// Each server can be specified either as a plain IP address (optionally followed
    /// by a "#" and the SNI server name for DNS over TLS) or with a URI syntax.
    ///
    /// When it is specified as an URI, the following forms are supported:
    /// dns+udp://ADDRESS[:PORT], dns+tls://ADDRESS[:PORT][#SERVERNAME] .
    ///
    /// When using the URI syntax, IPv6 addresses must be enclosed in square
    /// brackets ('[', ']').
    pub fn dns(self, dns: impl Into<glib::StrV>) -> Self {
        Self {
            builder: self.builder.property("dns", dns.into()),
        }
    }

    /// Array of DNS options to be added to resolv.conf.
    ///
    /// [`None`] means that the options are unset and left at the default.
    /// In this case NetworkManager will use default options. This is
    /// distinct from an empty list of properties.
    ///
    /// The following options are directly added to resolv.conf: "attempts",
    ///  "debug", "edns0",
    /// "inet6", "ip6-bytestring", "ip6-dotint", "ndots", "no-aaaa",
    /// "no-check-names", "no-ip6-dotint", "no-reload", "no-tld-query",
    /// "rotate", "single-request", "single-request-reopen", "timeout",
    /// "trust-ad", "use-vc". See the resolv.conf(5) man page for a
    /// detailed description of these options.
    ///
    /// In addition, NetworkManager supports the special options "_no-add-edns0"
    /// and "_no-add-trust-ad". They are not added to resolv.conf, and can be
    /// used to prevent the automatic addition of options "edns0" and "trust-ad"
    /// when using caching DNS plugins (see below).
    ///
    /// The "trust-ad" setting is only honored if the profile contributes
    /// name servers to resolv.conf, and if all contributing profiles have
    /// "trust-ad" enabled.
    ///
    /// When using a caching DNS plugin (dnsmasq or systemd-resolved in
    /// NetworkManager.conf) then "edns0" and "trust-ad" are automatically
    /// added, unless "_no-add-edns0" and "_no-add-trust-ad" are present.
    #[cfg(feature = "v1_2")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
    pub fn dns_options(self, dns_options: impl Into<glib::StrV>) -> Self {
        Self {
            builder: self.builder.property("dns-options", dns_options.into()),
        }
    }

    /// DNS servers priority.
    ///
    /// The relative priority for DNS servers specified by this setting.  A lower
    /// numerical value is better (higher priority).
    ///
    /// Negative values have the special effect of excluding other configurations
    /// with a greater numerical priority value; so in presence of at least one negative
    /// priority, only DNS servers from connections with the lowest priority value will be used.
    /// To avoid all DNS leaks, set the priority of the profile that should be used
    /// to the most negative value of all active connections profiles.
    ///
    /// Zero selects a globally configured default value. If the latter is missing
    /// or zero too, it defaults to 50 for VPNs (including WireGuard) and 100 for
    /// other connections.
    ///
    /// Note that the priority is to order DNS settings for multiple active
    /// connections.  It does not disambiguate multiple DNS servers within the
    /// same connection profile.
    ///
    /// When multiple devices have configurations with the same priority, VPNs will be
    /// considered first, then devices with the best (lowest metric) default
    /// route and then all other devices.
    ///
    /// When using dns=default, servers with higher priority will be on top of
    /// resolv.conf. To prioritize a given server over another one within the
    /// same connection, just specify them in the desired order.
    /// Note that commonly the resolver tries name servers in /etc/resolv.conf
    /// in the order listed, proceeding with the next server in the list
    /// on failure. See for example the "rotate" option of the dns-options setting.
    /// If there are any negative DNS priorities, then only name servers from
    /// the devices with that lowest priority will be considered.
    ///
    /// When using a DNS resolver that supports Conditional Forwarding or
    /// Split DNS (with dns=dnsmasq or dns=systemd-resolved settings), each connection
    /// is used to query domains in its search list. The search domains determine which
    /// name servers to ask, and the DNS priority is used to prioritize
    /// name servers based on the domain.  Queries for domains not present in any
    /// search list are routed through connections having the '~.' special wildcard
    /// domain, which is added automatically to connections with the default route
    /// (or can be added manually).  When multiple connections specify the same domain, the
    /// one with the best priority (lowest numerical value) wins.  If a sub domain
    /// is configured on another interface it will be accepted regardless the priority,
    /// unless parent domain on the other interface has a negative priority, which causes
    /// the sub domain to be shadowed.
    /// With Split DNS one can avoid undesired DNS leaks by properly configuring
    /// DNS priorities and the search domains, so that only name servers of the desired
    /// interface are configured.
    #[cfg(feature = "v1_4")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
    pub fn dns_priority(self, dns_priority: i32) -> Self {
        Self {
            builder: self.builder.property("dns-priority", dns_priority),
        }
    }

    /// List of DNS search domains. Domains starting with a tilde ('~')
    /// are considered 'routing' domains and are used only to decide the
    /// interface over which a query must be forwarded; they are not used
    /// to complete unqualified host names.
    ///
    /// When using a DNS plugin that supports Conditional Forwarding or
    /// Split DNS, then the search domains specify which name servers to
    /// query. This makes the behavior different from running with plain
    /// /etc/resolv.conf. For more information see also the dns-priority setting.
    ///
    /// When set on a profile that also enabled DHCP, the DNS search list
    /// received automatically (option 119 for DHCPv4 and option 24 for DHCPv6)
    /// gets merged with the manual list. This can be prevented by setting
    /// "ignore-auto-dns". Note that if no DNS searches are configured, the
    /// fallback will be derived from the domain from DHCP (option 15).
    pub fn dns_search(self, dns_search: impl Into<glib::StrV>) -> Self {
        Self {
            builder: self.builder.property("dns-search", dns_search.into()),
        }
    }

    /// Whether to configure sysctl interface-specific forwarding. When enabled, the interface
    /// will act as a router to forward the packet from one interface to another. When set to
    /// [`SettingIPConfigForwarding::Default`][crate::SettingIPConfigForwarding::Default], the value from global configuration is used;
    /// if no global default is defined, [`SettingIPConfigForwarding::Auto`][crate::SettingIPConfigForwarding::Auto] will be used.
    /// The #NMSettingIPConfig:forwarding property is ignored when #NMSettingIPConfig:method
    /// is set to "shared", because forwarding is always enabled in this case.
    /// The accepted values are:
    ///   [`SettingIPConfigForwarding::Default`][crate::SettingIPConfigForwarding::Default]: use global default.
    ///   [`SettingIPConfigForwarding::No`][crate::SettingIPConfigForwarding::No]: disabled.
    ///   [`SettingIPConfigForwarding::Yes`][crate::SettingIPConfigForwarding::Yes]: enabled.
    ///   [`SettingIPConfigForwarding::Auto`][crate::SettingIPConfigForwarding::Auto]: enable if any shared connection is active,
    ///        use kernel default otherwise.
    #[cfg(feature = "v1_54")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_54")))]
    pub fn forwarding(self, forwarding: i32) -> Self {
        Self {
            builder: self.builder.property("forwarding", forwarding),
        }
    }

    /// The gateway associated with this configuration. This is only meaningful
    /// if #NMSettingIPConfig:addresses is also set.
    ///
    /// Setting the gateway causes NetworkManager to configure a standard default route
    /// with the gateway as next hop. This is ignored if #NMSettingIPConfig:never-default
    /// is set. An alternative is to configure the default route explicitly with a manual
    /// route and /0 as prefix length.
    ///
    /// Note that the gateway usually conflicts with routing that NetworkManager configures
    /// for WireGuard interfaces, so usually it should not be set in that case. See
    /// #NMSettingWireGuard:ip4-auto-default-route.
    pub fn gateway(self, gateway: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("gateway", gateway.into()),
        }
    }

    /// When #NMSettingIPConfig:method is set to "auto" and this property to
    /// [`true`], automatically configured name servers and search domains are
    /// ignored and only name servers and search domains specified in the
    /// #NMSettingIPConfig:dns and #NMSettingIPConfig:dns-search properties, if
    /// any, are used.
    pub fn ignore_auto_dns(self, ignore_auto_dns: bool) -> Self {
        Self {
            builder: self.builder.property("ignore-auto-dns", ignore_auto_dns),
        }
    }

    /// When #NMSettingIPConfig:method is set to "auto" and this property to
    /// [`true`], automatically configured routes are ignored and only routes
    /// specified in the #NMSettingIPConfig:routes property, if any, are used.
    pub fn ignore_auto_routes(self, ignore_auto_routes: bool) -> Self {
        Self {
            builder: self
                .builder
                .property("ignore-auto-routes", ignore_auto_routes),
        }
    }

    /// If [`true`], allow overall network configuration to proceed even if the
    /// configuration specified by this property times out.  Note that at least
    /// one IP configuration must succeed or overall network configuration will
    /// still fail.  For example, in IPv6-only networks, setting this property to
    /// [`true`] on the #NMSettingIP4Config allows the overall network configuration
    /// to succeed if IPv4 configuration fails but IPv6 configuration completes
    /// successfully.
    pub fn may_fail(self, may_fail: bool) -> Self {
        Self {
            builder: self.builder.property("may-fail", may_fail),
        }
    }

    /// IP configuration method.
    ///
    /// #NMSettingIP4Config and #NMSettingIP6Config both support "disabled",
    /// "auto", "manual", and "link-local". See the subclass-specific
    /// documentation for other values.
    ///
    /// In general, for the "auto" method, properties such as
    /// #NMSettingIPConfig:dns and #NMSettingIPConfig:routes specify information
    /// that is added on to the information returned from automatic
    /// configuration.  The #NMSettingIPConfig:ignore-auto-routes and
    /// #NMSettingIPConfig:ignore-auto-dns properties modify this behavior.
    ///
    /// For methods that imply no upstream network, such as "shared" or
    /// "link-local", these properties must be empty.
    ///
    /// For IPv4 method "shared", the IP subnet can be configured by adding one
    /// manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the
    /// shared method must be configured on the interface which shares the internet
    /// to a subnet, not on the uplink which is shared.
    pub fn method(self, method: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("method", method.into()),
        }
    }

    /// If [`true`], this connection will never be the default connection for this
    /// IP type, meaning it will never be assigned the default route by
    /// NetworkManager.
    pub fn never_default(self, never_default: bool) -> Self {
        Self {
            builder: self.builder.property("never-default", never_default),
        }
    }

    /// Connections will default to keep the autogenerated priority 0 local rule
    /// unless this setting is set to [`true`].
    #[cfg(feature = "v1_44")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_44")))]
    pub fn replace_local_rule(self, replace_local_rule: Ternary) -> Self {
        Self {
            builder: self
                .builder
                .property("replace-local-rule", replace_local_rule),
        }
    }

    /// The minimum time interval in milliseconds for which dynamic IP configuration
    /// should be tried before the connection succeeds.
    ///
    /// This property is useful for example if both IPv4 and IPv6 are enabled and
    /// are allowed to fail. Normally the connection succeeds as soon as one of
    /// the two address families completes; by setting a required timeout for
    /// e.g. IPv4, one can ensure that even if IP6 succeeds earlier than IPv4,
    /// NetworkManager waits some time for IPv4 before the connection becomes
    /// active.
    ///
    /// Note that if #NMSettingIPConfig:may-fail is FALSE for the same address
    /// family, this property has no effect as NetworkManager needs to wait for
    /// the full DHCP timeout.
    ///
    /// A zero value means that no required timeout is present, -1 means the
    /// default value (either configuration ipvx.required-timeout override or
    /// zero).
    #[cfg(feature = "v1_34")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
    pub fn required_timeout(self, required_timeout: i32) -> Self {
        Self {
            builder: self.builder.property("required-timeout", required_timeout),
        }
    }

    /// The default metric for routes that don't explicitly specify a metric.
    /// The default value -1 means that the metric is chosen automatically
    /// based on the device type.
    /// The metric applies to dynamic routes, manual (static) routes that
    /// don't have an explicit metric setting, address prefix routes, and
    /// the default route.
    /// Note that for IPv6, the kernel accepts zero (0) but coerces it to
    /// 1024 (user default). Hence, setting this property to zero effectively
    /// mean setting it to 1024.
    /// For IPv4, zero is a regular value for the metric.
    pub fn route_metric(self, route_metric: i64) -> Self {
        Self {
            builder: self.builder.property("route-metric", route_metric),
        }
    }

    /// Enable policy routing (source routing) and set the routing table used when adding routes.
    ///
    /// This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes
    /// and static routes. But note that static routes can individually overwrite the setting
    /// by explicitly specifying a non-zero routing table.
    ///
    /// If the table setting is left at zero, it is eligible to be overwritten via global
    /// configuration. If the property is zero even after applying the global configuration
    /// value, policy routing is disabled for the address family of this connection.
    ///
    /// Policy routing disabled means that NetworkManager will add all routes to the main
    /// table (except static routes that explicitly configure a different table). Additionally,
    /// NetworkManager will not delete any extraneous routes from tables except the main table.
    /// This is to preserve backward compatibility for users who manage routing tables outside
    /// of NetworkManager.
    #[cfg(feature = "v1_10")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
    pub fn route_table(self, route_table: u32) -> Self {
        Self {
            builder: self.builder.property("route-table", route_table),
        }
    }

    /// Whether to add routes for DNS servers. When enabled, NetworkManager adds a route
    /// for each DNS server that is associated with this connection either statically
    /// (defined in the connection profile) or dynamically (for example, retrieved via
    /// DHCP). The route guarantees that the DNS server is reached via this interface. When
    /// set to [`SettingIPConfigRoutedDns::Default`][crate::SettingIPConfigRoutedDns::Default], the value from global
    /// configuration is used; if no global default is defined, this feature is disabled.
    #[cfg(feature = "v1_52")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
    pub fn routed_dns(self, routed_dns: i32) -> Self {
        Self {
            builder: self.builder.property("routed-dns", routed_dns),
        }
    }

    /// Array of IP routes.
    pub fn routes(self, routes: &[&IPRoute]) -> Self {
        Self {
            builder: self.builder.property(
                "routes",
                routes
                    .iter()
                    .map(|route| route.to_value())
                    .collect::<glib::ValueArray>(),
            ),
        }
    }

    /// This option allows you to specify a custom DHCP lease time for the shared connection
    /// method in seconds. The value should be either a number between 120 and 31536000 (one year)
    /// If this option is not specified, 3600 (one hour) is used.
    ///
    /// Special values are 0 for default value of 1 hour and 2147483647 (MAXINT32) for infinite lease time.
    #[cfg(feature = "v1_52")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
    pub fn shared_dhcp_lease_time(self, shared_dhcp_lease_time: i32) -> Self {
        Self {
            builder: self
                .builder
                .property("shared-dhcp-lease-time", shared_dhcp_lease_time),
        }
    }

    /// This option allows you to specify a custom DHCP range for the shared connection
    /// method. The value is expected to be in `<START_ADDRESS>,<END_ADDRESS>` format.
    /// The range should be part of network set by ipv4.address option and it should
    /// not contain network address or broadcast address. If this option is not specified,
    /// the DHCP range will be automatically determined based on the interface address.
    /// The range will be selected to be adjacent to the interface address, either before
    /// or after it, with the larger possible range being preferred. The range will be
    /// adjusted to fill the available address space, except for networks with a prefix
    /// length greater than 24, which will be treated as if they have a prefix length of 24.
    #[cfg(feature = "v1_52")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_52")))]
    pub fn shared_dhcp_range(self, shared_dhcp_range: impl Into<glib::GString>) -> Self {
        Self {
            builder: self
                .builder
                .property("shared-dhcp-range", shared_dhcp_range.into()),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`SettingIP4Config`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> SettingIP4Config {
        assert_initialized_main_thread!();
        self.builder.build()
    }
}