developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 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 | #include <stdio.h> |
| 21 | #include <string.h> |
| 22 | #include "dhcp4cApi.h" |
| 23 | #include "dhcpv4c_api.h" |
| 24 | |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 25 | |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 26 | // 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 | |
| 33 | typedef unsigned int token_t; |
| 34 | |
| 35 | typedef 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 | |
| 48 | static const char *dhcp_state[] = { |
| 49 | "init", |
| 50 | "selecting", |
| 51 | "requesting", |
| 52 | "rebinding", |
| 53 | "bound", |
| 54 | "renewing" |
| 55 | }; |
| 56 | |
| 57 | static INT dhcpv4c_sysevent_get_value(char *query_name, char *query_value, unsigned query_value_size) |
| 58 | { |
| 59 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 60 | if (query_name == NULL || query_value == NULL || query_value_size == 0) { |
| 61 | return STATUS_FAILURE; |
| 62 | } else { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 63 | 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 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 74 | return STATUS_FAILURE; |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 75 | } |
| 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); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 81 | return STATUS_FAILURE; |
| 82 | } |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 83 | } |
| 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 93 | |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 94 | 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); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 99 | return STATUS_FAILURE; |
| 100 | } |
| 101 | } |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 102 | pclose(fp); |
| 103 | strncpy(query_value, query, strlen(query)-1); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 104 | } |
| 105 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | #define UPTIME_FILE_PATH "/proc/uptime" |
| 109 | #define MAX_LINE_SIZE 64 |
| 110 | static 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 | |
| 145 | INT dhcpv4c_get_ert_lease_time_udhcp(UINT *pValue) |
| 146 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 147 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 148 | 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; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 154 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 155 | memset(query_value, 0, sizeof(query_value)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 156 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 157 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 161 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 162 | *pValue = atoi(query_value); |
| 163 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 164 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 165 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | INT dhcpv4c_get_ert_remain_lease_time_udhcp(UINT *pValue) |
| 169 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 170 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 171 | 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)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 179 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 180 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 184 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 185 | lease_time = atoi(query_value); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 186 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 187 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 191 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 192 | start_time = atoi(query_value); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 193 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 194 | dhcpv4c_get_up_time(&up_time); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 195 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 196 | remain_lease_time = lease_time - (up_time - start_time); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 197 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 198 | *pValue = remain_lease_time; |
| 199 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 200 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 201 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | INT dhcpv4c_get_ert_remain_renew_time_udhcp(UINT *pValue) |
| 205 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 206 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 207 | 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; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 214 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 215 | memset(query_value, 0, sizeof(query_value)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 216 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 217 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 221 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 222 | lease_time = atoi(query_value); |
| 223 | renew_time = lease_time/2; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 224 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 225 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 229 | |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 230 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 231 | start_time = atoi(query_value); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 232 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 233 | dhcpv4c_get_up_time(&up_time); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 234 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 235 | remain_renew_time = renew_time - (up_time - start_time); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 236 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 237 | *pValue = remain_renew_time; |
| 238 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 239 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 240 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | INT dhcpv4c_get_ert_remain_rebind_time_udhcp(UINT *pValue) |
| 244 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 245 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 246 | 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; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 253 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 254 | memset(query_value, 0, sizeof(query_value)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 255 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 256 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 260 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 261 | lease_time = atoi(query_value); |
| 262 | rebind_time = lease_time*7/8; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 263 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 264 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 268 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 269 | start_time = atoi(query_value); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 270 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 271 | dhcpv4c_get_up_time(&up_time); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 272 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 273 | remain_bind_time = rebind_time - (up_time - start_time); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 274 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 275 | *pValue = remain_bind_time; |
| 276 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 277 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 278 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | INT dhcpv4c_get_ert_config_attempts_udhcp(INT *pValue) |
| 282 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 283 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 284 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | INT dhcpv4c_get_ert_ifname_udhcp(CHAR *pName) |
| 294 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 295 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 296 | if (NULL == pName) { |
| 297 | HAL_DHCPV4C_ERT_DBG((stderr, "%s %d invalid parameter\n", __FUNCTION__, __LINE__)); |
| 298 | return STATUS_FAILURE; |
| 299 | } else { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 300 | 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 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 308 | return STATUS_FAILURE; |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 309 | } |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 310 | 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); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 320 | } |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 321 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | INT dhcpv4c_get_ert_fsm_state_udhcp(INT *pValue) |
| 325 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 326 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 327 | 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; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 334 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 335 | memset(query_value, 0, sizeof(query_value)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 336 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 337 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 341 | |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 342 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 343 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 350 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 351 | if ((i==sizeof(dhcp_state)/sizeof(char*)) && (strcmp("renew", query_value) == 0)) { |
| 352 | *pValue = COSA_DML_DHCPC_STATUS_Bound; |
| 353 | } |
| 354 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 355 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 356 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | INT dhcpv4c_get_ert_ip_addr_udhcp(UINT *pValue) |
| 360 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 361 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 362 | 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; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 369 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 370 | memset(query_value, 0, sizeof(query_value)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 371 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 372 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 376 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 377 | inet_aton(query_value, &addr); |
| 378 | *pValue = addr.s_addr; |
| 379 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 380 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 381 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 382 | } |
| 383 | |
| 384 | INT dhcpv4c_get_ert_mask_udhcp(UINT *pValue) |
| 385 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 386 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 387 | 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)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 396 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 397 | 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 | } |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 401 | |
| 402 | inet_aton(query_value, &addr); |
| 403 | *pValue = addr.s_addr; |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 404 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 405 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 406 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | INT dhcpv4c_get_ert_gw_udhcp(UINT *pValue) |
| 410 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 411 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 412 | 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; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 420 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 421 | memset(query_value, 0, sizeof(query_value)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 422 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 423 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 427 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 428 | gw_num = atoi(query_value); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 429 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 430 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 435 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 436 | inet_aton(query_value, &addr); |
| 437 | *pValue = addr.s_addr; |
| 438 | } else { |
| 439 | *pValue = 0; |
| 440 | } |
| 441 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 442 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 443 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 444 | } |
| 445 | |
| 446 | INT dhcpv4c_get_ert_dns_svrs_udhcp(dhcpv4c_ip_list_t *pList) |
| 447 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 448 | 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; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 455 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 456 | memset(query_value, 0, sizeof(query_value)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 457 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 458 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 462 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 463 | dns_num = atoi(query_value); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 464 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 465 | if (dns_num >= 1) { |
| 466 | int i = 0; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 467 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 468 | if (dns_num >4) |
| 469 | dns_num = 4; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 470 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 471 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 479 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 480 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 488 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 489 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | INT dhcpv4c_get_ert_dhcp_svr_udhcp(UINT *pValue) |
| 493 | { |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 494 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 495 | 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; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 502 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 503 | memset(query_value, 0, sizeof(query_value)); |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 504 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 505 | 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 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 509 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 510 | inet_aton(query_value, &addr); |
| 511 | *pValue = addr.s_addr; |
| 512 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 513 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 514 | return STATUS_SUCCESS; |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 515 | } |
| 516 | |
| 517 | // End of UDHCPC client required APi |
| 518 | |
| 519 | #ifdef DEBUG_QUERY_ALL |
| 520 | void query_all(); |
| 521 | static int query_all_in_progress = 0; |
| 522 | #endif |
| 523 | |
| 524 | INT dhcpv4c_get_ert_lease_time(UINT *pValue) |
| 525 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 526 | if (NULL == pValue) |
| 527 | { |
| 528 | return STATUS_FAILURE; |
| 529 | } |
| 530 | else |
| 531 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 532 | return dhcpv4c_get_ert_lease_time_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 533 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | INT dhcpv4c_get_ert_remain_lease_time(UINT *pValue) |
| 537 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 538 | if(pValue==NULL) |
| 539 | { |
| 540 | return(STATUS_FAILURE); |
| 541 | } |
| 542 | else |
| 543 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 544 | return dhcpv4c_get_ert_remain_lease_time_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 545 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | INT dhcpv4c_get_ert_remain_renew_time(UINT *pValue) |
| 549 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 550 | if (NULL == pValue) |
| 551 | { |
| 552 | return STATUS_FAILURE; |
| 553 | } |
| 554 | else |
| 555 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 556 | return dhcpv4c_get_ert_remain_renew_time_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 557 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | INT dhcpv4c_get_ert_remain_rebind_time(UINT *pValue) |
| 561 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 562 | if (NULL == pValue) |
| 563 | { |
| 564 | return STATUS_FAILURE; |
| 565 | } |
| 566 | else |
| 567 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 568 | return dhcpv4c_get_ert_remain_rebind_time_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 569 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 570 | } |
| 571 | |
| 572 | INT dhcpv4c_get_ert_config_attempts(INT *pValue) |
| 573 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 574 | if (NULL == pValue) |
| 575 | { |
| 576 | return STATUS_FAILURE; |
| 577 | } |
| 578 | else |
| 579 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 580 | return dhcpv4c_get_ert_config_attempts_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 581 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | INT dhcpv4c_get_ert_ifname(CHAR *pName) |
| 585 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 586 | if (NULL == pName) |
| 587 | { |
| 588 | return STATUS_FAILURE; |
| 589 | } |
| 590 | else |
| 591 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 592 | return dhcpv4c_get_ert_ifname_udhcp(pName); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 593 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 594 | } |
| 595 | |
| 596 | INT dhcpv4c_get_ert_fsm_state(INT *pValue) |
| 597 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 598 | if(pValue==NULL) |
| 599 | { |
| 600 | return(STATUS_FAILURE); |
| 601 | } |
| 602 | else |
| 603 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 604 | return dhcpv4c_get_ert_fsm_state_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 605 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 606 | } |
| 607 | |
| 608 | INT dhcpv4c_get_ert_ip_addr(UINT *pValue) |
| 609 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 610 | if (NULL == pValue) |
| 611 | { |
| 612 | return STATUS_FAILURE; |
| 613 | } |
| 614 | else |
| 615 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 616 | return dhcpv4c_get_ert_ip_addr_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 617 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 618 | } |
| 619 | |
| 620 | INT dhcpv4c_get_ert_mask(UINT *pValue) |
| 621 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 622 | if (NULL == pValue) |
| 623 | { |
| 624 | return STATUS_FAILURE; |
| 625 | } |
| 626 | else |
| 627 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 628 | return dhcpv4c_get_ert_mask_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 629 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 630 | } |
| 631 | |
| 632 | INT dhcpv4c_get_ert_gw(UINT *pValue) |
| 633 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 634 | if(pValue==NULL) |
| 635 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 636 | return STATUS_FAILURE; |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 637 | } |
| 638 | else |
| 639 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 640 | return dhcpv4c_get_ert_gw_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 641 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 642 | } |
| 643 | |
| 644 | INT dhcpv4c_get_ert_dns_svrs(dhcpv4c_ip_list_t *pList) |
| 645 | { |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 646 | if (NULL == pList) |
| 647 | { |
| 648 | return STATUS_FAILURE; |
| 649 | } |
| 650 | else |
| 651 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 652 | return dhcpv4c_get_ert_dns_svrs_udhcp((ipv4AddrList_t*) pList); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 653 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 654 | } |
| 655 | |
| 656 | INT dhcpv4c_get_ert_dhcp_svr(UINT *pValue) |
| 657 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 658 | |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 659 | if (NULL == pValue) |
| 660 | { |
| 661 | return STATUS_FAILURE; |
| 662 | } |
| 663 | else |
| 664 | { |
developer | b236c79 | 2022-05-13 13:21:23 +0800 | [diff] [blame] | 665 | return dhcpv4c_get_ert_dhcp_svr_udhcp(pValue); |
developer | 8bdcf62 | 2022-05-13 13:17:24 +0800 | [diff] [blame] | 666 | } |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 667 | } |
| 668 | |
developer | 272ba20 | 2022-04-07 18:13:54 +0800 | [diff] [blame] | 669 | /* 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 | */ |
| 685 | INT 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 | */ |
| 714 | INT 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 | */ |
| 743 | INT 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 | */ |
| 772 | INT 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 | */ |
| 801 | INT 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 | */ |
| 830 | INT 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 | */ |
| 859 | INT 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 | */ |
| 888 | INT 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 | */ |
| 917 | INT 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 | */ |
| 946 | INT 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 | */ |
| 975 | INT 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 | */ |
| 1004 | INT 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 | */ |
| 1034 | INT 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 | */ |
| 1063 | INT 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 | */ |
| 1092 | INT 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 |
| 1106 | void 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 | |