eapol.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009 Joshua Oreman <oremanj@rwcr.net>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00018 
00019 #ifndef _GPXE_EAPOL_H
00020 #define _GPXE_EAPOL_H
00021 
00022 /** @file
00023  *
00024  * Definitions for EAPOL (Extensible Authentication Protocol over
00025  * LANs) frames. Definitions for the packets usually encapsulated in
00026  * them are elsewhere.
00027  */
00028 
00029 #include <gpxe/tables.h>
00030 #include <stdint.h>
00031 
00032 FILE_LICENCE ( GPL2_OR_LATER );
00033 
00034 
00035 /**
00036  * @defgroup eapol_type EAPOL archetype identifiers
00037  * @{
00038  */
00039 #define EAPOL_TYPE_EAP          0 /**< EAP authentication handshake packet */
00040 #define EAPOL_TYPE_START        1 /**< Request by Peer to begin (no data) */
00041 #define EAPOL_TYPE_LOGOFF       2 /**< Request by Peer to terminate (no data) */
00042 #define EAPOL_TYPE_KEY          3 /**< EAPOL-Key packet */
00043 /** @} */
00044 
00045 /** Expected EAPOL version field value
00046  *
00047  * Version 2 is often seen and has no format differences from version 1;
00048  * however, many older APs will completely drop version-2 packets, so
00049  * we advertise ourselves as version 1.
00050  */
00051 #define EAPOL_THIS_VERSION      1
00052 
00053 /** Length of an EAPOL frame header */
00054 #define EAPOL_HDR_LEN           4
00055 
00056 /** An EAPOL frame
00057  *
00058  * This may encapsulate an eap_pkt, an eapol_key_pkt, or a Start or
00059  * Logoff request with no data attached. It is transmitted directly in
00060  * an Ethernet frame, with no IP packet header.
00061  */
00062 struct eapol_frame
00063 {
00064         /** EAPOL version identifier, always 1 */
00065         u8 version;
00066 
00067         /** EAPOL archetype identifier indicating format of payload */
00068         u8 type;
00069 
00070         /** Length of payload, in network byte order */
00071         u16 length;
00072 
00073         /** Payload, if @a type is EAP or EAPOL-Key */
00074         u8 data[0];
00075 } __attribute__ (( packed ));
00076 
00077 
00078 /** An EAPOL frame type handler
00079  *
00080  * Normally there will be at most two of these, one for EAP and one
00081  * for EAPOL-Key frames. The EAPOL interface code handles Start and
00082  * Logoff directly.
00083  */
00084 struct eapol_handler
00085 {
00086         /** EAPOL archetype identifier for payload this handler will handle */
00087         u8 type;
00088 
00089         /** Receive EAPOL-encapsulated packet of specified type
00090          *
00091          * @v iob       I/O buffer containing packet payload
00092          * @v netdev    Network device from which packet was received
00093          * @v ll_source Source link-layer address from which packet was received
00094          * @ret rc      Return status code
00095          *
00096          * The I/O buffer will have the EAPOL header pulled off it, so
00097          * @c iob->data points to the first byte of the payload.
00098          *
00099          * This function takes ownership of the I/O buffer passed to it.
00100          */
00101         int ( * rx ) ( struct io_buffer *iob, struct net_device *netdev,
00102                        const void *ll_source );
00103 };
00104 
00105 #define EAPOL_HANDLERS  __table ( struct eapol_handler, "eapol_handlers" )
00106 #define __eapol_handler __table_entry ( EAPOL_HANDLERS, 01 )
00107 
00108 
00109 extern struct net_protocol eapol_protocol __net_protocol;
00110 
00111 
00112 #endif /* _GPXE_EAPOL_H */

Generated on Tue Apr 6 20:01:06 2010 for gPXE by  doxygen 1.5.7.1