blob: 2f80937722eda601bc4d796f1b9aa06a7eabf101 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*!
2 * @file nmu_util.h
3 * @author Roger Huang <chaomin.haung@mediatek.com>
4 * @version 1.0
5 * @section LICENSE
6 *
7 * This software is protected by Copyright and the information contained
8 * herein is confidential. The software may not be copied and the information
9 * contained herein may not be used or disclosed except with the written
10 * permission of MediaTek Inc. (C) 2005
11 *
12 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
13 * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
14 * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
15 * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
18 * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
19 * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
20 * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
21 * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
22 * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
23 * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
24 *
25 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
26 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
27 * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
28 * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
29 * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
30 *
31 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
32 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
33 * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
34 * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
35 * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
36 *
37 * @section DESCRIPTION
38 * This file provides utility interface of nmu ( network management unit )
39 */
40
41#ifndef _NMU_UTIL_H
42#define _NMU_UTIL_H
43
44#include "nmu.h"
45
46
47/*!
48 * @brief set ethernet interface up
49 * @param eth_id ethernet interface id
50 */
51void nmu_set_eth_up(kal_uint8 eth_id);
52
53
54/*
55 * @brief set ethernet interface down
56 * @param eth_id ethernet interface id
57 */
58void nmu_set_eth_down(kal_uint8 eth_id);
59
60
61/*
62 * @brief check if ethernet interface is up or not
63 * @param eth_id ethernet interface id
64 * @return KAL_TRUE if ethernet interface is up, KAL_FALSE if it's down
65 * attribute is set
66 */
67kal_bool nmu_check_eth_up(kal_uint8 eth_id);
68
69
70/*
71 * @brief set host mac address of ethernet interface
72 * @param eth_id ethernet interface id
73 * @param mac_address mac address to be written
74 */
75void nmu_set_host_mac(kal_uint8 eth_id, void* mac_address);
76
77
78/*
79 * @brief get host mac address of ethernet interface
80 * @param eth_id ethernet interface id
81 * @param mac_address mac address to be read
82 */
83void nmu_get_host_mac(kal_uint8 eth_id, void* mac_address);
84
85
86/*
87 * @brief set gateway mac address of ethernet interface
88 * @param eth_id ethernet interface id
89 * @param mac_address mac address to be written
90 */
91void nmu_set_gateway_mac(kal_uint8 eth_id, void* mac_address);
92
93
94/*
95 * @brief get gateway mac address of ethernet interface
96 * @param eth_id ethernet interface id
97 * @param mac_address mac address to be read
98 */
99void nmu_get_gateway_mac(kal_uint8 eth_id, void* mac_address);
100
101
102/*
103 * @brief set transmit packet counts of ethernet interface
104 * @param eth_id ethernet interface id
105 * @param value value to be written
106 */
107void nmu_set_eth_tx_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
108
109
110/*
111 * @brief add transmit packet counts of ethernet interface
112 * @param eth_id ethernet interface id
113 * @param value value to be added
114 */
115void nmu_add_eth_tx_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
116
117
118/*
119 * @brief get transmit packet counts of ethernet interface
120 * @param eth_id ethernet interface id
121 * @param value value to be read
122 */
123void nmu_get_eth_tx_pkt_cnt(kal_uint8 eth_id, nmu_stat_t* value);
124
125
126/*
127 * @brief set receive packet counts of ethernet interface
128 * @param eth_id ethernet interface id
129 * @param value value to be written
130 */
131void nmu_set_eth_rx_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
132
133
134/*
135 * @brief add receive packet counts of ethernet interface
136 * @param eth_id ethernet interface id
137 * @param value value to be added
138 */
139void nmu_add_eth_rx_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
140
141
142/*
143 * @brief get receive packet counts of ethernet interface
144 * @param eth_id ethernet interface id
145 * @param value value to be read
146 */
147void nmu_get_eth_rx_pkt_cnt(kal_uint8 eth_id, nmu_stat_t* value);
148
149
150/*
151 * @brief set transmit packet bytes of ethernet interface
152 * @param eth_id ethernet interface id
153 * @param value value to be written
154 */
155void nmu_set_eth_tx_byte_cnt(kal_uint8 eth_id, nmu_stat_t value);
156
157
158/*
159 * @brief add transmit packet bytes of ethernet interface
160 * @param eth_id ethernet interface id
161 * @param value value to be added
162 */
163void nmu_add_eth_tx_byte_cnt(kal_uint8 eth_id, nmu_stat_t value);
164
165
166/*
167 * @brief get transmit packet bytes of ethernet interface
168 * @param eth_id ethernet interface id
169 * @param value value to be read
170 */
171void nmu_get_eth_tx_byte_cnt(kal_uint8 eth_id, nmu_stat_t* value);
172
173
174/*
175 * @brief set receive packet bytes of ethernet interface
176 * @param eth_id ethernet interface id
177 * @param value value to be written
178 */
179void nmu_set_eth_rx_byte_cnt(kal_uint8 eth_id, nmu_stat_t value);
180
181
182/*
183 * @brief add receive packet bytes of ethernet interface
184 * @param eth_id ethernet interface id
185 * @param value value to be added
186 */
187void nmu_add_eth_rx_byte_cnt(kal_uint8 eth_id, nmu_stat_t value);
188
189
190/*
191 * @brief get receive packet bytes of ethernet interface
192 * @param eth_id ethernet interface id
193 * @param value value to be read
194 */
195void nmu_get_eth_rx_byte_cnt(kal_uint8 eth_id, nmu_stat_t* value);
196
197
198/*
199 * @brief set receive packet bytes of ethernet interface
200 * @param eth_id ethernet interface id
201 * @param value value to be written
202 */
203void nmu_set_eth_tx_error_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
204
205
206/*
207 * @brief add receive packet bytes of ethernet interface
208 * @param eth_id ethernet interface id
209 * @param value value to be added
210 */
211void nmu_add_eth_tx_error_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
212
213
214/*
215 * @brief get receive packet bytes of ethernet interface
216 * @param eth_id ethernet interface id
217 * @param value value to be read
218 */
219void nmu_get_eth_tx_error_pkt_cnt(kal_uint8 eth_id, nmu_stat_t* value);
220
221
222/*
223 * @brief set receive packet bytes of ethernet interface
224 * @param eth_id ethernet interface id
225 * @param value value to be written
226 */
227void nmu_set_eth_rx_error_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
228
229
230/*
231 * @brief add receive packet bytes of ethernet interface
232 * @param eth_id ethernet interface id
233 * @param value value to be added
234 */
235void nmu_add_eth_rx_error_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
236
237
238/*
239 * @brief get receive packet bytes of ethernet interface
240 * @param eth_id ethernet interface id
241 * @param value value to be read
242 */
243void nmu_get_eth_rx_error_pkt_cnt(kal_uint8 eth_id, nmu_stat_t* value);
244
245/*
246 * @brief set transmit dropped packet counts of ethernet interface
247 * @param eth_id ethernet interface id
248 * @param value value to be written
249 */
250void nmu_set_eth_tx_drop_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
251
252
253/*
254 * @brief add transmit dropped packet counts of ethernet interface
255 * @param eth_id ethernet interface id
256 * @param value value to be added
257 */
258void nmu_add_eth_tx_drop_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
259
260
261/*
262 * @brief get transmit dropped packet counts of ethernet interface
263 * @param eth_id ethernet interface id
264 * @param value value to be read
265 */
266void nmu_get_eth_tx_drop_pkt_cnt(kal_uint8 eth_id, nmu_stat_t* value);
267
268
269/*
270 * @brief set receive dropped packet counts of ethernet interface
271 * @param eth_id ethernet interface id
272 * @param value value to be written
273 */
274void nmu_set_eth_rx_drop_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
275
276
277/*
278 * @brief add receive dropped packet counts of ethernet interface
279 * @param eth_id ethernet interface id
280 * @param value value to be added
281 */
282void nmu_add_eth_rx_drop_pkt_cnt(kal_uint8 eth_id, nmu_stat_t value);
283
284
285/*
286 * @brief get receive dropped packet counts of ethernet interface
287 * @param eth_id ethernet interface id
288 * @param value value to be read
289 */
290void nmu_get_eth_rx_drop_pkt_cnt(kal_uint8 eth_id, nmu_stat_t* value);
291
292
293/*
294 * @brief set receive dropped packet counts of ethernet interface
295 * @param eth_id ethernet interface id
296 * @param value value to be written
297 */
298void nmu_set_eth_rx_frame_align_error_cnt(kal_uint8 eth_id, nmu_stat_t value);
299
300
301/*
302 * @brief add receive dropped packet counts of ethernet interface
303 * @param eth_id ethernet interface id
304 * @param value value to be added
305 */
306void nmu_add_eth_rx_frame_align_error_cnt(kal_uint8 eth_id, nmu_stat_t value);
307
308
309/*
310 * @brief get receive packet bytes of ethernet interface
311 * @param eth_id ethernet interface id
312 * @param value value to be read
313 */
314void nmu_get_eth_rx_frame_align_error_cnt(kal_uint8 eth_id, nmu_stat_t* value);
315
316
317/*
318 * @brief set ipv4 instance IPv4 up
319 * @param ip_id ip instance id
320 */
321void nmu_set_ip4_up(kal_uint8 ip_id);
322
323
324/*
325 * @brief set ip instance IPv4 down
326 * @param ip_id ip instance id
327 */
328void nmu_set_ip4_down(kal_uint8 ip_id);
329
330
331/*
332 * @brief check ip instance IPv4 is up or not
333 * @param ip_id ip instance id
334 * @return KAL_TRUE if IPv4 is up, KAL_FALSE if not
335 */
336kal_bool nmu_check_ip4_up(kal_uint8 ip_id);
337
338
339/*
340 * @brief set IPv4 address of ip instance
341 * @param ip_id ip instance id
342 * @param ip_address IPv4 address to be written
343 */
344void nmu_set_ip4_ip(kal_uint8 ip_id, void* ip_address);
345
346
347/*
348 * @brief get IPv4 address of ip instance
349 * @param ip_id ip instance id
350 * @param ip_address IPv4 address to be read
351 */
352void nmu_get_ip4_ip(kal_uint8 ip_id, void* ip_address);
353
354
355/*
356 * @brief set IPv4 netmask of ip instance
357 * @param ip_id ip instance id
358 * @param mask IPv4 netmask to be written
359 */
360void nmu_set_ip4_mask(kal_uint8 ip_id, void* mask);
361
362
363/*
364 * @brief set IPv4 netmask of ip instance
365 * @param ip_id ip instance id
366 * @param mask IPv4 netmask to be written
367 */
368void nmu_get_ip4_mask(kal_uint8 ip_id, void* mask);
369
370
371/*
372 * @brief set IPv4 gateway address of ip instance
373 * @param ip_id ip instance id
374 * @param gateway IPv4 address to be written
375 */
376void nmu_set_ip4_gateway(kal_uint8 ip_id, void* gateway);
377
378
379/*
380 * @brief get IPv4 gateway address of ip instance
381 * @param ip_id ip instance id
382 * @param gateway IPv4 address to be read
383 */
384void nmu_get_ip4_gateway(kal_uint8 ip_id, void* gateway);
385
386
387/*
388 * @brief set IPv4 mtu size of ip instance
389 * @param ip_id ip instance id
390 * @param mtu_size mtu size to be written
391 */
392void nmu_set_ip4_mtu_size(kal_uint8 ip_id, kal_uint16 mtu_size);
393
394
395/*
396 * @brief get IPv4 mtu size of ip instance
397 * @param ip_id ip instance id
398 * @param mtu_size mtu size to be read
399 */
400void nmu_get_ip4_mtu_size(kal_uint8 ip_id, kal_uint16* mtu_size);
401
402
403/*
404 * @brief set total number of IPv4 DNS servers of ip instance
405 * @param ip_id ip instance id
406 * @param dns_num total number to be written
407 */
408void nmu_set_ip4_dns_num(kal_uint8 ip_id, kal_uint8 dns_num);
409
410
411/*
412 * @brief get total number of IPv4 DNS servers of ip instance
413 * @param ip_id ip instance id
414 * @param dns_num total number to be read
415 */
416void nmu_get_ip4_dns_num(kal_uint8 ip_id, kal_uint8* dns_num);
417
418
419/*
420 * @brief set DNS server IPv4 address of ip instance
421 * @param ip_id ip instance id
422 * @param dns_id dns server no
423 * @param dns IPv4 address to be written
424 */
425void nmu_set_ip4_dns(kal_uint8 ip_id, kal_uint8 dns_id, void* dns);
426
427
428/*
429 * @brief get DNS server IPv4 address of ip instance
430 * @param ip_id ip instance id
431 * @param dns_id dns server no
432 * @param dns IPv4 address to be read
433 */
434void nmu_get_ip4_dns(kal_uint8 ip_id, kal_uint8 dns_id, void* dns);
435
436
437/*
438 * @brief set ip instance IPv6 up
439 * @param ip_id ip instance id
440 */
441void nmu_set_ip6_up(kal_uint8 ip_id);
442
443
444/*
445 * @brief set ip instance IPv6 down
446 * @param ip_id ip instance id
447 */
448void nmu_set_ip6_down(kal_uint8 ip_id);
449
450
451/*
452 * @brief check ip instance IPv6 is up or not
453 * @param ip_id ip instance id
454 * @return KAL_TRUE if IPv6 is up, KAL_FALSE if not
455 */
456kal_bool nmu_check_ip6_up(kal_uint8 ip_id);
457
458
459/*
460 * @brief set IPv6 mtu size of ip instance
461 * @param ip_id ip instance id
462 * @param mtu_size mtu size to be written
463 */
464void nmu_set_ip6_mtu_size(kal_uint8 ip_id, kal_uint32 mtu_size);
465
466
467/*
468 * @brief get IPv6 mtu size of ip instance
469 * @param ip_id ip instance id
470 * @param mtu_size mtu size to be read
471 */
472void nmu_get_ip6_mtu_size(kal_uint8 ip_id, kal_uint32* mtu_size);
473
474
475/*
476 * @brief set IPv6 prefix length of ip instance
477 * @param ip_id ip instance id
478 * @param prefix_len prefix length to be written
479 */
480void nmu_set_ip6_prefix_len(kal_uint8 ip_id, kal_uint8 prefix_len);
481
482
483/*
484 * @brief get IPv6 prefix length of ip instance
485 * @param ip_id ip instance id
486 * @param prefix_len prefix length to be read
487 */
488void nmu_get_ip6_prefix_len(kal_uint8 ip_id, kal_uint8* prefix_len);
489
490
491/*
492 * @brief set IPv6 prefix of ip instance
493 * @param ip_id ip instance id
494 * @param prefix_len prefix to be written
495 */
496void nmu_set_ip6_prefix(kal_uint8 ip_id, void* prefix);
497
498
499/*
500 * @brief get IPv6 prefix of ip instance
501 * @param ip_id ip instance id
502 * @param prefix_len prefix to be read
503 */
504void nmu_get_ip6_prefix(kal_uint8 ip_id, void* prefix);
505
506
507/*
508 * @brief set IPv6 interface identifier length of ip instance
509 * @param ip_id ip instance id
510 * @param iid_len interface identifier length to be written
511 */
512void nmu_set_ip6_iid_len(kal_uint8 ip_id, kal_uint8 iid_len);
513
514
515/*
516 * @brief get IPv6 interface identifier length of ip instance
517 * @param ip_id ip instance id
518 * @param iid_len interface identifier length to be read
519 */
520void nmu_get_ip6_iid_len(kal_uint8 ip_id, kal_uint8* iid_len);
521
522
523/*
524 * @brief set IPv6 interface identifier of ip instance
525 * @param ip_id ip instance id
526 * @param iid_len interface identifier to be written
527 */
528void nmu_set_ip6_iid(kal_uint8 ip_id, void* iid);
529
530
531/*
532 * @brief get IPv6 interface identifier of ip instance
533 * @param ip_id ip instance id
534 * @param iid_len interface identifier to be read
535 */
536void nmu_get_ip6_iid(kal_uint8 ip_id, void* iid);
537
538
539/*
540 * @brief set total number of IPv6 DNS servers of ip instance
541 * @param ip_id ip instance id
542 * @param dns_num total number to be written
543 */
544void nmu_set_ip6_dns_num(kal_uint8 ip_id, kal_uint8 dns_num);
545
546
547/*
548 * @brief get total number of IPv6 DNS servers of ip instance
549 * @param ip_id ip instance id
550 * @param dns_num total number to be read
551 */
552void nmu_get_ip6_dns_num(kal_uint8 ip_id, kal_uint8* dns_num);
553
554
555/*
556 * @brief set DNS server IPv6 address of ip instance
557 * @param ip_id ip instance id
558 * @param dns_id dns server no
559 * @param dns IPv6 address to be written
560 */
561void nmu_set_ip6_dns(kal_uint8 ip_id, kal_uint8 dns_id, void* dns);
562
563
564/*
565 * @brief get DNS server IPv6 address of ip instance
566 * @param ip_id ip instance id
567 * @param dns_id dns server no
568 * @param dns IPv6 address to be read
569 */
570void nmu_get_ip6_dns(kal_uint8 ip_id, kal_uint8 dns_id, void* dns);
571
572
573/*
574 * @brief set fake netmask and gateway through real ip address
575 * @param ip_id ip instance id
576 * @param ip_address IPv4 address used to calculated fake netmask and gateway
577 */
578void nmu_set_ip4_fake_mask_and_gateway(kal_uint8 ip_id, void *ip_address);
579
580
581#endif // _NMU_UTIL_H
582