diff --git a/include/packet.h b/include/packet.h index 1936023..7a1fec9 100644 --- a/include/packet.h +++ b/include/packet.h @@ -128,6 +128,13 @@ private: */ class Packet { public: + /** + * Tag used to specify that a Packet should own a PDU pointer. + */ + struct own_pdu { + + }; + /** * \brief Default constructs a Packet. * @@ -143,6 +150,17 @@ public: */ Packet(const PDU *apdu, const Timestamp &tstamp) : pdu_(apdu->clone()), ts(tstamp) { } + + /** + * \brief Constructs a Packet from a PDU* and a Timestamp. + * + * The PDU* will be owned by the Packet. This means you + * do not have to explicitly delete the pointer, that + * will be done automatically by the Packet when it goes out + * of scope. + */ + Packet(PDU *apdu, const Timestamp &tstamp, own_pdu) + : pdu_(apdu), ts(tstamp) { } /** * \brief Constructs a Packet from a const PDU&.