@@ -1388,6 +1388,14 @@ s_no_extra_traits! {
1388
1388
pub sdl_data: [ :: c_char; 46 ] ,
1389
1389
}
1390
1390
1391
+ pub struct sockaddr_nl {
1392
+ pub nl_len: :: c_uchar,
1393
+ pub nl_family: :: sa_family_t,
1394
+ nl_pad: :: c_ushort,
1395
+ pub nl_pid: u32 ,
1396
+ pub nl_groups: u32
1397
+ }
1398
+
1391
1399
pub struct mq_attr {
1392
1400
pub mq_flags: :: c_long,
1393
1401
pub mq_maxmsg: :: c_long,
@@ -1788,6 +1796,34 @@ cfg_if! {
1788
1796
}
1789
1797
}
1790
1798
1799
+ impl PartialEq for sockaddr_nl {
1800
+ fn eq( & self , other: & sockaddr_nl) -> bool {
1801
+ self . nl_len == other. nl_len &&
1802
+ self . nl_family == other. nl_family &&
1803
+ self . nl_pid == other. nl_pid &&
1804
+ self . nl_groups == other. nl_groups
1805
+ }
1806
+ }
1807
+ impl Eq for sockaddr_nl { }
1808
+ impl :: fmt:: Debug for sockaddr_nl {
1809
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1810
+ f. debug_struct( "sockaddr_nl" )
1811
+ . field( "nl_len" , & self . nl_len)
1812
+ . field( "nl_family" , & self . nl_family)
1813
+ . field( "nl_pid" , & self . nl_pid)
1814
+ . field( "nl_groups" , & self . nl_groups)
1815
+ . finish( )
1816
+ }
1817
+ }
1818
+ impl :: hash:: Hash for sockaddr_nl {
1819
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1820
+ self . nl_len. hash( state) ;
1821
+ self . nl_family. hash( state) ;
1822
+ self . nl_pid. hash( state) ;
1823
+ self . nl_groups. hash( state) ;
1824
+ }
1825
+ }
1826
+
1791
1827
impl PartialEq for mq_attr {
1792
1828
fn eq( & self , other: & mq_attr) -> bool {
1793
1829
self . mq_flags == other. mq_flags &&
@@ -3183,6 +3219,104 @@ pub const SO_TS_MONOTONIC: ::c_int = 3;
3183
3219
pub const SO_TS_DEFAULT : :: c_int = SO_TS_REALTIME_MICRO ;
3184
3220
pub const SO_TS_CLOCK_MAX : :: c_int = SO_TS_MONOTONIC ;
3185
3221
3222
+ /// netlink constants
3223
+
3224
+ // sys/socket.h
3225
+ pub const AF_NETLINK : :: c_int = 38 ;
3226
+ pub const PF_NETLINK : :: c_int = AF_NETLINK ;
3227
+
3228
+ // netlink/netlink.h
3229
+ pub const SOL_NETLINK : :: c_int = 270 ;
3230
+ pub const NETLINK_ADD_MEMBERSHIP : :: c_int = 1 ;
3231
+ pub const NETLINK_DROP_MEMBERSHIP : :: c_int = 2 ;
3232
+ pub const NETLINK_PKTINFO : :: c_int = 3 ;
3233
+ pub const NETLINK_BROADCAST_ERROR : :: c_int = 4 ;
3234
+ pub const NETLINK_NO_ENOBUFS : :: c_int = 5 ;
3235
+ pub const NETLINK_RX_RING : :: c_int = 6 ;
3236
+ pub const NETLINK_TX_RING : :: c_int = 7 ;
3237
+ pub const NETLINK_LISTEN_ALL_NSID : :: c_int = 8 ;
3238
+ pub const NETLINK_LIST_MEMBERSHIPS : :: c_int = 9 ;
3239
+ pub const NETLINK_CAP_ACK : :: c_int = 10 ;
3240
+ pub const NETLINK_EXT_ACK : :: c_int = 11 ;
3241
+ pub const NETLINK_GET_STRICT_CHK : :: c_int = 12 ;
3242
+ //
3243
+ pub const NLM_F_REQUEST : :: c_int = 0x01 ;
3244
+ pub const NLM_F_MULTI : :: c_int = 0x02 ;
3245
+ pub const NLM_F_ACK : :: c_int = 0x04 ;
3246
+ pub const NLM_F_ECHO : :: c_int = 0x08 ;
3247
+ pub const NLM_F_DUMP_INTR : :: c_int = 0x10 ;
3248
+ pub const NLM_F_DUMP_FILTERED : :: c_int = 0x20 ;
3249
+ //
3250
+ pub const NLM_F_ROOT : :: c_int = 0x100 ;
3251
+ pub const NLM_F_MATCH : :: c_int = 0x200 ;
3252
+ pub const NLM_F_ATOMIC : :: c_int = 0x400 ;
3253
+ pub const NLM_F_DUMP : :: c_int = NLM_F_ROOT | NLM_F_MATCH ;
3254
+ //
3255
+ pub const NLM_F_REPLACE : :: c_int = 0x100 ;
3256
+ pub const NLM_F_EXCL : :: c_int = 0x200 ;
3257
+ pub const NLM_F_CREATE : :: c_int = 0x400 ;
3258
+ pub const NLM_F_APPEND : :: c_int = 0x800 ;
3259
+ //
3260
+ pub const NLM_F_NONREC : :: c_int = 0x100 ;
3261
+ //
3262
+ pub const NLM_F_CAPPED : :: c_int = 0x100 ;
3263
+ pub const NLM_F_ACK_TLVS : :: c_int = 0x200 ;
3264
+ //
3265
+ pub const NLMSG_NOOP : :: c_int = 0x1 ;
3266
+ pub const NLMSG_ERROR : :: c_int = 0x2 ;
3267
+ pub const NLMSG_DONE : :: c_int = 0x3 ;
3268
+ pub const NLMSG_OVERRUN : :: c_int = 0x4 ;
3269
+ //
3270
+ pub const NETLINK_ROUTE : :: c_int = 0 ;
3271
+ pub const NETLINK_UNUSED : :: c_int = 1 ;
3272
+ pub const NETLINK_USERSOCK : :: c_int = 2 ;
3273
+ pub const NETLINK_FIREWALL : :: c_int = 3 ;
3274
+ pub const NETLINK_SOCK_DIAG : :: c_int = 4 ;
3275
+ pub const NETLINK_NFLOG : :: c_int = 5 ;
3276
+ pub const NETLINK_XFRM : :: c_int = 6 ;
3277
+ pub const NETLINK_SELINUX : :: c_int = 7 ;
3278
+ pub const NETLINK_ISCSI : :: c_int = 8 ;
3279
+ pub const NETLINK_AUDIT : :: c_int = 9 ;
3280
+ pub const NETLINK_FIB_LOOKUP : :: c_int = 10 ;
3281
+ pub const NETLINK_CONNECTOR : :: c_int = 11 ;
3282
+ pub const NETLINK_NETFILTER : :: c_int = 12 ;
3283
+ pub const NETLINK_IP6_FW : :: c_int = 13 ;
3284
+ pub const NETLINK_DNRTMSG : :: c_int = 14 ;
3285
+ pub const NETLINK_KOBJECT_UEVENT : :: c_int = 15 ;
3286
+ pub const NETLINK_GENERIC : :: c_int = 16 ;
3287
+ //
3288
+ const NL_ITEM_ALIGN_SIZE : :: c_int = 4 ; // mem::size_of::<u32>(); FIXME accept new dep?
3289
+ pub const NLMSG_ALIGNTO : :: c_int = NL_ITEM_ALIGN_SIZE ;
3290
+
3291
+ // netlink/netlink_generic.h
3292
+ pub const CTRL_CMD_UNSPEC : :: c_int = 0 ;
3293
+ pub const CTRL_CMD_NEWFAMILY : :: c_int = 1 ;
3294
+ pub const CTRL_CMD_DELFAMILY : :: c_int = 2 ;
3295
+ pub const CTRL_CMD_GETFAMILY : :: c_int = 3 ;
3296
+ pub const CTRL_CMD_NEWOPS : :: c_int = 4 ;
3297
+ pub const CTRL_CMD_DELOPS : :: c_int = 5 ;
3298
+ pub const CTRL_CMD_GETOPS : :: c_int = 6 ;
3299
+ pub const CTRL_CMD_NEWMCAST_GRP : :: c_int = 7 ;
3300
+ pub const CTRL_CMD_DELMCAST_GRP : :: c_int = 8 ;
3301
+ pub const CTRL_CMD_GETMCAST_GRP : :: c_int = 9 ;
3302
+ pub const CTRL_CMD_GETPOLICY : :: c_int = 10 ;
3303
+ //
3304
+ pub const CTRL_ATTR_UNSPEC : :: c_int = 0 ;
3305
+ pub const CTRL_ATTR_FAMILY_ID : :: c_int = 1 ;
3306
+ pub const CTRL_ATTR_FAMILY_NAME : :: c_int = 2 ;
3307
+ pub const CTRL_ATTR_VERSION : :: c_int = 3 ;
3308
+ pub const CTRL_ATTR_HDRSIZE : :: c_int = 4 ;
3309
+ pub const CTRL_ATTR_MAXATTR : :: c_int = 5 ;
3310
+ pub const CTRL_ATTR_OPS : :: c_int = 6 ;
3311
+ pub const CTRL_ATTR_MCAST_GROUPS : :: c_int = 7 ;
3312
+ pub const CTRL_ATTR_POLICY : :: c_int = 8 ;
3313
+ pub const CTRL_ATTR_OP_POLICY : :: c_int = 9 ;
3314
+ pub const CTRL_ATTR_OP : :: c_int = 10 ;
3315
+ //
3316
+ pub const CTRL_ATTR_MCAST_GRP_UNSPEC : :: c_int = 0 ;
3317
+ pub const CTRL_ATTR_MCAST_GRP_NAME : :: c_int = 1 ;
3318
+ pub const CTRL_ATTR_MCAST_GRP_ID : :: c_int = 2 ;
3319
+
3186
3320
pub const LOCAL_CREDS : :: c_int = 2 ;
3187
3321
pub const LOCAL_CREDS_PERSISTENT : :: c_int = 3 ;
3188
3322
pub const LOCAL_CONNWAIT : :: c_int = 4 ;
0 commit comments