iPXE
eapol.h
Go to the documentation of this file.
1 #ifndef _IPXE_EAPOL_H
2 #define _IPXE_EAPOL_H
3 
4 /** @file
5  *
6  * Extensible Authentication Protocol over LAN (EAPoL)
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 FILE_SECBOOT ( PERMITTED );
12 
13 #include <stdint.h>
14 #include <ipxe/netdevice.h>
15 #include <ipxe/tables.h>
16 #include <ipxe/eap.h>
17 
18 /** EAPoL header */
19 struct eapol_header {
20  /** Version */
22  /** Type */
24  /** Payload length */
26 } __attribute__ (( packed ));
27 
28 /** 802.1X-2001 */
29 #define EAPOL_VERSION_2001 1
30 
31 /** EAPoL-encapsulated EAP packets */
32 #define EAPOL_TYPE_EAP 0
33 
34 /** EAPoL start */
35 #define EAPOL_TYPE_START 1
36 
37 /** EAPoL key */
38 #define EAPOL_TYPE_KEY 5
39 
40 /** An EAPoL supplicant */
42  /** EAP supplicant */
44  /** EAPoL-Start retransmission timer */
46  /** EAPoL-Start transmission count */
47  unsigned int count;
48 };
49 
50 /** Delay between EAPoL-Start packets */
51 #define EAPOL_START_INTERVAL ( 2 * TICKS_PER_SEC )
52 
53 /** Maximum number of EAPoL-Start packets to transmit */
54 #define EAPOL_START_COUNT 3
55 
56 /** An EAPoL handler */
57 struct eapol_handler {
58  /** Type */
60  /**
61  * Process received packet
62  *
63  * @v supplicant EAPoL supplicant
64  * @v iobuf I/O buffer
65  * @v ll_source Link-layer source address
66  * @ret rc Return status code
67  *
68  * This method takes ownership of the I/O buffer.
69  */
70  int ( * rx ) ( struct eapol_supplicant *supplicant,
71  struct io_buffer *iobuf, const void *ll_source );
72 };
73 
74 /** EAPoL handler table */
75 #define EAPOL_HANDLERS __table ( struct eapol_handler, "eapol_handlers" )
76 
77 /** Declare an EAPoL handler */
78 #define __eapol_handler __table_entry ( EAPOL_HANDLERS, 01 )
79 
80 extern struct net_protocol eapol_protocol __net_protocol;
81 
82 #endif /* _IPXE_EAPOL_H */
#define __attribute__(x)
Definition: compiler.h:10
uint16_t len
Payload length.
Definition: eapol.h:25
unsigned short uint16_t
Definition: stdint.h:11
A retry timer.
Definition: retry.h:22
An EAP supplicant.
Definition: eap.h:139
A timer.
Definition: timer.h:29
EAPoL header.
Definition: eapol.h:19
struct eap_supplicant eap
EAP supplicant.
Definition: eapol.h:43
struct net_protocol eapol_protocol __net_protocol
AoE protocol.
Definition: aoe.c:56
An EAPoL handler.
Definition: eapol.h:57
unsigned char uint8_t
Definition: stdint.h:10
int(* rx)(struct eapol_supplicant *supplicant, struct io_buffer *iobuf, const void *ll_source)
Process received packet.
Definition: eapol.h:70
uint8_t type
Type.
Definition: eapol.h:23
A network-layer protocol.
Definition: netdevice.h:65
Network device management.
FILE_SECBOOT(PERMITTED)
uint8_t version
Version.
Definition: eapol.h:21
Linker tables.
unsigned int count
EAPoL-Start transmission count.
Definition: eapol.h:47
An EAPoL supplicant.
Definition: eapol.h:41
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint8_t type
Type.
Definition: eapol.h:59
Extensible Authentication Protocol.
A persistent I/O buffer.
Definition: iobuf.h:38