@@ -4212,6 +4212,239 @@ pub const IPV6 = struct {
4212
4212
pub const FREEBIND = 78 ;
4213
4213
};
4214
4214
4215
+ pub const ETH = struct {
4216
+ // IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
4217
+ // and FCS/CRC (frame check sequence).
4218
+
4219
+ /// Octets in one ethernet addr
4220
+ pub const ALEN = 6 ;
4221
+ /// Octets in ethernet type field
4222
+ pub const TLEN = 2 ;
4223
+ /// Total octets in header
4224
+ pub const HLEN = 14 ;
4225
+ /// Min. octets in frame sans FC
4226
+ pub const ZLEN = 60 ;
4227
+ /// Max. octets in payload
4228
+ pub const DATA_LEN = 1500 ;
4229
+ /// Max. octets in frame sans FCS
4230
+ pub const FRAME_LEN = 1514 ;
4231
+ /// Octets in the FCS
4232
+ pub const FCS_LEN = 4 ;
4233
+
4234
+ /// Min IPv4 MTU per RFC791
4235
+ pub const MIN_MTU = 68 ;
4236
+ /// 65535, same as IP_MAX_MTU
4237
+ pub const MAX_MTU = 0xFFFF ;
4238
+
4239
+ // These are the defined Ethernet Protocol ID's.
4240
+
4241
+ /// Ethernet Loopback packet
4242
+ pub const P_LOOP = 0x0060 ;
4243
+ /// Xerox PUP packet
4244
+ pub const P_PUP = 0x0200 ;
4245
+ /// Xerox PUP Addr Trans packet
4246
+ pub const P_PUPAT = 0x0201 ;
4247
+ /// TSN (IEEE 1722) packet
4248
+ pub const P_TSN = 0x22F0 ;
4249
+ /// ERSPAN version 2 (type III)
4250
+ pub const P_ERSPAN2 = 0x22EB ;
4251
+ /// Internet Protocol packet
4252
+ pub const P_IP = 0x0800 ;
4253
+ /// CCITT X.25
4254
+ pub const P_X25 = 0x0805 ;
4255
+ /// Address Resolution packet
4256
+ pub const P_ARP = 0x0806 ;
4257
+ /// G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ]
4258
+ pub const P_BPQ = 0x08FF ;
4259
+ /// Xerox IEEE802.3 PUP packet
4260
+ pub const P_IEEEPUP = 0x0a00 ;
4261
+ /// Xerox IEEE802.3 PUP Addr Trans packet
4262
+ pub const P_IEEEPUPAT = 0x0a01 ;
4263
+ /// B.A.T.M.A.N.-Advanced packet [ NOT AN OFFICIALLY REGISTERED ID ]
4264
+ pub const P_BATMAN = 0x4305 ;
4265
+ /// DEC Assigned proto
4266
+ pub const P_DEC = 0x6000 ;
4267
+ /// DEC DNA Dump/Load
4268
+ pub const P_DNA_DL = 0x6001 ;
4269
+ /// DEC DNA Remote Console
4270
+ pub const P_DNA_RC = 0x6002 ;
4271
+ /// DEC DNA Routing
4272
+ pub const P_DNA_RT = 0x6003 ;
4273
+ /// DEC LAT
4274
+ pub const P_LAT = 0x6004 ;
4275
+ /// DEC Diagnostics
4276
+ pub const P_DIAG = 0x6005 ;
4277
+ /// DEC Customer use
4278
+ pub const P_CUST = 0x6006 ;
4279
+ /// DEC Systems Comms Arch
4280
+ pub const P_SCA = 0x6007 ;
4281
+ /// Trans Ether Bridging
4282
+ pub const P_TEB = 0x6558 ;
4283
+ /// Reverse Addr Res packet
4284
+ pub const P_RARP = 0x8035 ;
4285
+ /// Appletalk DDP
4286
+ pub const P_ATALK = 0x809B ;
4287
+ /// Appletalk AARP
4288
+ pub const P_AARP = 0x80F3 ;
4289
+ /// 802.1Q VLAN Extended Header
4290
+ pub const P_8021Q = 0x8100 ;
4291
+ /// ERSPAN type II
4292
+ pub const P_ERSPAN = 0x88BE ;
4293
+ /// IPX over DIX
4294
+ pub const P_IPX = 0x8137 ;
4295
+ /// IPv6 over bluebook
4296
+ pub const P_IPV6 = 0x86DD ;
4297
+ /// IEEE Pause frames. See 802.3 31B
4298
+ pub const P_PAUSE = 0x8808 ;
4299
+ /// Slow Protocol. See 802.3ad 43B
4300
+ pub const P_SLOW = 0x8809 ;
4301
+ /// Web-cache coordination protocol defined in draft-wilson-wrec-wccp-v2-00.txt
4302
+ pub const P_WCCP = 0x883E ;
4303
+ /// MPLS Unicast traffic
4304
+ pub const P_MPLS_UC = 0x8847 ;
4305
+ /// MPLS Multicast traffic
4306
+ pub const P_MPLS_MC = 0x8848 ;
4307
+ /// MultiProtocol Over ATM
4308
+ pub const P_ATMMPOA = 0x884c ;
4309
+ /// PPPoE discovery messages
4310
+ pub const P_PPP_DISC = 0x8863 ;
4311
+ /// PPPoE session messages
4312
+ pub const P_PPP_SES = 0x8864 ;
4313
+ /// HPNA, wlan link local tunnel
4314
+ pub const P_LINK_CTL = 0x886c ;
4315
+ /// Frame-based ATM Transport over Ethernet
4316
+ pub const P_ATMFATE = 0x8884 ;
4317
+ /// Port Access Entity (IEEE 802.1X)
4318
+ pub const P_PAE = 0x888E ;
4319
+ /// PROFINET
4320
+ pub const P_PROFINET = 0x8892 ;
4321
+ /// Multiple proprietary protocols
4322
+ pub const P_REALTEK = 0x8899 ;
4323
+ /// ATA over Ethernet
4324
+ pub const P_AOE = 0x88A2 ;
4325
+ /// EtherCAT
4326
+ pub const P_ETHERCAT = 0x88A4 ;
4327
+ /// 802.1ad Service VLAN
4328
+ pub const P_8021AD = 0x88A8 ;
4329
+ /// 802.1 Local Experimental 1.
4330
+ pub const P_802_EX1 = 0x88B5 ;
4331
+ /// 802.11 Preauthentication
4332
+ pub const P_PREAUTH = 0x88C7 ;
4333
+ /// TIPC
4334
+ pub const P_TIPC = 0x88CA ;
4335
+ /// Link Layer Discovery Protocol
4336
+ pub const P_LLDP = 0x88CC ;
4337
+ /// Media Redundancy Protocol
4338
+ pub const P_MRP = 0x88E3 ;
4339
+ /// 802.1ae MACsec
4340
+ pub const P_MACSEC = 0x88E5 ;
4341
+ /// 802.1ah Backbone Service Tag
4342
+ pub const P_8021AH = 0x88E7 ;
4343
+ /// 802.1Q MVRP
4344
+ pub const P_MVRP = 0x88F5 ;
4345
+ /// IEEE 1588 Timesync
4346
+ pub const P_1588 = 0x88F7 ;
4347
+ /// NCSI protocol
4348
+ pub const P_NCSI = 0x88F8 ;
4349
+ /// IEC 62439-3 PRP/HSRv0
4350
+ pub const P_PRP = 0x88FB ;
4351
+ /// Connectivity Fault Management
4352
+ pub const P_CFM = 0x8902 ;
4353
+ /// Fibre Channel over Ethernet
4354
+ pub const P_FCOE = 0x8906 ;
4355
+ /// Infiniband over Ethernet
4356
+ pub const P_IBOE = 0x8915 ;
4357
+ /// TDLS
4358
+ pub const P_TDLS = 0x890D ;
4359
+ /// FCoE Initialization Protocol
4360
+ pub const P_FIP = 0x8914 ;
4361
+ /// IEEE 802.21 Media Independent Handover Protocol
4362
+ pub const P_80221 = 0x8917 ;
4363
+ /// IEC 62439-3 HSRv1
4364
+ pub const P_HSR = 0x892F ;
4365
+ /// Network Service Header
4366
+ pub const P_NSH = 0x894F ;
4367
+ /// Ethernet loopback packet, per IEEE 802.3
4368
+ pub const P_LOOPBACK = 0x9000 ;
4369
+ /// deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ]
4370
+ pub const P_QINQ1 = 0x9100 ;
4371
+ /// deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ]
4372
+ pub const P_QINQ2 = 0x9200 ;
4373
+ /// deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ]
4374
+ pub const P_QINQ3 = 0x9300 ;
4375
+ /// Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ]
4376
+ pub const P_EDSA = 0xDADA ;
4377
+ /// Fake VLAN Header for DSA [ NOT AN OFFICIALLY REGISTERED ID ]
4378
+ pub const P_DSA_8021Q = 0xDADB ;
4379
+ /// A5PSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ]
4380
+ pub const P_DSA_A5PSW = 0xE001 ;
4381
+ /// ForCES inter-FE LFB type
4382
+ pub const P_IFE = 0xED3E ;
4383
+ /// IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ]
4384
+ pub const P_AF_IUCV = 0xFBFB ;
4385
+ /// If the value in the ethernet type is more than this value then the frame is Ethernet II. Else it is 802.3
4386
+ pub const P_802_3_MIN = 0x0600 ;
4387
+
4388
+ // Non DIX types. Won't clash for 1500 types.
4389
+
4390
+ /// Dummy type for 802.3 frames
4391
+ pub const P_802_3 = 0x0001 ;
4392
+ /// Dummy protocol id for AX.25
4393
+ pub const P_AX25 = 0x0002 ;
4394
+ /// Every packet (be careful!!!)
4395
+ pub const P_ALL = 0x0003 ;
4396
+ /// 802.2 frames
4397
+ pub const P_802_2 = 0x0004 ;
4398
+ /// Internal only
4399
+ pub const P_SNAP = 0x0005 ;
4400
+ /// DEC DDCMP: Internal only
4401
+ pub const P_DDCMP = 0x0006 ;
4402
+ /// Dummy type for WAN PPP frames
4403
+ pub const P_WAN_PPP = 0x0007 ;
4404
+ /// Dummy type for PPP MP frames
4405
+ pub const P_PPP_MP = 0x0008 ;
4406
+ /// Localtalk pseudo type
4407
+ pub const P_LOCALTALK = 0x0009 ;
4408
+ /// CAN: Controller Area Network
4409
+ pub const P_CAN = 0x000C ;
4410
+ /// CANFD: CAN flexible data rate
4411
+ pub const P_CANFD = 0x000D ;
4412
+ /// CANXL: eXtended frame Length
4413
+ pub const P_CANXL = 0x000E ;
4414
+ /// Dummy type for Atalk over PPP
4415
+ pub const P_PPPTALK = 0x0010 ;
4416
+ /// 802.2 frames
4417
+ pub const P_TR_802_2 = 0x0011 ;
4418
+
4419
+ pub const P_MOBITEX = 0x0015 ;
4420
+ /// Card specific control frames
4421
+ pub const P_CONTROL = 0x0016 ;
4422
+ /// Linux-IrDA
4423
+ pub const P_IRDA = 0x0017 ;
4424
+ /// Acorn Econet
4425
+ pub const P_ECONET = 0x0018 ;
4426
+ /// HDLC frames
4427
+ pub const P_HDLC = 0x0019 ;
4428
+ /// 1A for ArcNet :-)
4429
+ pub const P_ARCNET = 0x001A ;
4430
+ /// Distributed Switch Arch.
4431
+ pub const P_DSA = 0x001B ;
4432
+ /// Trailer switch tagging
4433
+ pub const P_TRAILER = 0x001C ;
4434
+ /// Nokia Phonet frames
4435
+ pub const P_PHONET = 0x00F5 ;
4436
+ /// IEEE802.15.4 frame
4437
+ pub const P_IEEE802154 = 0x00F6 ;
4438
+ /// ST-Ericsson CAIF protocol
4439
+ pub const P_CAIF = 0x00F7 ;
4440
+ /// Multiplexed DSA protocol
4441
+ pub const P_XDSA = 0x00F8 ;
4442
+ /// Qualcomm multiplexing and aggregation protocol
4443
+ pub const P_MAP = 0x00F9 ;
4444
+ /// Management component transport protocol packets
4445
+ pub const P_MCTP = 0x00FA ;
4446
+ };
4447
+
4215
4448
pub const MSG = struct {
4216
4449
pub const OOB = 0x0001 ;
4217
4450
pub const PEEK = 0x0002 ;
0 commit comments