1 /* 2 // Copyright (c) 2018 Intel Corporation 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 */ 16 #pragma once 17 #include <sdbusplus/timer.hpp> 18 #include "utils.hpp" 19 20 namespace phosphor 21 { 22 namespace service 23 { 24 25 static constexpr const char *serviceConfigSrvName = 26 "xyz.openbmc_project.Control.Service.Manager"; 27 static constexpr const char *serviceConfigIntfName = 28 "xyz.openbmc_project.Control.Service.Attributes"; 29 30 enum class UpdatedProp 31 { 32 port = 1, 33 channel, 34 state 35 }; 36 37 class ServiceConfig 38 { 39 public: 40 ServiceConfig(sdbusplus::asio::object_server &srv_, 41 std::shared_ptr<sdbusplus::asio::connection> &conn_, 42 std::string objPath_, std::string unitName); 43 ~ServiceConfig() = default; 44 45 void applySystemDServiceConfig(); 46 void startServiceRestartTimer(); 47 48 std::shared_ptr<sdbusplus::asio::connection> conn; 49 uint8_t updatedFlag; 50 51 private: 52 sdbusplus::asio::object_server &server; 53 std::string objPath; 54 55 uint16_t portNum; 56 std::string protocol; 57 std::string stateValue; 58 std::vector<std::string> channelList; 59 60 void registerProperties(); 61 std::string sysDUnitName; 62 std::string unitSocketFilePath; 63 std::string sysDSockObjPath; 64 65 void syncWithSystemD1Properties(); 66 }; 67 68 } // namespace service 69 } // namespace phosphor 70