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_FSM_H_ |
| 31 | #define _DPOE_SEC_FSM_H_ |
| 32 | |
| 33 | #include "bcmos_system.h" |
| 34 | #include "bcmolt_model_types.h" |
| 35 | #include "bcmolt_epon_oam_types.h" |
| 36 | #include "dpoe_eap_tls.h" |
| 37 | #include "dpoe_sec_mka_fsm.h" |
| 38 | |
| 39 | /* DPoE Security FSM Event Type definitions */ |
| 40 | typedef enum dpoe_sec_fsm_event |
| 41 | { |
| 42 | DPOE_SEC_FSM_EVENT__FIRST, |
| 43 | DPOE_SEC_FSM_EVENT_ENCRYPT_START = DPOE_SEC_FSM_EVENT__FIRST, |
| 44 | DPOE_SEC_FSM_EVENT_AUTH_START, |
| 45 | DPOE_SEC_FSM_EVENT_RX_OAM, |
| 46 | DPOE_SEC_FSM_EVENT_RX_EAPOL, |
| 47 | DPOE_SEC_FSM_EVENT_AUTH_COMPLETE, |
| 48 | DPOE_SEC_FSM_EVENT_MKA_COMPLETE, |
| 49 | DPOE_SEC_FSM_EVENT_TIMEOUT, |
| 50 | |
| 51 | DPOE_SEC_FSM_EVENT__COUNT |
| 52 | } dpoe_sec_fsm_event; |
| 53 | |
| 54 | /* DPoE Security FSM State definitions */ |
| 55 | typedef enum dpoe_sec_fsm_state |
| 56 | { |
| 57 | DPOE_SEC_FSM_STATE__FIRST, |
| 58 | DPOE_SEC_FSM_STATE_IDLE = DPOE_SEC_FSM_STATE__FIRST, |
| 59 | DPOE_SEC_FSM_STATE_AUTH_WAIT, |
| 60 | DPOE_SEC_FSM_STATE_ENCRYPT_DOWN_WAIT, |
| 61 | DPOE_SEC_FSM_STATE_ENCRYPT_BI_WAIT, |
| 62 | DPOE_SEC_FSM_STATE_COMPLETE, |
| 63 | |
| 64 | DPOE_SEC_FSM_STATE__COUNT |
| 65 | } dpoe_sec_fsm_state; |
| 66 | |
| 67 | /* DPoE Security FSM Event contents. This is a union of information required by the DPoE Security FSM. This data type |
| 68 | * permits a common function prototype for the state machine function table. */ |
| 69 | typedef struct dpoe_sec_fsm_event_data |
| 70 | { |
| 71 | dpoe_sec_fsm_event type; |
| 72 | union |
| 73 | { |
| 74 | bcmolt_u8_list_u16 rx_frame; |
| 75 | bcmos_errno sub_status; |
| 76 | } data; |
| 77 | } dpoe_sec_fsm_event_data; |
| 78 | |
| 79 | struct dpoe_sec_link_rec; |
| 80 | |
| 81 | typedef struct |
| 82 | { |
| 83 | bcmolt_epon_oam_dpoe_encryption_mode enc_mode; |
| 84 | bcmos_bool auth; |
| 85 | } dpoe_sec_fsm_start_data; |
| 86 | |
| 87 | typedef struct dpoe_sec_link_rec |
| 88 | { |
| 89 | bcmolt_devid device; |
| 90 | bcmolt_epon_link_key key; |
| 91 | dpoe_sec_fsm_start_data cfg; |
| 92 | bcmos_mac_address ni_mac; |
| 93 | bcmolt_epon_llid llid; |
| 94 | dpoe_sec_fsm_state fsm_state; |
| 95 | bcmos_errno status; |
| 96 | bcmos_timer timeout; |
| 97 | onu_auth_control auth_ctrl; |
| 98 | dpoe_sec_mka_fsm_ctrl mka_ctrl; |
| 99 | } dpoe_sec_link_rec; |
| 100 | |
| 101 | typedef struct |
| 102 | { |
| 103 | uint8_t *frame; |
| 104 | uint16_t length; |
| 105 | } dpoe_sec_fsm_rx_frame_data; |
| 106 | |
| 107 | typedef union |
| 108 | { |
| 109 | dpoe_sec_fsm_start_data start; |
| 110 | dpoe_sec_fsm_rx_frame_data rx_frame; |
| 111 | } dpoe_sec_fsm_msg_data; |
| 112 | |
| 113 | typedef struct |
| 114 | { |
| 115 | bcmos_msg os_msg; |
| 116 | bcmolt_epon_link_key link; |
| 117 | dpoe_sec_fsm_msg_data data; |
| 118 | } dpoe_sec_fsm_msg; |
| 119 | |
| 120 | typedef void (*f_dpoe_sec_fsm_cb)(bcmolt_devid, bcmolt_epon_link_key, bcmos_errno); |
| 121 | |
| 122 | bcmos_errno dpoe_sec_fsm_link_start(bcmolt_devid device, bcmolt_epon_link_key link_key, dpoe_sec_fsm_start_data *cfg); |
| 123 | |
| 124 | bcmos_errno dpoe_sec_fsm_link_rx_oam(bcmolt_devid device, bcmolt_epon_link_key link, uint8_t *oam, uint16_t length); |
| 125 | |
| 126 | bcmos_errno dpoe_sec_fsm_link_rx_eapol(bcmolt_devid device, bcmolt_epon_link_key link, uint8_t *eapol, uint16_t length); |
| 127 | |
| 128 | bcmos_errno dpoe_sec_fsm_init(f_dpoe_sec_cert_trust_cb cert_trust_cb, f_dpoe_sec_fsm_cb fsm_complete_cb); |
| 129 | |
| 130 | #endif /* _DPOE_SEC_FSM_H_ */ |