blob: 1f56fdd8d345a884577f20e0bc802430e68f5e8f [file] [log] [blame]
developer69bcd592024-03-25 14:26:39 +08001/* FILE NAME: air_sec.h
2 * PURPOSE:
3 * Define the security function in AIR SDK.
4 *
5 * NOTES:
6 * None
7 */
8
9#ifndef AIR_SEC_H
10#define AIR_SEC_H
11
12/* INCLUDE FILE DECLARATIONS
13*/
14
15/* NAMING CONSTANT DECLARATIONS
16*/
17
18/* Field for storm control */
19#define AIR_STORM_MAX_COUNT (255)
20
21#define AIR_MAX_NUM_OF_MAC (2048)
22
23typedef enum
24{
25 AIR_STORM_TYPE_BCST,
26 AIR_STORM_TYPE_MCST,
27 AIR_STORM_TYPE_UCST,
28 AIR_STORM_TYPE_LAST
29}AIR_STORM_TYPE_T;
30
31typedef enum
32{
33 AIR_STORM_UNIT_64K,
34 AIR_STORM_UNIT_256K,
35 AIR_STORM_UNIT_1M,
36 AIR_STORM_UNIT_4M,
37 AIR_STORM_UNIT_16M,
38 AIR_STORM_UNIT_32M,
39 AIR_STORM_UNIT_LAST
40}AIR_STORM_UNIT_T;
41
42/* Field for flooding port */
43typedef enum
44{
45 AIR_FLOOD_TYPE_BCST,
46 AIR_FLOOD_TYPE_MCST,
47 AIR_FLOOD_TYPE_UCST,
48 AIR_FLOOD_TYPE_QURY,
49 AIR_FLOOD_TYPE_LAST
50}AIR_FLOOD_TYPE_T;
51
52/* Port security port control configurations */
53typedef struct AIR_SEC_PORTSEC_PORT_CONFIG_S
54{
55 /* Source MAC address learning mode */
56 BOOL_T sa_lrn_en;
57
58 /* Learned source MAC address counter */
59 BOOL_T sa_lmt_en;
60
61 /* Rx SA allowable learning limit number */
62 UI32_T sa_lmt_cnt;
63
64}AIR_SEC_PORTSEC_PORT_CONFIG_T;
65
66/* MACRO FUNCTION DECLARATIONS
67*/
68
69/* DATA TYPE DECLARATIONS
70*/
71
72/* EXPORTED SUBPROGRAM SPECIFICATIONS
73*/
74/* FUNCTION NAME: air_sec_setStormEnable
75 * PURPOSE:
76 * Enable or disable per port storm control for specific type.
77 *
78 * INPUT:
79 * unit -- Select device ID
80 * port -- Select port number
81 * type -- AIR_STORM_TYPE_BCST
82 * AIR_STORM_TYPE_MCST
83 * AIR_STORM_TYPE_UCST
84 * storm_en -- TRUE
85 * FALSE
86 * OUTPUT:
87 * None
88 *
89 * RETURN:
90 * AIR_E_OK
91 * AIR_E_BAD_PARAMETER
92 *
93 * NOTES:
94 * None
95 */
96AIR_ERROR_NO_T
97air_sec_setStormEnable(
98 const UI32_T unit,
99 const UI32_T port,
100 const AIR_STORM_TYPE_T type,
101 const BOOL_T storm_en);
102
103/* FUNCTION NAME: air_sec_getStormEnable
104 * PURPOSE:
105 * Get per port status of storm control for specific type.
106 *
107 * INPUT:
108 * unit -- Select device ID
109 * port -- Select port number
110 * type -- AIR_STORM_TYPE_BCST
111 * AIR_STORM_TYPE_MCST
112 * AIR_STORM_TYPE_UCST
113 * OUTPUT:
114 * ptr_storm_en -- TRUE
115 * FALSE
116 * RETURN:
117 * AIR_E_OK
118 * AIR_E_BAD_PARAMETER
119 *
120 * NOTES:
121 * None
122 */
123AIR_ERROR_NO_T
124air_sec_getStormEnable(
125 const UI32_T unit,
126 const UI32_T port,
127 const AIR_STORM_TYPE_T type,
128 BOOL_T *ptr_storm_en);
129
130/* FUNCTION NAME: air_sec_setStormRate
131 * PURPOSE:
132 * Set per port storm rate limit control for specific type.
133 *
134 * INPUT:
135 * unit -- Select device ID
136 * port -- Select port number
137 * type -- AIR_STORM_TYPE_BCST
138 * AIR_STORM_TYPE_MCST
139 * AIR_STORM_TYPE_UCST
140 * count -- Count of the unit
141 * Range 0..255
142 * Rate = (count * unit) bps
143 * unit -- AIR_STORM_UNIT_64K
144 * AIR_STORM_UNIT_256K
145 * AIR_STORM_UNIT_1M
146 * AIR_STORM_UNIT_4M
147 * AIR_STORM_UNIT_16M
148 * AIR_STORM_UNIT_32M
149 * OUTPUT:
150 * None
151 *
152 * RETURN:
153 * AIR_E_OK
154 * AIR_E_BAD_PARAMETER
155 *
156 * NOTES:
157 * None
158 */
159AIR_ERROR_NO_T
160air_sec_setStormRate(
161 const UI32_T unit,
162 const UI32_T port,
163 const AIR_STORM_TYPE_T type,
164 const UI32_T count,
165 const AIR_STORM_UNIT_T storm_unit);
166
167/* FUNCTION NAME: air_sec_getStormRate
168 * PURPOSE:
169 * Get per port storm rate limit control for specific type.
170 *
171 * INPUT:
172 * unit -- Select device ID
173 * port -- Select port number
174 * type -- AIR_STORM_TYPE_BCST
175 * AIR_STORM_TYPE_MCST
176 * AIR_STORM_TYPE_UCST
177 * OUTPUT:
178 * ptr_count -- Count of the unit
179 * Range 0..255
180 * Rate = (count * unit) bps
181 * ptr_unit -- AIR_STORM_UNIT_64K
182 * AIR_STORM_UNIT_256K
183 * AIR_STORM_UNIT_1M
184 * AIR_STORM_UNIT_4M
185 * AIR_STORM_UNIT_16M
186 * AIR_STORM_UNIT_32M
187 * RETURN:
188 * AIR_E_OK
189 * AIR_E_BAD_PARAMETER
190 *
191 * NOTES:
192 * None
193 */
194AIR_ERROR_NO_T
195air_sec_getStormRate(
196 const UI32_T unit,
197 const UI32_T port,
198 const AIR_STORM_TYPE_T type,
199 UI32_T *ptr_count,
200 AIR_STORM_UNIT_T *ptr_unit);
201
202/* FUNCTION NAME: air_sec_setFldMode
203 * PURPOSE:
204 * Set per port flooding status for unknown type frame.
205 *
206 * INPUT:
207 * unit -- Select device ID
208 * port -- Select port to setting
209 * type -- AIR_FLOOD_TYPE_BCST
210 * AIR_FLOOD_TYPE_MCST
211 * AIR_FLOOD_TYPE_UCST
212 * AIR_FLOOD_TYPE_QURY
213 * fld_en -- TRUE : flooding specific type frame for specific port
214 * FALSE: drop specific type frame for specific port
215 * OUTPUT:
216 * None
217 *
218 * RETURN:
219 * AIR_E_OK
220 * AIR_E_BAD_PARAMETER
221 * NOTES:
222 * None
223 */
224AIR_ERROR_NO_T
225air_sec_setFldMode(
226 const UI32_T unit,
227 const UI32_T port,
228 const AIR_FLOOD_TYPE_T type,
229 const BOOL_T fld_en);
230
231/* FUNCTION NAME: air_sec_getFldMode
232 * PURPOSE:
233 * Get per port flooding status for unknown type frame.
234 *
235 * INPUT:
236 * unit -- Select device ID
237 * port -- Select port to setting
238 * type -- AIR_FLOOD_TYPE_BCST
239 * AIR_FLOOD_TYPE_MCST
240 * AIR_FLOOD_TYPE_UCST
241 * AIR_FLOOD_TYPE_QURY
242 * OUTPUT:
243 * ptr_fld_en -- TRUE : flooding specific type frame for specific port
244 * FALSE: drop specific type frame for specific port
245 * RETURN:
246 * AIR_E_OK
247 * AIR_E_BAD_PARAMETER
248 *
249 * NOTES:
250 * None
251 */
252AIR_ERROR_NO_T
253air_sec_getFldMode(
254 const UI32_T unit,
255 const UI32_T port,
256 const AIR_FLOOD_TYPE_T type,
257 BOOL_T *ptr_fld_en);
258
259/* FUNCTION NAME: air_sec_setPortSecPortCfg
260 * PURPOSE:
261 * Set port security configurations for specific port.
262 *
263 * INPUT:
264 * unit -- Device ID
265 * port -- Port ID
266 * port_config -- Structure of port configuration.
267 *
268 * OUTPUT:
269 * None
270 *
271 * RETURN:
272 * AIR_E_OK
273 * AIR_E_BAD_PARAMETER
274 *
275 * NOTES:
276 * None
277 */
278AIR_ERROR_NO_T
279air_sec_setPortSecPortCfg(
280 const UI32_T unit,
281 const UI32_T port,
282 const AIR_SEC_PORTSEC_PORT_CONFIG_T port_config);
283
284/* FUNCTION NAME: air_sec_getPortSecPortCfg
285 * PURPOSE:
286 * Get port security configurations for specific port.
287 *
288 * INPUT:
289 * unit -- Device ID
290 * port -- Port ID
291 *
292 * OUTPUT:
293 * ptr_port_config -- Structure of port configuration.
294 *
295 * RETURN:
296 * AIR_E_OK
297 * AIR_E_BAD_PARAMETER
298 *
299 * NOTES:
300 * None
301 */
302AIR_ERROR_NO_T
303air_sec_getPortSecPortCfg(
304 const UI32_T unit,
305 const UI32_T port,
306 AIR_SEC_PORTSEC_PORT_CONFIG_T *ptr_port_config);
307
308#endif /* End of AIR_SEC_H */