• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (c) 2022 Huawei Device Co., Ltd.
4  *
5  * Description: Provide NewIP universal library.
6  *
7  * Author: Yang Yanjun <yangyanjun@huawei.com>
8  *
9  * Data: 2022-07-18
10  */
11 #ifndef _NIP_LIB_H
12 #define _NIP_LIB_H
13 
14 /* AF_NINET by reading/sys/module/newip/parameters/af_ninet file to get the type value */
15 #define AF_NINET 45
16 
17 #define DEMO_INPUT_1  2  /* The DEMO program contains one parameter */
18 #define DEMO_INPUT_2  3
19 #define DEMO_INPUT_3  4
20 #define DEMO_INPUT_4  5
21 
22 /* Change the value based on the actual interface */
23 #define NIC_NAME       "wlan0"
24 #define NIC_NAME_CHECK "wlan"
25 #define CMD_ADD        "add"
26 #define CMD_DEL        "del"
27 
28 #define BUFLEN          1024
29 #define LISTEN_MAX      3
30 #define PKTCNT          10      /* Number of sent packets */
31 #define PKTLEN          1024    /* Length of sent packet */
32 #define SLEEP_US        500000  /* Packet sending interval (ms) */
33 #define SELECT_TIME     600
34 #define TCP_SERVER_PORT 5556    /* TCP Server Port */
35 #define UDP_SERVER_PORT 9090    /* UDP Server Port */
36 #define TIMEOUT_SEC     2
37 #define BITS_PER_BYTE   8
38 
39 #define ARRAY_LEN     255
40 
41 int nip_get_ifindex(const char *ifname, int *ifindex);
42 int nip_get_addr(char **args, struct nip_addr *addr);
43 
44 #endif /* _NIP_LIB_H */
45