dhcp4_dhcp4o6_ipc.h 2.29 KB
Newer Older
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
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

#ifndef DHCP4_DHCP4O6_IPC_H
#define DHCP4_DHCP4O6_IPC_H

/// @file dhcp4_dhcp4o6_ipc.h Defines the Dhcp4o6Ipc class.
/// This file defines the class Kea uses to act as the DHCPv4 server
/// side of DHCPv4-over-DHCPv6 communication between servers.
///

#include <dhcp/pkt4o6.h>
#include <dhcpsrv/dhcp4o6_ipc.h>
#include <boost/shared_ptr.hpp>

namespace isc {
namespace dhcp {

/// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv4 server side
31
class Dhcp4to6Ipc : public Dhcp4o6IpcBase {
32 33 34 35
protected:
    /// @brief Constructor
    ///
    /// Default constructor
36
    Dhcp4to6Ipc();
37 38

    /// @brief Destructor.
39
    virtual ~Dhcp4to6Ipc() { }
40 41 42 43

public:
    /// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
    ///
44
    /// Dhcp4to6Ipc is a singleton class
45 46
    ///
    /// @return the only existing instance of DHCP4o6 IPC
47
    static Dhcp4to6Ipc& instance();
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 73 74

    /// @brief Open communication socket
    ///
    /// Call base open method and sets the handler/callback when needed
    virtual void open();

    /// @brief On receive handler
    ///
    /// The handler processes the DHCPv4-query DHCPv6 packet and
    /// sends the DHCPv4-response DHCPv6 packet back to the DHCPv6 server
    static void handler();

    /// @brief Returns last received packet
    ///
    /// @return a reference to a shared pointer to the last received packet
    /// @note This reference should be cleared after use
    Pkt4o6Ptr& getReceived();

private:
    /// @brief last received packet
    Pkt4o6Ptr received_;
};

} // namespace isc
} // namespace dhcp

#endif