[kea-dev] Accessing DHCP options within hooks libs

Duane Zimmer Duane.Zimmer at yourlinkinc.net
Wed Jun 22 17:58:44 UTC 2016

Okay that all worked.  But now I'm stuck, what if I want to map a subnet from a helper-address to a different IP pool?  how do I do that?  

-----Original Message-----
From: kea-dev-bounces at lists.isc.org [mailto:kea-dev-bounces at lists.isc.org] On Behalf Of Francis Dupont
Sent: Tuesday, June 21, 2016 1:49 PM
To: Francis Dupont <fdupont at isc.org>
Cc: Kea Dev List <kea-dev at lists.isc.org>
Subject: Re: [kea-dev] Accessing DHCP options within hooks libs

Francis Dupont writes:
> We are using smart pointers, not raw pointers, so perhaps it is 
> possible to implement a kind of copy on write?
> PS: usually COW in C++ is done playing on const/not const.

=> revisiting the #4497 ticket and its associated discussio I add a point: there is a trivial way to deep copy a packet (or an option):
just pack it and unpack the result, i.e., the opposite of the repack method of pkt.h:

    /// @brief Copies content of input buffer to output buffer.
    /// This is mostly a diagnostic function. It is being used for sending
    /// received packet. Received packet is stored in data_, but
    /// transmitted data is stored in buffer_out_. If we want to send packet
    /// that we just received, a copy between those two buffers is necessary.
    void repack();
BTW even it is a reunpack() IMHO something like deepcopy() is a better (and less misleading) name.


Francis Dupont <fdupont at isc.org>

PS: sample code (with X = 4 or 6) for a packet:

void deepCopy(PktXPtr& pkt) {
    OutputBuffer& buf(pkt->getBuffer());
    pkt.reset(new PktX(&buf[0], buf.size(),
                       pkt->getRemotePort())); } _______________________________________________
kea-dev mailing list
kea-dev at lists.isc.org

More information about the kea-dev mailing list