SimpleLink CC3120/CC3220 Host Driver  Version 2.0.1.18
Simplifies the implementation of Internet connectivity
netcfg.h
1 /*
2  * Copyright (C) 2016 Texas Instruments Incorporated
3  *
4  * All rights reserved. Property of Texas Instruments Incorporated.
5  * Restricted rights to use, duplicate or disclose this code are
6  * granted through contract.
7  *
8  * The program may not be used without the written permission of
9  * Texas Instruments Incorporated or against the terms and conditions
10  * stipulated in the agreement under which this program has been supplied,
11  * and under no circumstances can it be used with non-TI connectivity device.
12  *
13  */
14 
15 
16 /*****************************************************************************/
17 /* Include files */
18 /*****************************************************************************/
19 #include <ti/drivers/net/wifi/simplelink.h>
20 
21 
22 #ifndef __NETCFG_H__
23 #define __NETCFG_H__
24 
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
44 /*****************************************************************************/
45 /* Macro declarations */
46 /*****************************************************************************/
47 
48 #define SL_MAC_ADDR_LEN (6)
49 #define SL_IPV6_ADDR_LEN (16)
50 #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) )
51 #define SL_IPV4_BYTE(val,index) ( (val >> (index*8)) & 0xFF )
52 
53 
54 #define SL_NETCFG_IF_IPV6_STA_LOCAL (0x4) /* disable ipv6 local */
55 #define SL_NETCFG_IF_IPV6_STA_GLOBAL (0x8) /* disable ipv6 global */
56 #define SL_NETCFG_IF_DISABLE_IPV4_DHCP (0x40) /* disable ipv4 dhcp */
57 #define SL_NETCFG_IF_IPV6_LOCAL_STATIC (0x80) /* enable ipv6 local static */
58 #define SL_NETCFG_IF_IPV6_LOCAL_STATELESS (0x100) /* enable ipv6 local stateless */
59 #define SL_NETCFG_IF_IPV6_LOCAL_STATEFUL (0x200) /* enable ipv6 local statefull */
60 #define SL_NETCFG_IF_IPV6_GLOBAL_STATIC (0x400) /* enable ipv6 global static */
61 #define SL_NETCFG_IF_IPV6_GLOBAL_STATEFUL (0x800) /* enable ipv6 global statefull */
62 #define SL_NETCFG_IF_DISABLE_IPV4_LLA (0x1000) /* disable LLA feature. Relevant only in IPV4 */
63 #define SL_NETCFG_IF_ENABLE_DHCP_RELEASE (0x2000) /* Enables DHCP release when WLAN disconnect command is issued */
64 #define SL_NETCFG_IF_IPV6_GLOBAL_STATELESS (0x4000) /* enable ipv6 global stateless */
65 #define SL_NETCFG_IF_DISABLE_FAST_RENEW (0x8000) /* fast renew disabled */
66 
67 
68 #define SL_NETCFG_IF_STATE (0)
69 #define SL_NETCFG_ADDR_DHCP (1)
70 #define SL_NETCFG_ADDR_DHCP_LLA (2)
71 #define SL_NETCFG_ADDR_RELEASE_IP (3)
72 #define SL_NETCFG_ADDR_STATIC (4)
73 #define SL_NETCFG_ADDR_STATELESS (5)
74 #define SL_NETCFG_ADDR_STATEFUL (6)
75 #define SL_NETCFG_ADDR_RELEASE_IP_SET (7)
76 #define SL_NETCFG_ADDR_RELEASE_IP_OFF (8)
77 #define SL_NETCFG_ADDR_ENABLE_FAST_RENEW (9)
78 #define SL_NETCFG_ADDR_DISABLE_FAST_RENEW (10)
79 #define SL_NETCFG_ADDR_FAST_RENEW_MODE_NO_WAIT_ACK (11)
80 #define SL_NETCFG_ADDR_FAST_RENEW_MODE_WAIT_ACK (12)
81 
82 
83 /*****************************************************************************/
84 /* Structure/Enum declarations */
85 /*****************************************************************************/
86 typedef enum
87 {
88  SL_NETCFG_MAC_ADDRESS_SET = 1,
89  SL_NETCFG_MAC_ADDRESS_GET = 2,
90  SL_NETCFG_AP_STATIONS_NUM_CONNECTED = 3,
91  SL_NETCFG_AP_STATIONS_INFO_LIST = 4,
92  SL_NETCFG_AP_STATION_DISCONNECT = 5,
93  SL_NETCFG_IF = 6,
94  SL_NETCFG_IPV4_STA_ADDR_MODE = 7,
95  SL_NETCFG_IPV4_AP_ADDR_MODE = 8,
96  SL_NETCFG_IPV6_ADDR_LOCAL = 9,
97  SL_NETCFG_IPV6_ADDR_GLOBAL = 10,
98  SL_NETCFG_IPV4_DHCP_CLIENT = 11,
99  SL_NETCFG_IPV4_DNS_CLIENT = 12,
100  MAX_SETTINGS = 0xFF
101 }SlNetCfg_e;
102 
103 typedef struct
104 {
105  _u32 DnsSecondServerAddr;
107 
108 
109 typedef struct
110 {
111  _u32 Ip;
112  _u32 Gateway;
113  _u32 Mask;
114  _u32 Dns[2];
115  _u32 DhcpServer;
116  _u32 LeaseTime;
117  _u32 TimeToRenew;
118  _u8 DhcpState;
119  _u8 Reserved[3];
121 
122 typedef enum
123 {
124  SL_NETCFG_DHCP_CLIENT_UNKNOWN = 0,
125  SL_NETCFG_DHCP_CLIENT_DISABLED,
126  SL_NETCFG_DHCP_CLIENT_ENABLED,
127  SL_NETCFG_DHCP_CLIENT_BOUND,
128  SL_NETCFG_DHCP_CLIENT_RENEW,
129  SL_NETCFG_DHCP_CLIENT_REBIND
130 }SlNetCfgIpv4DhcpClientState_e;
131 
132 
133 typedef enum
134 {
135  SL_NETCFG_DHCP_OPT_DISABLE_LLA = 0x2, /* 1=LLA disabled, 0=LLA enabled. */
136  SL_NETCFG_DHCP_OPT_RELEASE_IP_BEFORE_DISCONNECT = 0x4, /* 1=DHCP release enabled, 0=DHCP release disabled */
137  MAX_SL_NETCFG_DHCP_OPT = 0xFF
138 } SlNetCfgDhcpOption_e;
139 
140 
141 typedef struct
142 {
143  _u32 Ip;
144  _u32 IpMask;
145  _u32 IpGateway;
146  _u32 IpDnsServer;
148 
149 
150 typedef struct
151 {
152  _u32 Ip[4];
153  _u32 IpDnsServer[4];
154  _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. */
156 
157 #define _SL_NETCFG_IPV6_ADDR_BIT_STATUS 0x01
158 #define SL_IS_IPV6_ADDR_VALID(IpV6Flags) (IpV6Flags & _SL_NETCFG_IPV6_ADDR_BIT_STATUS)
159 
160 #define NET_CFG_STA_INFO_STATUS_DHCP_ADDR 1
161 
162 typedef struct
163 {
164  _u32 Ip;
165  _u8 MacAddr[6];
166  _u16 Status;
167  _u8 Name[32];
169 
170 
171 /*****************************************************************************/
172 /* Function prototypes */
173 /*****************************************************************************/
174 
433 #if _SL_INCLUDE_FUNC(sl_NetCfgSet)
434 _i16 sl_NetCfgSet(const _u16 ConfigId,const _u16 ConfigOpt,const _u16 ConfigLen,const _u8 *pValues);
435 #endif
436 
437 
626 #if _SL_INCLUDE_FUNC(sl_NetCfgGet)
627 _i16 sl_NetCfgGet(const _u16 ConfigId ,_u16 *pConfigOpt, _u16 *pConfigLen, _u8 *pValues);
628 #endif
629 
638 #ifdef __cplusplus
639 }
640 #endif /* __cplusplus */
641 
642 #endif /* __NETCFG_H__ */
643 
_i16 sl_NetCfgGet(const _u16 ConfigId, _u16 *pConfigOpt, _u16 *pConfigLen, _u8 *pValues)
Getting network configurations.
Definition: netcfg.c:85
_i16 sl_NetCfgSet(const _u16 ConfigId, const _u16 ConfigOpt, const _u16 ConfigLen, const _u8 *pValues)
Setting network configurations.
Definition: netcfg.c:42