1#[cfg(feature = "serde")]
2use serde::{Deserialize, Serialize};
3
4#[repr(u8)]
8#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
9#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
10pub enum IpNextProtocol {
11 Hopopt = 0,
13 Icmp = 1,
15 Igmp = 2,
17 Ggp = 3,
19 Ipv4 = 4,
21 St = 5,
23 Tcp = 6,
25 Cbt = 7,
27 Egp = 8,
29 Igp = 9,
31 BbnRccMon = 10,
33 NvpII = 11,
35 Pup = 12,
37 Argus = 13,
39 Emcon = 14,
41 Xnet = 15,
43 Chaos = 16,
45 Udp = 17,
47 Mux = 18,
49 DcnMeas = 19,
51 Hmp = 20,
53 Prm = 21,
55 XnsIdp = 22,
57 Trunk1 = 23,
59 Trunk2 = 24,
61 Leaf1 = 25,
63 Leaf2 = 26,
65 Rdp = 27,
67 Irtp = 28,
69 IsoTp4 = 29,
71 Netblt = 30,
73 MfeNsp = 31,
75 MeritInp = 32,
77 Dccp = 33,
79 ThreePc = 34,
81 Idpr = 35,
83 Xtp = 36,
85 Ddp = 37,
87 IdprCmtp = 38,
89 TpPlusPlus = 39,
91 Il = 40,
93 Ipv6 = 41,
95 Sdrp = 42,
97 Ipv6Route = 43,
99 Ipv6Frag = 44,
101 Idrp = 45,
103 Rsvp = 46,
105 Gre = 47,
107 Dsr = 48,
109 Bna = 49,
111 Esp = 50,
113 Ah = 51,
115 INlsp = 52,
117 Swipe = 53,
119 Narp = 54,
121 Mobile = 55,
123 Tlsp = 56,
125 Skip = 57,
127 Icmpv6 = 58,
129 Ipv6NoNxt = 59,
131 Ipv6Opts = 60,
133 HostInternal = 61,
135 Cftp = 62,
137 LocalNetwork = 63,
139 SatExpak = 64,
141 Kryptolan = 65,
143 Rvd = 66,
145 Ippc = 67,
147 DistributedFs = 68,
149 SatMon = 69,
151 Visa = 70,
153 Ipcv = 71,
155 Cpnx = 72,
157 Cphb = 73,
159 Wsn = 74,
161 Pvp = 75,
163 BrSatMon = 76,
165 SunNd = 77,
167 WbMon = 78,
169 WbExpak = 79,
171 IsoIp = 80,
173 Vmtp = 81,
175 SecureVmtp = 82,
177 Vines = 83,
179 TtpOrIptm = 84,
181 NsfnetIgp = 85,
183 Dgp = 86,
185 Tcf = 87,
187 Eigrp = 88,
189 OspfigP = 89,
191 SpriteRpc = 90,
193 Larp = 91,
195 Mtp = 92,
197 Ax25 = 93,
199 IpIp = 94,
201 Micp = 95,
203 SccSp = 96,
205 Etherip = 97,
207 Encap = 98,
209 PrivEncryption = 99,
211 Gmtp = 100,
213 Ifmp = 101,
215 Pnni = 102,
217 Pim = 103,
219 Aris = 104,
221 Scps = 105,
223 Qnx = 106,
225 AN = 107,
227 IpComp = 108,
229 Snp = 109,
231 CompaqPeer = 110,
233 IpxInIp = 111,
235 Vrrp = 112,
237 Pgm = 113,
239 ZeroHop = 114,
241 L2tp = 115,
243 Ddx = 116,
245 Iatp = 117,
247 Stp = 118,
249 Srp = 119,
251 Uti = 120,
253 Smp = 121,
255 Sm = 122,
257 Ptp = 123,
259 IsisOverIpv4 = 124,
261 Fire = 125,
263 Crtp = 126,
265 Crudp = 127,
267 Sscopmce = 128,
269 Iplt = 129,
271 Sps = 130,
273 Pipe = 131,
275 Sctp = 132,
277 Fc = 133,
279 RsvpE2eIgnore = 134,
281 MobilityHeader = 135,
283 UdpLite = 136,
285 MplsInIp = 137,
287 Manet = 138,
289 Hip = 139,
291 Shim6 = 140,
293 Wesp = 141,
295 Rohc = 142,
297 Test1 = 253,
299 Test2 = 254,
301 Reserved = 255,
303}
304
305impl IpNextProtocol {
306 pub fn new(n: u8) -> Self {
308 match n {
309 0 => Self::Hopopt,
310 1 => Self::Icmp,
311 2 => Self::Igmp,
312 3 => Self::Ggp,
313 4 => Self::Ipv4,
314 5 => Self::St,
315 6 => Self::Tcp,
316 7 => Self::Cbt,
317 8 => Self::Egp,
318 9 => Self::Igp,
319 10 => Self::BbnRccMon,
320 11 => Self::NvpII,
321 12 => Self::Pup,
322 13 => Self::Argus,
323 14 => Self::Emcon,
324 15 => Self::Xnet,
325 16 => Self::Chaos,
326 17 => Self::Udp,
327 18 => Self::Mux,
328 19 => Self::DcnMeas,
329 20 => Self::Hmp,
330 21 => Self::Prm,
331 22 => Self::XnsIdp,
332 23 => Self::Trunk1,
333 24 => Self::Trunk2,
334 25 => Self::Leaf1,
335 26 => Self::Leaf2,
336 27 => Self::Rdp,
337 28 => Self::Irtp,
338 29 => Self::IsoTp4,
339 30 => Self::Netblt,
340 31 => Self::MfeNsp,
341 32 => Self::MeritInp,
342 33 => Self::Dccp,
343 34 => Self::ThreePc,
344 35 => Self::Idpr,
345 36 => Self::Xtp,
346 37 => Self::Ddp,
347 38 => Self::IdprCmtp,
348 39 => Self::TpPlusPlus,
349 40 => Self::Il,
350 41 => Self::Ipv6,
351 42 => Self::Sdrp,
352 43 => Self::Ipv6Route,
353 44 => Self::Ipv6Frag,
354 45 => Self::Idrp,
355 46 => Self::Rsvp,
356 47 => Self::Gre,
357 48 => Self::Dsr,
358 49 => Self::Bna,
359 50 => Self::Esp,
360 51 => Self::Ah,
361 52 => Self::INlsp,
362 53 => Self::Swipe,
363 54 => Self::Narp,
364 55 => Self::Mobile,
365 56 => Self::Tlsp,
366 57 => Self::Skip,
367 58 => Self::Icmpv6,
368 59 => Self::Ipv6NoNxt,
369 60 => Self::Ipv6Opts,
370 61 => Self::HostInternal,
371 62 => Self::Cftp,
372 63 => Self::LocalNetwork,
373 64 => Self::SatExpak,
374 65 => Self::Kryptolan,
375 66 => Self::Rvd,
376 67 => Self::Ippc,
377 68 => Self::DistributedFs,
378 69 => Self::SatMon,
379 70 => Self::Visa,
380 71 => Self::Ipcv,
381 72 => Self::Cpnx,
382 73 => Self::Cphb,
383 74 => Self::Wsn,
384 75 => Self::Pvp,
385 76 => Self::BrSatMon,
386 77 => Self::SunNd,
387 78 => Self::WbMon,
388 79 => Self::WbExpak,
389 80 => Self::IsoIp,
390 81 => Self::Vmtp,
391 82 => Self::SecureVmtp,
392 83 => Self::Vines,
393 84 => Self::TtpOrIptm,
394 85 => Self::NsfnetIgp,
395 86 => Self::Dgp,
396 87 => Self::Tcf,
397 88 => Self::Eigrp,
398 89 => Self::OspfigP,
399 90 => Self::SpriteRpc,
400 91 => Self::Larp,
401 92 => Self::Mtp,
402 93 => Self::Ax25,
403 94 => Self::IpIp,
404 95 => Self::Micp,
405 96 => Self::SccSp,
406 97 => Self::Etherip,
407 98 => Self::Encap,
408 99 => Self::PrivEncryption,
409 100 => Self::Gmtp,
410 101 => Self::Ifmp,
411 102 => Self::Pnni,
412 103 => Self::Pim,
413 104 => Self::Aris,
414 105 => Self::Scps,
415 106 => Self::Qnx,
416 107 => Self::AN,
417 108 => Self::IpComp,
418 109 => Self::Snp,
419 110 => Self::CompaqPeer,
420 111 => Self::IpxInIp,
421 112 => Self::Vrrp,
422 113 => Self::Pgm,
423 114 => Self::ZeroHop,
424 115 => Self::L2tp,
425 116 => Self::Ddx,
426 117 => Self::Iatp,
427 118 => Self::Stp,
428 119 => Self::Srp,
429 120 => Self::Uti,
430 121 => Self::Smp,
431 122 => Self::Sm,
432 123 => Self::Ptp,
433 124 => Self::IsisOverIpv4,
434 125 => Self::Fire,
435 126 => Self::Crtp,
436 127 => Self::Crudp,
437 128 => Self::Sscopmce,
438 129 => Self::Iplt,
439 130 => Self::Sps,
440 131 => Self::Pipe,
441 132 => Self::Sctp,
442 133 => Self::Fc,
443 134 => Self::RsvpE2eIgnore,
444 135 => Self::MobilityHeader,
445 136 => Self::UdpLite,
446 137 => Self::MplsInIp,
447 138 => Self::Manet,
448 139 => Self::Hip,
449 140 => Self::Shim6,
450 141 => Self::Wesp,
451 142 => Self::Rohc,
452 253 => Self::Test1,
453 254 => Self::Test2,
454 _ => Self::Reserved,
455 }
456 }
457 pub fn as_str(&self) -> &'static str {
458 match self {
459 IpNextProtocol::Hopopt => "Hopopt",
460 IpNextProtocol::Icmp => "Icmp",
461 IpNextProtocol::Igmp => "Igmp",
462 IpNextProtocol::Ggp => "Ggp",
463 IpNextProtocol::Ipv4 => "Ipv4",
464 IpNextProtocol::St => "St",
465 IpNextProtocol::Tcp => "Tcp",
466 IpNextProtocol::Cbt => "Cbt",
467 IpNextProtocol::Egp => "Egp",
468 IpNextProtocol::Igp => "Igp",
469 IpNextProtocol::BbnRccMon => "BbnRccMon",
470 IpNextProtocol::NvpII => "NvpII",
471 IpNextProtocol::Pup => "Pup",
472 IpNextProtocol::Argus => "Argus",
473 IpNextProtocol::Emcon => "Emcon",
474 IpNextProtocol::Xnet => "Xnet",
475 IpNextProtocol::Chaos => "Chaos",
476 IpNextProtocol::Udp => "Udp",
477 IpNextProtocol::Mux => "Mux",
478 IpNextProtocol::DcnMeas => "DcnMeas",
479 IpNextProtocol::Hmp => "Hmp",
480 IpNextProtocol::Prm => "Prm",
481 IpNextProtocol::XnsIdp => "XnsIdp",
482 IpNextProtocol::Trunk1 => "Trunk1",
483 IpNextProtocol::Trunk2 => "Trunk2",
484 IpNextProtocol::Leaf1 => "Leaf1",
485 IpNextProtocol::Leaf2 => "Leaf2",
486 IpNextProtocol::Rdp => "Rdp",
487 IpNextProtocol::Irtp => "Irtp",
488 IpNextProtocol::IsoTp4 => "IsoTp4",
489 IpNextProtocol::Netblt => "Netblt",
490 IpNextProtocol::MfeNsp => "MfeNsp",
491 IpNextProtocol::MeritInp => "MeritInp",
492 IpNextProtocol::Dccp => "Dccp",
493 IpNextProtocol::ThreePc => "ThreePc",
494 IpNextProtocol::Idpr => "Idpr",
495 IpNextProtocol::Xtp => "Xtp",
496 IpNextProtocol::Ddp => "Ddp",
497 IpNextProtocol::IdprCmtp => "IdprCmtp",
498 IpNextProtocol::TpPlusPlus => "TpPlusPlus",
499 IpNextProtocol::Il => "Il",
500 IpNextProtocol::Ipv6 => "Ipv6",
501 IpNextProtocol::Sdrp => "Sdrp",
502 IpNextProtocol::Ipv6Route => "Ipv6Route",
503 IpNextProtocol::Ipv6Frag => "Ipv6Frag",
504 IpNextProtocol::Idrp => "Idrp",
505 IpNextProtocol::Rsvp => "Rsvp",
506 IpNextProtocol::Gre => "Gre",
507 IpNextProtocol::Dsr => "Dsr",
508 IpNextProtocol::Bna => "Bna",
509 IpNextProtocol::Esp => "Esp",
510 IpNextProtocol::Ah => "Ah",
511 IpNextProtocol::INlsp => "INlsp",
512 IpNextProtocol::Swipe => "Swipe",
513 IpNextProtocol::Narp => "Narp",
514 IpNextProtocol::Mobile => "Mobile",
515 IpNextProtocol::Tlsp => "Tlsp",
516 IpNextProtocol::Skip => "Skip",
517 IpNextProtocol::Icmpv6 => "Icmpv6",
518 IpNextProtocol::Ipv6NoNxt => "Ipv6NoNxt",
519 IpNextProtocol::Ipv6Opts => "Ipv6Opts",
520 IpNextProtocol::HostInternal => "HostInternal",
521 IpNextProtocol::Cftp => "Cftp",
522 IpNextProtocol::LocalNetwork => "LocalNetwork",
523 IpNextProtocol::SatExpak => "SatExpak",
524 IpNextProtocol::Kryptolan => "Kryptolan",
525 IpNextProtocol::Rvd => "Rvd",
526 IpNextProtocol::Ippc => "Ippc",
527 IpNextProtocol::DistributedFs => "DistributedFs",
528 IpNextProtocol::SatMon => "SatMon",
529 IpNextProtocol::Visa => "Visa",
530 IpNextProtocol::Ipcv => "Ipcv",
531 IpNextProtocol::Cpnx => "Cpnx",
532 IpNextProtocol::Cphb => "Cphb",
533 IpNextProtocol::Wsn => "Wsn",
534 IpNextProtocol::Pvp => "Pvp",
535 IpNextProtocol::BrSatMon => "BrSatMon",
536 IpNextProtocol::SunNd => "SunNd",
537 IpNextProtocol::WbMon => "WbMon",
538 IpNextProtocol::WbExpak => "WbExpak",
539 IpNextProtocol::IsoIp => "IsoIp",
540 IpNextProtocol::Vmtp => "Vmtp",
541 IpNextProtocol::SecureVmtp => "SecureVmtp",
542 IpNextProtocol::Vines => "Vines",
543 IpNextProtocol::TtpOrIptm => "TtpOrIptm",
544 IpNextProtocol::NsfnetIgp => "NsfnetIgp",
545 IpNextProtocol::Dgp => "Dgp",
546 IpNextProtocol::Tcf => "Tcf",
547 IpNextProtocol::Eigrp => "Eigrp",
548 IpNextProtocol::OspfigP => "OspfigP",
549 IpNextProtocol::SpriteRpc => "SpriteRpc",
550 IpNextProtocol::Larp => "Larp",
551 IpNextProtocol::Mtp => "Mtp",
552 IpNextProtocol::Ax25 => "Ax25",
553 IpNextProtocol::IpIp => "IpIp",
554 IpNextProtocol::Micp => "Micp",
555 IpNextProtocol::SccSp => "SccSp",
556 IpNextProtocol::Etherip => "Etherip",
557 IpNextProtocol::Encap => "Encap",
558 IpNextProtocol::PrivEncryption => "PrivEncryption",
559 IpNextProtocol::Gmtp => "Gmtp",
560 IpNextProtocol::Ifmp => "Ifmp",
561 IpNextProtocol::Pnni => "Pnni",
562 IpNextProtocol::Pim => "Pim",
563 IpNextProtocol::Aris => "Aris",
564 IpNextProtocol::Scps => "Scps",
565 IpNextProtocol::Qnx => "Qnx",
566 IpNextProtocol::AN => "AN",
567 IpNextProtocol::IpComp => "IpComp",
568 IpNextProtocol::Snp => "Snp",
569 IpNextProtocol::CompaqPeer => "CompaqPeer",
570 IpNextProtocol::IpxInIp => "IpxInIp",
571 IpNextProtocol::Vrrp => "Vrrp",
572 IpNextProtocol::Pgm => "Pgm",
573 IpNextProtocol::ZeroHop => "ZeroHop",
574 IpNextProtocol::L2tp => "L2tp",
575 IpNextProtocol::Ddx => "Ddx",
576 IpNextProtocol::Iatp => "Iatp",
577 IpNextProtocol::Stp => "Stp",
578 IpNextProtocol::Srp => "Srp",
579 IpNextProtocol::Uti => "Uti",
580 IpNextProtocol::Smp => "Smp",
581 IpNextProtocol::Sm => "Sm",
582 IpNextProtocol::Ptp => "Ptp",
583 IpNextProtocol::IsisOverIpv4 => "IsisOverIpv4",
584 IpNextProtocol::Fire => "Fire",
585 IpNextProtocol::Crtp => "Crtp",
586 IpNextProtocol::Crudp => "Crudp",
587 IpNextProtocol::Sscopmce => "Sscopmce",
588 IpNextProtocol::Iplt => "Iplt",
589 IpNextProtocol::Sps => "Sps",
590 IpNextProtocol::Pipe => "Pipe",
591 IpNextProtocol::Sctp => "Sctp",
592 IpNextProtocol::Fc => "Fc",
593 IpNextProtocol::RsvpE2eIgnore => "RsvpE2eIgnore",
594 IpNextProtocol::MobilityHeader => "MobilityHeader",
595 IpNextProtocol::UdpLite => "UdpLite",
596 IpNextProtocol::MplsInIp => "MplsInIp",
597 IpNextProtocol::Manet => "Manet",
598 IpNextProtocol::Hip => "Hip",
599 IpNextProtocol::Shim6 => "Shim6",
600 IpNextProtocol::Wesp => "Wesp",
601 IpNextProtocol::Rohc => "Rohc",
602 IpNextProtocol::Test1 => "Test1",
603 IpNextProtocol::Test2 => "Test2",
604 IpNextProtocol::Reserved => "Reserved",
605 }
606 }
607 pub fn value(&self) -> u8 {
608 *self as u8
609 }
610}