blob: 021b0f4932cd21e57a4068b2464408b179a7fff4 [file] [log] [blame]
developer272ba202022-04-07 18:13:54 +08001/*
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#include <stdio.h>
21#include <string.h>
22#include "dhcp4cApi.h"
23#include "dhcpv4c_api.h"
24
developerb236c792022-05-13 13:21:23 +080025
developer272ba202022-04-07 18:13:54 +080026// start of UDHCPC client required API
27#include <sys/socket.h>
28#include <netinet/in.h>
29#include <arpa/inet.h>
30
31#define HAL_DHCPV4C_ERT_DBG(x) do{fprintf x; fflush(stdout);}while(0);
32
33typedef unsigned int token_t;
34
35typedef enum
36_COSA_DML_DHCPC_STATUS
37{
38 COSA_DML_DHCPC_STATUS_Init = 1,
39 COSA_DML_DHCPC_STATUS_Selecting,
40 COSA_DML_DHCPC_STATUS_Requesting,
41 COSA_DML_DHCPC_STATUS_Rebinding,
42 COSA_DML_DHCPC_STATUS_Bound,
43 COSA_DML_DHCPC_STATUS_Renewing
44};
45
46#define DEFAULT_ERT_IFNAME "erouter0"
47
48static const char *dhcp_state[] = {
49 "init",
50 "selecting",
51 "requesting",
52 "rebinding",
53 "bound",
54 "renewing"
55};
56
57static INT dhcpv4c_sysevent_get_value(char *query_name, char *query_value, unsigned query_value_size)
58{
59
developer8bdcf622022-05-13 13:17:24 +080060 if (query_name == NULL || query_value == NULL || query_value_size == 0) {
61 return STATUS_FAILURE;
62 } else {
developerb236c792022-05-13 13:21:23 +080063 FILE *fp = NULL;
64 char command[128] = {0};
65 char ert_ifname[32] = {0};
66 char name[64] = {0};
67 char inf[32] = {0};
68 char query[64] = {0};
69
70 snprintf(command, 128, "sysevent get %s", "current_wan_ifname");
71 fp = popen(command, "r");
72 if (fp == NULL)
73 {
developer8bdcf622022-05-13 13:17:24 +080074 return STATUS_FAILURE;
developerb236c792022-05-13 13:21:23 +080075 }
76 if (fgets(inf, sizeof(inf), fp) != NULL)
77 {
78 if(strlen(inf) == 0){
79 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d syseventError %d\n", __FUNCTION__, __LINE__, STATUS_FAILURE));
80 pclose(fp);
developer8bdcf622022-05-13 13:17:24 +080081 return STATUS_FAILURE;
82 }
developerb236c792022-05-13 13:21:23 +080083 }
84 pclose(fp);
85 strncpy(ert_ifname, inf, strlen(inf)-1);
86 snprintf(name, sizeof(name), query_name, ert_ifname);
87 snprintf(command, 128, "sysevent get %s", name);
88 fp = popen(command, "r");
89 if (fp == NULL)
90 {
91 return STATUS_FAILURE;
92 }
developer272ba202022-04-07 18:13:54 +080093
developerb236c792022-05-13 13:21:23 +080094 if (fgets(query, query_value_size, fp) != NULL)
95 {
96 if(strlen(query) == 0){
97 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d syseventError %d\n", __FUNCTION__, __LINE__, STATUS_FAILURE));
98 pclose(fp);
developer8bdcf622022-05-13 13:17:24 +080099 return STATUS_FAILURE;
100 }
101 }
developerb236c792022-05-13 13:21:23 +0800102 pclose(fp);
103 strncpy(query_value, query, strlen(query)-1);
developer8bdcf622022-05-13 13:17:24 +0800104 }
105 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800106}
107
108#define UPTIME_FILE_PATH "/proc/uptime"
109#define MAX_LINE_SIZE 64
110static int dhcpv4c_get_up_time(unsigned int *up_time)
111{
112 FILE *fp;
113 char line[MAX_LINE_SIZE];
114 char *ret_val;
115 unsigned int upTime = 0;
116
117 /* This file contains two numbers:
118 * the uptime of the system (seconds), and the amount of time spent in idle process (seconds).
119 * We care only for the first one */
120 fp = fopen( UPTIME_FILE_PATH, "r");
121 if (fp == NULL)
122 {
123 return -1;
124 }
125
126 ret_val = fgets(line,MAX_LINE_SIZE,fp);
127 fclose(fp);
128
129 if (ret_val == NULL)
130 {
131 return -1;
132 }
133
134 /* Extracting the first token (number of up-time in seconds). */
135 ret_val = strtok (line," .");
136
137 /* we need only the number of seconds */
138 upTime += atoi(ret_val);
139
140 *up_time = upTime;
141
142 return 0;
143}
144
145INT dhcpv4c_get_ert_lease_time_udhcp(UINT *pValue)
146{
developerb236c792022-05-13 13:21:23 +0800147
developer8bdcf622022-05-13 13:17:24 +0800148 if (NULL == pValue) {
149 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
150 return STATUS_FAILURE;
151 } else {
152 char query_value[64];
153 int ret = STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800154
developer8bdcf622022-05-13 13:17:24 +0800155 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800156
developer8bdcf622022-05-13 13:17:24 +0800157 ret = dhcpv4c_sysevent_get_value("ipv4_%s_lease_time", query_value, sizeof(query_value));
158 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
159 return STATUS_FAILURE;
160 }
developer272ba202022-04-07 18:13:54 +0800161
developer8bdcf622022-05-13 13:17:24 +0800162 *pValue = atoi(query_value);
163 }
developer272ba202022-04-07 18:13:54 +0800164
developer8bdcf622022-05-13 13:17:24 +0800165 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800166}
167
168INT dhcpv4c_get_ert_remain_lease_time_udhcp(UINT *pValue)
169{
developer272ba202022-04-07 18:13:54 +0800170
developer8bdcf622022-05-13 13:17:24 +0800171 if (NULL == pValue) {
172 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
173 return STATUS_FAILURE;
174 } else {
175 char query_value[64];
176 int ret = STATUS_SUCCESS;
177 unsigned lease_time = 0, start_time = 0, up_time = 0, remain_lease_time = 0;
178 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800179
developer8bdcf622022-05-13 13:17:24 +0800180 ret = dhcpv4c_sysevent_get_value("ipv4_%s_lease_time", query_value, sizeof(query_value));
181 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
182 return STATUS_FAILURE;
183 }
developer272ba202022-04-07 18:13:54 +0800184
developer8bdcf622022-05-13 13:17:24 +0800185 lease_time = atoi(query_value);
developer272ba202022-04-07 18:13:54 +0800186
developer8bdcf622022-05-13 13:17:24 +0800187 ret = dhcpv4c_sysevent_get_value("ipv4_%s_start_time", query_value, sizeof(query_value));
188 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
189 return STATUS_FAILURE;
190 }
developer272ba202022-04-07 18:13:54 +0800191
developer8bdcf622022-05-13 13:17:24 +0800192 start_time = atoi(query_value);
developer272ba202022-04-07 18:13:54 +0800193
developer8bdcf622022-05-13 13:17:24 +0800194 dhcpv4c_get_up_time(&up_time);
developer272ba202022-04-07 18:13:54 +0800195
developer8bdcf622022-05-13 13:17:24 +0800196 remain_lease_time = lease_time - (up_time - start_time);
developer272ba202022-04-07 18:13:54 +0800197
developer8bdcf622022-05-13 13:17:24 +0800198 *pValue = remain_lease_time;
199 }
developer272ba202022-04-07 18:13:54 +0800200
developer8bdcf622022-05-13 13:17:24 +0800201 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800202}
203
204INT dhcpv4c_get_ert_remain_renew_time_udhcp(UINT *pValue)
205{
developer272ba202022-04-07 18:13:54 +0800206
developer8bdcf622022-05-13 13:17:24 +0800207 if (NULL == pValue) {
208 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
209 return STATUS_FAILURE;
210 } else {
211 char query_value[64];
212 int ret = STATUS_SUCCESS;
213 unsigned lease_time = 0, start_time = 0, up_time = 0, renew_time = 0, remain_renew_time = 0;
developer272ba202022-04-07 18:13:54 +0800214
developer8bdcf622022-05-13 13:17:24 +0800215 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800216
developer8bdcf622022-05-13 13:17:24 +0800217 ret = dhcpv4c_sysevent_get_value("ipv4_%s_lease_time", query_value, sizeof(query_value));
218 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
219 return STATUS_FAILURE;
220 }
developer272ba202022-04-07 18:13:54 +0800221
developer8bdcf622022-05-13 13:17:24 +0800222 lease_time = atoi(query_value);
223 renew_time = lease_time/2;
developer272ba202022-04-07 18:13:54 +0800224
developer8bdcf622022-05-13 13:17:24 +0800225 ret = dhcpv4c_sysevent_get_value("ipv4_%s_start_time", query_value, sizeof(query_value));
226 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
227 return STATUS_FAILURE;
228 }
developer272ba202022-04-07 18:13:54 +0800229
developerb236c792022-05-13 13:21:23 +0800230
developer8bdcf622022-05-13 13:17:24 +0800231 start_time = atoi(query_value);
developer272ba202022-04-07 18:13:54 +0800232
developer8bdcf622022-05-13 13:17:24 +0800233 dhcpv4c_get_up_time(&up_time);
developer272ba202022-04-07 18:13:54 +0800234
developer8bdcf622022-05-13 13:17:24 +0800235 remain_renew_time = renew_time - (up_time - start_time);
developer272ba202022-04-07 18:13:54 +0800236
developer8bdcf622022-05-13 13:17:24 +0800237 *pValue = remain_renew_time;
238 }
developer272ba202022-04-07 18:13:54 +0800239
developer8bdcf622022-05-13 13:17:24 +0800240 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800241}
242
243INT dhcpv4c_get_ert_remain_rebind_time_udhcp(UINT *pValue)
244{
developer272ba202022-04-07 18:13:54 +0800245
developer8bdcf622022-05-13 13:17:24 +0800246 if (NULL == pValue) {
247 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
248 return STATUS_FAILURE;
249 } else {
250 char query_value[64];
251 int ret = STATUS_SUCCESS;
252 unsigned lease_time = 0, start_time = 0, up_time = 0, rebind_time = 0, remain_bind_time = 0;
developer272ba202022-04-07 18:13:54 +0800253
developer8bdcf622022-05-13 13:17:24 +0800254 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800255
developer8bdcf622022-05-13 13:17:24 +0800256 ret = dhcpv4c_sysevent_get_value("ipv4_%s_lease_time", query_value, sizeof(query_value));
257 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
258 return STATUS_FAILURE;
259 }
developer272ba202022-04-07 18:13:54 +0800260
developer8bdcf622022-05-13 13:17:24 +0800261 lease_time = atoi(query_value);
262 rebind_time = lease_time*7/8;
developer272ba202022-04-07 18:13:54 +0800263
developer8bdcf622022-05-13 13:17:24 +0800264 ret = dhcpv4c_sysevent_get_value("ipv4_%s_start_time", query_value, sizeof(query_value));
265 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
266 return STATUS_FAILURE;
267 }
developer272ba202022-04-07 18:13:54 +0800268
developer8bdcf622022-05-13 13:17:24 +0800269 start_time = atoi(query_value);
developer272ba202022-04-07 18:13:54 +0800270
developer8bdcf622022-05-13 13:17:24 +0800271 dhcpv4c_get_up_time(&up_time);
developer272ba202022-04-07 18:13:54 +0800272
developer8bdcf622022-05-13 13:17:24 +0800273 remain_bind_time = rebind_time - (up_time - start_time);
developer272ba202022-04-07 18:13:54 +0800274
developer8bdcf622022-05-13 13:17:24 +0800275 *pValue = remain_bind_time;
276 }
developer272ba202022-04-07 18:13:54 +0800277
developer8bdcf622022-05-13 13:17:24 +0800278 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800279}
280
281INT dhcpv4c_get_ert_config_attempts_udhcp(INT *pValue)
282{
developer272ba202022-04-07 18:13:54 +0800283
developer8bdcf622022-05-13 13:17:24 +0800284 if (NULL == pValue) {
285 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
286 return STATUS_FAILURE;
287 } else {
288 *pValue = 100;
289 return STATUS_SUCCESS;
290 }
developer272ba202022-04-07 18:13:54 +0800291}
292
293INT dhcpv4c_get_ert_ifname_udhcp(CHAR *pName)
294{
developer272ba202022-04-07 18:13:54 +0800295
developer8bdcf622022-05-13 13:17:24 +0800296 if (NULL == pName) {
297 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
298 return STATUS_FAILURE;
299 } else {
developerb236c792022-05-13 13:21:23 +0800300 FILE *fp = NULL;
301 char command[128] = {0};
302 char ert_ifname[32] = {0};
303
304 snprintf(command, 128, "sysevent get %s", "current_wan_ifname");
305 fp = popen(command, "r");
306 if (fp == NULL)
307 {
developer8bdcf622022-05-13 13:17:24 +0800308 return STATUS_FAILURE;
developer8bdcf622022-05-13 13:17:24 +0800309 }
developerb236c792022-05-13 13:21:23 +0800310 if (fgets(ert_ifname, sizeof(ert_ifname), fp) != NULL)
311 {
312 if(strlen(ert_ifname) == 0){
313 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d syseventError %d\n", __FUNCTION__, __LINE__, STATUS_FAILURE));
314 pclose(fp);
315 return STATUS_FAILURE;
316 }
317 }
318 pclose(fp);
319 strncpy(pName, ert_ifname, strlen(ert_ifname)-1);
developer8bdcf622022-05-13 13:17:24 +0800320 }
developerb236c792022-05-13 13:21:23 +0800321 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800322}
323
324INT dhcpv4c_get_ert_fsm_state_udhcp(INT *pValue)
325{
developer272ba202022-04-07 18:13:54 +0800326
developer8bdcf622022-05-13 13:17:24 +0800327 if (NULL == pValue) {
328 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
329 return STATUS_FAILURE;
330 } else {
331 char query_value[64];
332 int ret = STATUS_SUCCESS;
333 struct in_addr addr;
developer272ba202022-04-07 18:13:54 +0800334
developer8bdcf622022-05-13 13:17:24 +0800335 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800336
developer8bdcf622022-05-13 13:17:24 +0800337 ret = dhcpv4c_sysevent_get_value("ipv4_%s_dhcp_state", query_value, sizeof(query_value));
338 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
339 return STATUS_FAILURE;
340 }
developer272ba202022-04-07 18:13:54 +0800341
developer272ba202022-04-07 18:13:54 +0800342
developer8bdcf622022-05-13 13:17:24 +0800343 int i = 0;
344 for (i=0; i<sizeof(dhcp_state)/sizeof(char*); i++) {
345 if (strcmp(dhcp_state[i], query_value) == 0) {
346 *pValue = i+1;
347 break;
348 }
349 }
developer272ba202022-04-07 18:13:54 +0800350
developer8bdcf622022-05-13 13:17:24 +0800351 if ((i==sizeof(dhcp_state)/sizeof(char*)) && (strcmp("renew", query_value) == 0)) {
352 *pValue = COSA_DML_DHCPC_STATUS_Bound;
353 }
354 }
developer272ba202022-04-07 18:13:54 +0800355
developer8bdcf622022-05-13 13:17:24 +0800356 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800357}
358
359INT dhcpv4c_get_ert_ip_addr_udhcp(UINT *pValue)
360{
developer272ba202022-04-07 18:13:54 +0800361
developer8bdcf622022-05-13 13:17:24 +0800362 if (NULL == pValue) {
363 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
364 return STATUS_FAILURE;
365 } else {
366 char query_value[64];
367 int ret = STATUS_SUCCESS;
368 struct in_addr addr;
developer272ba202022-04-07 18:13:54 +0800369
developer8bdcf622022-05-13 13:17:24 +0800370 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800371
developer8bdcf622022-05-13 13:17:24 +0800372 ret = dhcpv4c_sysevent_get_value("ipv4_%s_ipaddr", query_value, sizeof(query_value));
373 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
374 return STATUS_FAILURE;
375 }
developer272ba202022-04-07 18:13:54 +0800376
developer8bdcf622022-05-13 13:17:24 +0800377 inet_aton(query_value, &addr);
378 *pValue = addr.s_addr;
379 }
developer272ba202022-04-07 18:13:54 +0800380
developer8bdcf622022-05-13 13:17:24 +0800381 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800382}
383
384INT dhcpv4c_get_ert_mask_udhcp(UINT *pValue)
385{
developer272ba202022-04-07 18:13:54 +0800386
developer8bdcf622022-05-13 13:17:24 +0800387 if (NULL == pValue) {
388 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
389 return STATUS_FAILURE;
390 } else {
391 char query_value[64];
392 int ret = STATUS_SUCCESS;
393 struct in_addr addr;
394 unsigned mask = 0;
395 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800396
developer8bdcf622022-05-13 13:17:24 +0800397 ret = dhcpv4c_sysevent_get_value("ipv4_%s_subnet", query_value, sizeof(query_value));
398 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
399 return STATUS_FAILURE;
400 }
developerb236c792022-05-13 13:21:23 +0800401
402 inet_aton(query_value, &addr);
403 *pValue = addr.s_addr;
developer8bdcf622022-05-13 13:17:24 +0800404 }
developer272ba202022-04-07 18:13:54 +0800405
developer8bdcf622022-05-13 13:17:24 +0800406 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800407}
408
409INT dhcpv4c_get_ert_gw_udhcp(UINT *pValue)
410{
developer272ba202022-04-07 18:13:54 +0800411
developer8bdcf622022-05-13 13:17:24 +0800412 if (NULL == pValue) {
413 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
414 return STATUS_FAILURE;
415 } else {
416 char query_value[64];
417 int ret = STATUS_SUCCESS;
418 struct in_addr addr;
419 unsigned gw_num = 0;
developer272ba202022-04-07 18:13:54 +0800420
developer8bdcf622022-05-13 13:17:24 +0800421 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800422
developer8bdcf622022-05-13 13:17:24 +0800423 ret = dhcpv4c_sysevent_get_value("ipv4_%s_gw_number", query_value, sizeof(query_value));
424 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
425 return STATUS_FAILURE;
426 }
developer272ba202022-04-07 18:13:54 +0800427
developer8bdcf622022-05-13 13:17:24 +0800428 gw_num = atoi(query_value);
developer272ba202022-04-07 18:13:54 +0800429
developer8bdcf622022-05-13 13:17:24 +0800430 if (gw_num >= 1) {
431 ret = dhcpv4c_sysevent_get_value("ipv4_%s_gw_0", query_value, sizeof(query_value));
432 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
433 return STATUS_FAILURE;
434 }
developer272ba202022-04-07 18:13:54 +0800435
developer8bdcf622022-05-13 13:17:24 +0800436 inet_aton(query_value, &addr);
437 *pValue = addr.s_addr;
438 } else {
439 *pValue = 0;
440 }
441 }
developer272ba202022-04-07 18:13:54 +0800442
developer8bdcf622022-05-13 13:17:24 +0800443 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800444}
445
446INT dhcpv4c_get_ert_dns_svrs_udhcp(dhcpv4c_ip_list_t *pList)
447{
developer8bdcf622022-05-13 13:17:24 +0800448 if (NULL == pList) {
449 return STATUS_FAILURE;
450 } else {
451 char query_value[64];
452 int ret = STATUS_SUCCESS;
453 struct in_addr addr;
454 unsigned dns_num = 0;
developer272ba202022-04-07 18:13:54 +0800455
developer8bdcf622022-05-13 13:17:24 +0800456 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800457
developer8bdcf622022-05-13 13:17:24 +0800458 ret = dhcpv4c_sysevent_get_value("ipv4_%s_dns_number", query_value, sizeof(query_value));
459 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
460 return STATUS_FAILURE;
461 }
developer272ba202022-04-07 18:13:54 +0800462
developer8bdcf622022-05-13 13:17:24 +0800463 dns_num = atoi(query_value);
developer272ba202022-04-07 18:13:54 +0800464
developer8bdcf622022-05-13 13:17:24 +0800465 if (dns_num >= 1) {
466 int i = 0;
developer272ba202022-04-07 18:13:54 +0800467
developer8bdcf622022-05-13 13:17:24 +0800468 if (dns_num >4)
469 dns_num = 4;
developer272ba202022-04-07 18:13:54 +0800470
developer8bdcf622022-05-13 13:17:24 +0800471 for (i=0; i<dns_num; i++) {
472 char gw_str[32];
473 memset(gw_str, 0, sizeof(gw_str));
474 snprintf(gw_str, sizeof(gw_str), "ipv4_%s_dns_%d", "%s", i);
475 ret = dhcpv4c_sysevent_get_value(gw_str, query_value, sizeof(query_value));
476 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
477 continue;
478 }
developer272ba202022-04-07 18:13:54 +0800479
developer8bdcf622022-05-13 13:17:24 +0800480 inet_aton(query_value, &addr);
481 pList->addrs[i] = addr.s_addr;
482 }
483 pList->number = dns_num;
484 } else {
485 pList->number = 0;
486 }
487 }
developer272ba202022-04-07 18:13:54 +0800488
developer8bdcf622022-05-13 13:17:24 +0800489 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800490}
491
492INT dhcpv4c_get_ert_dhcp_svr_udhcp(UINT *pValue)
493{
developer272ba202022-04-07 18:13:54 +0800494
developer8bdcf622022-05-13 13:17:24 +0800495 if (NULL == pValue) {
496 HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__));
497 return STATUS_FAILURE;
498 } else {
499 char query_value[64];
500 int ret = STATUS_SUCCESS;
501 struct in_addr addr;
developer272ba202022-04-07 18:13:54 +0800502
developer8bdcf622022-05-13 13:17:24 +0800503 memset(query_value, 0, sizeof(query_value));
developer272ba202022-04-07 18:13:54 +0800504
developer8bdcf622022-05-13 13:17:24 +0800505 ret = dhcpv4c_sysevent_get_value("ipv4_%s_dhcp_server", query_value, sizeof(query_value));
506 if (ret != STATUS_SUCCESS || strlen(query_value) == 0) {
507 return STATUS_FAILURE;
508 }
developer272ba202022-04-07 18:13:54 +0800509
developer8bdcf622022-05-13 13:17:24 +0800510 inet_aton(query_value, &addr);
511 *pValue = addr.s_addr;
512 }
developer272ba202022-04-07 18:13:54 +0800513
developer8bdcf622022-05-13 13:17:24 +0800514 return STATUS_SUCCESS;
developer272ba202022-04-07 18:13:54 +0800515}
516
517// End of UDHCPC client required APi
518
519#ifdef DEBUG_QUERY_ALL
520void query_all();
521static int query_all_in_progress = 0;
522#endif
523
524INT dhcpv4c_get_ert_lease_time(UINT *pValue)
525{
developer8bdcf622022-05-13 13:17:24 +0800526 if (NULL == pValue)
527 {
528 return STATUS_FAILURE;
529 }
530 else
531 {
developerb236c792022-05-13 13:21:23 +0800532 return dhcpv4c_get_ert_lease_time_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800533 }
developer272ba202022-04-07 18:13:54 +0800534}
535
536INT dhcpv4c_get_ert_remain_lease_time(UINT *pValue)
537{
developer8bdcf622022-05-13 13:17:24 +0800538 if(pValue==NULL)
539 {
540 return(STATUS_FAILURE);
541 }
542 else
543 {
developerb236c792022-05-13 13:21:23 +0800544 return dhcpv4c_get_ert_remain_lease_time_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800545 }
developer272ba202022-04-07 18:13:54 +0800546}
547
548INT dhcpv4c_get_ert_remain_renew_time(UINT *pValue)
549{
developer8bdcf622022-05-13 13:17:24 +0800550 if (NULL == pValue)
551 {
552 return STATUS_FAILURE;
553 }
554 else
555 {
developerb236c792022-05-13 13:21:23 +0800556 return dhcpv4c_get_ert_remain_renew_time_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800557 }
developer272ba202022-04-07 18:13:54 +0800558}
559
560INT dhcpv4c_get_ert_remain_rebind_time(UINT *pValue)
561{
developer8bdcf622022-05-13 13:17:24 +0800562 if (NULL == pValue)
563 {
564 return STATUS_FAILURE;
565 }
566 else
567 {
developerb236c792022-05-13 13:21:23 +0800568 return dhcpv4c_get_ert_remain_rebind_time_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800569 }
developer272ba202022-04-07 18:13:54 +0800570}
571
572INT dhcpv4c_get_ert_config_attempts(INT *pValue)
573{
developer8bdcf622022-05-13 13:17:24 +0800574 if (NULL == pValue)
575 {
576 return STATUS_FAILURE;
577 }
578 else
579 {
developerb236c792022-05-13 13:21:23 +0800580 return dhcpv4c_get_ert_config_attempts_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800581 }
developer272ba202022-04-07 18:13:54 +0800582}
583
584INT dhcpv4c_get_ert_ifname(CHAR *pName)
585{
developer8bdcf622022-05-13 13:17:24 +0800586 if (NULL == pName)
587 {
588 return STATUS_FAILURE;
589 }
590 else
591 {
developerb236c792022-05-13 13:21:23 +0800592 return dhcpv4c_get_ert_ifname_udhcp(pName);
developer8bdcf622022-05-13 13:17:24 +0800593 }
developer272ba202022-04-07 18:13:54 +0800594}
595
596INT dhcpv4c_get_ert_fsm_state(INT *pValue)
597{
developer8bdcf622022-05-13 13:17:24 +0800598 if(pValue==NULL)
599 {
600 return(STATUS_FAILURE);
601 }
602 else
603 {
developerb236c792022-05-13 13:21:23 +0800604 return dhcpv4c_get_ert_fsm_state_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800605 }
developer272ba202022-04-07 18:13:54 +0800606}
607
608INT dhcpv4c_get_ert_ip_addr(UINT *pValue)
609{
developer8bdcf622022-05-13 13:17:24 +0800610 if (NULL == pValue)
611 {
612 return STATUS_FAILURE;
613 }
614 else
615 {
developerb236c792022-05-13 13:21:23 +0800616 return dhcpv4c_get_ert_ip_addr_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800617 }
developer272ba202022-04-07 18:13:54 +0800618}
619
620INT dhcpv4c_get_ert_mask(UINT *pValue)
621{
developer8bdcf622022-05-13 13:17:24 +0800622 if (NULL == pValue)
623 {
624 return STATUS_FAILURE;
625 }
626 else
627 {
developerb236c792022-05-13 13:21:23 +0800628 return dhcpv4c_get_ert_mask_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800629 }
developer272ba202022-04-07 18:13:54 +0800630}
631
632INT dhcpv4c_get_ert_gw(UINT *pValue)
633{
developer8bdcf622022-05-13 13:17:24 +0800634 if(pValue==NULL)
635 {
developerb236c792022-05-13 13:21:23 +0800636 return STATUS_FAILURE;
developer8bdcf622022-05-13 13:17:24 +0800637 }
638 else
639 {
developerb236c792022-05-13 13:21:23 +0800640 return dhcpv4c_get_ert_gw_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800641 }
developer272ba202022-04-07 18:13:54 +0800642}
643
644INT dhcpv4c_get_ert_dns_svrs(dhcpv4c_ip_list_t *pList)
645{
developer8bdcf622022-05-13 13:17:24 +0800646 if (NULL == pList)
647 {
648 return STATUS_FAILURE;
649 }
650 else
651 {
developerb236c792022-05-13 13:21:23 +0800652 return dhcpv4c_get_ert_dns_svrs_udhcp((ipv4AddrList_t*) pList);
developer8bdcf622022-05-13 13:17:24 +0800653 }
developer272ba202022-04-07 18:13:54 +0800654}
655
656INT dhcpv4c_get_ert_dhcp_svr(UINT *pValue)
657{
developerb236c792022-05-13 13:21:23 +0800658
developer8bdcf622022-05-13 13:17:24 +0800659 if (NULL == pValue)
660 {
661 return STATUS_FAILURE;
662 }
663 else
664 {
developerb236c792022-05-13 13:21:23 +0800665 return dhcpv4c_get_ert_dhcp_svr_udhcp(pValue);
developer8bdcf622022-05-13 13:17:24 +0800666 }
developer272ba202022-04-07 18:13:54 +0800667}
668
developer272ba202022-04-07 18:13:54 +0800669/* dhcpv4c_get_ecm_lease_time() function */
670/**
671* Description: Gets the ECM Offered Lease Time.
672* Parameters : 
673* pValue - Value in Seconds.
674* @return The status of the operation.
675* @retval STATUS_SUCCESS if successful.
676* @retval STATUS_FAILURE if any error is detected 
677
678* @execution Synchronous.
679* @sideeffect None.
680*
681* @note This function must not suspend and must not invoke any blocking system 
682* calls. It should probably just send a message to a driver event handler task. 
683*
684*/
685INT dhcpv4c_get_ecm_lease_time(UINT *pValue)
686{
687 if (NULL == pValue)
688 {
689 return STATUS_FAILURE;
690 }
691 else
692 {
693 return STATUS_SUCCESS;
694 //return dhcp4c_get_ecm_lease_time(pValue);
695 }
696}
697
698/* dhcpv4c_get_ecm_remain_lease_time() function */
699/**
700* Description: Gets the ECM Remaining Lease Time
701* Parameters : 
702* pValue - Value in Seconds.
703* @return The status of the operation.
704* @retval STATUS_SUCCESS if successful.
705* @retval STATUS_FAILURE if any error is detected 
706
707* @execution Synchronous.
708* @sideeffect None.
709*
710* @note This function must not suspend and must not invoke any blocking system 
711* calls. It should probably just send a message to a driver event handler task. 
712*
713*/
714INT dhcpv4c_get_ecm_remain_lease_time(UINT *pValue)
715{
716 if (NULL == pValue)
717 {
718 return STATUS_FAILURE;
719 }
720 else
721 {
722 return STATUS_SUCCESS;
723 //return dhcp4c_get_ecm_remain_lease_time(pValue);
724 }
725}
726
727/* dhcpv4c_get_ecm_remain_renew_time() function */
728/**
729* Description: Gets the ECM Interface Remaining time to Renew.
730* Parameters : 
731* pValue - Value in Seconds.
732* @return The status of the operation.
733* @retval STATUS_SUCCESS if successful.
734* @retval STATUS_FAILURE if any error is detected 
735
736* @execution Synchronous.
737* @sideeffect None.
738*
739* @note This function must not suspend and must not invoke any blocking system 
740* calls. It should probably just send a message to a driver event handler task. 
741*
742*/
743INT dhcpv4c_get_ecm_remain_renew_time(UINT *pValue)
744{
745 if (NULL == pValue)
746 {
747 return STATUS_FAILURE;
748 }
749 else
750 {
751 return STATUS_SUCCESS;
752 //return dhcp4c_get_ecm_remain_renew_time(pValue);
753 }
754}
755
756/* dhcpv4c_get_ecm_remain_rebind_time() function */
757/**
758* Description: Gets the ECM Interface Remaining time to Rebind.
759* Parameters : 
760* pValue - Value in Seconds.
761* @return The status of the operation.
762* @retval STATUS_SUCCESS if successful.
763* @retval STATUS_FAILURE if any error is detected 
764
765* @execution Synchronous.
766* @sideeffect None.
767*
768* @note This function must not suspend and must not invoke any blocking system 
769* calls. It should probably just send a message to a driver event handler task. 
770*
771*/
772INT dhcpv4c_get_ecm_remain_rebind_time(UINT *pValue)
773{
774 if (NULL == pValue)
775 {
776 return STATUS_FAILURE;
777 }
778 else
779 {
780 return STATUS_SUCCESS;
781 //return dhcp4c_get_ecm_remain_rebind_time(pValue);
782 }
783}
784
785/* dhcpv4c_get_ecm_config_attempts() function */
786/**
787* Description: Gets the ECM Configuration Number of Attemts.
788* Parameters : 
789* pValue - Count.
790* @return The status of the operation.
791* @retval STATUS_SUCCESS if successful.
792* @retval STATUS_FAILURE if any error is detected 
793
794* @execution Synchronous.
795* @sideeffect None.
796*
797* @note This function must not suspend and must not invoke any blocking system 
798* calls. It should probably just send a message to a driver event handler task. 
799*
800*/
801INT dhcpv4c_get_ecm_config_attempts(INT *pValue)
802{
803 if (NULL == pValue)
804 {
805 return STATUS_FAILURE;
806 }
807 else
808 {
809 return STATUS_SUCCESS;
810 //return dhcp4c_get_ecm_config_attempts(pValue);
811 }
812}
813
814/* dhcpv4c_get_ecm_ifname() function */
815/**
816* Description: Gets the ECM Interface Name.
817* Parameters : 
818* pName - Name of the Interface (e.g doc0)
819* @return The status of the operation.
820* @retval STATUS_SUCCESS if successful.
821* @retval STATUS_FAILURE if any error is detected 
822
823* @execution Synchronous.
824* @sideeffect None.
825*
826* @note This function must not suspend and must not invoke any blocking system 
827* calls. It should probably just send a message to a driver event handler task. 
828*
829*/
830INT dhcpv4c_get_ecm_ifname(CHAR *pName)
831{
832 if (NULL == pName)
833 {
834 return STATUS_FAILURE;
835 }
836 else
837 {
838 return STATUS_SUCCESS;
839 //return dhcp4c_get_ecm_ifname(pName);;
840 }
841}
842
843/* dhcpv4c_get_ecm_fsm_state() function */
844/**
845* Description: Gets the ECM DHCP State
846* Parameters : 
847* pValue - State of the DHCP (RENEW/ACQUIRED etc)
848* @return The status of the operation.
849* @retval STATUS_SUCCESS if successful.
850* @retval STATUS_FAILURE if any error is detected 
851
852* @execution Synchronous.
853* @sideeffect None.
854*
855* @note This function must not suspend and must not invoke any blocking system 
856* calls. It should probably just send a message to a driver event handler task. 
857*
858*/
859INT dhcpv4c_get_ecm_fsm_state(INT *pValue)
860{
861 if (NULL == pValue)
862 {
863 return STATUS_FAILURE;
864 }
865 else
866 {
867 return STATUS_SUCCESS;
868 //return dhcp4c_get_ecm_fsm_state(pValue);
869 }
870}
871
872/* dhcpv4c_get_ecm_ip_addr() function */
873/**
874* Description: Gets the ECM Interface IP Address
875* Parameters : 
876* pValue - IP Address of the Interface.
877* @return The status of the operation.
878* @retval STATUS_SUCCESS if successful.
879* @retval STATUS_FAILURE if any error is detected 
880
881* @execution Synchronous.
882* @sideeffect None.
883*
884* @note This function must not suspend and must not invoke any blocking system 
885* calls. It should probably just send a message to a driver event handler task. 
886*
887*/
888INT dhcpv4c_get_ecm_ip_addr(UINT *pValue)
889{
890 if (NULL == pValue)
891 {
892 return STATUS_FAILURE;
893 }
894 else
895 {
896 return STATUS_SUCCESS;
897 //return dhcp4c_get_ecm_ip_addr(pValue);
898 }
899}
900
901/* dhcpv4c_get_ecm_mask() function */
902/**
903* Description: Gets the ECM Interface Subnet Mask.
904* Parameters : 
905* pValue - Subnet Mask (bitmask).
906* @return The status of the operation.
907* @retval STATUS_SUCCESS if successful.
908* @retval STATUS_FAILURE if any error is detected 
909
910* @execution Synchronous.
911* @sideeffect None.
912*
913* @note This function must not suspend and must not invoke any blocking system 
914* calls. It should probably just send a message to a driver event handler task. 
915*
916*/
917INT dhcpv4c_get_ecm_mask(UINT *pValue)
918{
919 if (NULL == pValue)
920 {
921 return STATUS_FAILURE;
922 }
923 else
924 {
925 return STATUS_SUCCESS;
926 //return dhcp4c_get_ecm_mask(pValue);
927 }
928}
929
930/* dhcpv4c_get_ecm_gw() function */
931/**
932* Description: Gets the ECM Gateway IP Address
933* Parameters : 
934* pValue - IP Address of Gateway
935* @return The status of the operation.
936* @retval STATUS_SUCCESS if successful.
937* @retval STATUS_FAILURE if any error is detected 
938
939* @execution Synchronous.
940* @sideeffect None.
941*
942* @note This function must not suspend and must not invoke any blocking system 
943* calls. It should probably just send a message to a driver event handler task. 
944*
945*/
946INT dhcpv4c_get_ecm_gw(UINT *pValue)
947{
948 if (NULL == pValue)
949 {
950 return STATUS_FAILURE;
951 }
952 else
953 {
954 return STATUS_SUCCESS;
955 //return dhcp4c_get_ecm_gw(pValue);
956 }
957}
958
959/* dhcpv4c_get_ecm_dns_svrs() function */
960/**
961* Description: Gets the ECM List of DNS Servers
962* Parameters : 
963* pList - List of IP Addresses (of DNS Servers)
964* @return The status of the operation.
965* @retval STATUS_SUCCESS if successful.
966* @retval STATUS_FAILURE if any error is detected 
967
968* @execution Synchronous.
969* @sideeffect None.
970*
971* @note This function must not suspend and must not invoke any blocking system 
972* calls. It should probably just send a message to a driver event handler task. 
973*
974*/
975INT dhcpv4c_get_ecm_dns_svrs(dhcpv4c_ip_list_t *pList)
976{
977 if (NULL == pList)
978 {
979 return STATUS_FAILURE;
980 }
981 else
982 {
983 return STATUS_SUCCESS;
984 //return dhcp4c_get_ecm_dns_svrs((ipv4AddrList_t*) pList);
985 }
986}
987
988/* dhcpv4c_get_ecm_dhcp_svr() function */
989/**
990* Description: Gets the ECM DHCP Server IP Address
991* Parameters : 
992* pValue - IP Address
993* @return The status of the operation.
994* @retval STATUS_SUCCESS if successful.
995* @retval STATUS_FAILURE if any error is detected 
996
997* @execution Synchronous.
998* @sideeffect None.
999*
1000* @note This function must not suspend and must not invoke any blocking system 
1001* calls. It should probably just send a message to a driver event handler task. 
1002*
1003*/
1004INT dhcpv4c_get_ecm_dhcp_svr(UINT *pValue)
1005{
1006 if (NULL == pValue)
1007 {
1008 return STATUS_FAILURE;
1009 }
1010 else
1011 {
1012 return STATUS_SUCCESS;
1013 //return dhcp4c_get_ecm_dhcp_svr(pValue);
1014 }
1015}
1016
1017
1018/* dhcpv4c_get_emta_remain_lease_time() function */
1019/**
1020* Description: Gets the E-MTA interface Least Time
1021* Parameters : 
1022* pValue - Value in Seconds.
1023* @return The status of the operation.
1024* @retval STATUS_SUCCESS if successful.
1025* @retval STATUS_FAILURE if any error is detected 
1026
1027* @execution Synchronous.
1028* @sideeffect None.
1029*
1030* @note This function must not suspend and must not invoke any blocking system 
1031* calls. It should probably just send a message to a driver event handler task. 
1032*
1033*/
1034INT dhcpv4c_get_emta_remain_lease_time(UINT *pValue)
1035{
1036 if (NULL == pValue)
1037 {
1038 return STATUS_FAILURE;
1039 }
1040 else
1041 {
1042 return STATUS_SUCCESS;
1043 //return dhcp4c_get_emta_remain_lease_time(pValue);
1044 }
1045}
1046
1047/* dhcpv4c_get_emta_remain_renew_time() function */
1048/**
1049* Description: Gets the E-MTA interface Remaining Time to Renew
1050* Parameters : 
1051* pValue - Value in Seconds.
1052* @return The status of the operation.
1053* @retval STATUS_SUCCESS if successful.
1054* @retval STATUS_FAILURE if any error is detected 
1055
1056* @execution Synchronous.
1057* @sideeffect None.
1058*
1059* @note This function must not suspend and must not invoke any blocking system 
1060* calls. It should probably just send a message to a driver event handler task. 
1061*
1062*/
1063INT dhcpv4c_get_emta_remain_renew_time(UINT *pValue)
1064{
1065 if (NULL == pValue)
1066 {
1067 return STATUS_FAILURE;
1068 }
1069 else
1070 {
1071 return STATUS_SUCCESS;
1072 //return dhcp4c_get_emta_remain_renew_time(pValue);
1073 }
1074}
1075
1076/* dhcpv4c_get_emta_remain_rebind_time() function */
1077/**
1078* Description: Gets the E-MTA interface Remaining Time to Rebind
1079* Parameters : 
1080* pValue - Value in Seconds.
1081* @return The status of the operation.
1082* @retval STATUS_SUCCESS if successful.
1083* @retval STATUS_FAILURE if any error is detected 
1084
1085* @execution Synchronous.
1086* @sideeffect None.
1087*
1088* @note This function must not suspend and must not invoke any blocking system 
1089* calls. It should probably just send a message to a driver event handler task. 
1090*
1091*/
1092INT dhcpv4c_get_emta_remain_rebind_time(UINT *pValue)
1093{
1094 if (NULL == pValue)
1095 {
1096 return STATUS_FAILURE;
1097 }
1098 else
1099 {
1100 return STATUS_SUCCESS;
1101 //return dhcp4c_get_emta_remain_rebind_time(pValue);
1102 }
1103}
1104
1105#ifdef DEBUG_QUERY_ALL
1106void query_all()
1107{
1108 int i;
1109
1110 unsigned int Value;
1111 int iValue;
1112 char Name[100];
1113 dhcpv4c_ip_list_t List;
1114
1115 unsigned int* pValue = &Value;
1116 int* piValue = &iValue;
1117 char* pName = &Name[0];
1118 dhcpv4c_ip_list_t* pList = &List;
1119
1120 int result;
1121
1122 query_all_in_progress = 1;
1123
1124 printf("Query all start\n");
1125
1126 result = dhcpv4c_get_ert_lease_time(&Value);
1127 printf("dhcpv4_get_ert_lease_time - result=%d pValue = %d\n", result, *pValue);
1128
1129 result = dhcp4c_get_ert_remain_lease_time(pValue);
1130 printf("dhcpv4_get_ert_remain_lease_time - result=%d pValue = %d\n", result, *pValue);
1131
1132 result = dhcpv4c_get_ert_remain_renew_time(pValue);
1133 printf("dhcpv4_get_ert_remain_renew_time - result=%d pValue = %d\n", result, *pValue);
1134
1135 result = dhcpv4c_get_ert_remain_rebind_time(pValue);
1136 printf("dhcpv4_get_ert_remain_rebind_time - result=%d pValue = %d\n", result, *pValue);
1137
1138 result = dhcpv4c_get_ert_config_attempts(piValue);
1139 printf("dhcpv4_get_ert_config_attempts - result=%d piValue = %d\n", result, *piValue);
1140
1141 result = dhcpv4c_get_ert_ifname(pName);
1142 printf("dhcpv4_get_ert_ifname - result=%d pName = [%s]\n", result, pName);
1143
1144 result = dhcpv4c_get_ert_fsm_state(piValue);
1145 printf("dhcpv4_get_ert_fsm_state - result=%d piValue = %d\n", result, *piValue);
1146
1147 result = dhcpv4c_get_ert_ip_addr(pValue);
1148 printf("dhcpv4_get_ert_ip_addr - result=%d pValue = %04X\n", result, *pValue);
1149
1150 result = dhcpv4c_get_ert_mask(pValue);
1151 printf("dhcpv4_get_ert_mask - result=%d pValue = %04X\n", result, *pValue);
1152
1153 result = dhcpv4c_get_ert_gw(pValue);
1154 printf("dhcpv4_get_ert_gw - result=%d pValue = %04X\n", result, *pValue);
1155
1156 result = dhcpv4c_get_ert_dns_svrs(pList);
1157 printf("dhcpv4_get_ert_dns_svrs - result=%d num_servers = %d\n", result, pList->number);
1158 for (i=0;i<pList->number;i++)
1159 {
1160 printf(" server [%d] = %04X\n", i, pList->addrs[i]);
1161 }
1162
1163 result = dhcpv4c_get_ert_dhcp_svr(pValue);
1164 printf("dhcpv4_get_ert_dhcp_svr - result=%d pValue = %04X\n", result, *pValue);
1165
1166 result = dhcpv4c_get_ecm_lease_time(pValue);
1167 printf("dhcpv4_get_ecm_lease_time - result=%d pValue = %d\n", result, *pValue);
1168
1169 result = dhcpv4c_get_ecm_remain_lease_time(pValue);
1170 printf("dhcpv4_get_ecm_remain_lease_time - result=%d pValue = %d\n", result, *pValue);
1171
1172 result = dhcpv4c_get_ecm_remain_renew_time(pValue);
1173 printf("dhcpv4_get_ecm_remain_renew_time - result=%d pValue = %d\n", result, *pValue);
1174
1175 result = dhcpv4c_get_ecm_remain_rebind_time(pValue);
1176 printf("dhcpv4_get_ecm_remain_rebind_time - result=%d pValue = %d\n", result, *pValue);
1177
1178 result = dhcpv4c_get_ecm_config_attempts(piValue);
1179 printf("dhcpv4_get_ecm_config_attempts - result=%d piValue = %d\n", result, *piValue);
1180
1181 result = dhcpv4c_get_ecm_ifname(pName);
1182 printf("dhcpv4_get_ecm_ifname - result=%d pName = [%s]\n", result, pName);
1183
1184 result = dhcpv4c_get_ecm_fsm_state(piValue);
1185 printf("dhcpv4_get_ecm_fsm_state - result=%d piValue = %d\n", result, *piValue);
1186
1187 result = dhcpv4c_get_ecm_ip_addr(pValue);
1188 printf("dhcpv4_get_ecm_ip_addr - result=%d pValue = %04X\n", result, *pValue);
1189
1190 result = dhcpv4c_get_ecm_mask(pValue);
1191 printf("dhcpv4_get_ecm_mask - result=%d pValue = %04X\n", result, *pValue);
1192
1193 result = dhcpv4c_get_ecm_gw(pValue);
1194 printf("dhcpv4_get_ecm_gw - result=%d pValue = %04X\n", result, *pValue);
1195
1196 result = dhcpv4c_get_ecm_dns_svrs(pList);
1197 printf("dhcpv4_get_ecm_dns_svrs - result=%d num_servers = %d\n", result, pList->number);
1198 for (i=0;i<pList->number;i++)
1199 {
1200 printf(" server [%d] = %04X\n", i, pList->addrs[i]);
1201 }
1202
1203 result = dhcpv4c_get_ecm_dhcp_svr(pValue);
1204 printf("dhcpv4_get_ecm_dhcp_svr - result=%d pValue = %04X\n", result, *pValue);
1205
1206 result = dhcpv4c_get_emta_remain_lease_time(pValue);
1207 printf("dhcpv4_get_emta_remain_lease_time - result=%d pValue = %d\n", result, *pValue);
1208
1209 result = dhcpv4c_get_emta_remain_renew_time(pValue);
1210 printf("dhcpv4_get_ecm_remain_renew_time - result=%d pValue = %d\n", result, *pValue);
1211
1212 result = dhcpv4c_get_emta_remain_rebind_time(pValue);
1213 printf("dhcpv4_get_ecm_remain_rebind_time - result=%d pValue = %d\n", result, *pValue);
1214
1215 printf("Query all end\n");
1216
1217 query_all_in_progress = 0;
1218}
1219
1220#endif
1221
1222