blob: 7ffb76916c9985c01054330979d3b7e20d4e5b37 [file] [log] [blame]
Ratan Gupta4af36762017-04-20 19:12:29 +05301#pragma once
2
Ratan Gupta4af36762017-04-20 19:12:29 +05303#include <sdbusplus/bus.hpp>
4#include <sdbusplus/server/object.hpp>
Ratan Gupta4af36762017-04-20 19:12:29 +05305#include <string>
Patrick Venture189d44e2018-07-09 12:30:59 -07006#include <xyz/openbmc_project/Network/IP/server.hpp>
7#include <xyz/openbmc_project/Object/Delete/server.hpp>
Ratan Gupta4af36762017-04-20 19:12:29 +05308
9namespace phosphor
10{
11namespace network
12{
13
14using IPIfaces =
15 sdbusplus::server::object::object<
16 sdbusplus::xyz::openbmc_project::Network::server::IP,
17 sdbusplus::xyz::openbmc_project::Object::server::Delete>;
18
19using IP = sdbusplus::xyz::openbmc_project::Network::server::IP;
20
21class EthernetInterface;
22
23/** @class IPAddress
24 * @brief OpenBMC IPAddress implementation.
25 * @details A concrete implementation for the
26 * xyz.openbmc_project.Network.IPProtocol
27 * xyz.openbmc_project.Network.IP Dbus interfaces.
28 */
29class IPAddress : public IPIfaces
30{
31 public:
32 IPAddress() = delete;
33 IPAddress(const IPAddress&) = delete;
34 IPAddress& operator=(const IPAddress&) = delete;
35 IPAddress(IPAddress&&) = delete;
36 IPAddress& operator=(IPAddress &&) = delete;
37 virtual ~IPAddress() = default;
38
39 /** @brief Constructor to put object onto bus at a dbus path.
40 * @param[in] bus - Bus to attach to.
41 * @param[in] objPath - Path to attach at.
42 * @param[in] parent - Parent object.
43 * @param[in] type - ipaddress type(v4/v6).
44 * @param[in] ipAddress - ipadress.
Ratan Gupta29b0e432017-05-25 12:51:40 +053045 * @param[in] origin - origin of ipaddress(dhcp/static/SLAAC/LinkLocal).
Ratan Gupta4af36762017-04-20 19:12:29 +053046 * @param[in] prefixLength - Length of prefix.
47 * @param[in] gateway - gateway address.
48 */
49 IPAddress(sdbusplus::bus::bus& bus,
50 const char* objPath,
51 EthernetInterface& parent,
52 IP::Protocol type,
53 const std::string& ipAddress,
Ratan Gupta29b0e432017-05-25 12:51:40 +053054 IP::AddressOrigin origin,
Ratan Gupta4af36762017-04-20 19:12:29 +053055 uint8_t prefixLength,
56 const std::string& gateway);
57
58 /** @brief Delete this d-bus object.
59 */
60 void delete_() override;
61
62 private:
63
64 /** @brief Parent Object. */
65 EthernetInterface& parent;
66
67};
68
69} // namespace network
70} // namespace phosphor