| ... | @@ -4212,6 +4212,239 @@ pub const IPV6 = struct { | ... | @@ -4212,6 +4212,239 @@ pub const IPV6 = struct { |
| 4212 | pub const FREEBIND = 78; | 4212 | pub const FREEBIND = 78; |
| 4213 | }; | 4213 | }; |
| 4214 | | 4214 | |
| | 4215 | /// IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble |
| | 4216 | /// and FCS/CRC (frame check sequence). |
| | 4217 | pub const ETH = struct { |
| | 4218 | /// Octets in one ethernet addr |
| | 4219 | pub const ALEN = 6; |
| | 4220 | /// Octets in ethernet type field |
| | 4221 | pub const TLEN = 2; |
| | 4222 | /// Total octets in header |
| | 4223 | pub const HLEN = 14; |
| | 4224 | /// Min. octets in frame sans FC |
| | 4225 | pub const ZLEN = 60; |
| | 4226 | /// Max. octets in payload |
| | 4227 | pub const DATA_LEN = 1500; |
| | 4228 | /// Max. octets in frame sans FCS |
| | 4229 | pub const FRAME_LEN = 1514; |
| | 4230 | /// Octets in the FCS |
| | 4231 | pub const FCS_LEN = 4; |
| | 4232 | |
| | 4233 | /// Min IPv4 MTU per RFC791 |
| | 4234 | pub const MIN_MTU = 68; |
| | 4235 | /// 65535, same as IP_MAX_MTU |
| | 4236 | pub const MAX_MTU = 0xFFFF; |
| | 4237 | |
| | 4238 | /// These are the defined Ethernet Protocol ID's. |
| | 4239 | pub const P = struct { |
| | 4240 | /// Ethernet Loopback packet |
| | 4241 | pub const LOOP = 0x0060; |
| | 4242 | /// Xerox PUP packet |
| | 4243 | pub const PUP = 0x0200; |
| | 4244 | /// Xerox PUP Addr Trans packet |
| | 4245 | pub const PUPAT = 0x0201; |
| | 4246 | /// TSN (IEEE 1722) packet |
| | 4247 | pub const TSN = 0x22F0; |
| | 4248 | /// ERSPAN version 2 (type III) |
| | 4249 | pub const ERSPAN2 = 0x22EB; |
| | 4250 | /// Internet Protocol packet |
| | 4251 | pub const IP = 0x0800; |
| | 4252 | /// CCITT X.25 |
| | 4253 | pub const X25 = 0x0805; |
| | 4254 | /// Address Resolution packet |
| | 4255 | pub const ARP = 0x0806; |
| | 4256 | /// G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4257 | pub const BPQ = 0x08FF; |
| | 4258 | /// Xerox IEEE802.3 PUP packet |
| | 4259 | pub const IEEEPUP = 0x0a00; |
| | 4260 | /// Xerox IEEE802.3 PUP Addr Trans packet |
| | 4261 | pub const IEEEPUPAT = 0x0a01; |
| | 4262 | /// B.A.T.M.A.N.-Advanced packet [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4263 | pub const BATMAN = 0x4305; |
| | 4264 | /// DEC Assigned proto |
| | 4265 | pub const DEC = 0x6000; |
| | 4266 | /// DEC DNA Dump/Load |
| | 4267 | pub const DNA_DL = 0x6001; |
| | 4268 | /// DEC DNA Remote Console |
| | 4269 | pub const DNA_RC = 0x6002; |
| | 4270 | /// DEC DNA Routing |
| | 4271 | pub const DNA_RT = 0x6003; |
| | 4272 | /// DEC LAT |
| | 4273 | pub const LAT = 0x6004; |
| | 4274 | /// DEC Diagnostics |
| | 4275 | pub const DIAG = 0x6005; |
| | 4276 | /// DEC Customer use |
| | 4277 | pub const CUST = 0x6006; |
| | 4278 | /// DEC Systems Comms Arch |
| | 4279 | pub const SCA = 0x6007; |
| | 4280 | /// Trans Ether Bridging |
| | 4281 | pub const TEB = 0x6558; |
| | 4282 | /// Reverse Addr Res packet |
| | 4283 | pub const RARP = 0x8035; |
| | 4284 | /// Appletalk DDP |
| | 4285 | pub const ATALK = 0x809B; |
| | 4286 | /// Appletalk AARP |
| | 4287 | pub const AARP = 0x80F3; |
| | 4288 | /// 802.1Q VLAN Extended Header |
| | 4289 | pub const P_8021Q = 0x8100; |
| | 4290 | /// ERSPAN type II |
| | 4291 | pub const ERSPAN = 0x88BE; |
| | 4292 | /// IPX over DIX |
| | 4293 | pub const IPX = 0x8137; |
| | 4294 | /// IPv6 over bluebook |
| | 4295 | pub const IPV6 = 0x86DD; |
| | 4296 | /// IEEE Pause frames. See 802.3 31B |
| | 4297 | pub const PAUSE = 0x8808; |
| | 4298 | /// Slow Protocol. See 802.3ad 43B |
| | 4299 | pub const SLOW = 0x8809; |
| | 4300 | /// Web-cache coordination protocol defined in draft-wilson-wrec-wccp-v2-00.txt |
| | 4301 | pub const WCCP = 0x883E; |
| | 4302 | /// MPLS Unicast traffic |
| | 4303 | pub const MPLS_UC = 0x8847; |
| | 4304 | /// MPLS Multicast traffic |
| | 4305 | pub const MPLS_MC = 0x8848; |
| | 4306 | /// MultiProtocol Over ATM |
| | 4307 | pub const ATMMPOA = 0x884c; |
| | 4308 | /// PPPoE discovery messages |
| | 4309 | pub const PPP_DISC = 0x8863; |
| | 4310 | /// PPPoE session messages |
| | 4311 | pub const PPP_SES = 0x8864; |
| | 4312 | /// HPNA, wlan link local tunnel |
| | 4313 | pub const LINK_CTL = 0x886c; |
| | 4314 | /// Frame-based ATM Transport over Ethernet |
| | 4315 | pub const ATMFATE = 0x8884; |
| | 4316 | /// Port Access Entity (IEEE 802.1X) |
| | 4317 | pub const PAE = 0x888E; |
| | 4318 | /// PROFINET |
| | 4319 | pub const PROFINET = 0x8892; |
| | 4320 | /// Multiple proprietary protocols |
| | 4321 | pub const REALTEK = 0x8899; |
| | 4322 | /// ATA over Ethernet |
| | 4323 | pub const AOE = 0x88A2; |
| | 4324 | /// EtherCAT |
| | 4325 | pub const ETHERCAT = 0x88A4; |
| | 4326 | /// 802.1ad Service VLAN |
| | 4327 | pub const @"8021AD" = 0x88A8; |
| | 4328 | /// 802.1 Local Experimental 1. |
| | 4329 | pub const @"802_EX1" = 0x88B5; |
| | 4330 | /// 802.11 Preauthentication |
| | 4331 | pub const PREAUTH = 0x88C7; |
| | 4332 | /// TIPC |
| | 4333 | pub const TIPC = 0x88CA; |
| | 4334 | /// Link Layer Discovery Protocol |
| | 4335 | pub const LLDP = 0x88CC; |
| | 4336 | /// Media Redundancy Protocol |
| | 4337 | pub const MRP = 0x88E3; |
| | 4338 | /// 802.1ae MACsec |
| | 4339 | pub const MACSEC = 0x88E5; |
| | 4340 | /// 802.1ah Backbone Service Tag |
| | 4341 | pub const @"8021AH" = 0x88E7; |
| | 4342 | /// 802.1Q MVRP |
| | 4343 | pub const MVRP = 0x88F5; |
| | 4344 | /// IEEE 1588 Timesync |
| | 4345 | pub const @"1588" = 0x88F7; |
| | 4346 | /// NCSI protocol |
| | 4347 | pub const NCSI = 0x88F8; |
| | 4348 | /// IEC 62439-3 PRP/HSRv0 |
| | 4349 | pub const PRP = 0x88FB; |
| | 4350 | /// Connectivity Fault Management |
| | 4351 | pub const CFM = 0x8902; |
| | 4352 | /// Fibre Channel over Ethernet |
| | 4353 | pub const FCOE = 0x8906; |
| | 4354 | /// Infiniband over Ethernet |
| | 4355 | pub const IBOE = 0x8915; |
| | 4356 | /// TDLS |
| | 4357 | pub const TDLS = 0x890D; |
| | 4358 | /// FCoE Initialization Protocol |
| | 4359 | pub const FIP = 0x8914; |
| | 4360 | /// IEEE 802.21 Media Independent Handover Protocol |
| | 4361 | pub const @"80221" = 0x8917; |
| | 4362 | /// IEC 62439-3 HSRv1 |
| | 4363 | pub const HSR = 0x892F; |
| | 4364 | /// Network Service Header |
| | 4365 | pub const NSH = 0x894F; |
| | 4366 | /// Ethernet loopback packet, per IEEE 802.3 |
| | 4367 | pub const LOOPBACK = 0x9000; |
| | 4368 | /// deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4369 | pub const QINQ1 = 0x9100; |
| | 4370 | /// deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4371 | pub const QINQ2 = 0x9200; |
| | 4372 | /// deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4373 | pub const QINQ3 = 0x9300; |
| | 4374 | /// Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4375 | pub const EDSA = 0xDADA; |
| | 4376 | /// Fake VLAN Header for DSA [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4377 | pub const DSA_8021Q = 0xDADB; |
| | 4378 | /// A5PSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4379 | pub const DSA_A5PSW = 0xE001; |
| | 4380 | /// ForCES inter-FE LFB type |
| | 4381 | pub const IFE = 0xED3E; |
| | 4382 | /// IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] |
| | 4383 | pub const AF_IUCV = 0xFBFB; |
| | 4384 | /// If the value in the ethernet type is more than this value then the frame is Ethernet II. Else it is 802.3 |
| | 4385 | pub const @"802_3_MIN" = 0x0600; |
| | 4386 | |
| | 4387 | // Non DIX types. Won't clash for 1500 types. |
| | 4388 | |
| | 4389 | /// Dummy type for 802.3 frames |
| | 4390 | pub const @"802_3" = 0x0001; |
| | 4391 | /// Dummy protocol id for AX.25 |
| | 4392 | pub const AX25 = 0x0002; |
| | 4393 | /// Every packet (be careful!!!) |
| | 4394 | pub const ALL = 0x0003; |
| | 4395 | /// 802.2 frames |
| | 4396 | pub const @"802_2" = 0x0004; |
| | 4397 | /// Internal only |
| | 4398 | pub const SNAP = 0x0005; |
| | 4399 | /// DEC DDCMP: Internal only |
| | 4400 | pub const DDCMP = 0x0006; |
| | 4401 | /// Dummy type for WAN PPP frames |
| | 4402 | pub const WAN_PPP = 0x0007; |
| | 4403 | /// Dummy type for PPP MP frames |
| | 4404 | pub const PPP_MP = 0x0008; |
| | 4405 | /// Localtalk pseudo type |
| | 4406 | pub const LOCALTALK = 0x0009; |
| | 4407 | /// CAN: Controller Area Network |
| | 4408 | pub const CAN = 0x000C; |
| | 4409 | /// CANFD: CAN flexible data rate |
| | 4410 | pub const CANFD = 0x000D; |
| | 4411 | /// CANXL: eXtended frame Length |
| | 4412 | pub const CANXL = 0x000E; |
| | 4413 | /// Dummy type for Atalk over PPP |
| | 4414 | pub const PPPTALK = 0x0010; |
| | 4415 | /// 802.2 frames |
| | 4416 | pub const TR_802_2 = 0x0011; |
| | 4417 | /// Mobitex (kaz@cafe.net) |
| | 4418 | pub const MOBITEX = 0x0015; |
| | 4419 | /// Card specific control frames |
| | 4420 | pub const CONTROL = 0x0016; |
| | 4421 | /// Linux-IrDA |
| | 4422 | pub const IRDA = 0x0017; |
| | 4423 | /// Acorn Econet |
| | 4424 | pub const ECONET = 0x0018; |
| | 4425 | /// HDLC frames |
| | 4426 | pub const HDLC = 0x0019; |
| | 4427 | /// 1A for ArcNet :-) |
| | 4428 | pub const ARCNET = 0x001A; |
| | 4429 | /// Distributed Switch Arch. |
| | 4430 | pub const DSA = 0x001B; |
| | 4431 | /// Trailer switch tagging |
| | 4432 | pub const TRAILER = 0x001C; |
| | 4433 | /// Nokia Phonet frames |
| | 4434 | pub const PHONET = 0x00F5; |
| | 4435 | /// IEEE802.15.4 frame |
| | 4436 | pub const IEEE802154 = 0x00F6; |
| | 4437 | /// ST-Ericsson CAIF protocol |
| | 4438 | pub const CAIF = 0x00F7; |
| | 4439 | /// Multiplexed DSA protocol |
| | 4440 | pub const XDSA = 0x00F8; |
| | 4441 | /// Qualcomm multiplexing and aggregation protocol |
| | 4442 | pub const MAP = 0x00F9; |
| | 4443 | /// Management component transport protocol packets |
| | 4444 | pub const MCTP = 0x00FA; |
| | 4445 | }; |
| | 4446 | }; |
| | 4447 | |
| 4215 | pub const MSG = struct { | 4448 | pub const MSG = struct { |
| 4216 | pub const OOB = 0x0001; | 4449 | pub const OOB = 0x0001; |
| 4217 | pub const PEEK = 0x0002; | 4450 | pub const PEEK = 0x0002; |