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