blob: f7209bbb5d522d553a773b850c2af5f298e05275 [file] [log] [blame]
/*
<:copyright-BRCM:2016:DUAL/GPL:standard
Broadcom Proprietary and Confidential.(c) 2016 Broadcom
All Rights Reserved
Unless you and Broadcom execute a separate written software license
agreement governing use of this software, this software is licensed
to you under the terms of the GNU General Public License version 2
(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
with the following added to such license:
As a special exception, the copyright holders of this software give
you permission to link this software with independent modules, and
to copy and distribute the resulting executable under terms of your
choice, provided that you also meet, for each linked independent
module, the terms and conditions of the license of that module.
An independent module is a module which is not derived from this
software. The special exception does not apply to any modifications
of the software.
Not withstanding the above, under no circumstances may you combine
this software in any way with any other Broadcom software provided
under a license other than the GPL, without Broadcom's express prior
written consent.
:>
*/
#ifndef _DPOE_SEC_MKA_FSM_H_
#define _DPOE_SEC_MKA_FSM_H_
#include "bcmos_system.h"
#include "dpoe_sec_util.h"
#include "mka.h"
/* --- Types --- */
typedef enum dpoe_sec_mka_fsm_state
{
DPOE_SEC_MKA_FSM_STATE__INVALID = -1, /**< permits event validation */
DPOE_SEC_MKA_FSM_STATE_NULL = 0,
DPOE_SEC_MKA_FSM_STATE_SET_ENCRYPTION ,
DPOE_SEC_MKA_FSM_STATE_START_MKA ,
DPOE_SEC_MKA_FSM_STATE_SEND_SAK ,
DPOE_SEC_MKA_FSM_STATE_OPERATIONAL ,
DPOE_SEC_MKA_FSM_STATE_SEND_NEW_SAK ,
DPOE_SEC_MKA_FSM_STATE__COUNT
} dpoe_sec_mka_fsm_state;
/* DPoE Security MKA information stored with each link. */
typedef struct dpoe_sec_mka_fsm_info
{
bcmos_timer rx_timer; /**< Timer entry for MKA FSM */
bcmos_timer tx_timer; /**< Timer entry for MKA messages */
} dpoe_sec_mka_fsm_info;
typedef struct
{
mka_link_info *mka_info; /**< MKA information */
dpoe_sec_mka_fsm_info *mka_fsm_info; /**< MKA FSM information */
dpoe_sec_mka_fsm_state mka_fsm_state; /**< State of the DPoE Security MKA FSM */
} dpoe_sec_mka_fsm_ctrl;
struct dpoe_sec_link_rec;
typedef void (*f_dpoe_sec_mka_cb)(struct dpoe_sec_link_rec*, bcmos_errno status);
/* --- Function prototypes --- */
/* Start MKA on a link */
bcmos_errno dpoe_sec_mka_fsm_start(struct dpoe_sec_link_rec *link);
/* Handle reception of an OAM frame */
void dpoe_sec_mka_fsm_rx_oam(struct dpoe_sec_link_rec *link, uint8_t *frame, uint16_t length);
/* Handle reception of an EAPOL frame */
void dpoe_sec_mka_fsm_rx_eapol(struct dpoe_sec_link_rec *link, uint8_t *frame, uint16_t length);
/* Is the MKA FSM running on a link? */
bcmos_bool dpoe_sec_mka_fsm_running(struct dpoe_sec_link_rec *link);
/* Handle link de-registration (stop the MKA FSM) */
bcmos_errno dpoe_sec_mka_fsm_deregister(struct dpoe_sec_link_rec *link);
void dpoe_sec_mka_fsm_init(f_dpoe_sec_mka_cb mka_cb);
#endif /* _DPOE_SEC_MKA_FSM_H_ */