summaryrefslogtreecommitdiffstats
path: root/ipaddress.hpp
blob: 51c17ce0d2fb32ef1f2abf82ae5884323438c2c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once

#include "xyz/openbmc_project/Network/IP/server.hpp"
#include "xyz/openbmc_project/Object/Delete/server.hpp"

#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>

#include <string>

namespace phosphor
{
namespace network
{

using IPIfaces =
    sdbusplus::server::object::object<
        sdbusplus::xyz::openbmc_project::Network::server::IP,
        sdbusplus::xyz::openbmc_project::Object::server::Delete>;

using IP = sdbusplus::xyz::openbmc_project::Network::server::IP;

class EthernetInterface;

/** @class IPAddress
 *  @brief OpenBMC IPAddress implementation.
 *  @details A concrete implementation for the
 *  xyz.openbmc_project.Network.IPProtocol
 *  xyz.openbmc_project.Network.IP Dbus interfaces.
 */
class IPAddress : public IPIfaces
{
    public:
        IPAddress() = delete;
        IPAddress(const IPAddress&) = delete;
        IPAddress& operator=(const IPAddress&) = delete;
        IPAddress(IPAddress&&) = delete;
        IPAddress& operator=(IPAddress &&) = delete;
        virtual ~IPAddress() = default;

        /** @brief Constructor to put object onto bus at a dbus path.
         *  @param[in] bus - Bus to attach to.
         *  @param[in] objPath - Path to attach at.
         *  @param[in] parent - Parent object.
         *  @param[in] type - ipaddress type(v4/v6).
         *  @param[in] ipAddress - ipadress.
         *  @param[in] origin - origin of ipaddress(dhcp/static/SLAAC/LinkLocal).
         *  @param[in] prefixLength - Length of prefix.
         *  @param[in] gateway - gateway address.
         */
        IPAddress(sdbusplus::bus::bus& bus,
                  const char* objPath,
                  EthernetInterface& parent,
                  IP::Protocol type,
                  const std::string& ipAddress,
                  IP::AddressOrigin origin,
                  uint8_t prefixLength,
                  const std::string& gateway);

        /** @brief Delete this d-bus object.
         */
        void delete_() override;

    private:

        /** @brief Parent Object. */
        EthernetInterface& parent;

};

} // namespace network
} // namespace phosphor
OpenPOWER on IntegriCloud