rice-c 0.4.2

ICE (RFC8445) implementation protocol
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
/* automatically generated by rust-bindgen 0.72.1 */

pub const RICE_PROTO_MAJOR: u32 = 0;
pub const RICE_PROTO_MINOR: u32 = 4;
pub const RICE_PROTO_PATCH: u32 = 2;
#[doc = " Component is in initial state and no connectivity checks are in progress."]
pub const RICE_COMPONENT_CONNECTION_STATE_NEW: RiceComponentConnectionState = 0;
#[doc = " Connectivity checks are in progress for this candidate"]
pub const RICE_COMPONENT_CONNECTION_STATE_CONNECTING: RiceComponentConnectionState = 1;
#[doc = " A [`CandidatePair`](crate::candidate::CandidatePair`) has been selected for this component"]
pub const RICE_COMPONENT_CONNECTION_STATE_CONNECTED: RiceComponentConnectionState = 2;
#[doc = " No connection could be found for this Component"]
pub const RICE_COMPONENT_CONNECTION_STATE_FAILED: RiceComponentConnectionState = 3;
pub type RiceComponentConnectionState = u32;
#[doc = " IP version 4."]
pub const RICE_ADDRESS_FAMILY_IPV4: RiceAddressFamily = 1;
#[doc = " IP version 6."]
pub const RICE_ADDRESS_FAMILY_IPV6: RiceAddressFamily = 2;
pub type RiceAddressFamily = u32;
#[doc = " The candidate is a local network interface"]
pub const RICE_CANDIDATE_TYPE_HOST: RiceCandidateType = 0;
#[doc = " The candidate was discovered from incoming data"]
pub const RICE_CANDIDATE_TYPE_PEER_REFLEXIVE: RiceCandidateType = 1;
#[doc = " The candidate was discovered by asking an external server (STUN/TURN)"]
pub const RICE_CANDIDATE_TYPE_SERVER_REFLEXIVE: RiceCandidateType = 2;
#[doc = " The candidate will relay all data through an external server (TURN)."]
pub const RICE_CANDIDATE_TYPE_RELAYED: RiceCandidateType = 3;
pub type RiceCandidateType = u32;
#[doc = " Not an error. The operation was completed successfully."]
pub const RICE_ERROR_SUCCESS: RiceError = 0;
#[doc = " The operation failed for an unspecified reason."]
pub const RICE_ERROR_FAILED: RiceError = -1;
#[doc = " A required resource was not found."]
pub const RICE_ERROR_RESOURCE_NOT_FOUND: RiceError = -2;
#[doc = " The operation is already in progress."]
pub const RICE_ERROR_ALREADY_IN_PROGRESS: RiceError = -3;
pub type RiceError = i32;
#[doc = " The configuration will automatically be used when supported."]
pub const RICE_FEATURE_DISABLED: RiceFeature = -1;
#[doc = " The configuration will automatically be used when supported."]
pub const RICE_FEATURE_AUTO: RiceFeature = 0;
#[doc = " The configuration is enabled and required."]
pub const RICE_FEATURE_REQUIRED: RiceFeature = 1;
pub type RiceFeature = i32;
#[doc = " The SHA-1 HMAC."]
pub const RICE_INTEGRITY_ALGORITHM_SHA1: RiceIntegrityAlgorithm = 0;
#[doc = " The SHA-256 HMAC."]
pub const RICE_INTEGRITY_ALGORITHM_SHA256: RiceIntegrityAlgorithm = 1;
pub type RiceIntegrityAlgorithm = u32;
#[doc = " No error."]
pub const RICE_PARSE_CANDIDATE_ERROR_SUCCESS: RiceParseCandidateError = 0;
#[doc = " Not a candidate message."]
pub const RICE_PARSE_CANDIDATE_ERROR_NOT_CANDIDATE: RiceParseCandidateError = -1;
#[doc = " Invalid foundation value."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_FOUNDATION: RiceParseCandidateError = -2;
#[doc = " Invalid component id."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_COMPONENT_ID: RiceParseCandidateError = -3;
#[doc = " Invalid transport type."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_TRANSPORT_TYPE: RiceParseCandidateError = -4;
#[doc = " Invalid priority value."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_PRIORITY: RiceParseCandidateError = -5;
#[doc = " Invalid network address."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_ADDRESS: RiceParseCandidateError = -6;
#[doc = " Invalid candidate type."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_CANDIDATE_TYPE: RiceParseCandidateError = -7;
#[doc = " Invalid extension format."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_EXTENSION: RiceParseCandidateError = -8;
#[doc = " Data is not well formed."]
pub const RICE_PARSE_CANDIDATE_ERROR_MALFORMED: RiceParseCandidateError = -9;
pub type RiceParseCandidateError = i32;
#[doc = " Not a TCP candidate."]
pub const RICE_TCP_TYPE_NONE: RiceTcpType = 0;
#[doc = " The candidate address will connect to a remote address."]
pub const RICE_TCP_TYPE_ACTIVE: RiceTcpType = 1;
#[doc = " The candidate will listen for incominng TCP connections."]
pub const RICE_TCP_TYPE_PASSIVE: RiceTcpType = 2;
#[doc = " Simultaneous open.  The candidate will both listen for incoming connections, and connect to\n remote addresses."]
pub const RICE_TCP_TYPE_SO: RiceTcpType = 3;
pub type RiceTcpType = u32;
#[doc = " Openssl."]
pub const RICE_TLS_VARIANT_OPENSSL: RiceTlsVariant = 1;
#[doc = " Rustls."]
pub const RICE_TLS_VARIANT_RUSTLS: RiceTlsVariant = 2;
#[doc = " Dimpl."]
pub const RICE_TLS_VARIANT_DIMPL: RiceTlsVariant = 3;
pub type RiceTlsVariant = u32;
#[doc = " The UDP transport"]
pub const RICE_TRANSPORT_TYPE_UDP: RiceTransportType = 0;
#[doc = " The TCP transport"]
pub const RICE_TRANSPORT_TYPE_TCP: RiceTransportType = 1;
pub type RiceTransportType = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Credentials {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct RiceAddress {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgent {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceComponent {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceStream {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceTlsConfig {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceTurnConfig {
    _unused: [u8; 0],
}
#[doc = " A pointer to a sequence of bytes and the associated size."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceDataImpl {
    #[doc = " A pointer to a sequence of bytes."]
    pub ptr: *mut u8,
    #[doc = " Number of bytes pointed to in `ptr`."]
    pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceDataImpl"][::core::mem::size_of::<RiceDataImpl>() - 16usize];
    ["Alignment of RiceDataImpl"][::core::mem::align_of::<RiceDataImpl>() - 8usize];
    ["Offset of field: RiceDataImpl::ptr"][::core::mem::offset_of!(RiceDataImpl, ptr) - 0usize];
    ["Offset of field: RiceDataImpl::size"][::core::mem::offset_of!(RiceDataImpl, size) - 8usize];
};
#[doc = " The data is borrowed and will not be freed on destruction."]
pub const RICE_DATA_BORROWED: RiceData_Tag = 0;
#[doc = " The data is owned and will be freed on destruction."]
pub const RICE_DATA_OWNED: RiceData_Tag = 1;
#[doc = " A pointer to a sequence of bytes and size."]
pub type RiceData_Tag = ::core::ffi::c_uint;
#[repr(C)]
pub struct RiceData {
    pub tag: RiceData_Tag,
    pub field1: RiceData__bindgen_ty_1,
}
#[repr(C)]
pub union RiceData__bindgen_ty_1 {
    pub field1: ::core::mem::ManuallyDrop<RiceData__bindgen_ty_1__bindgen_ty_1>,
    pub field2: ::core::mem::ManuallyDrop<RiceData__bindgen_ty_1__bindgen_ty_2>,
}
#[repr(C)]
#[derive(Debug)]
pub struct RiceData__bindgen_ty_1__bindgen_ty_1 {
    pub borrowed: RiceDataImpl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceData__bindgen_ty_1__bindgen_ty_1"]
        [::core::mem::size_of::<RiceData__bindgen_ty_1__bindgen_ty_1>() - 16usize];
    ["Alignment of RiceData__bindgen_ty_1__bindgen_ty_1"]
        [::core::mem::align_of::<RiceData__bindgen_ty_1__bindgen_ty_1>() - 8usize];
    ["Offset of field: RiceData__bindgen_ty_1__bindgen_ty_1::borrowed"]
        [::core::mem::offset_of!(RiceData__bindgen_ty_1__bindgen_ty_1, borrowed) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceData__bindgen_ty_1__bindgen_ty_2 {
    pub owned: RiceDataImpl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceData__bindgen_ty_1__bindgen_ty_2"]
        [::core::mem::size_of::<RiceData__bindgen_ty_1__bindgen_ty_2>() - 16usize];
    ["Alignment of RiceData__bindgen_ty_1__bindgen_ty_2"]
        [::core::mem::align_of::<RiceData__bindgen_ty_1__bindgen_ty_2>() - 8usize];
    ["Offset of field: RiceData__bindgen_ty_1__bindgen_ty_2::owned"]
        [::core::mem::offset_of!(RiceData__bindgen_ty_1__bindgen_ty_2, owned) - 0usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceData__bindgen_ty_1"][::core::mem::size_of::<RiceData__bindgen_ty_1>() - 16usize];
    ["Alignment of RiceData__bindgen_ty_1"]
        [::core::mem::align_of::<RiceData__bindgen_ty_1>() - 8usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceData"][::core::mem::size_of::<RiceData>() - 24usize];
    ["Alignment of RiceData"][::core::mem::align_of::<RiceData>() - 8usize];
    ["Offset of field: RiceData::tag"][::core::mem::offset_of!(RiceData, tag) - 0usize];
};
#[doc = " Transmit the data using the specified 5-tuple."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceTransmit {
    #[doc = " The associated stream identifier."]
    pub stream_id: usize,
    #[doc = " The transport type for the transmission."]
    pub transport: RiceTransportType,
    #[doc = " The socket source address to send from."]
    pub from: *const RiceAddress,
    #[doc = " The socket destination address to send to."]
    pub to: *const RiceAddress,
    #[doc = " The data to send."]
    pub data: RiceDataImpl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceTransmit"][::core::mem::size_of::<RiceTransmit>() - 48usize];
    ["Alignment of RiceTransmit"][::core::mem::align_of::<RiceTransmit>() - 8usize];
    ["Offset of field: RiceTransmit::stream_id"]
        [::core::mem::offset_of!(RiceTransmit, stream_id) - 0usize];
    ["Offset of field: RiceTransmit::transport"]
        [::core::mem::offset_of!(RiceTransmit, transport) - 8usize];
    ["Offset of field: RiceTransmit::from"][::core::mem::offset_of!(RiceTransmit, from) - 16usize];
    ["Offset of field: RiceTransmit::to"][::core::mem::offset_of!(RiceTransmit, to) - 24usize];
    ["Offset of field: RiceTransmit::data"][::core::mem::offset_of!(RiceTransmit, data) - 32usize];
};
#[doc = " A socket with the specified network 5-tuple."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentSocket {
    #[doc = " The ICE stream id."]
    pub stream_id: usize,
    #[doc = " The ICE component id."]
    pub component_id: usize,
    #[doc = " The transport type to allocate."]
    pub transport: RiceTransportType,
    #[doc = " The source address to allocate from."]
    pub from: *const RiceAddress,
    #[doc = " The destination address to connect to."]
    pub to: *const RiceAddress,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentSocket"][::core::mem::size_of::<RiceAgentSocket>() - 40usize];
    ["Alignment of RiceAgentSocket"][::core::mem::align_of::<RiceAgentSocket>() - 8usize];
    ["Offset of field: RiceAgentSocket::stream_id"]
        [::core::mem::offset_of!(RiceAgentSocket, stream_id) - 0usize];
    ["Offset of field: RiceAgentSocket::component_id"]
        [::core::mem::offset_of!(RiceAgentSocket, component_id) - 8usize];
    ["Offset of field: RiceAgentSocket::transport"]
        [::core::mem::offset_of!(RiceAgentSocket, transport) - 16usize];
    ["Offset of field: RiceAgentSocket::from"]
        [::core::mem::offset_of!(RiceAgentSocket, from) - 24usize];
    ["Offset of field: RiceAgentSocket::to"]
        [::core::mem::offset_of!(RiceAgentSocket, to) - 32usize];
};
#[doc = " An ICE candidate."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceCandidate {
    pub component_id: usize,
    pub candidate_type: RiceCandidateType,
    pub transport_type: RiceTransportType,
    pub foundation: *const ::core::ffi::c_char,
    pub priority: u32,
    pub address: *const RiceAddress,
    pub base_address: *const RiceAddress,
    pub related_address: *const RiceAddress,
    pub tcp_type: RiceTcpType,
    pub extensions: *mut *mut ::core::ffi::c_char,
    pub extensions_len: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceCandidate"][::core::mem::size_of::<RiceCandidate>() - 80usize];
    ["Alignment of RiceCandidate"][::core::mem::align_of::<RiceCandidate>() - 8usize];
    ["Offset of field: RiceCandidate::component_id"]
        [::core::mem::offset_of!(RiceCandidate, component_id) - 0usize];
    ["Offset of field: RiceCandidate::candidate_type"]
        [::core::mem::offset_of!(RiceCandidate, candidate_type) - 8usize];
    ["Offset of field: RiceCandidate::transport_type"]
        [::core::mem::offset_of!(RiceCandidate, transport_type) - 12usize];
    ["Offset of field: RiceCandidate::foundation"]
        [::core::mem::offset_of!(RiceCandidate, foundation) - 16usize];
    ["Offset of field: RiceCandidate::priority"]
        [::core::mem::offset_of!(RiceCandidate, priority) - 24usize];
    ["Offset of field: RiceCandidate::address"]
        [::core::mem::offset_of!(RiceCandidate, address) - 32usize];
    ["Offset of field: RiceCandidate::base_address"]
        [::core::mem::offset_of!(RiceCandidate, base_address) - 40usize];
    ["Offset of field: RiceCandidate::related_address"]
        [::core::mem::offset_of!(RiceCandidate, related_address) - 48usize];
    ["Offset of field: RiceCandidate::tcp_type"]
        [::core::mem::offset_of!(RiceCandidate, tcp_type) - 56usize];
    ["Offset of field: RiceCandidate::extensions"]
        [::core::mem::offset_of!(RiceCandidate, extensions) - 64usize];
    ["Offset of field: RiceCandidate::extensions_len"]
        [::core::mem::offset_of!(RiceCandidate, extensions_len) - 72usize];
};
#[doc = " A new pair has been selected for a component."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentSelectedPair {
    #[doc = " The ICE stream id."]
    pub stream_id: usize,
    #[doc = " The ICE component id."]
    pub component_id: usize,
    #[doc = " The local candidate of a selected pair."]
    pub local: RiceCandidate,
    #[doc = " The remote candidate of a selected pair."]
    pub remote: RiceCandidate,
    #[doc = " The local TURN transport type (if any)."]
    pub local_turn_transport: RiceTransportType,
    #[doc = " The local TURN address to send data from."]
    pub local_turn_local_addr: *const RiceAddress,
    #[doc = " The local TURN address to send data to."]
    pub local_turn_remote_addr: *const RiceAddress,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentSelectedPair"][::core::mem::size_of::<RiceAgentSelectedPair>() - 200usize];
    ["Alignment of RiceAgentSelectedPair"]
        [::core::mem::align_of::<RiceAgentSelectedPair>() - 8usize];
    ["Offset of field: RiceAgentSelectedPair::stream_id"]
        [::core::mem::offset_of!(RiceAgentSelectedPair, stream_id) - 0usize];
    ["Offset of field: RiceAgentSelectedPair::component_id"]
        [::core::mem::offset_of!(RiceAgentSelectedPair, component_id) - 8usize];
    ["Offset of field: RiceAgentSelectedPair::local"]
        [::core::mem::offset_of!(RiceAgentSelectedPair, local) - 16usize];
    ["Offset of field: RiceAgentSelectedPair::remote"]
        [::core::mem::offset_of!(RiceAgentSelectedPair, remote) - 96usize];
    ["Offset of field: RiceAgentSelectedPair::local_turn_transport"]
        [::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_transport) - 176usize];
    ["Offset of field: RiceAgentSelectedPair::local_turn_local_addr"]
        [::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_local_addr) - 184usize];
    ["Offset of field: RiceAgentSelectedPair::local_turn_remote_addr"]
        [::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_remote_addr) - 192usize];
};
#[doc = " A [`Component`](crate::component::Component) has changed state."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentComponentStateChange {
    #[doc = " The ICE stream id."]
    pub stream_id: usize,
    #[doc = " The ICE component id."]
    pub component_id: usize,
    #[doc = " The new state of the component."]
    pub state: RiceComponentConnectionState,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentComponentStateChange"]
        [::core::mem::size_of::<RiceAgentComponentStateChange>() - 24usize];
    ["Alignment of RiceAgentComponentStateChange"]
        [::core::mem::align_of::<RiceAgentComponentStateChange>() - 8usize];
    ["Offset of field: RiceAgentComponentStateChange::stream_id"]
        [::core::mem::offset_of!(RiceAgentComponentStateChange, stream_id) - 0usize];
    ["Offset of field: RiceAgentComponentStateChange::component_id"]
        [::core::mem::offset_of!(RiceAgentComponentStateChange, component_id) - 8usize];
    ["Offset of field: RiceAgentComponentStateChange::state"]
        [::core::mem::offset_of!(RiceAgentComponentStateChange, state) - 16usize];
};
#[doc = " A local candidate that has been gathered."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceGatheredCandidate {
    pub candidate: RiceCandidate,
    pub turn_agent: *mut ::core::ffi::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceGatheredCandidate"][::core::mem::size_of::<RiceGatheredCandidate>() - 88usize];
    ["Alignment of RiceGatheredCandidate"]
        [::core::mem::align_of::<RiceGatheredCandidate>() - 8usize];
    ["Offset of field: RiceGatheredCandidate::candidate"]
        [::core::mem::offset_of!(RiceGatheredCandidate, candidate) - 0usize];
    ["Offset of field: RiceGatheredCandidate::turn_agent"]
        [::core::mem::offset_of!(RiceGatheredCandidate, turn_agent) - 80usize];
};
#[doc = " A [`Component`](crate::component::Component) has gathered a candidate."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentGatheredCandidate {
    #[doc = " The ICE stream id."]
    pub stream_id: usize,
    #[doc = " The candidate gathered."]
    pub gathered: RiceGatheredCandidate,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentGatheredCandidate"]
        [::core::mem::size_of::<RiceAgentGatheredCandidate>() - 96usize];
    ["Alignment of RiceAgentGatheredCandidate"]
        [::core::mem::align_of::<RiceAgentGatheredCandidate>() - 8usize];
    ["Offset of field: RiceAgentGatheredCandidate::stream_id"]
        [::core::mem::offset_of!(RiceAgentGatheredCandidate, stream_id) - 0usize];
    ["Offset of field: RiceAgentGatheredCandidate::gathered"]
        [::core::mem::offset_of!(RiceAgentGatheredCandidate, gathered) - 8usize];
};
#[doc = " A [`Component`](crate::component::Component) has completed gathering."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentGatheringComplete {
    #[doc = " The ICE stream id."]
    pub stream_id: usize,
    #[doc = " The ICE component id."]
    pub component_id: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentGatheringComplete"]
        [::core::mem::size_of::<RiceAgentGatheringComplete>() - 16usize];
    ["Alignment of RiceAgentGatheringComplete"]
        [::core::mem::align_of::<RiceAgentGatheringComplete>() - 8usize];
    ["Offset of field: RiceAgentGatheringComplete::stream_id"]
        [::core::mem::offset_of!(RiceAgentGatheringComplete, stream_id) - 0usize];
    ["Offset of field: RiceAgentGatheringComplete::component_id"]
        [::core::mem::offset_of!(RiceAgentGatheringComplete, component_id) - 8usize];
};
#[doc = " The Agent is closed.  No further progress will be made."]
pub const RICE_AGENT_POLL_CLOSED: RiceAgentPoll_Tag = 0;
#[doc = " Wait until the specified `Instant` has been reached (or an external event)."]
pub const RICE_AGENT_POLL_WAIT_UNTIL_NANOS: RiceAgentPoll_Tag = 1;
#[doc = " Connect from the specified interface to the specified address.  Reply (success or failure)\n should be notified using `rice_stream_handle_allocated_socket()`."]
pub const RICE_AGENT_POLL_ALLOCATE_SOCKET: RiceAgentPoll_Tag = 2;
#[doc = " It is possible to remove the specified 5-tuple. The socket will not be referenced any\n further."]
pub const RICE_AGENT_POLL_REMOVE_SOCKET: RiceAgentPoll_Tag = 3;
#[doc = " A new pair has been selected for a component."]
pub const RICE_AGENT_POLL_SELECTED_PAIR: RiceAgentPoll_Tag = 4;
#[doc = " A [`Component`](crate::component::Component) has changed state."]
pub const RICE_AGENT_POLL_COMPONENT_STATE_CHANGE: RiceAgentPoll_Tag = 5;
#[doc = " A [`Component`](crate::component::Component) has gathered a candidate."]
pub const RICE_AGENT_POLL_GATHERED_CANDIDATE: RiceAgentPoll_Tag = 6;
#[doc = " A [`Component`](crate::component::Component) has completed gathering."]
pub const RICE_AGENT_POLL_GATHERING_COMPLETE: RiceAgentPoll_Tag = 7;
#[doc = " Return value of `rice_agent_poll()`."]
pub type RiceAgentPoll_Tag = ::core::ffi::c_uint;
#[repr(C)]
pub struct RiceAgentPoll {
    pub tag: RiceAgentPoll_Tag,
    pub field1: RiceAgentPoll__bindgen_ty_1,
}
#[repr(C)]
pub union RiceAgentPoll__bindgen_ty_1 {
    pub field1: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>,
    pub field2: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>,
    pub field3: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>,
    pub field4: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>,
    pub field5: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>,
    pub field6: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>,
    pub field7: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_1 {
    pub wait_until_nanos: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_1"]
        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>() - 8usize];
    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_1"]
        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>() - 8usize];
    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_1::wait_until_nanos"][::core::mem::offset_of!(
        RiceAgentPoll__bindgen_ty_1__bindgen_ty_1,
        wait_until_nanos
    ) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_2 {
    pub allocate_socket: RiceAgentSocket,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_2"]
        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>() - 40usize];
    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_2"]
        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>() - 8usize];
    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_2::allocate_socket"][::core::mem::offset_of!(
        RiceAgentPoll__bindgen_ty_1__bindgen_ty_2,
        allocate_socket
    ) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_3 {
    pub remove_socket: RiceAgentSocket,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_3"]
        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>() - 40usize];
    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_3"]
        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>() - 8usize];
    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_3::remove_socket"][::core::mem::offset_of!(
        RiceAgentPoll__bindgen_ty_1__bindgen_ty_3,
        remove_socket
    ) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_4 {
    pub selected_pair: RiceAgentSelectedPair,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_4"]
        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>() - 200usize];
    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_4"]
        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>() - 8usize];
    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_4::selected_pair"][::core::mem::offset_of!(
        RiceAgentPoll__bindgen_ty_1__bindgen_ty_4,
        selected_pair
    ) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_5 {
    pub component_state_change: RiceAgentComponentStateChange,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_5"]
        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>() - 24usize];
    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_5"]
        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>() - 8usize];
    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_5::component_state_change"][::core::mem::offset_of!(
        RiceAgentPoll__bindgen_ty_1__bindgen_ty_5,
        component_state_change
    )
        - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_6 {
    pub gathered_candidate: RiceAgentGatheredCandidate,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_6"]
        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>() - 96usize];
    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_6"]
        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>() - 8usize];
    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_6::gathered_candidate"][::core::mem::offset_of!(
        RiceAgentPoll__bindgen_ty_1__bindgen_ty_6,
        gathered_candidate
    ) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_7 {
    pub gathering_complete: RiceAgentGatheringComplete,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_7"]
        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>() - 16usize];
    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_7"]
        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>() - 8usize];
    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_7::gathering_complete"][::core::mem::offset_of!(
        RiceAgentPoll__bindgen_ty_1__bindgen_ty_7,
        gathering_complete
    ) - 0usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll__bindgen_ty_1"]
        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1>() - 200usize];
    ["Alignment of RiceAgentPoll__bindgen_ty_1"]
        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1>() - 8usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceAgentPoll"][::core::mem::size_of::<RiceAgentPoll>() - 208usize];
    ["Alignment of RiceAgentPoll"][::core::mem::align_of::<RiceAgentPoll>() - 8usize];
    ["Offset of field: RiceAgentPoll::tag"][::core::mem::offset_of!(RiceAgentPoll, tag) - 0usize];
};
#[doc = " ICE/TURN credentials."]
pub type RiceCredentials = Credentials;
#[doc = " Return value for `rice_stream_handle_incoming_data()`."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceStreamIncomingData {
    #[doc = " The data was handled internally. `rice_agent_poll()` should be called at the\n next earliest opportunity."]
    pub handled: bool,
    #[doc = " Whether there is more data to pull using `rice_stream_poll_recv()`."]
    pub have_more_data: bool,
    #[doc = " The data pointer. If non-NULL, this is the same value as provided to\n `rice_stream_handle_incoming_data()` and has the same lifetime contraints as that original\n data pointer."]
    pub data: RiceDataImpl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of RiceStreamIncomingData"][::core::mem::size_of::<RiceStreamIncomingData>() - 24usize];
    ["Alignment of RiceStreamIncomingData"]
        [::core::mem::align_of::<RiceStreamIncomingData>() - 8usize];
    ["Offset of field: RiceStreamIncomingData::handled"]
        [::core::mem::offset_of!(RiceStreamIncomingData, handled) - 0usize];
    ["Offset of field: RiceStreamIncomingData::have_more_data"]
        [::core::mem::offset_of!(RiceStreamIncomingData, have_more_data) - 1usize];
    ["Offset of field: RiceStreamIncomingData::data"]
        [::core::mem::offset_of!(RiceStreamIncomingData, data) - 8usize];
};
unsafe extern "C" {
    #[doc = " Query the built version of `rice-proto`."]
    pub fn rice_version(major: *mut u32, minor: *mut u32, patch: *mut u32);
}
unsafe extern "C" {
    #[doc = " Create a new ICE Agent."]
    pub fn rice_agent_new(controlling: bool, trickle_ice: bool) -> *mut RiceAgent;
}
unsafe extern "C" {
    #[doc = " Increase the reference count of the `RiceAgent`.\n\n This function is multi-threading safe."]
    pub fn rice_agent_ref(agent: *const RiceAgent) -> *mut RiceAgent;
}
unsafe extern "C" {
    #[doc = " Decrease the reference count of the `RiceAgent`.\n\n If this is the last reference, then the `RiceAgent` is freed.\n\n This function is multi-threading safe."]
    pub fn rice_agent_unref(agent: *mut RiceAgent);
}
unsafe extern "C" {
    #[doc = " Close the `RiceAgent`.\n\n Closure does involve closing network resources (signalled through calls to\n `rice_agent_poll()`) and will only succesfully complete once `rice_agent_poll`() returns\n `Closed`."]
    pub fn rice_agent_close(agent: *const RiceAgent, now_nanos: i64);
}
unsafe extern "C" {
    #[doc = " Return the process-local unique id for this agent."]
    pub fn rice_agent_id(agent: *const RiceAgent) -> u64;
}
unsafe extern "C" {
    #[doc = " Get the timing advance time in nanoseconds of the `RiceAgent`.\n\n This is known as the Ta value in the ICE specification.\n\n The default value is 50ms."]
    pub fn rice_agent_get_timing_advance(agent: *const RiceAgent) -> u64;
}
unsafe extern "C" {
    #[doc = " Set the timing advance time in nanoseconds of the `RiceAgent`.\n\n This is known as the Ta value in the ICE specification.\n\n The default value is 50ms."]
    pub fn rice_agent_set_timing_advance(agent: *const RiceAgent, ta: u64);
}
unsafe extern "C" {
    #[doc = " Configure the default timeouts and retransmissions for each STUN request.\n\n - `initial` - the initial time between consecutive transmissions. If 0, or 1, then only a\n   single request will be performed.\n - `max` - the maximum amount of time between consecutive retransmits.\n - `retransmits` - the total number of transmissions of the request.\n - `final_retransmit_timeout` - the amount of time after the final transmission to wait\n   for a response before considering the request as having timed out.\n\n As specified in RFC 8489, `initial_rto` should be >= 500ms (unless specific information is\n available on the RTT, `max` is `Duration::MAX`, `retransmits` has a default value of 7,\n and `last_retransmit_timeout` should be `16 * initial_rto`.\n\n STUN transactions over TCP will only send a single request and have a timeout of the sum of\n the timeouts of a UDP transaction."]
    pub fn rice_agent_set_request_retransmits(
        agent: *const RiceAgent,
        initial_nanos: u64,
        max_nanos: u64,
        retransmits: u32,
        final_retransmit_timeout_nanos: u64,
    );
}
unsafe extern "C" {
    #[doc = " Get the controlling state of the `RiceAgent`.\n\n A return value of `true` indicates the `RiceAgent` is in controlling mode, false the controlled\n mode.  This value can change during ICE processing."]
    pub fn rice_agent_get_controlling(agent: *const RiceAgent) -> bool;
}
unsafe extern "C" {
    #[doc = " The number of bytes in a `RiceData`."]
    pub fn rice_data_len(data: *const RiceData) -> usize;
}
unsafe extern "C" {
    #[doc = " The data pointer for a `RiceData`."]
    pub fn rice_data_ptr(data: *const RiceData) -> *mut u8;
}
unsafe extern "C" {
    #[doc = " Free any resources allocated within a `RiceTransmit`.\n\n The `RiceTransmit` must have been previously initialized with `rice_transmit_init()`."]
    pub fn rice_transmit_clear(transmit: *mut RiceTransmit);
}
unsafe extern "C" {
    #[doc = " Initialize a `RiceTransmit` with default values."]
    pub fn rice_transmit_init(transmit: *mut RiceTransmit);
}
unsafe extern "C" {
    #[doc = " Initialize a `RiceAgentPoll` with a default value."]
    pub fn rice_agent_poll_init(poll: *mut RiceAgentPoll);
}
unsafe extern "C" {
    #[doc = " Clear a `RiceAgentPoll` of any allocated values.\n\n `rice_agent_poll_init()` must have been called previously."]
    pub fn rice_agent_poll_clear(poll: *mut RiceAgentPoll);
}
unsafe extern "C" {
    #[doc = " Poll the `RiceAgent` for further progress.\n\n The returned value indicates what should be done to continue making progress."]
    pub fn rice_agent_poll(agent: *mut RiceAgent, now_nanos: i64, poll: *mut RiceAgentPoll);
}
unsafe extern "C" {
    #[doc = " Poll the `RiceAgent` for a transmission to send.\n\n If there is no transmission, then `transmit` will be filled with empty data.\n\n `rice_transmit_init()` or `rice_transmit_clear()` must be called before this function."]
    pub fn rice_agent_poll_transmit(
        agent: *mut RiceAgent,
        now_nanos: i64,
        transmit: *mut RiceTransmit,
    );
}
unsafe extern "C" {
    #[doc = " Add a STUN server to this `RiceAgent`."]
    pub fn rice_agent_add_stun_server(
        agent: *const RiceAgent,
        transport: RiceTransportType,
        addr: *const RiceAddress,
    );
}
unsafe extern "C" {
    #[doc = " Create a new TURN configuration."]
    pub fn rice_turn_config_new(
        transport: RiceTransportType,
        addr: *const RiceAddress,
        credentials: *const RiceCredentials,
    ) -> *mut RiceTurnConfig;
}
unsafe extern "C" {
    #[doc = " Copy a [`RiceTurnConfig`]."]
    pub fn rice_turn_config_copy(config: *const RiceTurnConfig) -> *mut RiceTurnConfig;
}
unsafe extern "C" {
    #[doc = " Free a [`RiceTurnConfig`]."]
    pub fn rice_turn_config_free(config: *mut RiceTurnConfig);
}
unsafe extern "C" {
    #[doc = " The transport to connect to the TURN server."]
    pub fn rice_turn_config_get_client_transport(
        config: *const RiceTurnConfig,
    ) -> RiceTransportType;
}
unsafe extern "C" {
    #[doc = " The address of the TURN server."]
    pub fn rice_turn_config_get_addr(config: *const RiceTurnConfig) -> *mut RiceAddress;
}
unsafe extern "C" {
    #[doc = " Set the allocation transport requested from the TURN server."]
    pub fn rice_turn_config_set_allocation_transport(
        config: *const RiceTurnConfig,
        transport: RiceTransportType,
    );
}
unsafe extern "C" {
    #[doc = " Retrieve the allocation transport that will be requested from the TURN server."]
    pub fn rice_turn_config_get_allocation_transport(
        config: *const RiceTurnConfig,
    ) -> RiceTransportType;
}
unsafe extern "C" {
    #[doc = " Add an [`RiceAddressFamily`] that will be requested.\n\n Duplicate [`RiceAddressFamily`]s are ignored."]
    pub fn rice_turn_config_add_address_family(
        config: *mut RiceTurnConfig,
        family: RiceAddressFamily,
    );
}
unsafe extern "C" {
    #[doc = " Set the [`RiceAddressFamily`] that will be requested.\n\n This will override all previously set [`RiceAddressFamily`]s."]
    pub fn rice_turn_config_set_address_family(
        config: *mut RiceTurnConfig,
        family: RiceAddressFamily,
    );
}
unsafe extern "C" {
    #[doc = " The address family to allocate as a relayed address on the TURN server."]
    pub fn rice_turn_config_get_address_families(
        config: *const RiceTurnConfig,
        n_families: *mut usize,
        families: *mut RiceAddressFamily,
    );
}
unsafe extern "C" {
    #[doc = " The credentials to use for accessing the TURN server."]
    pub fn rice_turn_config_get_credentials(config: *const RiceTurnConfig) -> *mut RiceCredentials;
}
unsafe extern "C" {
    #[doc = " Connect to the TURN server over TLS."]
    pub fn rice_turn_config_set_tls_config(
        config: *mut RiceTurnConfig,
        tls_config: *const RiceTlsConfig,
    );
}
unsafe extern "C" {
    #[doc = " The TLS config associated with this TURN configuration."]
    pub fn rice_turn_config_get_tls_config(config: *const RiceTurnConfig) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
    #[doc = " Add a supported integrity algorithm for authentication with the TURN server."]
    pub fn rice_turn_config_add_supported_integrity(
        config: *mut RiceTurnConfig,
        integrity: RiceIntegrityAlgorithm,
    );
}
unsafe extern "C" {
    #[doc = " Set the supported integrity algorithm for authentication with the TURN server.\n\n This will override all previously set values."]
    pub fn rice_turn_config_set_supported_integrity(
        config: *mut RiceTurnConfig,
        integrity: RiceIntegrityAlgorithm,
    );
}
unsafe extern "C" {
    #[doc = " The address family to allocate as a relayed address on the TURN server."]
    pub fn rice_turn_config_get_supported_integrity(
        config: *const RiceTurnConfig,
        n_integrities: *mut usize,
        integrities: *mut RiceIntegrityAlgorithm,
    );
}
unsafe extern "C" {
    #[doc = " Set whether anonymous username usage is required.\n\n A value of `Required` requires the server to support RFC 8489 and the `Userhash` attribute."]
    pub fn rice_turn_config_set_anonymous_username(config: *mut RiceTurnConfig, anon: RiceFeature);
}
unsafe extern "C" {
    #[doc = " Whether anonymous username usage is required.\n\n A value of `Required` requires the server to support RFC 8489 and the `Userhash` attribute."]
    pub fn rice_turn_config_get_anonymous_username(config: *mut RiceTurnConfig) -> RiceFeature;
}
unsafe extern "C" {
    #[doc = " Increase the reference count of the `RiceTlsConfig`.\n\n This function is multi-threading safe."]
    pub fn rice_tls_config_ref(config: *const RiceTlsConfig) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
    #[doc = " Decrease the reference count of the `RiceTlsConfig`.\n\n If this is the last reference, then the `RiceTlsConfig` is freed.\n\n This function is multi-threading safe."]
    pub fn rice_tls_config_unref(config: *mut RiceTlsConfig);
}
unsafe extern "C" {
    #[doc = " The TLS variant for a [`RiceTlsConfig`]"]
    pub fn rice_tls_config_variant(config: *const RiceTlsConfig) -> RiceTlsVariant;
}
unsafe extern "C" {
    #[doc = " Construct a new TLS configuration using Openssl."]
    pub fn rice_tls_config_new_openssl(transport: RiceTransportType) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
    #[doc = " Construct a new TLS configuration using Rustls."]
    pub fn rice_tls_config_new_rustls_with_dns(
        server_name: *const ::core::ffi::c_char,
    ) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
    #[doc = " Construct a new TLS configuration using Rustls."]
    pub fn rice_tls_config_new_rustls_with_ip(addr: *const RiceAddress) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
    #[doc = " Construct a new TLS configuration using Rustls."]
    pub fn rice_tls_config_new_dimpl() -> *mut RiceTlsConfig;
}
unsafe extern "C" {
    #[doc = " Add an ICE stream to the `RiceAgent`."]
    pub fn rice_agent_add_stream(agent: *mut RiceAgent) -> *mut RiceStream;
}
unsafe extern "C" {
    #[doc = " Retrieve a previously added stream from the `RiceAgent`.\n\n Will return `NULL` if the stream does not exist."]
    pub fn rice_agent_get_stream(agent: *const RiceAgent, stream_id: usize) -> *mut RiceStream;
}
unsafe extern "C" {
    #[doc = " Increase the reference count of the `RiceStream`.\n\n This function is multi-threading safe."]
    pub fn rice_stream_ref(stream: *const RiceStream) -> *mut RiceStream;
}
unsafe extern "C" {
    #[doc = " Decrease the reference count of the `RiceStream`.\n\n If this is the last reference, then the `RiceStream` is freed (but will still be referenced by\n the `RiceAgent`).\n\n This function is multi-threading safe."]
    pub fn rice_stream_unref(stream: *mut RiceStream);
}
unsafe extern "C" {
    #[doc = " Retrieve the stream id of the `RiceStream`."]
    pub fn rice_stream_get_id(stream: *const RiceStream) -> usize;
}
unsafe extern "C" {
    #[doc = " Retrieve the `RiceAgent` of the `RiceStream`."]
    pub fn rice_stream_get_agent(stream: *const RiceStream) -> *mut RiceAgent;
}
unsafe extern "C" {
    #[doc = " Notify success or failure to create a socket to the `RiceStream`.\n\n `socket_addr` can be `NULL` to indicate failure."]
    pub fn rice_stream_handle_allocated_socket(
        stream: *mut RiceStream,
        component_id: usize,
        transport: RiceTransportType,
        from: *const RiceAddress,
        to: *const RiceAddress,
        socket_addr: *mut RiceAddress,
        now_nanos: i64,
    );
}
unsafe extern "C" {
    #[doc = " Construct a new set of ICE/TURN credentials."]
    pub fn rice_credentials_new(
        ufrag: *const ::core::ffi::c_char,
        passwd: *const ::core::ffi::c_char,
    ) -> *mut RiceCredentials;
}
unsafe extern "C" {
    #[doc = " Construct a new set of ICE/TURN credentials."]
    pub fn rice_credentials_copy(creds: *const RiceCredentials) -> *mut RiceCredentials;
}
unsafe extern "C" {
    #[doc = " Free a set of ICE/TURN credentials."]
    pub fn rice_credentials_free(credentials: *mut RiceCredentials);
}
unsafe extern "C" {
    #[doc = " Retrieve the `RiceCandidate` ufrag attribute bytes.\n The pre-allocated array should be 256 bytes at most.\n\n Returns the actual length of the ufrag attribute."]
    pub fn rice_credentials_get_ufrag_bytes(
        credentials: *const RiceCredentials,
        ptr: *mut ::core::ffi::c_char,
    ) -> usize;
}
unsafe extern "C" {
    #[doc = " Compare two sets of Credentials.\n\n This function is NULL safe."]
    pub fn rice_credentials_eq(
        creds1: *const RiceCredentials,
        creds2: *const RiceCredentials,
    ) -> bool;
}
unsafe extern "C" {
    #[doc = " Retrieve the local ICE credentials currently set on the `RiceStream`."]
    pub fn rice_stream_get_local_credentials(stream: *const RiceStream) -> *mut RiceCredentials;
}
unsafe extern "C" {
    #[doc = " Retrieve the remote ICE credentials currently set on the `RiceStream`."]
    pub fn rice_stream_get_remote_credentials(stream: *const RiceStream) -> *mut RiceCredentials;
}
unsafe extern "C" {
    #[doc = " Set the local credentials to use for this `RiceStream`."]
    pub fn rice_stream_set_local_credentials(
        stream: *mut RiceStream,
        credentials: *const RiceCredentials,
    );
}
unsafe extern "C" {
    #[doc = " Set the remote credentials to use for this `RiceStream`."]
    pub fn rice_stream_set_remote_credentials(
        stream: *mut RiceStream,
        credentials: *const RiceCredentials,
    );
}
unsafe extern "C" {
    #[doc = " Construct a `RiceCandidate` from a string as formatted in an SDP and specified in RFC5245\n Section 15.1.\n\n Takes the form 'a=candidate:foundation 1 UDP 12345 127.0.0.1 23456 typ host'."]
    pub fn rice_candidate_new_from_sdp_string(
        cand_str: *const ::core::ffi::c_char,
    ) -> *mut RiceCandidate;
}
unsafe extern "C" {
    #[doc = " Construct a `RiceCandidate` from a string as formatted in an SDP and specified in RFC5245\n Section 15.1.\n\n Takes the form 'a=candidate:foundation 1 UDP 12345 127.0.0.1 23456 typ host'."]
    pub fn rice_candidate_init_from_sdp_string(
        candidate: *mut RiceCandidate,
        cand_str: *const ::core::ffi::c_char,
    ) -> RiceParseCandidateError;
}
unsafe extern "C" {
    #[doc = " Return a SDP candidate string as specified in RFC5245 Section 15.1."]
    pub fn rice_candidate_to_sdp_string(
        candidate: *const RiceCandidate,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Free an allocated string."]
    pub fn rice_string_free(string: *mut ::core::ffi::c_char);
}
unsafe extern "C" {
    #[doc = " Construct a new `RiceCandidate` with the provided values.\n\n Will return NULL on error."]
    pub fn rice_candidate_new(
        component_id: usize,
        ctype: RiceCandidateType,
        ttype: RiceTransportType,
        foundation: *const ::core::ffi::c_char,
        address: *mut RiceAddress,
    ) -> *mut RiceCandidate;
}
unsafe extern "C" {
    #[doc = " Construct a new `RiceCandidate` with the provided values."]
    pub fn rice_candidate_init(
        candidate: *mut RiceCandidate,
        component_id: usize,
        ctype: RiceCandidateType,
        ttype: RiceTransportType,
        foundation: *const ::core::ffi::c_char,
        address: *mut RiceAddress,
    ) -> RiceError;
}
unsafe extern "C" {
    #[doc = " Set the base address of a `RiceCandidate`."]
    pub fn rice_candidate_set_priority(candidate: *mut RiceCandidate, priority: u32);
}
unsafe extern "C" {
    #[doc = " Set the base address of a `RiceCandidate`."]
    pub fn rice_candidate_set_base_address(
        candidate: *mut RiceCandidate,
        base_address: *mut RiceAddress,
    );
}
unsafe extern "C" {
    #[doc = " Set the related address of a `RiceCandidate`."]
    pub fn rice_candidate_set_related_address(
        candidate: *mut RiceCandidate,
        related_address: *mut RiceAddress,
    );
}
unsafe extern "C" {
    #[doc = " Set the tcp type of a `RiceCandidate`."]
    pub fn rice_candidate_set_tcp_type(candidate: *mut RiceCandidate, tcp_type: RiceTcpType);
}
unsafe extern "C" {
    #[doc = " Perform a deep copy of a `RiceCandidate`."]
    pub fn rice_candidate_copy(candidate: *const RiceCandidate) -> *mut RiceCandidate;
}
unsafe extern "C" {
    #[doc = " Perform a deep copy of a `RiceCandidate`."]
    pub fn rice_candidate_copy_into(candidate: *const RiceCandidate, ret: *mut RiceCandidate);
}
unsafe extern "C" {
    #[doc = " Clear any resources allocated within a `RiceCandidate`.\n\n Useful for stack-allocated `RiceCandidate`s or when embedded in other structures.\n\n This function is NULL safe."]
    pub fn rice_candidate_clear(candidate: *mut RiceCandidate);
}
unsafe extern "C" {
    #[doc = " Free a `RiceCandidate`.\n\n This function is NULL safe."]
    pub fn rice_candidate_free(candidate: *mut RiceCandidate);
}
unsafe extern "C" {
    #[doc = " Free a `RiceCandidate`."]
    pub fn rice_candidate_eq(candidate: *const RiceCandidate, other: *const RiceCandidate) -> bool;
}
unsafe extern "C" {
    #[doc = " Add a local `RiceGatheredCandidate` to a `RiceStream`."]
    pub fn rice_stream_add_local_gathered_candidate(
        stream: *mut RiceStream,
        candidate: *const RiceGatheredCandidate,
    ) -> bool;
}
unsafe extern "C" {
    #[doc = " Add a remote candidate to the `RiceStream`."]
    pub fn rice_stream_add_remote_candidate(
        stream: *mut RiceStream,
        candidate: *const RiceCandidate,
    );
}
unsafe extern "C" {
    #[doc = " Signal the end of a set of local candidates.\n\n Any local candidates provided after calling this function will result in an error."]
    pub fn rice_stream_end_of_local_candidates(stream: *mut RiceStream);
}
unsafe extern "C" {
    #[doc = " Retrieve previously set local candidates for connection checks from this stream."]
    pub fn rice_stream_get_local_candidates(
        stream: *mut RiceStream,
        n_candidates: *mut usize,
        candidates: *mut RiceCandidate,
    );
}
unsafe extern "C" {
    #[doc = " Signal the end of a set of remote candidates.\n\n Any remote candidates provided after calling this function will result in an error."]
    pub fn rice_stream_end_of_remote_candidates(stream: *mut RiceStream);
}
unsafe extern "C" {
    #[doc = " Retrieve previously set remote candidates for connection checks from this stream."]
    pub fn rice_stream_get_remote_candidates(
        stream: *mut RiceStream,
        n_candidates: *mut usize,
        candidates: *mut RiceCandidate,
    );
}
unsafe extern "C" {
    #[doc = " Provide data to the `RiceStream` for processing.\n\n The returned value contains what processing was completed on the provided data and any\n application data that needs to be handled."]
    pub fn rice_stream_handle_incoming_data(
        stream: *mut RiceStream,
        component_id: usize,
        transport: RiceTransportType,
        from: *const RiceAddress,
        to: *const RiceAddress,
        data: *const u8,
        data_len: usize,
        now_nanos: i64,
        ret: *mut RiceStreamIncomingData,
    );
}
unsafe extern "C" {
    #[doc = " Poll for further application data that has been received.\n\n Free the returned data with `rice_free_data()`."]
    pub fn rice_stream_poll_recv(
        stream: *mut RiceStream,
        component_id: *mut usize,
        data_len: *mut usize,
    ) -> *mut u8;
}
unsafe extern "C" {
    #[doc = " Free allocated data."]
    pub fn rice_free_data(data: *mut u8);
}
unsafe extern "C" {
    #[doc = " Return the component ids currently in use by a `RiceStream`.\n\n `ret` can be NULL to discover the length of the data that would be provided."]
    pub fn rice_stream_component_ids(stream: *mut RiceStream, len: *mut usize, ret: *mut usize);
}
unsafe extern "C" {
    #[doc = " Add an ICE component to a `RiceStream`."]
    pub fn rice_stream_add_component(stream: *mut RiceStream) -> *mut RiceComponent;
}
unsafe extern "C" {
    #[doc = " Increase the reference count of the `RiceComponent`.\n\n This function is multi-threading safe."]
    pub fn rice_component_ref(component: *const RiceComponent) -> *mut RiceComponent;
}
unsafe extern "C" {
    #[doc = " Decrease the reference count of the `RiceComponent`.\n\n If this is the last reference, then the `RiceComponent` is freed (but will still be referenced by\n the `RiceStream`).\n\n This function is multi-threading safe."]
    pub fn rice_component_unref(component: *mut RiceComponent);
}
unsafe extern "C" {
    #[doc = " Retrieve the component id of the `RiceComponent`."]
    pub fn rice_component_get_id(component: *const RiceComponent) -> usize;
}
unsafe extern "C" {
    #[doc = " Retrieve the component id of the `RiceComponent`."]
    pub fn rice_component_get_stream(component: *const RiceComponent) -> *mut RiceStream;
}
unsafe extern "C" {
    #[doc = " Retrieve the component connection state of the `RiceComponent`."]
    pub fn rice_component_get_state(
        component: *const RiceComponent,
    ) -> RiceComponentConnectionState;
}
unsafe extern "C" {
    #[doc = " Retrieve the ICE candidates selected pair of the `RiceComponent`.\n\n Before the pair has been selected through ICE, `local` and `remote` will be zeroed to signal\n unset."]
    pub fn rice_component_selected_pair(
        component: *const RiceComponent,
        local: *mut RiceCandidate,
        remote: *mut RiceCandidate,
    );
}
unsafe extern "C" {
    #[doc = " Retrieve a previously added `RiceComponent`.\n\n If the `RiceComponent` does not exist, `NULL` is returned."]
    pub fn rice_stream_get_component(
        stream: *const RiceStream,
        component_id: usize,
    ) -> *mut RiceComponent;
}
unsafe extern "C" {
    #[doc = " Start gathering candidates for a component with the provided local socket addresses.\n\n - `component`: The component to start gathering.\n - `sockets_len`: The number of entries in both `sockets_addr` and `sockets_transports`.\n - `sockets_addr`: An array of addresses for producing host and STUN server-reflexive\n   candidates.\n - `sockets_transports`: An array of transport types for producing host and STUN\n   server-reflexive candidates.\n - `turn_len`: the number of entries in both `turn_sockets` and `turn_config`.\n - `turn_sockets`: An array of local addresses for producing TURN candidates.\n - `turn_config`: An array of TURN server configurations.\n\n Candidates will be generated as follows (if they succeed):\n\n 1. A host candidate for each `(sockets_transports[i], socket_addr[i])`. If TCP, then both an\n    active and passive host candidate will be generated.\n 2. For each configured STUN server, a reflexive candidate for each\n    `(sockets_transports[i], socket_addr[i])` if different from any other candidate\n    produced. The local address for each STUN server connection will be one of the entries\n    provided in `sockets_addr`.\n 3. For each `(turn_sockets[i], turn_config[i])` a TURN allocation will be attempted and a\n    relayed candidate produced on success.  If you would like multiple options for relayed\n    candidates, e.g. UDP, TCP, TCP/TLS, then provide each options as different entries in the\n    provided array. The `turn_sockets[i]` value is the local address to communicate with the\n    TURN server in `turn_config[i]` and should be different than any value provided through\n    `sockets_addr`."]
    pub fn rice_component_gather_candidates(
        component: *mut RiceComponent,
        sockets_len: usize,
        sockets_addr: *const *const RiceAddress,
        sockets_transports: *const RiceTransportType,
        turn_len: usize,
        turn_sockets: *const *const RiceAddress,
        turn_config: *const *mut RiceTurnConfig,
    ) -> RiceError;
}
unsafe extern "C" {
    #[doc = " Send data to the connected peer.\n\n This will fail before a connection is successfully completed."]
    pub fn rice_component_send(
        component: *mut RiceComponent,
        data: *mut u8,
        len: usize,
        now_nanos: i64,
        transmit: *mut RiceTransmit,
    ) -> RiceError;
}
unsafe extern "C" {
    #[doc = " Start gathering candidates for a component with the provided local socket addresses."]
    pub fn rice_component_set_selected_pair(
        component: *mut RiceComponent,
        local: *const RiceCandidate,
        remote: *const RiceCandidate,
    ) -> RiceError;
}
unsafe extern "C" {
    #[doc = " Create a `RiceAddress` from a string representation of the socket address."]
    pub fn rice_address_new_from_string(string: *const ::core::ffi::c_char) -> *mut RiceAddress;
}
unsafe extern "C" {
    #[doc = " Construct a `RiceAddress` from a sequence of bytes.\n\n The number of bytes required depends on the address family being constructed:\n - IPv4 -> 4.\n - IPv6 -> 16."]
    pub fn rice_address_new_from_bytes(
        family: RiceAddressFamily,
        bytes: *const u8,
        port: u16,
    ) -> *mut RiceAddress;
}
unsafe extern "C" {
    #[doc = " The address family of the `RiceAddress`."]
    pub fn rice_address_get_family(addr: *const RiceAddress) -> RiceAddressFamily;
}
unsafe extern "C" {
    #[doc = " Retrieve the bytes of a `RiceAddress`.\n\n The number of bytes required depends on the address family being constructed:\n - IPv4 -> 4.\n - IPv6 -> 16."]
    pub fn rice_address_get_address_bytes(addr: *const RiceAddress, bytes: *mut u8) -> usize;
}
unsafe extern "C" {
    #[doc = " Retrieve the port of a `RiceAddress`."]
    pub fn rice_address_get_port(addr: *const RiceAddress) -> u16;
}
unsafe extern "C" {
    #[doc = " Compare whether two `RiceAddress`es are equal."]
    pub fn rice_address_cmp(
        addr: *const RiceAddress,
        other: *const RiceAddress,
    ) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[doc = " Copy a `RiceAddress`."]
    pub fn rice_address_copy(addr: *const RiceAddress) -> *mut RiceAddress;
}
unsafe extern "C" {
    #[doc = " Free a `RiceAddress`."]
    pub fn rice_address_free(addr: *mut RiceAddress);
}
unsafe extern "C" {
    #[doc = " Generate a random sequence of characters suitable for username fragments and passwords."]
    pub fn rice_random_string(length: usize) -> *mut ::core::ffi::c_char;
}