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 
16 /** EAPoL header */
17 struct eapol_header {
18 	/** Version */
19 	uint8_t version;
20 	/** Type */
21 	uint8_t type;
22 	/** Payload length */
23 	uint16_t len;
24 } __attribute__ (( packed ));
25 
26 /** 802.1X-2001 */
27 #define EAPOL_VERSION_2001 1
28 
29 /** EAPoL-encapsulated EAP packets */
30 #define EAPOL_TYPE_EAP 0
31 
32 /** EAPoL key */
33 #define EAPOL_TYPE_KEY 5
34 
35 /** An EAPoL handler */
36 struct eapol_handler {
37 	/** Type */
38 	uint8_t type;
39 	/**
40 	 * Process received packet
41 	 *
42 	 * @v iobuf		I/O buffer
43 	 * @v netdev		Network device
44 	 * @v ll_source		Link-layer source address
45 	 * @ret rc		Return status code
46 	 *
47 	 * This method takes ownership of the I/O buffer.
48 	 */
49 	int ( * rx ) ( struct io_buffer *iobuf, struct net_device *netdev,
50 		       const void *ll_source );
51 };
52 
53 /** EAPoL handler table */
54 #define EAPOL_HANDLERS __table ( struct eapol_handler, "eapol_handlers" )
55 
56 /** Declare an EAPoL handler */
57 #define __eapol_handler __table_entry ( EAPOL_HANDLERS, 01 )
58 
59 extern struct net_protocol eapol_protocol __net_protocol;
60 
61 #endif /* _IPXE_EAPOL_H */
62