@@ -1387,6 +1387,14 @@ s_no_extra_traits! {
1387
1387
pub sdl_data: [ :: c_char; 46 ] ,
1388
1388
}
1389
1389
1390
+ pub struct sockaddr_nl {
1391
+ pub nl_len: :: c_uchar,
1392
+ pub nl_family: :: sa_family_t,
1393
+ nl_pad: :: c_ushort,
1394
+ pub nl_pid: u32 ,
1395
+ pub nl_groups: u32
1396
+ }
1397
+
1390
1398
pub struct mq_attr {
1391
1399
pub mq_flags: :: c_long,
1392
1400
pub mq_maxmsg: :: c_long,
@@ -1800,6 +1808,34 @@ cfg_if! {
1800
1808
}
1801
1809
}
1802
1810
1811
+ impl PartialEq for sockaddr_nl {
1812
+ fn eq( & self , other: & sockaddr_nl) -> bool {
1813
+ self . nl_len == other. nl_len &&
1814
+ self . nl_family == other. nl_family &&
1815
+ self . nl_pid == other. nl_pid &&
1816
+ self . nl_groups == other. nl_groups
1817
+ }
1818
+ }
1819
+ impl Eq for sockaddr_nl { }
1820
+ impl :: fmt:: Debug for sockaddr_nl {
1821
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1822
+ f. debug_struct( "sockaddr_nl" )
1823
+ . field( "nl_len" , & self . nl_len)
1824
+ . field( "nl_family" , & self . nl_family)
1825
+ . field( "nl_pid" , & self . nl_pid)
1826
+ . field( "nl_groups" , & self . nl_groups)
1827
+ . finish( )
1828
+ }
1829
+ }
1830
+ impl :: hash:: Hash for sockaddr_nl {
1831
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1832
+ self . nl_len. hash( state) ;
1833
+ self . nl_family. hash( state) ;
1834
+ self . nl_pid. hash( state) ;
1835
+ self . nl_groups. hash( state) ;
1836
+ }
1837
+ }
1838
+
1803
1839
impl PartialEq for mq_attr {
1804
1840
fn eq( & self , other: & mq_attr) -> bool {
1805
1841
self . mq_flags == other. mq_flags &&
@@ -3061,6 +3097,104 @@ pub const SO_TS_MONOTONIC: ::c_int = 3;
3061
3097
pub const SO_TS_DEFAULT : :: c_int = SO_TS_REALTIME_MICRO ;
3062
3098
pub const SO_TS_CLOCK_MAX : :: c_int = SO_TS_MONOTONIC ;
3063
3099
3100
+ /// netlink constants
3101
+
3102
+ // sys/socket.h
3103
+ pub const AF_NETLINK : :: c_int = 38 ;
3104
+ pub const PF_NETLINK : :: c_int = AF_NETLINK ;
3105
+
3106
+ // netlink/netlink.h
3107
+ pub const SOL_NETLINK : :: c_int = 270 ;
3108
+ pub const NETLINK_ADD_MEMBERSHIP : :: c_int = 1 ;
3109
+ pub const NETLINK_DROP_MEMBERSHIP : :: c_int = 2 ;
3110
+ pub const NETLINK_PKTINFO : :: c_int = 3 ;
3111
+ pub const NETLINK_BROADCAST_ERROR : :: c_int = 4 ;
3112
+ pub const NETLINK_NO_ENOBUFS : :: c_int = 5 ;
3113
+ pub const NETLINK_RX_RING : :: c_int = 6 ;
3114
+ pub const NETLINK_TX_RING : :: c_int = 7 ;
3115
+ pub const NETLINK_LISTEN_ALL_NSID : :: c_int = 8 ;
3116
+ pub const NETLINK_LIST_MEMBERSHIPS : :: c_int = 9 ;
3117
+ pub const NETLINK_CAP_ACK : :: c_int = 10 ;
3118
+ pub const NETLINK_EXT_ACK : :: c_int = 11 ;
3119
+ pub const NETLINK_GET_STRICT_CHK : :: c_int = 12 ;
3120
+ //
3121
+ pub const NLM_F_REQUEST : :: c_int = 0x01 ;
3122
+ pub const NLM_F_MULTI : :: c_int = 0x02 ;
3123
+ pub const NLM_F_ACK : :: c_int = 0x04 ;
3124
+ pub const NLM_F_ECHO : :: c_int = 0x08 ;
3125
+ pub const NLM_F_DUMP_INTR : :: c_int = 0x10 ;
3126
+ pub const NLM_F_DUMP_FILTERED : :: c_int = 0x20 ;
3127
+ //
3128
+ pub const NLM_F_ROOT : :: c_int = 0x100 ;
3129
+ pub const NLM_F_MATCH : :: c_int = 0x200 ;
3130
+ pub const NLM_F_ATOMIC : :: c_int = 0x400 ;
3131
+ pub const NLM_F_DUMP : :: c_int = NLM_F_ROOT | NLM_F_MATCH ;
3132
+ //
3133
+ pub const NLM_F_REPLACE : :: c_int = 0x100 ;
3134
+ pub const NLM_F_EXCL : :: c_int = 0x200 ;
3135
+ pub const NLM_F_CREATE : :: c_int = 0x400 ;
3136
+ pub const NLM_F_APPEND : :: c_int = 0x800 ;
3137
+ //
3138
+ pub const NLM_F_NONREC : :: c_int = 0x100 ;
3139
+ //
3140
+ pub const NLM_F_CAPPED : :: c_int = 0x100 ;
3141
+ pub const NLM_F_ACK_TLVS : :: c_int = 0x200 ;
3142
+ //
3143
+ pub const NLMSG_NOOP : :: c_int = 0x1 ;
3144
+ pub const NLMSG_ERROR : :: c_int = 0x2 ;
3145
+ pub const NLMSG_DONE : :: c_int = 0x3 ;
3146
+ pub const NLMSG_OVERRUN : :: c_int = 0x4 ;
3147
+ //
3148
+ pub const NETLINK_ROUTE : :: c_int = 0 ;
3149
+ pub const NETLINK_UNUSED : :: c_int = 1 ;
3150
+ pub const NETLINK_USERSOCK : :: c_int = 2 ;
3151
+ pub const NETLINK_FIREWALL : :: c_int = 3 ;
3152
+ pub const NETLINK_SOCK_DIAG : :: c_int = 4 ;
3153
+ pub const NETLINK_NFLOG : :: c_int = 5 ;
3154
+ pub const NETLINK_XFRM : :: c_int = 6 ;
3155
+ pub const NETLINK_SELINUX : :: c_int = 7 ;
3156
+ pub const NETLINK_ISCSI : :: c_int = 8 ;
3157
+ pub const NETLINK_AUDIT : :: c_int = 9 ;
3158
+ pub const NETLINK_FIB_LOOKUP : :: c_int = 10 ;
3159
+ pub const NETLINK_CONNECTOR : :: c_int = 11 ;
3160
+ pub const NETLINK_NETFILTER : :: c_int = 12 ;
3161
+ pub const NETLINK_IP6_FW : :: c_int = 13 ;
3162
+ pub const NETLINK_DNRTMSG : :: c_int = 14 ;
3163
+ pub const NETLINK_KOBJECT_UEVENT : :: c_int = 15 ;
3164
+ pub const NETLINK_GENERIC : :: c_int = 16 ;
3165
+ //
3166
+ const NL_ITEM_ALIGN_SIZE : :: c_int = 4 ; // mem::size_of::<u32>(); FIXME accept new dep?
3167
+ pub const NLMSG_ALIGNTO : :: c_int = NL_ITEM_ALIGN_SIZE ;
3168
+
3169
+ // netlink/netlink_generic.h
3170
+ pub const CTRL_CMD_UNSPEC : :: c_int = 0 ;
3171
+ pub const CTRL_CMD_NEWFAMILY : :: c_int = 1 ;
3172
+ pub const CTRL_CMD_DELFAMILY : :: c_int = 2 ;
3173
+ pub const CTRL_CMD_GETFAMILY : :: c_int = 3 ;
3174
+ pub const CTRL_CMD_NEWOPS : :: c_int = 4 ;
3175
+ pub const CTRL_CMD_DELOPS : :: c_int = 5 ;
3176
+ pub const CTRL_CMD_GETOPS : :: c_int = 6 ;
3177
+ pub const CTRL_CMD_NEWMCAST_GRP : :: c_int = 7 ;
3178
+ pub const CTRL_CMD_DELMCAST_GRP : :: c_int = 8 ;
3179
+ pub const CTRL_CMD_GETMCAST_GRP : :: c_int = 9 ;
3180
+ pub const CTRL_CMD_GETPOLICY : :: c_int = 10 ;
3181
+ //
3182
+ pub const CTRL_ATTR_UNSPEC : :: c_int = 0 ;
3183
+ pub const CTRL_ATTR_FAMILY_ID : :: c_int = 1 ;
3184
+ pub const CTRL_ATTR_FAMILY_NAME : :: c_int = 2 ;
3185
+ pub const CTRL_ATTR_VERSION : :: c_int = 3 ;
3186
+ pub const CTRL_ATTR_HDRSIZE : :: c_int = 4 ;
3187
+ pub const CTRL_ATTR_MAXATTR : :: c_int = 5 ;
3188
+ pub const CTRL_ATTR_OPS : :: c_int = 6 ;
3189
+ pub const CTRL_ATTR_MCAST_GROUPS : :: c_int = 7 ;
3190
+ pub const CTRL_ATTR_POLICY : :: c_int = 8 ;
3191
+ pub const CTRL_ATTR_OP_POLICY : :: c_int = 9 ;
3192
+ pub const CTRL_ATTR_OP : :: c_int = 10 ;
3193
+ //
3194
+ pub const CTRL_ATTR_MCAST_GRP_UNSPEC : :: c_int = 0 ;
3195
+ pub const CTRL_ATTR_MCAST_GRP_NAME : :: c_int = 1 ;
3196
+ pub const CTRL_ATTR_MCAST_GRP_ID : :: c_int = 2 ;
3197
+
3064
3198
pub const LOCAL_CREDS : :: c_int = 2 ;
3065
3199
pub const LOCAL_CREDS_PERSISTENT : :: c_int = 3 ;
3066
3200
pub const LOCAL_CONNWAIT : :: c_int = 4 ;
0 commit comments