Lines Matching refs:cfg

206             sptr<InterfaceConfiguration> cfg = new (std::nothrow) InterfaceConfiguration();  in ReadUserConfiguration()  local
207 if (cfg == nullptr) { in ReadUserConfiguration()
211 ParserFileConfig(fileContent, iface, cfg); in ReadUserConfiguration()
215 devCfgs[iface] = cfg; in ReadUserConfiguration()
223 …tConfiguration::WriteUserConfiguration(const std::string &iface, sptr<InterfaceConfiguration> &cfg) in WriteUserConfiguration() argument
225 if (cfg == nullptr) { in WriteUserConfiguration()
234 if (cfg->mode_ == STATIC || cfg->mode_ == LAN_STATIC) { in WriteUserConfiguration()
235 ParserIfaceIpAndRoute(cfg, std::string()); in WriteUserConfiguration()
239 GenCfgContent(iface, cfg, fileContent); in WriteUserConfiguration()
332 sptr<InterfaceConfiguration> cfg = new (std::nothrow) InterfaceConfiguration(); in MakeInterfaceConfiguration() local
333 if (cfg == nullptr) { in MakeInterfaceConfiguration()
337 cfg->mode_ = devCfg->mode_; in MakeInterfaceConfiguration()
339 cfg->ipStatic_.ipAddrList_.push_back(ipAddr); in MakeInterfaceConfiguration()
347 cfg->ipStatic_.netMaskList_.push_back(netMask); in MakeInterfaceConfiguration()
350 cfg->ipStatic_.routeList_.push_back(route.destination_); in MakeInterfaceConfiguration()
352 cfg->ipStatic_.gatewayList_ = GetGatewayFromRouteList(devLinkInfo->routeList_); in MakeInterfaceConfiguration()
354 cfg->ipStatic_.domain_ = devLinkInfo->domain_; in MakeInterfaceConfiguration()
356 cfg->ipStatic_.dnsServers_.push_back(addr); in MakeInterfaceConfiguration()
358 return cfg; in MakeInterfaceConfiguration()
474 sptr<InterfaceConfiguration> cfg) in ParserFileConfig() argument
477 ParseBootProto(fileContent, cfg); in ParserFileConfig()
478 ParseStaticConfig(fileContent, cfg); in ParserFileConfig()
479 ParserFileHttpProxy(fileContent, cfg); in ParserFileConfig()
493 …rnetConfiguration::ParseBootProto(const std::string &fileContent, sptr<InterfaceConfiguration> cfg) in ParseBootProto() argument
502 cfg->mode_ = LAN_STATIC; in ParseBootProto()
504 cfg->mode_ = LAN_DHCP; in ParseBootProto()
506 cfg->mode_ = STATIC; in ParseBootProto()
508 cfg->mode_ = DHCP; in ParseBootProto()
512 …tConfiguration::ParseStaticConfig(const std::string &fileContent, sptr<InterfaceConfiguration> cfg) in ParseStaticConfig() argument
514 if (cfg->mode_ != STATIC && cfg->mode_ != LAN_STATIC) { in ParseStaticConfig()
554 StaticConfiguration::ExtractNetAddrBySeparator(ipAddresses, cfg->ipStatic_.ipAddrList_); in ParseStaticConfig()
555 StaticConfiguration::ExtractNetAddrBySeparator(routes, cfg->ipStatic_.routeList_); in ParseStaticConfig()
556 StaticConfiguration::ExtractNetAddrBySeparator(gateways, cfg->ipStatic_.gatewayList_); in ParseStaticConfig()
557 StaticConfiguration::ExtractNetAddrBySeparator(netMasks, cfg->ipStatic_.netMaskList_); in ParseStaticConfig()
558 StaticConfiguration::ExtractNetAddrBySeparator(dnsServers, cfg->ipStatic_.dnsServers_); in ParseStaticConfig()
559 ParserIfaceIpAndRoute(cfg, routeMasks); in ParseStaticConfig()
562 …ation::ParserFileHttpProxy(const std::string &fileContent, const sptr<InterfaceConfiguration> &cfg) in ParserFileHttpProxy() argument
567 cfg->httpProxy_.SetHost(fileContent.substr(pos, fileContent.find(WRAP, pos) - pos)); in ParserFileHttpProxy()
574 cfg->httpProxy_.SetPort(static_cast<uint16_t>(port)); in ParserFileHttpProxy()
585 cfg->httpProxy_.SetExclusionList(exclusionList); in ParserFileHttpProxy()
589 void EthernetConfiguration::ParserIfaceIpAndRoute(sptr<InterfaceConfiguration> &cfg, const std::str… in ParserIfaceIpAndRoute() argument
591 if (cfg == nullptr) { in ParserIfaceIpAndRoute()
596 …std::for_each(cfg->ipStatic_.netMaskList_.begin(), cfg->ipStatic_.netMaskList_.end(), [&cfg](const… in ParserIfaceIpAndRoute()
598 for (auto &ipAddr : cfg->ipStatic_.ipAddrList_) { in ParserIfaceIpAndRoute()
612 for (auto &route : cfg->ipStatic_.routeList_) { in ParserIfaceIpAndRoute()
637 …id EthernetConfiguration::GenCfgContent(const std::string &iface, sptr<InterfaceConfiguration> cfg, in GenCfgContent() argument
640 if (cfg == nullptr) { in GenCfgContent()
646 std::string mode = GetIfaceMode(cfg->mode_); in GenCfgContent()
648 if (cfg->mode_ == STATIC || cfg->mode_ == LAN_STATIC) { in GenCfgContent()
649 std::string ipAddresses = AccumulateNetAddress(cfg->ipStatic_.ipAddrList_); in GenCfgContent()
650 std::string netMasks = AccumulateNetAddress(cfg->ipStatic_.netMaskList_); in GenCfgContent()
651 std::string gateways = AccumulateNetAddress(cfg->ipStatic_.gatewayList_); in GenCfgContent()
652 std::string routes = AccumulateNetAddress(cfg->ipStatic_.routeList_); in GenCfgContent()
654 … std::accumulate(cfg->ipStatic_.routeList_.begin(), cfg->ipStatic_.routeList_.end(), std::string(), in GenCfgContent()
660 std::string dnsServers = AccumulateNetAddress(cfg->ipStatic_.dnsServers_); in GenCfgContent()
669 GenHttpProxyContent(cfg, fileContent); in GenCfgContent()
672 void EthernetConfiguration::GenHttpProxyContent(const sptr<InterfaceConfiguration> &cfg, std::strin… in GenHttpProxyContent() argument
674 const auto &exclusionList = cfg->httpProxy_.GetExclusionList(); in GenHttpProxyContent()
681 fileContent = fileContent + KEY_PROXY_HOST + cfg->httpProxy_.GetHost() + WRAP; in GenHttpProxyContent()
682 fileContent = fileContent + KEY_PROXY_PORT + std::to_string(cfg->httpProxy_.GetPort()) + WRAP; in GenHttpProxyContent()