Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | <:copyright-BRCM:2016:DUAL/GPL:standard |
| 3 | |
| 4 | Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Unless you and Broadcom execute a separate written software license |
| 8 | agreement governing use of this software, this software is licensed |
| 9 | to you under the terms of the GNU General Public License version 2 |
| 10 | (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 11 | with 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 | |
| 22 | Not withstanding the above, under no circumstances may you combine |
| 23 | this software in any way with any other Broadcom software provided |
| 24 | under a license other than the GPL, without Broadcom's express prior |
| 25 | written 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 | |
| 39 | typedef 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. */ |
| 54 | typedef 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 | |
| 60 | typedef 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 | |
| 67 | struct dpoe_sec_link_rec; |
| 68 | |
| 69 | typedef 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 */ |
| 74 | bcmos_errno dpoe_sec_mka_fsm_start(struct dpoe_sec_link_rec *link); |
| 75 | |
| 76 | /* Handle reception of an OAM frame */ |
| 77 | void 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 */ |
| 80 | void 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? */ |
| 83 | bcmos_bool dpoe_sec_mka_fsm_running(struct dpoe_sec_link_rec *link); |
| 84 | |
| 85 | /* Handle link de-registration (stop the MKA FSM) */ |
| 86 | bcmos_errno dpoe_sec_mka_fsm_deregister(struct dpoe_sec_link_rec *link); |
| 87 | |
| 88 | void dpoe_sec_mka_fsm_init(f_dpoe_sec_mka_cb mka_cb); |
| 89 | |
| 90 | #endif /* _DPOE_SEC_MKA_FSM_H_ */ |