summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/eapol.h
blob: 952d6c75206f15b93a23812061f4e473f4b8ae54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef _IPXE_EAPOL_H
#define _IPXE_EAPOL_H

/** @file
 *
 * Extensible Authentication Protocol over LAN (EAPoL)
 *
 */

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#include <stdint.h>
#include <ipxe/netdevice.h>
#include <ipxe/tables.h>

/** EAPoL header */
struct eapol_header {
	/** Version */
	uint8_t version;
	/** Type */
	uint8_t type;
	/** Payload length */
	uint16_t len;
} __attribute__ (( packed ));

/** 802.1X-2001 */
#define EAPOL_VERSION_2001 1

/** EAPoL-encapsulated EAP packets */
#define EAPOL_TYPE_EAP 0

/** EAPoL key */
#define EAPOL_TYPE_KEY 5

/** An EAPoL handler */
struct eapol_handler {
	/** Type */
	uint8_t type;
	/**
	 * Process received packet
	 *
	 * @v iobuf		I/O buffer
	 * @v netdev		Network device
	 * @v ll_source		Link-layer source address
	 * @ret rc		Return status code
	 *
	 * This method takes ownership of the I/O buffer.
	 */
	int ( * rx ) ( struct io_buffer *iobuf, struct net_device *netdev,
		       const void *ll_source );
};

/** EAPoL handler table */
#define EAPOL_HANDLERS __table ( struct eapol_handler, "eapol_handlers" )

/** Declare an EAPoL handler */
#define __eapol_handler __table_entry ( EAPOL_HANDLERS, 01 )

extern struct net_protocol eapol_protocol __net_protocol;

#endif /* _IPXE_EAPOL_H */