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