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
|
// automatically generated by rust-bindgen 0.39.0
use core::option::Option;
use libc::{c_char, c_int, c_void, iovec, nlmsghdr, FILE};
#[repr(C)]
pub struct nftnl_batch(c_void);
extern "C" {
pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch;
pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int;
pub fn nftnl_batch_free(batch: *mut nftnl_batch);
pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void;
pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32;
pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int;
pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32);
}
pub const NFTNL_PARSE_EBADINPUT: u32 = 0;
pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1;
pub const NFTNL_PARSE_EBADTYPE: u32 = 2;
pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3;
pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0;
pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1;
pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2;
pub type nftnl_output_type = u32;
pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1;
pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2;
pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3;
pub type nftnl_output_flags = u32;
pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0;
pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1;
pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2;
pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3;
pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4;
pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5;
pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6;
pub type nftnl_cmd_type = u32;
pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0;
pub const NFTNL_PARSE_XML: nftnl_parse_type = 1;
pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2;
pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3;
pub type nftnl_parse_type = u32;
#[repr(C)]
pub struct nftnl_parse_err(c_void);
extern "C" {
pub fn nftnl_nlmsg_build_hdr(
buf: *mut c_char,
type_: u16,
family: u16,
flags: u16,
seq: u32,
) -> *mut nlmsghdr;
pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err;
pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err);
pub fn nftnl_parse_perror(str: *const c_char, err: *mut nftnl_parse_err) -> c_int;
pub fn nftnl_batch_is_supported() -> c_int;
pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr;
pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr;
}
#[repr(C)]
pub struct nftnl_chain(c_void);
extern "C" {
pub fn nftnl_chain_alloc() -> *mut nftnl_chain;
pub fn nftnl_chain_free(arg1: *const nftnl_chain);
}
pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0;
pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1;
pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2;
pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3;
pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4;
pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5;
pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6;
pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7;
pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8;
pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9;
pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10;
pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11;
pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 12;
pub type nftnl_chain_attr = u32;
extern "C" {
pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool;
pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16);
pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void);
pub fn nftnl_chain_set_data(
t: *mut nftnl_chain,
attr: u16,
data: *const c_void,
data_len: u32,
) -> c_int;
pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8);
pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32);
pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32);
pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64);
pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str: *const c_char) -> c_int;
pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void;
pub fn nftnl_chain_get_data(
c: *const nftnl_chain,
attr: u16,
data_len: *mut u32,
) -> *const c_void;
pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char;
pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8;
pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32;
pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32;
pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64;
pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain);
pub fn nftnl_chain_parse(
c: *mut nftnl_chain,
type_: nftnl_parse_type,
data: *const c_char,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_chain_parse_file(
c: *mut nftnl_chain,
type_: nftnl_parse_type,
fp: *mut FILE,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_chain_snprintf(
buf: *mut c_char,
size: usize,
t: *const nftnl_chain,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_chain_fprintf(
fp: *mut FILE,
c: *const nftnl_chain,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int;
}
#[repr(C)]
pub struct nftnl_chain_list(c_void);
extern "C" {
pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list;
pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list);
pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int;
pub fn nftnl_chain_list_foreach(
chain_list: *mut nftnl_chain_list,
cb: Option<unsafe extern "C" fn(t: *mut nftnl_chain, data: *mut c_void) -> c_int>,
data: *mut c_void,
) -> c_int;
pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list);
pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list);
pub fn nftnl_chain_list_del(c: *mut nftnl_chain);
}
#[repr(C)]
pub struct nftnl_chain_list_iter(c_void);
extern "C" {
pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter;
pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain;
pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter);
}
#[repr(C)]
pub struct nftnl_expr(c_void);
pub const NFTNL_EXPR_NAME: u32 = 0;
pub const NFTNL_EXPR_BASE: u32 = 1;
extern "C" {
pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr;
pub fn nftnl_expr_free(expr: *const nftnl_expr);
pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool;
pub fn nftnl_expr_set(
expr: *mut nftnl_expr,
type_: u16,
data: *const c_void,
data_len: u32,
) -> c_int;
pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8);
pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16);
pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32);
pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64);
pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str: *const c_char) -> c_int;
pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32)
-> *const c_void;
pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8;
pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16;
pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32;
pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64;
pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char;
pub fn nftnl_expr_cmp(e1: *const nftnl_expr, e2: *const nftnl_expr) -> bool;
pub fn nftnl_expr_snprintf(
buf: *mut c_char,
buflen: usize,
expr: *const nftnl_expr,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_expr_fprintf(
fp: *mut FILE,
expr: *const nftnl_expr,
type_: u32,
flags: u32,
) -> c_int;
}
pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1;
pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2;
pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3;
pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4;
pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5;
pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6;
pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7;
pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8;
pub const NFTNL_EXPR_NG_DREG: u32 = 1;
pub const NFTNL_EXPR_NG_MODULUS: u32 = 2;
pub const NFTNL_EXPR_NG_TYPE: u32 = 3;
pub const NFTNL_EXPR_NG_OFFSET: u32 = 4;
pub const NFTNL_EXPR_META_KEY: u32 = 1;
pub const NFTNL_EXPR_META_DREG: u32 = 2;
pub const NFTNL_EXPR_META_SREG: u32 = 3;
pub const NFTNL_EXPR_RT_KEY: u32 = 1;
pub const NFTNL_EXPR_RT_DREG: u32 = 2;
pub const NFTNL_EXPR_CMP_SREG: u32 = 1;
pub const NFTNL_EXPR_CMP_OP: u32 = 2;
pub const NFTNL_EXPR_CMP_DATA: u32 = 3;
pub const NFTNL_EXPR_RANGE_SREG: u32 = 1;
pub const NFTNL_EXPR_RANGE_OP: u32 = 2;
pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3;
pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4;
pub const NFTNL_EXPR_IMM_DREG: u32 = 1;
pub const NFTNL_EXPR_IMM_DATA: u32 = 2;
pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3;
pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4;
pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1;
pub const NFTNL_EXPR_CTR_BYTES: u32 = 2;
pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1;
pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2;
pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3;
pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4;
pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5;
pub const NFTNL_EXPR_TG_NAME: u32 = 1;
pub const NFTNL_EXPR_TG_REV: u32 = 2;
pub const NFTNL_EXPR_TG_INFO: u32 = 3;
pub const NFTNL_EXPR_MT_NAME: u32 = 1;
pub const NFTNL_EXPR_MT_REV: u32 = 2;
pub const NFTNL_EXPR_MT_INFO: u32 = 3;
pub const NFTNL_EXPR_NAT_TYPE: u32 = 1;
pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2;
pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3;
pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4;
pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5;
pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6;
pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7;
pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1;
pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2;
pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3;
pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4;
pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5;
pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1;
pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2;
pub const NFTNL_EXPR_DYNSET_OP: u32 = 3;
pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4;
pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5;
pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6;
pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7;
pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1;
pub const NFTNL_EXPR_LOG_GROUP: u32 = 2;
pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3;
pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4;
pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5;
pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6;
pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1;
pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2;
pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3;
pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4;
pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5;
pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6;
pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7;
pub const NFTNL_EXPR_CT_DREG: u32 = 1;
pub const NFTNL_EXPR_CT_KEY: u32 = 2;
pub const NFTNL_EXPR_CT_DIR: u32 = 3;
pub const NFTNL_EXPR_CT_SREG: u32 = 4;
pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1;
pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2;
pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3;
pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4;
pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5;
pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1;
pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2;
pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3;
pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4;
pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5;
pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1;
pub const NFTNL_EXPR_REJECT_CODE: u32 = 2;
pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1;
pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2;
pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3;
pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4;
pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1;
pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2;
pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3;
pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1;
pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2;
pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3;
pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1;
pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2;
pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3;
pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1;
pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2;
pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1;
pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1;
pub const NFTNL_EXPR_HASH_SREG: u32 = 1;
pub const NFTNL_EXPR_HASH_DREG: u32 = 2;
pub const NFTNL_EXPR_HASH_LEN: u32 = 3;
pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4;
pub const NFTNL_EXPR_HASH_SEED: u32 = 5;
pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6;
pub const NFTNL_EXPR_HASH_TYPE: u32 = 7;
pub const NFTNL_EXPR_FIB_DREG: u32 = 1;
pub const NFTNL_EXPR_FIB_RESULT: u32 = 2;
pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3;
pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1;
pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2;
pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3;
pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4;
pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5;
#[repr(C)]
pub struct nftnl_gen(c_void);
extern "C" {
pub fn nftnl_gen_alloc() -> *mut nftnl_gen;
pub fn nftnl_gen_free(arg1: *const nftnl_gen);
}
pub const NFTNL_GEN_ID: u32 = 0;
pub const __NFTNL_GEN_MAX: u32 = 1;
extern "C" {
pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool;
pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16);
pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int;
pub fn nftnl_gen_set_data(
gen: *mut nftnl_gen,
attr: u16,
data: *const c_void,
data_len: u32,
) -> c_int;
pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void;
pub fn nftnl_gen_get_data(
gen: *const nftnl_gen,
attr: u16,
data_len: *mut u32,
) -> *const c_void;
pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32);
pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32;
pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int;
pub fn nftnl_gen_snprintf(
buf: *mut c_char,
size: usize,
gen: *const nftnl_gen,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32)
-> c_int;
}
pub const NFTNL_OBJ_TABLE: u32 = 0;
pub const NFTNL_OBJ_NAME: u32 = 1;
pub const NFTNL_OBJ_TYPE: u32 = 2;
pub const NFTNL_OBJ_FAMILY: u32 = 3;
pub const NFTNL_OBJ_USE: u32 = 4;
pub const NFTNL_OBJ_HANDLE: u32 = 5;
pub const NFTNL_OBJ_BASE: u32 = 16;
pub const __NFTNL_OBJ_MAX: u32 = 17;
pub const NFTNL_OBJ_CTR_PKTS: u32 = 16;
pub const NFTNL_OBJ_CTR_BYTES: u32 = 17;
pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16;
pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17;
pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18;
pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16;
pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17;
pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18;
pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16;
pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17;
pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18;
pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19;
pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20;
#[repr(C)]
pub struct nftnl_obj(c_void);
extern "C" {
pub fn nftnl_obj_alloc() -> *mut nftnl_obj;
pub fn nftnl_obj_free(ne: *const nftnl_obj);
pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool;
pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16);
pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32);
pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void);
pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8);
pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16);
pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32);
pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64);
pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str: *const c_char);
pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void;
pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void;
pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8;
pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16;
pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32;
pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64;
pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char;
pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj);
pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int;
pub fn nftnl_obj_parse(
ne: *mut nftnl_obj,
type_: nftnl_parse_type,
data: *const c_char,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_obj_parse_file(
ne: *mut nftnl_obj,
type_: nftnl_parse_type,
fp: *mut FILE,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_obj_snprintf(
buf: *mut c_char,
size: usize,
ne: *const nftnl_obj,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int;
}
#[repr(C)]
pub struct nftnl_obj_list(c_void);
extern "C" {
pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list;
pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list);
pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int;
pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list);
pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list);
pub fn nftnl_obj_list_del(t: *mut nftnl_obj);
pub fn nftnl_obj_list_foreach(
table_list: *mut nftnl_obj_list,
cb: Option<unsafe extern "C" fn(t: *mut nftnl_obj, data: *mut c_void) -> c_int>,
data: *mut c_void,
) -> c_int;
}
#[repr(C)]
pub struct nftnl_obj_list_iter(c_void);
extern "C" {
pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter;
pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj;
pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter);
}
#[repr(C)]
pub struct nftnl_rule(c_void);
extern "C" {
pub fn nftnl_rule_alloc() -> *mut nftnl_rule;
pub fn nftnl_rule_free(arg1: *const nftnl_rule);
}
pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0;
pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1;
pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2;
pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3;
pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4;
pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5;
pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6;
pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7;
pub const NFTNL_RULE_ID: nftnl_rule_attr = 8;
pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 9;
pub type nftnl_rule_attr = u32;
extern "C" {
pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16);
pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool;
pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int;
pub fn nftnl_rule_set_data(
r: *mut nftnl_rule,
attr: u16,
data: *const c_void,
data_len: u32,
) -> c_int;
pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32);
pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64);
pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str: *const c_char) -> c_int;
pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void;
pub fn nftnl_rule_get_data(
r: *const nftnl_rule,
attr: u16,
data_len: *mut u32,
) -> *const c_void;
pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char;
pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8;
pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32;
pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64;
pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr);
pub fn nftnl_rule_cmp(r1: *const nftnl_rule, r2: *const nftnl_rule) -> bool;
pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule);
pub fn nftnl_rule_parse(
r: *mut nftnl_rule,
type_: nftnl_parse_type,
data: *const c_char,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_rule_parse_file(
r: *mut nftnl_rule,
type_: nftnl_parse_type,
fp: *mut FILE,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_rule_snprintf(
buf: *mut c_char,
size: usize,
t: *const nftnl_rule,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32)
-> c_int;
pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int;
pub fn nftnl_expr_foreach(
r: *mut nftnl_rule,
cb: Option<unsafe extern "C" fn(e: *mut nftnl_expr, data: *mut c_void) -> c_int>,
data: *mut c_void,
) -> c_int;
}
#[repr(C)]
pub struct nftnl_expr_iter(c_void);
extern "C" {
pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter;
pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr;
pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter);
}
#[repr(C)]
pub struct nftnl_rule_list(c_void);
extern "C" {
pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list;
pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list);
pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int;
pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list);
pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list);
pub fn nftnl_rule_list_del(r: *mut nftnl_rule);
pub fn nftnl_rule_list_foreach(
rule_list: *mut nftnl_rule_list,
cb: Option<unsafe extern "C" fn(t: *mut nftnl_rule, data: *mut c_void) -> c_int>,
data: *mut c_void,
) -> c_int;
}
#[repr(C)]
pub struct nftnl_rule_list_iter(c_void);
extern "C" {
pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter;
pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule;
pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule;
pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter);
}
#[repr(C)]
pub struct nftnl_ruleset(c_void);
extern "C" {
pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset;
pub fn nftnl_ruleset_free(r: *const nftnl_ruleset);
}
pub const NFTNL_RULESET_TABLELIST: u32 = 0;
pub const NFTNL_RULESET_CHAINLIST: u32 = 1;
pub const NFTNL_RULESET_SETLIST: u32 = 2;
pub const NFTNL_RULESET_RULELIST: u32 = 3;
pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0;
pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1;
pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2;
pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3;
pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4;
pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5;
pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6;
pub type nftnl_ruleset_type = u32;
extern "C" {
pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool;
pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16);
pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void);
pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void;
}
pub const NFTNL_RULESET_CTX_CMD: u32 = 0;
pub const NFTNL_RULESET_CTX_TYPE: u32 = 1;
pub const NFTNL_RULESET_CTX_TABLE: u32 = 2;
pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3;
pub const NFTNL_RULESET_CTX_RULE: u32 = 4;
pub const NFTNL_RULESET_CTX_SET: u32 = 5;
pub const NFTNL_RULESET_CTX_DATA: u32 = 6;
#[repr(C)]
pub struct nftnl_parse_ctx(c_void);
extern "C" {
pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx);
pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool;
pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void;
pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32;
pub fn nftnl_ruleset_parse_file_cb(
type_: nftnl_parse_type,
fp: *mut FILE,
err: *mut nftnl_parse_err,
data: *mut c_void,
cb: Option<unsafe extern "C" fn(ctx: *const nftnl_parse_ctx) -> c_int>,
) -> c_int;
pub fn nftnl_ruleset_parse_buffer_cb(
type_: nftnl_parse_type,
buffer: *const c_char,
err: *mut nftnl_parse_err,
data: *mut c_void,
cb: Option<unsafe extern "C" fn(ctx: *const nftnl_parse_ctx) -> c_int>,
) -> c_int;
pub fn nftnl_ruleset_parse(
rs: *mut nftnl_ruleset,
type_: nftnl_parse_type,
data: *const c_char,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_ruleset_parse_file(
rs: *mut nftnl_ruleset,
type_: nftnl_parse_type,
fp: *mut FILE,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_ruleset_snprintf(
buf: *mut c_char,
size: usize,
rs: *const nftnl_ruleset,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_ruleset_fprintf(
fp: *mut FILE,
rs: *const nftnl_ruleset,
type_: u32,
flags: u32,
) -> c_int;
}
pub const NFTNL_SET_TABLE: nftnl_set_attr = 0;
pub const NFTNL_SET_NAME: nftnl_set_attr = 1;
pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2;
pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3;
pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4;
pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5;
pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6;
pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7;
pub const NFTNL_SET_ID: nftnl_set_attr = 8;
pub const NFTNL_SET_POLICY: nftnl_set_attr = 9;
pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10;
pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11;
pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12;
pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13;
pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14;
pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15;
pub const __NFTNL_SET_MAX: nftnl_set_attr = 16;
pub type nftnl_set_attr = u32;
#[repr(C)]
pub struct nftnl_set(c_void);
extern "C" {
pub fn nftnl_set_alloc() -> *mut nftnl_set;
pub fn nftnl_set_free(s: *const nftnl_set);
pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set;
pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool;
pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16);
pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int;
pub fn nftnl_set_set_data(
s: *mut nftnl_set,
attr: u16,
data: *const c_void,
data_len: u32,
) -> c_int;
pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32);
pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64);
pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str: *const c_char) -> c_int;
pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void;
pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void;
pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char;
pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32;
pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64;
pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set);
pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int;
pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int;
pub fn nftnl_set_snprintf(
buf: *mut c_char,
size: usize,
s: *const nftnl_set,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int;
}
#[repr(C)]
pub struct nftnl_set_list(c_void);
extern "C" {
pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list;
pub fn nftnl_set_list_free(list: *mut nftnl_set_list);
pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int;
pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list);
pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list);
pub fn nftnl_set_list_del(s: *mut nftnl_set);
pub fn nftnl_set_list_foreach(
set_list: *mut nftnl_set_list,
cb: Option<unsafe extern "C" fn(t: *mut nftnl_set, data: *mut c_void) -> c_int>,
data: *mut c_void,
) -> c_int;
}
#[repr(C)]
pub struct nftnl_set_list_iter(c_void);
extern "C" {
pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter;
pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set;
pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set;
pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter);
pub fn nftnl_set_parse(
s: *mut nftnl_set,
type_: nftnl_parse_type,
data: *const c_char,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_set_parse_file(
s: *mut nftnl_set,
type_: nftnl_parse_type,
fp: *mut FILE,
err: *mut nftnl_parse_err,
) -> c_int;
}
pub const NFTNL_SET_ELEM_FLAGS: u32 = 0;
pub const NFTNL_SET_ELEM_KEY: u32 = 1;
pub const NFTNL_SET_ELEM_VERDICT: u32 = 2;
pub const NFTNL_SET_ELEM_CHAIN: u32 = 3;
pub const NFTNL_SET_ELEM_DATA: u32 = 4;
pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5;
pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6;
pub const NFTNL_SET_ELEM_USERDATA: u32 = 7;
pub const NFTNL_SET_ELEM_EXPR: u32 = 8;
pub const NFTNL_SET_ELEM_OBJREF: u32 = 9;
#[repr(C)]
pub struct nftnl_set_elem(c_void);
extern "C" {
pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem;
pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem);
pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem;
pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem);
pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16);
pub fn nftnl_set_elem_set(
s: *mut nftnl_set_elem,
attr: u16,
data: *const c_void,
data_len: u32,
) -> c_int;
pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32);
pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64);
pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str: *const c_char) -> c_int;
pub fn nftnl_set_elem_get(
s: *mut nftnl_set_elem,
attr: u16,
data_len: *mut u32,
) -> *const c_void;
pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char;
pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32;
pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64;
pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool;
pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set);
pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem);
pub fn nftnl_set_elem_parse(
e: *mut nftnl_set_elem,
type_: nftnl_parse_type,
data: *const c_char,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_set_elem_parse_file(
e: *mut nftnl_set_elem,
type_: nftnl_parse_type,
fp: *mut FILE,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_set_elem_snprintf(
buf: *mut c_char,
size: usize,
s: *const nftnl_set_elem,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_set_elem_fprintf(
fp: *mut FILE,
se: *mut nftnl_set_elem,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_set_elem_foreach(
s: *mut nftnl_set,
cb: Option<unsafe extern "C" fn(e: *mut nftnl_set_elem, data: *mut c_void) -> c_int>,
data: *mut c_void,
) -> c_int;
}
#[repr(C)]
pub struct nftnl_set_elems_iter(c_void);
extern "C" {
pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter;
pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem;
pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem;
pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter);
pub fn nftnl_set_elems_nlmsg_build_payload_iter(
nlh: *mut nlmsghdr,
iter: *mut nftnl_set_elems_iter,
) -> c_int;
}
#[repr(C)]
pub struct nftnl_table(c_void);
extern "C" {
pub fn nftnl_table_alloc() -> *mut nftnl_table;
pub fn nftnl_table_free(arg1: *const nftnl_table);
}
pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0;
pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1;
pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2;
pub const NFTNL_TABLE_USE: nftnl_table_attr = 3;
pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4;
pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 5;
pub type nftnl_table_attr = u32;
extern "C" {
pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool;
pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16);
pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void);
pub fn nftnl_table_set_data(
t: *mut nftnl_table,
attr: u16,
data: *const c_void,
data_len: u32,
) -> c_int;
pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void;
pub fn nftnl_table_get_data(
t: *const nftnl_table,
attr: u16,
data_len: *mut u32,
) -> *const c_void;
pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8);
pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32);
pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64);
pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str: *const c_char) -> c_int;
pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8;
pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32;
pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64;
pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char;
pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table);
pub fn nftnl_table_parse(
t: *mut nftnl_table,
type_: nftnl_parse_type,
data: *const c_char,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_table_parse_file(
t: *mut nftnl_table,
type_: nftnl_parse_type,
fp: *mut FILE,
err: *mut nftnl_parse_err,
) -> c_int;
pub fn nftnl_table_snprintf(
buf: *mut c_char,
size: usize,
t: *const nftnl_table,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_table_fprintf(
fp: *mut FILE,
t: *const nftnl_table,
type_: u32,
flags: u32,
) -> c_int;
pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int;
}
#[repr(C)]
pub struct nftnl_table_list(c_void);
extern "C" {
pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list;
pub fn nftnl_table_list_free(list: *mut nftnl_table_list);
pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int;
pub fn nftnl_table_list_foreach(
table_list: *mut nftnl_table_list,
cb: Option<unsafe extern "C" fn(t: *mut nftnl_table, data: *mut c_void) -> c_int>,
data: *mut c_void,
) -> c_int;
pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list);
pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list);
pub fn nftnl_table_list_del(r: *mut nftnl_table);
}
#[repr(C)]
pub struct nftnl_table_list_iter(c_void);
extern "C" {
pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter;
pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table;
pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter);
}
pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0;
pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1;
pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2;
pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3;
pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4;
pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5;
pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6;
pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7;
pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8;
pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9;
pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10;
pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11;
pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12;
pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13;
pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14;
pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15;
pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16;
pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17;
pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18;
pub type nftnl_trace_attr = u32;
#[repr(C)]
pub struct nftnl_trace(c_void);
extern "C" {
pub fn nftnl_trace_alloc() -> *mut nftnl_trace;
pub fn nftnl_trace_free(trace: *const nftnl_trace);
pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool;
pub fn nftnl_trace_get_data(
trace: *const nftnl_trace,
type_: u16,
data_len: *mut u32,
) -> *const c_void;
pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16;
pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32;
pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64;
pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char;
pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int;
}
#[repr(C)]
pub struct nftnl_udata(c_void);
#[repr(C)]
pub struct nftnl_udata_buf(c_void);
extern "C" {
pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf;
pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf);
pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32;
pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void;
pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32);
pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata;
pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata;
pub fn nftnl_udata_put(
buf: *mut nftnl_udata_buf,
type_: u8,
len: u32,
value: *const c_void,
) -> bool;
pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool;
pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool;
pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8;
pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8;
pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void;
pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32;
pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata;
}
pub type nftnl_udata_cb_t =
Option<unsafe extern "C" fn(attr: *const nftnl_udata, data: *mut c_void) -> c_int>;
extern "C" {
pub fn nftnl_udata_parse(
data: *const c_void,
data_len: u32,
cb: nftnl_udata_cb_t,
cb_data: *mut c_void,
) -> c_int;
}
|