Lines Matching refs:dhcpConfig

33 static int SetEnableConfigInfo(DhcpConfig *dhcpConfig, const char *pKey, const char *pValue)
35 if ((dhcpConfig == nullptr) || (pKey == nullptr) || (pValue == nullptr)) {
36 DHCP_LOGE("SetEnableConfigInfo param dhcpConfig or pKey or pValue is nullptr!");
47 dhcpConfig->distribution = uValue;
49 dhcpConfig->broadcast = uValue;
54 static int SetTimeConfigInfo(DhcpConfig *dhcpConfig, const char *pKey, const char *pValue)
56 if ((dhcpConfig == nullptr) || (pKey == nullptr) || (pValue == nullptr)) {
57 DHCP_LOGE("SetTimeConfigInfo param dhcpConfig or pKey or pValue is nullptr!");
68 dhcpConfig->leaseTime = uValue;
70 dhcpConfig->renewalTime = uValue;
72 dhcpConfig->rebindingTime = uValue;
77 static int SetNetConfigInfo(DhcpConfig *dhcpConfig, const char *pKey, const char *pValue, int common)
79 if ((dhcpConfig == nullptr) || (pKey == nullptr) || (pValue == nullptr)) {
80 DHCP_LOGE("SetNetConfigInfo param dhcpConfig or pKey or pValue is nullptr!");
91 dhcpConfig->serverId = uValue;
93 dhcpConfig->gateway = uValue;
95 dhcpConfig->netmask = uValue;
100 static int SetIpAddressPool(DhcpConfig *dhcpConfig, const char *pValue)
102 if ((dhcpConfig == nullptr) || (pValue == nullptr)) {
103 DHCP_LOGE("SetIpAddressPool param dhcpConfig or pValue is nullptr!");
120 dhcpConfig->pool.beginAddress = begin;
126 dhcpConfig->pool.endAddress = end;
130 static int SetDnsInfo(DhcpConfig *dhcpConfig, const char *pValue)
132 if ((dhcpConfig == nullptr) || (pValue == nullptr)) {
133 DHCP_LOGE("SetDnsInfo param dhcpConfig or pValue is nullptr!");
146 if (GetOption(&dhcpConfig->options, optDns.code) != nullptr) {
147 RemoveOption(&dhcpConfig->options, optDns.code);
161 PushBackOption(&dhcpConfig->options, &optDns);
165 static int SetIfnameInfo(DhcpConfig *dhcpConfig, const char *pValue)
167 if ((dhcpConfig == nullptr) || (pValue == nullptr)) {
168 DHCP_LOGE("SetIfnameInfo dhcpConfig or pValue is nullptr!");
175 if (memset_s(dhcpConfig->ifname, IFACE_NAME_SIZE, '\0', IFACE_NAME_SIZE) != EOK ||
176 strncpy_s(dhcpConfig->ifname, IFACE_NAME_SIZE, pValue, strlen(pValue)) != EOK) {
182 static int SetDhcpConfig(DhcpConfig *dhcpConfig, const char *strLine, int common)
197 return SetIfnameInfo(dhcpConfig, pSave);
199 return SetDnsInfo(dhcpConfig, pSave);
201 return SetIpAddressPool(dhcpConfig, pSave);
204 return SetNetConfigInfo(dhcpConfig, pTok, pSave, common);
207 return SetTimeConfigInfo(dhcpConfig, pTok, pSave);
209 return SetEnableConfigInfo(dhcpConfig, pTok, pSave);
216 static int ParseConfigFile(const char *configFile, const char *ifname, DhcpConfig *dhcpConfig)
218 if ((configFile == nullptr) || (strlen(configFile) == 0) || (dhcpConfig == nullptr)) {
219 DHCP_LOGE("ParseConfigFile param configFile or dhcpConfig is nullptr or len = 0!");
251 if (bValid && SetDhcpConfig(dhcpConfig, strLine, bComm) != RET_SUCCESS) {