blob: f7209bbb5d522d553a773b850c2af5f298e05275 [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/*
2<:copyright-BRCM:2016:DUAL/GPL:standard
3
4 Broadcom Proprietary and Confidential.(c) 2016 Broadcom
5 All Rights Reserved
6
7Unless you and Broadcom execute a separate written software license
8agreement governing use of this software, this software is licensed
9to you under the terms of the GNU General Public License version 2
10(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
11with the following added to such license:
12
13 As a special exception, the copyright holders of this software give
14 you permission to link this software with independent modules, and
15 to copy and distribute the resulting executable under terms of your
16 choice, provided that you also meet, for each linked independent
17 module, the terms and conditions of the license of that module.
18 An independent module is a module which is not derived from this
19 software. The special exception does not apply to any modifications
20 of the software.
21
22Not withstanding the above, under no circumstances may you combine
23this software in any way with any other Broadcom software provided
24under a license other than the GPL, without Broadcom's express prior
25written consent.
26
27:>
28 */
29
30#ifndef _DPOE_SEC_MKA_FSM_H_
31#define _DPOE_SEC_MKA_FSM_H_
32
33#include "bcmos_system.h"
34#include "dpoe_sec_util.h"
35#include "mka.h"
36
37/* --- Types --- */
38
39typedef enum dpoe_sec_mka_fsm_state
40{
41 DPOE_SEC_MKA_FSM_STATE__INVALID = -1, /**< permits event validation */
42
43 DPOE_SEC_MKA_FSM_STATE_NULL = 0,
44 DPOE_SEC_MKA_FSM_STATE_SET_ENCRYPTION ,
45 DPOE_SEC_MKA_FSM_STATE_START_MKA ,
46 DPOE_SEC_MKA_FSM_STATE_SEND_SAK ,
47 DPOE_SEC_MKA_FSM_STATE_OPERATIONAL ,
48 DPOE_SEC_MKA_FSM_STATE_SEND_NEW_SAK ,
49
50 DPOE_SEC_MKA_FSM_STATE__COUNT
51} dpoe_sec_mka_fsm_state;
52
53/* DPoE Security MKA information stored with each link. */
54typedef struct dpoe_sec_mka_fsm_info
55{
56 bcmos_timer rx_timer; /**< Timer entry for MKA FSM */
57 bcmos_timer tx_timer; /**< Timer entry for MKA messages */
58} dpoe_sec_mka_fsm_info;
59
60typedef struct
61{
62 mka_link_info *mka_info; /**< MKA information */
63 dpoe_sec_mka_fsm_info *mka_fsm_info; /**< MKA FSM information */
64 dpoe_sec_mka_fsm_state mka_fsm_state; /**< State of the DPoE Security MKA FSM */
65} dpoe_sec_mka_fsm_ctrl;
66
67struct dpoe_sec_link_rec;
68
69typedef void (*f_dpoe_sec_mka_cb)(struct dpoe_sec_link_rec*, bcmos_errno status);
70
71/* --- Function prototypes --- */
72
73/* Start MKA on a link */
74bcmos_errno dpoe_sec_mka_fsm_start(struct dpoe_sec_link_rec *link);
75
76/* Handle reception of an OAM frame */
77void dpoe_sec_mka_fsm_rx_oam(struct dpoe_sec_link_rec *link, uint8_t *frame, uint16_t length);
78
79/* Handle reception of an EAPOL frame */
80void dpoe_sec_mka_fsm_rx_eapol(struct dpoe_sec_link_rec *link, uint8_t *frame, uint16_t length);
81
82/* Is the MKA FSM running on a link? */
83bcmos_bool dpoe_sec_mka_fsm_running(struct dpoe_sec_link_rec *link);
84
85/* Handle link de-registration (stop the MKA FSM) */
86bcmos_errno dpoe_sec_mka_fsm_deregister(struct dpoe_sec_link_rec *link);
87
88void dpoe_sec_mka_fsm_init(f_dpoe_sec_mka_cb mka_cb);
89
90#endif /* _DPOE_SEC_MKA_FSM_H_ */