@@ -209,6 +209,13 @@ s! {
209
209
pub ar_pln: u8 ,
210
210
pub ar_op: u16 ,
211
211
}
212
+
213
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
214
+ pub struct af_alg_iv {
215
+ pub ivlen: u32 ,
216
+ pub iv: [ :: c_uchar; 0 ] ,
217
+ }
218
+
212
219
}
213
220
214
221
s_no_extra_traits ! {
@@ -240,19 +247,6 @@ s_no_extra_traits!{
240
247
__ss_pad2: [ u8 ; 128 - 2 * 8 ] ,
241
248
}
242
249
243
- pub struct sockaddr_alg {
244
- pub salg_family: sa_family_t,
245
- pub salg_type: [ :: c_uchar; 14 ] ,
246
- pub salg_feat: u32 ,
247
- pub salg_mask: u32 ,
248
- pub salg_name: [ :: c_uchar; 64 ] ,
249
- }
250
-
251
- pub struct af_alg_iv {
252
- pub ivlen: u32 ,
253
- pub iv: [ :: c_uchar; 0 ] ,
254
- }
255
-
256
250
pub struct utsname {
257
251
pub sysname: [ :: c_char; 65 ] ,
258
252
pub nodename: [ :: c_char; 65 ] ,
@@ -261,6 +255,16 @@ s_no_extra_traits!{
261
255
pub machine: [ :: c_char; 65 ] ,
262
256
pub domainname: [ :: c_char; 65 ]
263
257
}
258
+
259
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
260
+ pub struct sockaddr_alg {
261
+ pub salg_family: sa_family_t,
262
+ pub salg_type: [ :: c_uchar; 14 ] ,
263
+ pub salg_feat: u32 ,
264
+ pub salg_mask: u32 ,
265
+ pub salg_name: [ :: c_uchar; 64 ] ,
266
+ }
267
+
264
268
}
265
269
266
270
cfg_if ! {
@@ -324,6 +328,52 @@ cfg_if! {
324
328
}
325
329
}
326
330
331
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
332
+ impl PartialEq for sockaddr_alg {
333
+ fn eq( & self , other: & sockaddr_alg) -> bool {
334
+ self . salg_family == other. salg_family
335
+ && self
336
+ . salg_type
337
+ . iter( )
338
+ . zip( other. salg_type. iter( ) )
339
+ . all( |( a, b) | a == b)
340
+ && self . salg_feat == other. salg_feat
341
+ && self . salg_mask == other. salg_mask
342
+ && self
343
+ . salg_name
344
+ . iter( )
345
+ . zip( other. salg_name. iter( ) )
346
+ . all( |( a, b) | a == b)
347
+ }
348
+ }
349
+
350
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
351
+ impl Eq for sockaddr_alg { }
352
+
353
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
354
+ impl :: fmt:: Debug for sockaddr_alg {
355
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
356
+ f. debug_struct( "sockaddr_alg" )
357
+ . field( "salg_family" , & self . salg_family)
358
+ // .field("salg_type", &self.salg_type)
359
+ . field( "salg_feat" , & self . salg_feat)
360
+ . field( "salg_mask" , & self . salg_mask)
361
+ // .field("salg_name", &self.salg_name)
362
+ . finish( )
363
+ }
364
+ }
365
+
366
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
367
+ impl :: hash:: Hash for sockaddr_alg {
368
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
369
+ self . salg_family. hash( state) ;
370
+ self . salg_type. hash( state) ;
371
+ self . salg_feat. hash( state) ;
372
+ self . salg_mask. hash( state) ;
373
+ self . salg_name. hash( state) ;
374
+ }
375
+ }
376
+
327
377
impl PartialEq for utsname {
328
378
fn eq( & self , other: & utsname) -> bool {
329
379
self . sysname
@@ -670,6 +720,7 @@ pub const SOL_DCCP: ::c_int = 269;
670
720
pub const SOL_NETLINK : :: c_int = 270 ;
671
721
pub const SOL_TIPC : :: c_int = 271 ;
672
722
pub const SOL_BLUETOOTH : :: c_int = 274 ;
723
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
673
724
pub const SOL_ALG : :: c_int = 279 ;
674
725
675
726
pub const AF_UNSPEC : :: c_int = 0 ;
@@ -1142,13 +1193,20 @@ pub const ARPHRD_IEEE802154: u16 = 804;
1142
1193
pub const ARPHRD_VOID : u16 = 0xFFFF ;
1143
1194
pub const ARPHRD_NONE : u16 = 0xFFFE ;
1144
1195
1196
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1145
1197
pub const ALG_SET_KEY : :: c_int = 1 ;
1198
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1146
1199
pub const ALG_SET_IV : :: c_int = 2 ;
1200
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1147
1201
pub const ALG_SET_OP : :: c_int = 3 ;
1202
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1148
1203
pub const ALG_SET_AEAD_ASSOCLEN : :: c_int = 4 ;
1204
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1149
1205
pub const ALG_SET_AEAD_AUTHSIZE : :: c_int = 5 ;
1150
1206
1207
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1151
1208
pub const ALG_OP_DECRYPT : :: c_int = 0 ;
1209
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1152
1210
pub const ALG_OP_ENCRYPT : :: c_int = 1 ;
1153
1211
1154
1212
fn CMSG_ALIGN ( len : usize ) -> usize {
0 commit comments