RDK-B
wan_hal.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's LICENSE file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2019 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 #ifndef __WAN_HAL_H__
21 #define __WAN_HAL_H__
22 
23 #include <stdint.h>
24 
25 /**
26  * @defgroup WAN_HAL WAN HAL
27  *
28  * @defgroup WAN_HAL_TYPES WAN HAL Data Types
29  * @ingroup WAN_HAL
30  *
31  * @defgroup WAN_HAL_APIS WAN HAL APIs
32  * @ingroup WAN_HAL
33  *
34  **/
35 
36 /**
37  * @addtogroup WAN_HAL_TYPES
38  * @{
39  */
40 
41 #define RETURN_ERROR 1
42 #define RETURN_OK 0
43 
44 #define BUFLEN_8 8
45 #define BUFLEN_32 32
46 #define BUFLEN_64 64
47 
48 typedef enum
49 {
54 } t_eWanMode;
55 
56 typedef struct
58 {
59  char ifname[64]; // interface name (erouter0)
60  char subnetmask[64]; // subnet mask
61  char ipaddress[64]; // ip address to assign (192.168.0.1)
62  char dnsservers[256]; // new-line separated list of servers to be added
63  char defaultgateway[64]; // default gateway address
64 
66 
67 typedef struct
69 {
70  char ifname[64]; // interface name (erouter0)
71  char ipaddress[128]; // ip address to assign
72  char dnsservers[512]; // new-line separated list of servers to be added
75 
77 
78 /*
79  * The WAN_QOS_QUEUE structure needed in ccsp-wanagent and wan-hal
80  */
81 typedef struct
83 {
84  unsigned long InstanceNumber;
85  char Alias[64];
86  unsigned long queueKey;
87  unsigned char queueEnable;
88  char queueStatus[256];
89  char queueInterface[256];
90  unsigned long queueWeight;
91  unsigned long queuePrecedence;
92  unsigned long REDThreshold;
93  char dropAlgorithm[256];
94  char schedulerAlgorithm[256];
95  signed long shapingRate;
96  unsigned long shapingBurstSize;
97  signed long MinBitRate;
98  char QueueName[256];
99  signed long DslLatency;
100  signed long PtmPriority;
101  unsigned long QueueId;
102  unsigned long LowClassMaxThreshold;
103  unsigned long LowClassMinThreshold;
104  unsigned long HighClassMinThreshold;
105  unsigned long HighClassMaxThreshold;
106  char L2DeviceType[32];
107 
109 
110 /* * MAPT */
111 typedef struct
113 {
114  char ifName[64];
115  char brIPv6Prefix[128];
116  char ruleIPv4Prefix[128];
117  char ruleIPv6Prefix[128];
118  unsigned int psidOffset;
119  unsigned int ratio;
120  char pdIPv6Prefix[128];
121 
123 
124 /**
125  * Structure for SELFHEAL configuration which is required in ccsp-wanagent
126  * and wan hal. */
127 typedef struct
129 {
130  unsigned int rebootStatus;
131 }
133 
134 /** @} */ //END OF GROUP WAN_HAL_TYPES
135 
136 /**
137  * @addtogroup WAN_HAL_APIS
138  * @{
139  */
140 
141 /* wan_hal_Init() function */
142 /**
143 * @description - Initialise the wan features
144 *
145 * @return The status of the operation
146 * @retval RETURN_OK if successful
147 * @retval RETURN_ERR if any error is detected
148 *
149 */
150 int wan_hal_Init();
151 
152 /* wan_hal_SetWanmode() function */
153 /**
154 * @description Set wanmode value
155 *
156 * @param pValue - the WANMODE value to be set
157 *
158 * @return The status of the operation
159 * @retval RETURN_OK if successful
160 * @retval RETURN_ERR if any error is detected
161 *
162 */
164 
165 /* wan_hal_SetWanConnectionEnable() function */
166 /**
167 * @description Set wanconnection enable value
168 *
169 * @param pValue - the WanConnectionEnable value to be set
170 *
171 * @return The status of the operation
172 * @retval RETURN_OK if successful
173 * @retval RETURN_ERR if any error is detected
174 *
175 */
176 int wan_hal_SetWanConnectionEnable(unsigned int enable);
177 /**
178 * @description Set SelfHeal Configuration to wanmanager
179 *
180 * @param pSelfHealConfig - Ptr to struct contains the configuration
181 *
182 * @return The status of the operation
183 * @retval RETURN_OK if successful
184 * @retval RETURN_ERR if any error is detected
185 *
186 */
187 int wan_hal_SetSelfHealConfig(PSELFHEAL_CONFIG pSelfHealConfig);
188 
189 /* wanmgr_hal_GetWanOEUpstreamCurrRate() function */
190 /**
191 * @description Get the current payload bandwidth of the upstream WANoE Connection
192 *
193 * @param pValue - Pointer field where the current payload bandwidth to be updated
194 *
195 * @return The status of the operation
196 * @retval RETURN_OK if successful
197 * @retval RETURN_ERR if any error is detected
198 *
199 */
200 int wan_hal_GetWanOEUpstreamCurrRate(unsigned int *pValue);
201 
202 /* wanmgr_hal_GetWanOEDownstreamCurrRate() function */
203 /**
204 * @description Get the current payload bandwidth of the downstream WANoE Connection
205 *
206 * @param pValue - Pointer field where the current payload bandwidth to be updated
207 *
208 * @return The status of the operation
209 * @retval RETURN_OK if successful
210 * @retval RETURN_ERR if any error is detected
211 *
212 */
213 int wan_hal_GetWanOEDownstreamCurrRate(unsigned int *pValue);
214 
215 /* wan_hal_SetQosConfiguration() function */
216 /**
217 * @description Sets the current QoS configuration
218 *
219 * @param queueInfo - QoS configurations to be set
220 * @param QueueNumberOfEntries - The number of QoS profiles
221 * @param baseifname - Base interface name
222 * @param wanifname - Wan interface name
223 *
224 * @return The status of the operation
225 * @retval RETURN_OK if successful
226 * @retval RETURN_ERR if any error is detected
227 *
228 */
229 int wan_hal_SetQoSConfiguration(PWAN_QOS_QUEUE pQueue, unsigned int QueueNumberOfEntries, const char* baseifname, const char* wanifname);
230 
231 /* wan_hal_ConfigureIpv4() function */
232 /**
233 * @description configure IPv4 dnsservers, netmask and ip address for the required interface
234 *
235 * @param pWanIpv4Cfg - fill needed WAN_IPV4_CFG information
236 *
237 * @return The status of the operation
238 * @retval RETURN_OK if successful
239 * @retval RETURN_ERR if any error is detected
240 *
241 */
242 int wan_hal_ConfigureIpv4(PWAN_IPV4_CFG pWanIpv4Cfg);
243 
244 /* wan_hal_UnConfigureIpv4() function */
245 /**
246 * @description unconfigure IPv4 dnsservers, netmask and ip address for the required interface
247 *
248 * @param pWanIpv4Cfg - fill needed WAN_IPV4_CFG information
249 *
250 * @return The status of the operation
251 * @retval RETURN_OK if successful
252 * @retval RETURN_ERR if any error is detected
253 *
254 */
255 int wan_hal_UnConfigureIpv4(PWAN_IPV4_CFG pWanIpv4Cfg);
256 
257 /* wan_hal_ConfigureIpv6() function */
258 /**
259 * @description Add IPv6 address for the required interface
260 *
261 * @param pWanIpv6Cfg - fill needed WAN_IPV6_CFG information
262 *
263 * @return The status of the operation
264 * @retval RETURN_OK if successful
265 * @retval RETURN_ERR if any error is detected
266 *
267 */
268 int wan_hal_ConfigureIpv6(PWAN_IPV6_CFG pWanIpv6Cfg);
269 
270 /* wan_hal_UnConfigureIpv4() function */
271 /**
272 * @description Delete IPv6 address for the required interface
273 *
274 * @param pWanIpv6Cfg - fill needed WAN_IPV6_CFG information
275 *
276 * @return The status of the operation
277 * @retval RETURN_OK if successful
278 * @retval RETURN_ERR if any error is detected
279 *
280 */
281 int wan_hal_UnConfigureIpv6(PWAN_IPV6_CFG pWanIpv6Cfg);
282 
283 /* wan_hal_EnableMapt() function */
284 /**
285 * @description Enable MAPT for the required interface
286 *
287 * @param pMAPTCfg - Needs to fill PWAN_MAPT_CFG params
288 *
289 * @return The status of the operation
290 * @retval RETURN_OK if successful
291 * @retval RETURN_ERR if any error is detected
292 *
293 */
294 int wan_hal_EnableMapt( PWAN_MAPT_CFG pMAPTCfg );
295 
296 /* wan_hal_DisableMapt() function */
297 /**
298 * @description Disable MAPT for the required interface
299 *
300 * @param ifName - interface name
301 *
302 * @return The status of the operation
303 * @retval RETURN_OK if successful
304 * @retval RETURN_ERR if any error is detected
305 *
306 */
307 int wan_hal_DisableMapt(const char* ifName);
308 
309 /**
310  * @description Set/Reset WanOE mode based on the enable flag. If it is
311  * true, update the boardparam to set WAN_ETH_MODE in the CPE. Else disabled
312  * the WAN_ETH_MODE and reclaim ethernet port.
313  * @param enable flag indicates to enable or disable ETH_WAN mode in CPE.
314  */
315 int wan_hal_enableWanOEMode(const unsigned char enable);
316 
317 /**
318  * @description Get authentication information like ADSL username and password.
319  * @param autInfo to hold the authentication data
320  * @retval RETURN_OK if successful else RETURN_ERR
321  */
322 int wan_hal_getAuthInfo(char *authInfo);
323 
324 /** @} */ //END OF GROUP WAN_HAL_APIS
325 #endif /* __WAN_HAL_H__ */
WAN_MAPT_CFG
struct _WAN_MAPT_CFG WAN_MAPT_CFG
WAN_MODE_DSL_ONLY
@ WAN_MODE_DSL_ONLY
Definition: wan_hal.h:51
_WAN_IPV6_CFG::preferredlifetime
int preferredlifetime
Definition: wan_hal.h:73
_WAN_QOS_QUEUE::queueKey
unsigned long queueKey
Definition: wan_hal.h:86
t_eWanMode
t_eWanMode
Definition: wan_hal.h:48
_WAN_QOS_QUEUE::LowClassMinThreshold
unsigned long LowClassMinThreshold
Definition: wan_hal.h:103
WAN_QOS_QUEUE
struct _WAN_QOS_QUEUE WAN_QOS_QUEUE
wan_hal_SetQoSConfiguration
int wan_hal_SetQoSConfiguration(PWAN_QOS_QUEUE pQueue, unsigned int QueueNumberOfEntries, const char *baseifname, const char *wanifname)
_WAN_QOS_QUEUE::InstanceNumber
unsigned long InstanceNumber
Definition: wan_hal.h:84
PWAN_IPV6_CFG
struct _WAN_IPV6_CFG * PWAN_IPV6_CFG
_WAN_IPV4_CFG::subnetmask
char subnetmask[64]
Definition: wan_hal.h:60
SELFHEAL_CONFIG
struct _SELFHEAL_CONFIG SELFHEAL_CONFIG
WAN_IPV4_CFG
struct _WAN_IPV4_CFG WAN_IPV4_CFG
_WAN_QOS_QUEUE::shapingRate
signed long shapingRate
Definition: wan_hal.h:95
_WAN_MAPT_CFG::ratio
unsigned int ratio
Definition: wan_hal.h:119
_WAN_QOS_QUEUE::PtmPriority
signed long PtmPriority
Definition: wan_hal.h:100
_WAN_IPV4_CFG::dnsservers
char dnsservers[256]
Definition: wan_hal.h:62
wan_hal_SetWanConnectionEnable
int wan_hal_SetWanConnectionEnable(unsigned int enable)
PWAN_MAPT_CFG
struct _WAN_MAPT_CFG * PWAN_MAPT_CFG
_WAN_MAPT_CFG
Definition: wan_hal.h:111
wan_hal_EnableMapt
int wan_hal_EnableMapt(PWAN_MAPT_CFG pMAPTCfg)
wan_hal_DisableMapt
int wan_hal_DisableMapt(const char *ifName)
_WAN_IPV4_CFG::ipaddress
char ipaddress[64]
Definition: wan_hal.h:61
_SELFHEAL_CONFIG
Definition: wan_hal.h:127
wan_hal_UnConfigureIpv4
int wan_hal_UnConfigureIpv4(PWAN_IPV4_CFG pWanIpv4Cfg)
_WAN_IPV4_CFG::defaultgateway
char defaultgateway[64]
Definition: wan_hal.h:63
_WAN_QOS_QUEUE::MinBitRate
signed long MinBitRate
Definition: wan_hal.h:97
_WAN_QOS_QUEUE::shapingBurstSize
unsigned long shapingBurstSize
Definition: wan_hal.h:96
_WAN_QOS_QUEUE::HighClassMinThreshold
unsigned long HighClassMinThreshold
Definition: wan_hal.h:104
wan_hal_GetWanOEUpstreamCurrRate
int wan_hal_GetWanOEUpstreamCurrRate(unsigned int *pValue)
wan_hal_GetWanOEDownstreamCurrRate
int wan_hal_GetWanOEDownstreamCurrRate(unsigned int *pValue)
_WAN_QOS_QUEUE::HighClassMaxThreshold
unsigned long HighClassMaxThreshold
Definition: wan_hal.h:105
_WAN_QOS_QUEUE::QueueId
unsigned long QueueId
Definition: wan_hal.h:101
PWAN_IPV4_CFG
struct _WAN_IPV4_CFG * PWAN_IPV4_CFG
WAN_MODE_ETH_ONLY
@ WAN_MODE_ETH_ONLY
Definition: wan_hal.h:52
_SELFHEAL_CONFIG::rebootStatus
unsigned int rebootStatus
Definition: wan_hal.h:130
_WAN_IPV4_CFG
Definition: wan_hal.h:56
PSELFHEAL_CONFIG
struct _SELFHEAL_CONFIG * PSELFHEAL_CONFIG
wan_hal_ConfigureIpv4
int wan_hal_ConfigureIpv4(PWAN_IPV4_CFG pWanIpv4Cfg)
_WAN_QOS_QUEUE
Definition: wan_hal.h:81
wan_hal_Init
int wan_hal_Init()
WAN_IPV6_CFG
struct _WAN_IPV6_CFG WAN_IPV6_CFG
_WAN_QOS_QUEUE::queuePrecedence
unsigned long queuePrecedence
Definition: wan_hal.h:91
_WAN_QOS_QUEUE::queueEnable
unsigned char queueEnable
Definition: wan_hal.h:87
wan_hal_UnConfigureIpv6
int wan_hal_UnConfigureIpv6(PWAN_IPV6_CFG pWanIpv6Cfg)
_WAN_IPV6_CFG
Definition: wan_hal.h:67
wan_hal_SetWanmode
int wan_hal_SetWanmode(t_eWanMode mode)
wan_hal_enableWanOEMode
int wan_hal_enableWanOEMode(const unsigned char enable)
wan_hal_SetSelfHealConfig
int wan_hal_SetSelfHealConfig(PSELFHEAL_CONFIG pSelfHealConfig)
WAN_MODE_AUTO
@ WAN_MODE_AUTO
Definition: wan_hal.h:53
_WAN_QOS_QUEUE::REDThreshold
unsigned long REDThreshold
Definition: wan_hal.h:92
wan_hal_ConfigureIpv6
int wan_hal_ConfigureIpv6(PWAN_IPV6_CFG pWanIpv6Cfg)
WAN_MODE_DISABLED
@ WAN_MODE_DISABLED
Definition: wan_hal.h:50
_WAN_IPV4_CFG::ifname
char ifname[64]
Definition: wan_hal.h:59
_WAN_QOS_QUEUE::DslLatency
signed long DslLatency
Definition: wan_hal.h:99
PWAN_QOS_QUEUE
struct _WAN_QOS_QUEUE * PWAN_QOS_QUEUE
wan_hal_getAuthInfo
int wan_hal_getAuthInfo(char *authInfo)
_WAN_MAPT_CFG::psidOffset
unsigned int psidOffset
Definition: wan_hal.h:118
_WAN_IPV6_CFG::validlifetime
int validlifetime
Definition: wan_hal.h:74
_WAN_QOS_QUEUE::LowClassMaxThreshold
unsigned long LowClassMaxThreshold
Definition: wan_hal.h:102
_WAN_QOS_QUEUE::queueWeight
unsigned long queueWeight
Definition: wan_hal.h:90