cross_socket/packet/
ip.rs

1/// IP Next Level Protocol
2#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
3pub enum IpNextLevelProtocol {
4    Hopopt,
5    Icmp,
6    Igmp,
7    Ggp,
8    Ipv4,
9    St,
10    Tcp,
11    Cbt,
12    Egp,
13    Igp,
14    BbnRccMon,
15    NvpII,
16    Pup,
17    Argus,
18    Emcon,
19    Xnet,
20    Chaos,
21    Udp,
22    Mux,
23    DcnMeas,
24    Hmp,
25    Prm,
26    XnsIdp,
27    Trunk1,
28    Trunk2,
29    Leaf1,
30    Leaf2,
31    Rdp,
32    Irtp,
33    IsoTp4,
34    Netblt,
35    MfeNsp,
36    MeritInp,
37    Dccp,
38    ThreePc,
39    Idpr,
40    Xtp,
41    Ddp,
42    IdprCmtp,
43    TpPlusPlus,
44    Il,
45    Ipv6,
46    Sdrp,
47    Ipv6Route,
48    Ipv6Frag,
49    Idrp,
50    Rsvp,
51    Gre,
52    Dsr,
53    Bna,
54    Esp,
55    Ah,
56    INlsp,
57    Swipe,
58    Narp,
59    Mobile,
60    Tlsp,
61    Skip,
62    Icmpv6,
63    Ipv6NoNxt,
64    Ipv6Opts,
65    HostInternal,
66    Cftp,
67    LocalNetwork,
68    SatExpak,
69    Kryptolan,
70    Rvd,
71    Ippc,
72    Cpnx,
73    Cphb,
74    Wsn,
75    Pvp,
76    BrSatMon,
77    SunNd,
78    WbMon,
79    WbExpak,
80    IsoIp,
81    Vmtp,
82    SecureVmtp,
83    Vines,
84    TtpOrIptm,
85    NsfnetIgp,
86    Dgp,
87    Tcf,
88    Eigrp,
89    OspfigP,
90    SpriteRpc,
91    Larp,
92    Mtp,
93    Ax25,
94    IpIp,
95    Micp,
96    SccSp,
97    Etherip,
98    Encap,
99    PrivEncryption,
100    Gmtp,
101    Ifmp,
102    Pnni,
103    Pim,
104    Aris,
105    Scps,
106    Qnx,
107    AN,
108    IpComp,
109    Snp,
110    CompaqPeer,
111    IpxInIp,
112    Vrrp,
113    Pgm,
114    ZeroHop,
115    L2tp,
116    Ddx,
117    Iatp,
118    Stp,
119    Srp,
120    Uti,
121    Smp,
122    Ptp,
123    IsisOverIpv4,
124    Fire,
125    Crtp,
126    Crudp,
127    Sscopmce,
128    Iplt,
129    Sps,
130    Pipe,
131    Sctp,
132    Fc,
133    RsvpE2eIgnore,
134    MobilityHeader,
135    UdpLite,
136    MplsInIp,
137    Manet,
138    Hip,
139    Shim6,
140    Wesp,
141    Rohc,
142    Test1,
143    Test2,
144    Reserved,
145}
146
147impl IpNextLevelProtocol {
148    /// IpNextLevelProtocol from u8
149    pub fn from_u8(n: u8) -> IpNextLevelProtocol {
150        match n {
151            0 => IpNextLevelProtocol::Hopopt,
152            1 => IpNextLevelProtocol::Icmp,
153            2 => IpNextLevelProtocol::Igmp,
154            3 => IpNextLevelProtocol::Ggp,
155            4 => IpNextLevelProtocol::Ipv4,
156            5 => IpNextLevelProtocol::St,
157            6 => IpNextLevelProtocol::Tcp,
158            7 => IpNextLevelProtocol::Cbt,
159            8 => IpNextLevelProtocol::Egp,
160            9 => IpNextLevelProtocol::Igp,
161            10 => IpNextLevelProtocol::BbnRccMon,
162            11 => IpNextLevelProtocol::NvpII,
163            12 => IpNextLevelProtocol::Pup,
164            13 => IpNextLevelProtocol::Argus,
165            14 => IpNextLevelProtocol::Emcon,
166            15 => IpNextLevelProtocol::Xnet,
167            16 => IpNextLevelProtocol::Chaos,
168            17 => IpNextLevelProtocol::Udp,
169            18 => IpNextLevelProtocol::Mux,
170            19 => IpNextLevelProtocol::DcnMeas,
171            20 => IpNextLevelProtocol::Hmp,
172            21 => IpNextLevelProtocol::Prm,
173            22 => IpNextLevelProtocol::XnsIdp,
174            23 => IpNextLevelProtocol::Trunk1,
175            24 => IpNextLevelProtocol::Trunk2,
176            25 => IpNextLevelProtocol::Leaf1,
177            26 => IpNextLevelProtocol::Leaf2,
178            27 => IpNextLevelProtocol::Rdp,
179            28 => IpNextLevelProtocol::Irtp,
180            29 => IpNextLevelProtocol::IsoTp4,
181            30 => IpNextLevelProtocol::Netblt,
182            31 => IpNextLevelProtocol::MfeNsp,
183            32 => IpNextLevelProtocol::MeritInp,
184            33 => IpNextLevelProtocol::Dccp,
185            34 => IpNextLevelProtocol::ThreePc,
186            35 => IpNextLevelProtocol::Idpr,
187            36 => IpNextLevelProtocol::Xtp,
188            37 => IpNextLevelProtocol::Ddp,
189            38 => IpNextLevelProtocol::IdprCmtp,
190            39 => IpNextLevelProtocol::TpPlusPlus,
191            40 => IpNextLevelProtocol::Il,
192            41 => IpNextLevelProtocol::Ipv6,
193            42 => IpNextLevelProtocol::Sdrp,
194            43 => IpNextLevelProtocol::Ipv6Route,
195            44 => IpNextLevelProtocol::Ipv6Frag,
196            45 => IpNextLevelProtocol::Idrp,
197            46 => IpNextLevelProtocol::Rsvp,
198            47 => IpNextLevelProtocol::Gre,
199            48 => IpNextLevelProtocol::Dsr,
200            49 => IpNextLevelProtocol::Bna,
201            50 => IpNextLevelProtocol::Esp,
202            51 => IpNextLevelProtocol::Ah,
203            52 => IpNextLevelProtocol::INlsp,
204            53 => IpNextLevelProtocol::Swipe,
205            54 => IpNextLevelProtocol::Narp,
206            55 => IpNextLevelProtocol::Mobile,
207            56 => IpNextLevelProtocol::Tlsp,
208            57 => IpNextLevelProtocol::Skip,
209            58 => IpNextLevelProtocol::Icmpv6,
210            59 => IpNextLevelProtocol::Ipv6NoNxt,
211            60 => IpNextLevelProtocol::Ipv6Opts,
212            61 => IpNextLevelProtocol::HostInternal,
213            62 => IpNextLevelProtocol::Cftp,
214            63 => IpNextLevelProtocol::LocalNetwork,
215            64 => IpNextLevelProtocol::SatExpak,
216            65 => IpNextLevelProtocol::Kryptolan,
217            66 => IpNextLevelProtocol::Rvd,
218            67 => IpNextLevelProtocol::Ippc,
219            68 => IpNextLevelProtocol::Cpnx,
220            69 => IpNextLevelProtocol::Cphb,
221            70 => IpNextLevelProtocol::Wsn,
222            71 => IpNextLevelProtocol::Pvp,
223            72 => IpNextLevelProtocol::BrSatMon,
224            73 => IpNextLevelProtocol::SunNd,
225            74 => IpNextLevelProtocol::WbMon,
226            75 => IpNextLevelProtocol::WbExpak,
227            76 => IpNextLevelProtocol::IsoIp,
228            77 => IpNextLevelProtocol::Vmtp,
229            78 => IpNextLevelProtocol::SecureVmtp,
230            79 => IpNextLevelProtocol::Vines,
231            80 => IpNextLevelProtocol::TtpOrIptm,
232            81 => IpNextLevelProtocol::NsfnetIgp,
233            82 => IpNextLevelProtocol::Dgp,
234            83 => IpNextLevelProtocol::Tcf,
235            84 => IpNextLevelProtocol::Eigrp,
236            85 => IpNextLevelProtocol::OspfigP,
237            86 => IpNextLevelProtocol::SpriteRpc,
238            87 => IpNextLevelProtocol::Larp,
239            88 => IpNextLevelProtocol::Mtp,
240            89 => IpNextLevelProtocol::Ax25,
241            90 => IpNextLevelProtocol::IpIp,
242            91 => IpNextLevelProtocol::Micp,
243            92 => IpNextLevelProtocol::SccSp,
244            93 => IpNextLevelProtocol::Etherip,
245            94 => IpNextLevelProtocol::Encap,
246            95 => IpNextLevelProtocol::PrivEncryption,
247            96 => IpNextLevelProtocol::Gmtp,
248            97 => IpNextLevelProtocol::Ifmp,
249            98 => IpNextLevelProtocol::Pnni,
250            99 => IpNextLevelProtocol::Pim,
251            100 => IpNextLevelProtocol::Aris,
252            101 => IpNextLevelProtocol::Scps,
253            102 => IpNextLevelProtocol::Qnx,
254            103 => IpNextLevelProtocol::AN,
255            104 => IpNextLevelProtocol::IpComp,
256            105 => IpNextLevelProtocol::Snp,
257            106 => IpNextLevelProtocol::CompaqPeer,
258            107 => IpNextLevelProtocol::IpxInIp,
259            108 => IpNextLevelProtocol::Vrrp,
260            109 => IpNextLevelProtocol::Pgm,
261            110 => IpNextLevelProtocol::ZeroHop,
262            111 => IpNextLevelProtocol::L2tp,
263            112 => IpNextLevelProtocol::Ddx,
264            113 => IpNextLevelProtocol::Iatp,
265            114 => IpNextLevelProtocol::Stp,
266            115 => IpNextLevelProtocol::Srp,
267            116 => IpNextLevelProtocol::Uti,
268            117 => IpNextLevelProtocol::Smp,
269            118 => IpNextLevelProtocol::Ptp,
270            119 => IpNextLevelProtocol::IsisOverIpv4,
271            120 => IpNextLevelProtocol::Fire,
272            121 => IpNextLevelProtocol::Crtp,
273            122 => IpNextLevelProtocol::Crudp,
274            123 => IpNextLevelProtocol::Sscopmce,
275            124 => IpNextLevelProtocol::Iplt,
276            125 => IpNextLevelProtocol::Sps,
277            126 => IpNextLevelProtocol::Pipe,
278            127 => IpNextLevelProtocol::Sctp,
279            128 => IpNextLevelProtocol::Fc,
280            129 => IpNextLevelProtocol::RsvpE2eIgnore,
281            130 => IpNextLevelProtocol::MobilityHeader,
282            131 => IpNextLevelProtocol::UdpLite,
283            132 => IpNextLevelProtocol::MplsInIp,
284            133 => IpNextLevelProtocol::Manet,
285            134 => IpNextLevelProtocol::Hip,
286            135 => IpNextLevelProtocol::Shim6,
287            136 => IpNextLevelProtocol::Wesp,
288            137 => IpNextLevelProtocol::Rohc,
289            138 => IpNextLevelProtocol::Test1,
290            139 => IpNextLevelProtocol::Test2,
291            140 => IpNextLevelProtocol::Reserved,
292            _ => IpNextLevelProtocol::Reserved,
293        }
294    }
295    #[allow(dead_code)]
296    pub(crate) fn from_pnet_packet_protocol(
297        n: pnet::packet::ip::IpNextHeaderProtocol,
298    ) -> IpNextLevelProtocol {
299        match n {
300            pnet::packet::ip::IpNextHeaderProtocols::Hopopt => IpNextLevelProtocol::Hopopt,
301            pnet::packet::ip::IpNextHeaderProtocols::Icmp => IpNextLevelProtocol::Icmp,
302            pnet::packet::ip::IpNextHeaderProtocols::Igmp => IpNextLevelProtocol::Igmp,
303            pnet::packet::ip::IpNextHeaderProtocols::Ggp => IpNextLevelProtocol::Ggp,
304            pnet::packet::ip::IpNextHeaderProtocols::Ipv4 => IpNextLevelProtocol::Ipv4,
305            pnet::packet::ip::IpNextHeaderProtocols::St => IpNextLevelProtocol::St,
306            pnet::packet::ip::IpNextHeaderProtocols::Tcp => IpNextLevelProtocol::Tcp,
307            pnet::packet::ip::IpNextHeaderProtocols::Cbt => IpNextLevelProtocol::Cbt,
308            pnet::packet::ip::IpNextHeaderProtocols::Egp => IpNextLevelProtocol::Egp,
309            pnet::packet::ip::IpNextHeaderProtocols::Igp => IpNextLevelProtocol::Igp,
310            pnet::packet::ip::IpNextHeaderProtocols::BbnRccMon => IpNextLevelProtocol::BbnRccMon,
311            pnet::packet::ip::IpNextHeaderProtocols::NvpII => IpNextLevelProtocol::NvpII,
312            pnet::packet::ip::IpNextHeaderProtocols::Pup => IpNextLevelProtocol::Pup,
313            pnet::packet::ip::IpNextHeaderProtocols::Argus => IpNextLevelProtocol::Argus,
314            pnet::packet::ip::IpNextHeaderProtocols::Emcon => IpNextLevelProtocol::Emcon,
315            pnet::packet::ip::IpNextHeaderProtocols::Xnet => IpNextLevelProtocol::Xnet,
316            pnet::packet::ip::IpNextHeaderProtocols::Chaos => IpNextLevelProtocol::Chaos,
317            pnet::packet::ip::IpNextHeaderProtocols::Udp => IpNextLevelProtocol::Udp,
318            pnet::packet::ip::IpNextHeaderProtocols::Mux => IpNextLevelProtocol::Mux,
319            pnet::packet::ip::IpNextHeaderProtocols::DcnMeas => IpNextLevelProtocol::DcnMeas,
320            pnet::packet::ip::IpNextHeaderProtocols::Hmp => IpNextLevelProtocol::Hmp,
321            pnet::packet::ip::IpNextHeaderProtocols::Prm => IpNextLevelProtocol::Prm,
322            pnet::packet::ip::IpNextHeaderProtocols::XnsIdp => IpNextLevelProtocol::XnsIdp,
323            pnet::packet::ip::IpNextHeaderProtocols::Trunk1 => IpNextLevelProtocol::Trunk1,
324            pnet::packet::ip::IpNextHeaderProtocols::Trunk2 => IpNextLevelProtocol::Trunk2,
325            pnet::packet::ip::IpNextHeaderProtocols::Leaf1 => IpNextLevelProtocol::Leaf1,
326            pnet::packet::ip::IpNextHeaderProtocols::Leaf2 => IpNextLevelProtocol::Leaf2,
327            pnet::packet::ip::IpNextHeaderProtocols::Rdp => IpNextLevelProtocol::Rdp,
328            pnet::packet::ip::IpNextHeaderProtocols::Irtp => IpNextLevelProtocol::Irtp,
329            pnet::packet::ip::IpNextHeaderProtocols::IsoTp4 => IpNextLevelProtocol::IsoTp4,
330            pnet::packet::ip::IpNextHeaderProtocols::Netblt => IpNextLevelProtocol::Netblt,
331            pnet::packet::ip::IpNextHeaderProtocols::MfeNsp => IpNextLevelProtocol::MfeNsp,
332            pnet::packet::ip::IpNextHeaderProtocols::MeritInp => IpNextLevelProtocol::MeritInp,
333            pnet::packet::ip::IpNextHeaderProtocols::Dccp => IpNextLevelProtocol::Dccp,
334            pnet::packet::ip::IpNextHeaderProtocols::ThreePc => IpNextLevelProtocol::ThreePc,
335            pnet::packet::ip::IpNextHeaderProtocols::Idpr => IpNextLevelProtocol::Idpr,
336            pnet::packet::ip::IpNextHeaderProtocols::Xtp => IpNextLevelProtocol::Xtp,
337            pnet::packet::ip::IpNextHeaderProtocols::Ddp => IpNextLevelProtocol::Ddp,
338            pnet::packet::ip::IpNextHeaderProtocols::IdprCmtp => IpNextLevelProtocol::IdprCmtp,
339            pnet::packet::ip::IpNextHeaderProtocols::TpPlusPlus => IpNextLevelProtocol::TpPlusPlus,
340            pnet::packet::ip::IpNextHeaderProtocols::Il => IpNextLevelProtocol::Il,
341            pnet::packet::ip::IpNextHeaderProtocols::Ipv6 => IpNextLevelProtocol::Ipv6,
342            pnet::packet::ip::IpNextHeaderProtocols::Sdrp => IpNextLevelProtocol::Sdrp,
343            pnet::packet::ip::IpNextHeaderProtocols::Ipv6Route => IpNextLevelProtocol::Ipv6Route,
344            pnet::packet::ip::IpNextHeaderProtocols::Ipv6Frag => IpNextLevelProtocol::Ipv6Frag,
345            pnet::packet::ip::IpNextHeaderProtocols::Idrp => IpNextLevelProtocol::Idrp,
346            pnet::packet::ip::IpNextHeaderProtocols::Rsvp => IpNextLevelProtocol::Rsvp,
347            pnet::packet::ip::IpNextHeaderProtocols::Gre => IpNextLevelProtocol::Gre,
348            pnet::packet::ip::IpNextHeaderProtocols::Dsr => IpNextLevelProtocol::Dsr,
349            pnet::packet::ip::IpNextHeaderProtocols::Bna => IpNextLevelProtocol::Bna,
350            pnet::packet::ip::IpNextHeaderProtocols::Esp => IpNextLevelProtocol::Esp,
351            pnet::packet::ip::IpNextHeaderProtocols::Ah => IpNextLevelProtocol::Ah,
352            pnet::packet::ip::IpNextHeaderProtocols::INlsp => IpNextLevelProtocol::INlsp,
353            pnet::packet::ip::IpNextHeaderProtocols::Swipe => IpNextLevelProtocol::Swipe,
354            pnet::packet::ip::IpNextHeaderProtocols::Narp => IpNextLevelProtocol::Narp,
355            pnet::packet::ip::IpNextHeaderProtocols::Mobile => IpNextLevelProtocol::Mobile,
356            pnet::packet::ip::IpNextHeaderProtocols::Tlsp => IpNextLevelProtocol::Tlsp,
357            pnet::packet::ip::IpNextHeaderProtocols::Skip => IpNextLevelProtocol::Skip,
358            pnet::packet::ip::IpNextHeaderProtocols::Icmpv6 => IpNextLevelProtocol::Icmpv6,
359            pnet::packet::ip::IpNextHeaderProtocols::Ipv6NoNxt => IpNextLevelProtocol::Ipv6NoNxt,
360            pnet::packet::ip::IpNextHeaderProtocols::Ipv6Opts => IpNextLevelProtocol::Ipv6Opts,
361            pnet::packet::ip::IpNextHeaderProtocols::HostInternal => {
362                IpNextLevelProtocol::HostInternal
363            }
364            pnet::packet::ip::IpNextHeaderProtocols::Cftp => IpNextLevelProtocol::Cftp,
365            pnet::packet::ip::IpNextHeaderProtocols::LocalNetwork => {
366                IpNextLevelProtocol::LocalNetwork
367            }
368            pnet::packet::ip::IpNextHeaderProtocols::SatExpak => IpNextLevelProtocol::SatExpak,
369            pnet::packet::ip::IpNextHeaderProtocols::Kryptolan => IpNextLevelProtocol::Kryptolan,
370            pnet::packet::ip::IpNextHeaderProtocols::Rvd => IpNextLevelProtocol::Rvd,
371            pnet::packet::ip::IpNextHeaderProtocols::Ippc => IpNextLevelProtocol::Ippc,
372            pnet::packet::ip::IpNextHeaderProtocols::Cpnx => IpNextLevelProtocol::Cpnx,
373            pnet::packet::ip::IpNextHeaderProtocols::Cphb => IpNextLevelProtocol::Cphb,
374            pnet::packet::ip::IpNextHeaderProtocols::Wsn => IpNextLevelProtocol::Wsn,
375            pnet::packet::ip::IpNextHeaderProtocols::Pvp => IpNextLevelProtocol::Pvp,
376            pnet::packet::ip::IpNextHeaderProtocols::BrSatMon => IpNextLevelProtocol::BrSatMon,
377            pnet::packet::ip::IpNextHeaderProtocols::SunNd => IpNextLevelProtocol::SunNd,
378            pnet::packet::ip::IpNextHeaderProtocols::WbMon => IpNextLevelProtocol::WbMon,
379            pnet::packet::ip::IpNextHeaderProtocols::WbExpak => IpNextLevelProtocol::WbExpak,
380            pnet::packet::ip::IpNextHeaderProtocols::IsoIp => IpNextLevelProtocol::IsoIp,
381            pnet::packet::ip::IpNextHeaderProtocols::Vmtp => IpNextLevelProtocol::Vmtp,
382            pnet::packet::ip::IpNextHeaderProtocols::SecureVmtp => IpNextLevelProtocol::SecureVmtp,
383            pnet::packet::ip::IpNextHeaderProtocols::Vines => IpNextLevelProtocol::Vines,
384            pnet::packet::ip::IpNextHeaderProtocols::TtpOrIptm => IpNextLevelProtocol::TtpOrIptm,
385            pnet::packet::ip::IpNextHeaderProtocols::NsfnetIgp => IpNextLevelProtocol::NsfnetIgp,
386            pnet::packet::ip::IpNextHeaderProtocols::Dgp => IpNextLevelProtocol::Dgp,
387            pnet::packet::ip::IpNextHeaderProtocols::Tcf => IpNextLevelProtocol::Tcf,
388            pnet::packet::ip::IpNextHeaderProtocols::Eigrp => IpNextLevelProtocol::Eigrp,
389            pnet::packet::ip::IpNextHeaderProtocols::OspfigP => IpNextLevelProtocol::OspfigP,
390            pnet::packet::ip::IpNextHeaderProtocols::SpriteRpc => IpNextLevelProtocol::SpriteRpc,
391            pnet::packet::ip::IpNextHeaderProtocols::Larp => IpNextLevelProtocol::Larp,
392            pnet::packet::ip::IpNextHeaderProtocols::Mtp => IpNextLevelProtocol::Mtp,
393            pnet::packet::ip::IpNextHeaderProtocols::Ax25 => IpNextLevelProtocol::Ax25,
394            pnet::packet::ip::IpNextHeaderProtocols::IpIp => IpNextLevelProtocol::IpIp,
395            pnet::packet::ip::IpNextHeaderProtocols::Micp => IpNextLevelProtocol::Micp,
396            pnet::packet::ip::IpNextHeaderProtocols::SccSp => IpNextLevelProtocol::SccSp,
397            pnet::packet::ip::IpNextHeaderProtocols::Etherip => IpNextLevelProtocol::Etherip,
398            pnet::packet::ip::IpNextHeaderProtocols::Encap => IpNextLevelProtocol::Encap,
399            pnet::packet::ip::IpNextHeaderProtocols::PrivEncryption => {
400                IpNextLevelProtocol::PrivEncryption
401            }
402            pnet::packet::ip::IpNextHeaderProtocols::Gmtp => IpNextLevelProtocol::Gmtp,
403            pnet::packet::ip::IpNextHeaderProtocols::Ifmp => IpNextLevelProtocol::Ifmp,
404            pnet::packet::ip::IpNextHeaderProtocols::Pnni => IpNextLevelProtocol::Pnni,
405            pnet::packet::ip::IpNextHeaderProtocols::Pim => IpNextLevelProtocol::Pim,
406            pnet::packet::ip::IpNextHeaderProtocols::Aris => IpNextLevelProtocol::Aris,
407            pnet::packet::ip::IpNextHeaderProtocols::Scps => IpNextLevelProtocol::Scps,
408            pnet::packet::ip::IpNextHeaderProtocols::Qnx => IpNextLevelProtocol::Qnx,
409            pnet::packet::ip::IpNextHeaderProtocols::AN => IpNextLevelProtocol::AN,
410            pnet::packet::ip::IpNextHeaderProtocols::IpComp => IpNextLevelProtocol::IpComp,
411            pnet::packet::ip::IpNextHeaderProtocols::Snp => IpNextLevelProtocol::Snp,
412            pnet::packet::ip::IpNextHeaderProtocols::CompaqPeer => IpNextLevelProtocol::CompaqPeer,
413            pnet::packet::ip::IpNextHeaderProtocols::IpxInIp => IpNextLevelProtocol::IpxInIp,
414            pnet::packet::ip::IpNextHeaderProtocols::Vrrp => IpNextLevelProtocol::Vrrp,
415            pnet::packet::ip::IpNextHeaderProtocols::Pgm => IpNextLevelProtocol::Pgm,
416            pnet::packet::ip::IpNextHeaderProtocols::ZeroHop => IpNextLevelProtocol::ZeroHop,
417            pnet::packet::ip::IpNextHeaderProtocols::L2tp => IpNextLevelProtocol::L2tp,
418            pnet::packet::ip::IpNextHeaderProtocols::Ddx => IpNextLevelProtocol::Ddx,
419            pnet::packet::ip::IpNextHeaderProtocols::Iatp => IpNextLevelProtocol::Iatp,
420            pnet::packet::ip::IpNextHeaderProtocols::Stp => IpNextLevelProtocol::Stp,
421            pnet::packet::ip::IpNextHeaderProtocols::Srp => IpNextLevelProtocol::Srp,
422            pnet::packet::ip::IpNextHeaderProtocols::Uti => IpNextLevelProtocol::Uti,
423            pnet::packet::ip::IpNextHeaderProtocols::Smp => IpNextLevelProtocol::Smp,
424            pnet::packet::ip::IpNextHeaderProtocols::Ptp => IpNextLevelProtocol::Ptp,
425            pnet::packet::ip::IpNextHeaderProtocols::IsisOverIpv4 => {
426                IpNextLevelProtocol::IsisOverIpv4
427            }
428            pnet::packet::ip::IpNextHeaderProtocols::Fire => IpNextLevelProtocol::Fire,
429            pnet::packet::ip::IpNextHeaderProtocols::Crtp => IpNextLevelProtocol::Crtp,
430            pnet::packet::ip::IpNextHeaderProtocols::Crudp => IpNextLevelProtocol::Crudp,
431            pnet::packet::ip::IpNextHeaderProtocols::Sscopmce => IpNextLevelProtocol::Sscopmce,
432            pnet::packet::ip::IpNextHeaderProtocols::Iplt => IpNextLevelProtocol::Iplt,
433            pnet::packet::ip::IpNextHeaderProtocols::Sps => IpNextLevelProtocol::Sps,
434            pnet::packet::ip::IpNextHeaderProtocols::Pipe => IpNextLevelProtocol::Pipe,
435            pnet::packet::ip::IpNextHeaderProtocols::Sctp => IpNextLevelProtocol::Sctp,
436            pnet::packet::ip::IpNextHeaderProtocols::Fc => IpNextLevelProtocol::Fc,
437            pnet::packet::ip::IpNextHeaderProtocols::RsvpE2eIgnore => {
438                IpNextLevelProtocol::RsvpE2eIgnore
439            }
440            pnet::packet::ip::IpNextHeaderProtocols::MobilityHeader => {
441                IpNextLevelProtocol::MobilityHeader
442            }
443            pnet::packet::ip::IpNextHeaderProtocols::UdpLite => IpNextLevelProtocol::UdpLite,
444            pnet::packet::ip::IpNextHeaderProtocols::MplsInIp => IpNextLevelProtocol::MplsInIp,
445            pnet::packet::ip::IpNextHeaderProtocols::Manet => IpNextLevelProtocol::Manet,
446            pnet::packet::ip::IpNextHeaderProtocols::Hip => IpNextLevelProtocol::Hip,
447            pnet::packet::ip::IpNextHeaderProtocols::Shim6 => IpNextLevelProtocol::Shim6,
448            pnet::packet::ip::IpNextHeaderProtocols::Wesp => IpNextLevelProtocol::Wesp,
449            pnet::packet::ip::IpNextHeaderProtocols::Rohc => IpNextLevelProtocol::Rohc,
450            pnet::packet::ip::IpNextHeaderProtocols::Test1 => IpNextLevelProtocol::Test1,
451            pnet::packet::ip::IpNextHeaderProtocols::Test2 => IpNextLevelProtocol::Test2,
452            pnet::packet::ip::IpNextHeaderProtocols::Reserved => IpNextLevelProtocol::Reserved,
453            _ => IpNextLevelProtocol::Reserved,
454        }
455    }
456
457    pub(crate) fn to_socket_protocol(&self) -> socket2::Protocol {
458        match *self {
459            IpNextLevelProtocol::Tcp => socket2::Protocol::TCP,
460            IpNextLevelProtocol::Udp => socket2::Protocol::UDP,
461            IpNextLevelProtocol::Icmp => socket2::Protocol::ICMPV4,
462            IpNextLevelProtocol::Icmpv6 => socket2::Protocol::ICMPV6,
463            _ => socket2::Protocol::TCP,
464        }
465    }
466}