SimpleLink CC31xx/CC32xx Host Driver  Version 3.0.1.55
Simplifies the implementation of Internet connectivity
netcfg.h
1 /*
2  * netcfg.h - CC31xx/CC32xx Host Driver Implementation
3  *
4  * Copyright (C) 2017 Texas Instruments Incorporated - https://www.ti.com/
5  *
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35 */
36 
37 
38 
39 /*****************************************************************************/
40 /* Include files */
41 /*****************************************************************************/
42 #include <ti/drivers/net/wifi/simplelink.h>
43 
44 
45 #ifndef __NETCFG_H__
46 #define __NETCFG_H__
47 
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
67 /*****************************************************************************/
68 /* Macro declarations */
69 /*****************************************************************************/
70 
71 #define SL_MAC_ADDR_LEN (6)
72 #define SL_IPV6_ADDR_LEN (16)
73 #define SL_IPV4_VAL(add_3,add_2,add_1,add_0) ((((_u32)add_3 << 24) & 0xFF000000) | (((_u32)add_2 << 16) & 0xFF0000) | (((_u32)add_1 << 8) & 0xFF00) | ((_u32)add_0 & 0xFF) )
74 #define SL_IPV6_VAL(add_1,add_2) ((((_u32)add_1 << 16) & 0xFFFF0000) | (((_u32)add_2 ) & 0x0000FFFF) )
75 #define SL_IPV4_BYTE(val,index) ( (val >> (index*8)) & 0xFF )
76 
77 
78 #define SL_NETCFG_IF_IPV6_STA_LOCAL (0x4) /* disable ipv6 local */
79 #define SL_NETCFG_IF_IPV6_STA_GLOBAL (0x8) /* disable ipv6 global */
80 #define SL_NETCFG_IF_DISABLE_IPV4_DHCP (0x40) /* disable ipv4 dhcp */
81 #define SL_NETCFG_IF_IPV6_LOCAL_STATIC (0x80) /* enable ipv6 local static */
82 #define SL_NETCFG_IF_IPV6_LOCAL_STATELESS (0x100) /* enable ipv6 local stateless */
83 #define SL_NETCFG_IF_IPV6_LOCAL_STATEFUL (0x200) /* enable ipv6 local statefull */
84 #define SL_NETCFG_IF_IPV6_GLOBAL_STATIC (0x400) /* enable ipv6 global static */
85 #define SL_NETCFG_IF_IPV6_GLOBAL_STATEFUL (0x800) /* enable ipv6 global statefull */
86 #define SL_NETCFG_IF_DISABLE_IPV4_LLA (0x1000) /* disable LLA feature. Relevant only in IPV4 */
87 #define SL_NETCFG_IF_ENABLE_DHCP_RELEASE (0x2000) /* Enables DHCP release when WLAN disconnect command is issued */
88 #define SL_NETCFG_IF_IPV6_GLOBAL_STATELESS (0x4000) /* enable ipv6 global stateless */
89 #define SL_NETCFG_IF_DISABLE_FAST_RENEW (0x8000) /* fast renew disabled */
90 
91 
92 #define SL_NETCFG_IF_STATE (0)
93 #define SL_NETCFG_ADDR_DHCP (1)
94 #define SL_NETCFG_ADDR_DHCP_LLA (2)
95 #define SL_NETCFG_ADDR_STATIC (4)
96 #define SL_NETCFG_ADDR_STATELESS (5)
97 #define SL_NETCFG_ADDR_STATEFUL (6)
98 #define SL_NETCFG_ADDR_RELEASE_IP_SET (7)
99 #define SL_NETCFG_ADDR_RELEASE_IP_OFF (8)
100 #define SL_NETCFG_ADDR_ENABLE_FAST_RENEW (9)
101 #define SL_NETCFG_ADDR_DISABLE_FAST_RENEW (10)
102 #define SL_NETCFG_ADDR_FAST_RENEW_MODE_NO_WAIT_ACK (11)
103 #define SL_NETCFG_ADDR_FAST_RENEW_MODE_WAIT_ACK (12)
104 
105 
106 /*****************************************************************************/
107 /* Structure/Enum declarations */
108 /*****************************************************************************/
109 typedef enum
110 {
111  SL_NETCFG_MAC_ADDRESS_SET = 1,
112  SL_NETCFG_MAC_ADDRESS_GET = 2,
113  SL_NETCFG_AP_STATIONS_NUM_CONNECTED = 3,
114  SL_NETCFG_AP_STATIONS_INFO_LIST = 4,
115  SL_NETCFG_AP_STATION_DISCONNECT = 5,
116  SL_NETCFG_IF = 6,
117  SL_NETCFG_IPV4_STA_ADDR_MODE = 7,
118  SL_NETCFG_IPV4_AP_ADDR_MODE = 8,
119  SL_NETCFG_IPV6_ADDR_LOCAL = 9,
120  SL_NETCFG_IPV6_ADDR_GLOBAL = 10,
121  SL_NETCFG_IPV4_DHCP_CLIENT = 11,
122  SL_NETCFG_IPV4_DNS_CLIENT = 12,
123  SL_NETCFG_IPV6_DNS_CLIENT = 13,
124  MAX_SETTINGS = 0xFF
125 }SlNetCfg_e;
126 
127 typedef struct
128 {
129  _u32 DnsSecondServerAddr;
131 
132 typedef struct
133 {
134  _u32 DnsSecondServerAddr[4];
136 
137 
138 typedef struct
139 {
140  _u32 Ip;
141  _u32 Gateway;
142  _u32 Mask;
143  _u32 Dns[2];
144  _u32 DhcpServer;
145  _u32 LeaseTime;
146  _u32 TimeToRenew;
147  _u8 DhcpState;
148  _u8 Reserved[3];
150 
151 typedef enum
152 {
153  SL_NETCFG_DHCP_CLIENT_UNKNOWN = 0,
154  SL_NETCFG_DHCP_CLIENT_DISABLED,
155  SL_NETCFG_DHCP_CLIENT_ENABLED,
156  SL_NETCFG_DHCP_CLIENT_BOUND,
157  SL_NETCFG_DHCP_CLIENT_RENEW,
158  SL_NETCFG_DHCP_CLIENT_REBIND
159 }SlNetCfgIpv4DhcpClientState_e;
160 
161 
162 typedef enum
163 {
164  SL_NETCFG_DHCP_OPT_DISABLE_LLA = 0x2, /* 1=LLA disabled, 0=LLA enabled. */
165  SL_NETCFG_DHCP_OPT_RELEASE_IP_BEFORE_DISCONNECT = 0x4, /* 1=DHCP release enabled, 0=DHCP release disabled */
166  MAX_SL_NETCFG_DHCP_OPT = 0xFF
167 } SlNetCfgDhcpOption_e;
168 
169 typedef struct
170 {
171  _u32 Ip;
172  _u32 IpMask;
173  _u32 IpGateway;
174  _u32 IpDnsServer;
176 
177 typedef struct
178 {
179  _u32 Ip[4];
180  _u32 IpDnsServer[4];
181  _u32 IpV6Flags; /* bit 0: Indicate if the address is valid for use in the network (IPv6 DAD completed) . If not, try again later or set a different address. 1=Valid. Relevant for sl_NetCfgGet only. */
183 
184 #define _SL_NETCFG_IPV6_ADDR_BIT_STATUS 0x01
185 #define SL_IS_IPV6_ADDR_VALID(IpV6Flags) (IpV6Flags & _SL_NETCFG_IPV6_ADDR_BIT_STATUS)
186 
187 #define NET_CFG_STA_INFO_STATUS_DHCP_ADDR 1
188 
189 typedef struct
190 {
191  _u32 Ip;
192  _u8 MacAddr[6];
193  _u16 Status;
194  _u8 Name[32];
196 
197 /*****************************************************************************/
198 /* Function prototypes */
199 /*****************************************************************************/
200 
484 #if _SL_INCLUDE_FUNC(sl_NetCfgSet)
485 _i16 sl_NetCfgSet(const _u16 ConfigId,const _u16 ConfigOpt,const _u16 ConfigLen,const _u8 *pValues);
486 #endif
487 
488 
689 #if _SL_INCLUDE_FUNC(sl_NetCfgGet)
690 _i16 sl_NetCfgGet(const _u16 ConfigId ,_u16 *pConfigOpt, _u16 *pConfigLen, _u8 *pValues);
691 #endif
692 
701 #ifdef __cplusplus
702 }
703 #endif /* __cplusplus */
704 
705 #endif /* __NETCFG_H__ */
706 
_i16 sl_NetCfgGet(const _u16 ConfigId, _u16 *pConfigOpt, _u16 *pConfigLen, _u8 *pValues)
Getting network configurations.
Definition: netcfg.c:104
_i16 sl_NetCfgSet(const _u16 ConfigId, const _u16 ConfigOpt, const _u16 ConfigLen, const _u8 *pValues)
Setting network configurations.
Definition: netcfg.c:63