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