netlink_rs/lib.rs
1#![cfg_attr(feature="clippy", feature(plugin))]
2#![cfg_attr(feature="clippy", plugin(clippy))]
3
4extern crate libc;
5extern crate byteorder;
6
7pub mod socket;
8
9use std::convert::Into;
10
11pub enum Protocol {
12 Route, /* 0 Routing/device hook */
13 Unused, /* 1 Unused number */
14 Usersock, /* 2 Reserved for user mode socket protocols */
15 Firewall, /* 3 Firewalling hook */
16 INETDiag, /* 4 INET socket monitoring */
17 Nflog, /* 5 netfilter/iptables ULOG */
18 Xfrm, /* 6 ipsec */
19 SELinux, /* 7 SELinux event notifications */
20 Iscsi, /* 8 Open-iSCSI */
21 Audit, /* 9 auditing */
22 FibLookup, // 10
23 Connector, // 11
24 Netfilter, /* 12 netfilter subsystem */
25 Ip6FW, // 13
26 Dnrtmsg, /* 14 DECnet routing messages */
27 KobjectUevent, // 15 /* Kernel messages to userspace */
28 Generic, // 16
29 SCSITransport, // 18 /* SCSI Transports */
30 Ecryptfs, // 19
31}
32
33impl Into<i32> for Protocol {
34 fn into(self) -> i32 {
35 use Protocol::*;
36 match self {
37 Route => 0,
38 Unused => 1,
39 Usersock => 2,
40 Firewall => 3,
41 INETDiag => 4,
42 Nflog => 5,
43 Xfrm => 6,
44 SELinux => 7,
45 Iscsi => 8,
46 Audit => 9,
47 FibLookup => 10,
48 Connector => 11,
49 Netfilter => 12,
50 Ip6FW => 13,
51 Dnrtmsg => 14,
52 KobjectUevent => 15,
53 Generic => 16,
54 SCSITransport => 18,
55 Ecryptfs => 19,
56 }
57 }
58}