auth.h (4732B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 */ 9 10 #ifndef __BCM_AUTH_H__ 11 #define __BCM_AUTH_H__ 12 13 #include <bcm/types.h> 14 15 #define BCM_AUTH_MODE_UNCONTROLLED 0x00000001 16 #define BCM_AUTH_MODE_UNAUTH 0x00000002 17 #define BCM_AUTH_MODE_AUTH 0x00000004 18 19 #define BCM_AUTH_BLOCK_IN 0x00000008 20 #define BCM_AUTH_BLOCK_INOUT 0x00000010 21 22 #define BCM_AUTH_LEARN 0x00000020 23 #define BCM_AUTH_IGNORE_LINK 0x00000040 24 #define BCM_AUTH_IGNORE_VIOLATION 0x00000080 25 #define BCM_AUTH_DROP_UNKNOWN 0x00000100 26 27 #define BCM_AUTH_REASON_UNKNOWN 0x00002000 28 #define BCM_AUTH_REASON_LINK 0x00004000 29 #define BCM_AUTH_REASON_VIOLATION 0x00008000 30 31 #ifndef BCM_HIDE_DISPATCHABLE 32 33 /* Initialize bcm_auth API module */ 34 extern int bcm_auth_init( 35 int unit); 36 37 /* De-configure bcm_auth API module. */ 38 extern int bcm_auth_detach( 39 int unit); 40 41 /* Sets or gets authorization operating mode */ 42 extern int bcm_auth_mode_set( 43 int unit, 44 int port, 45 uint32 mode); 46 47 /* Sets or gets authorization operating mode */ 48 extern int bcm_auth_mode_get( 49 int unit, 50 int port, 51 uint32 *modep); 52 53 #endif /* BCM_HIDE_DISPATCHABLE */ 54 55 /* Definition for 802.1X callout functions. */ 56 typedef void (*bcm_auth_cb_t)( 57 void *cookie, 58 int unit, 59 int port, 60 int reason); 61 62 #ifndef BCM_HIDE_DISPATCHABLE 63 64 /* 65 * Register a callback function to be called when a port 66 * becomes asynchronously unauthorized. 67 */ 68 extern int bcm_auth_unauth_callback( 69 int unit, 70 bcm_auth_cb_t func, 71 void *cookie); 72 73 /* Enable/disable the ability of packets to be sent out a port. */ 74 extern int bcm_auth_egress_set( 75 int unit, 76 int port, 77 int enable); 78 79 /* Enable/disable the ability of packets to be sent out a port. */ 80 extern int bcm_auth_egress_get( 81 int unit, 82 int port, 83 int *enable); 84 85 /* Add Switch's MAC address. */ 86 extern int bcm_auth_mac_add( 87 int unit, 88 int port, 89 bcm_mac_t mac); 90 91 /* Remove Switch's MAC address. */ 92 extern int bcm_auth_mac_delete( 93 int unit, 94 int port, 95 bcm_mac_t mac); 96 97 /* Remove Switch's MAC address. */ 98 extern int bcm_auth_mac_delete_all( 99 int unit, 100 int port); 101 102 #endif /* BCM_HIDE_DISPATCHABLE */ 103 104 /* Features that can be controlled for EAP packets. */ 105 typedef enum bcm_auth_mac_control_e { 106 bcmEapControlL2UserAddr = 0, /* enable L2 User Address frame bypass EAP 107 Port State Filter and SA Filter. */ 108 bcmEapControlDHCP = 1, /* enable DHCP frame bypass EAP Port State 109 Filter and SA Filter. */ 110 bcmEapControlARP = 2, /* enable ARP frame bypass EAP Port State 111 Filter and SA Filter. */ 112 bcmEapControlMAC2X = 3, /* enable(DA=01-80-c2-00-00-22,23,....,2f) 113 frame bypass EAP Port State Filter and SA 114 Filter. */ 115 bcmEapControlGVRP = 4, /* enable(DA=01-80-c2-00-00-21) frame bypass 116 EAP Port State FIlter and SA Filter. */ 117 bcmEapControlGMRP = 5, /* enable(DA=01-80-c2-00-00-20) frame bypass 118 EAP Port State FIlter and SA Filter. */ 119 bcmEapControlMAC1X = 6, /* enable(DA=01-80-c2-00-00-11,12,....,1f) 120 frame bypass EAP Port State FIlter and SA 121 Filter. */ 122 bcmEapControlAllBridges = 7, /* enable (DA=01-80-c2-00-00-10) frame 123 bypass EAP Port State FIlter and SA 124 Filter. */ 125 bcmEapControlMAC0X = 8, /* enable (DA=01-80-c2-00-00-02) or 126 (DA=01-80-c2-00-00-04,05,....,0f) frame 127 bypass EAP Port State FIlter and SA 128 Filter. */ 129 bcmEapControlMACBPDU = 9 /* enable BPDU frame bypass EAP Port State 130 FIlter and SA Filter. */ 131 } bcm_auth_mac_control_t; 132 133 #ifndef BCM_HIDE_DISPATCHABLE 134 135 /* Enable or disable to bypass the EAP MAC control type. */ 136 extern int bcm_auth_mac_control_set( 137 int unit, 138 bcm_auth_mac_control_t type, 139 uint32 value); 140 141 /* Enable or disable to bypass the EAP MAC control type. */ 142 extern int bcm_auth_mac_control_get( 143 int unit, 144 bcm_auth_mac_control_t type, 145 uint32 *value); 146 147 #endif /* BCM_HIDE_DISPATCHABLE */ 148 149 #endif /* __BCM_AUTH_H__ */