blob: fa8b3adb83379a9f18fa9b1edb8a68fa9bb9b06c [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_FSM_H_
#define _DPOE_SEC_FSM_H_
#include "bcmos_system.h"
#include "bcmolt_model_types.h"
#include "bcmolt_epon_oam_types.h"
#include "dpoe_eap_tls.h"
#include "dpoe_sec_mka_fsm.h"
/* DPoE Security FSM Event Type definitions */
typedef enum dpoe_sec_fsm_event
{
DPOE_SEC_FSM_EVENT__FIRST,
DPOE_SEC_FSM_EVENT_ENCRYPT_START = DPOE_SEC_FSM_EVENT__FIRST,
DPOE_SEC_FSM_EVENT_AUTH_START,
DPOE_SEC_FSM_EVENT_RX_OAM,
DPOE_SEC_FSM_EVENT_RX_EAPOL,
DPOE_SEC_FSM_EVENT_AUTH_COMPLETE,
DPOE_SEC_FSM_EVENT_MKA_COMPLETE,
DPOE_SEC_FSM_EVENT_TIMEOUT,
DPOE_SEC_FSM_EVENT__COUNT
} dpoe_sec_fsm_event;
/* DPoE Security FSM State definitions */
typedef enum dpoe_sec_fsm_state
{
DPOE_SEC_FSM_STATE__FIRST,
DPOE_SEC_FSM_STATE_IDLE = DPOE_SEC_FSM_STATE__FIRST,
DPOE_SEC_FSM_STATE_AUTH_WAIT,
DPOE_SEC_FSM_STATE_ENCRYPT_DOWN_WAIT,
DPOE_SEC_FSM_STATE_ENCRYPT_BI_WAIT,
DPOE_SEC_FSM_STATE_COMPLETE,
DPOE_SEC_FSM_STATE__COUNT
} dpoe_sec_fsm_state;
/* DPoE Security FSM Event contents. This is a union of information required by the DPoE Security FSM. This data type
* permits a common function prototype for the state machine function table. */
typedef struct dpoe_sec_fsm_event_data
{
dpoe_sec_fsm_event type;
union
{
bcmolt_u8_list_u16 rx_frame;
bcmos_errno sub_status;
} data;
} dpoe_sec_fsm_event_data;
struct dpoe_sec_link_rec;
typedef struct
{
bcmolt_epon_oam_dpoe_encryption_mode enc_mode;
bcmos_bool auth;
} dpoe_sec_fsm_start_data;
typedef struct dpoe_sec_link_rec
{
bcmolt_devid device;
bcmolt_epon_link_key key;
dpoe_sec_fsm_start_data cfg;
bcmos_mac_address ni_mac;
bcmolt_epon_llid llid;
dpoe_sec_fsm_state fsm_state;
bcmos_errno status;
bcmos_timer timeout;
onu_auth_control auth_ctrl;
dpoe_sec_mka_fsm_ctrl mka_ctrl;
} dpoe_sec_link_rec;
typedef struct
{
uint8_t *frame;
uint16_t length;
} dpoe_sec_fsm_rx_frame_data;
typedef union
{
dpoe_sec_fsm_start_data start;
dpoe_sec_fsm_rx_frame_data rx_frame;
} dpoe_sec_fsm_msg_data;
typedef struct
{
bcmos_msg os_msg;
bcmolt_epon_link_key link;
dpoe_sec_fsm_msg_data data;
} dpoe_sec_fsm_msg;
typedef void (*f_dpoe_sec_fsm_cb)(bcmolt_devid, bcmolt_epon_link_key, bcmos_errno);
bcmos_errno dpoe_sec_fsm_link_start(bcmolt_devid device, bcmolt_epon_link_key link_key, dpoe_sec_fsm_start_data *cfg);
bcmos_errno dpoe_sec_fsm_link_rx_oam(bcmolt_devid device, bcmolt_epon_link_key link, uint8_t *oam, uint16_t length);
bcmos_errno dpoe_sec_fsm_link_rx_eapol(bcmolt_devid device, bcmolt_epon_link_key link, uint8_t *eapol, uint16_t length);
bcmos_errno dpoe_sec_fsm_init(f_dpoe_sec_cert_trust_cb cert_trust_cb, f_dpoe_sec_fsm_cb fsm_complete_cb);
#endif /* _DPOE_SEC_FSM_H_ */