libtins  4.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Member Functions | List of all members
Tins::Packet Class Reference

Classes

struct  own_pdu
 

Public Member Functions

 Packet ()
 Default constructs a Packet. More...
 
 Packet (const PDU *apdu, const Timestamp &tstamp)
 Constructs a Packet from a PDU* and a Timestamp. More...
 
 Packet (const PDU &apdu, const Timestamp &tstamp)
 Constructs a Packet from a PDU& and a Timestamp. More...
 
 Packet (PDU *apdu, const Timestamp &tstamp, own_pdu)
 Constructs a Packet from a PDU* and a Timestamp. More...
 
 Packet (const PDU &rhs)
 Constructs a Packet from a const PDU&. More...
 
 Packet (const RefPacket &pck)
 Constructs a Packet from a RefPacket. More...
 
 Packet (const PtrPacket &pck)
 Constructs a Packet from a PtrPacket object.
 
 Packet (const Packet &rhs)
 Copy constructor. More...
 
Packetoperator= (const Packet &rhs)
 Copy assignment operator. More...
 
 Packet (Packet &&rhs) TINS_NOEXCEPT
 
Packetoperator= (Packet &&rhs) TINS_NOEXCEPT
 
 ~Packet ()
 Packet destructor. More...
 
const Timestamptimestamp () const
 
PDUpdu ()
 Returns the stored PDU*. More...
 
const PDUpdu () const
 Returns the stored PDU*. More...
 
PDUrelease_pdu ()
 Releases ownership of the stored PDU*. More...
 
 operator bool () const
 Tests whether this is Packet contains a valid PDU. More...
 
Packetoperator/= (const PDU &rhs)
 Concatenation operator. More...
 

Constructor & Destructor Documentation

Tins::Packet::Packet ( )
inline

Default constructs a Packet.

The PDU* will be set to a null pointer.

Tins::Packet::Packet ( const PDU apdu,
const Timestamp tstamp 
)
inline

Constructs a Packet from a PDU* and a Timestamp.

The PDU is cloned using PDU::clone.

Tins::Packet::Packet ( const PDU apdu,
const Timestamp tstamp 
)
inline

Constructs a Packet from a PDU& and a Timestamp.

The PDU is cloned using PDU::clone.

Tins::Packet::Packet ( PDU apdu,
const Timestamp tstamp,
own_pdu   
)
inline

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.

Tins::Packet::Packet ( const PDU rhs)
inline

Constructs a Packet from a const PDU&.

The timestamp will be set to the current time.

This calls PDU::clone on the PDU parameter.

Tins::Packet::Packet ( const RefPacket pck)
inline

Constructs a Packet from a RefPacket.

This calls PDU::clone on the RefPacket's PDU.

Tins::Packet::Packet ( const Packet rhs)
inline

Copy constructor.

This calls PDU::clone on the rhs's PDU* member.

Tins::Packet::Packet ( Packet &&  rhs)
inline

Move constructor.

Tins::Packet::~Packet ( )
inline

Packet destructor.

This calls operator delete on the stored PDU*.

Member Function Documentation

Tins::Packet::operator bool ( ) const
inline

Tests whether this is Packet contains a valid PDU.

Returns
true if pdu() == nullptr, false otherwise.
Packet& Tins::Packet::operator/= ( const PDU rhs)
inline

Concatenation operator.

Adds the PDU at the end of the PDU stack.

Parameters
rhsThe PDU to be appended.
Packet& Tins::Packet::operator= ( const Packet rhs)
inline

Copy assignment operator.

This calls PDU::clone on the rhs's PDU* member.

Packet& Tins::Packet::operator= ( Packet &&  rhs)
inline

Move assignment operator.

PDU* Tins::Packet::pdu ( )
inline

Returns the stored PDU*.

Caller must not delete the pointer.

See Also
Packet::release_pdu
const PDU* Tins::Packet::pdu ( ) const
inline

Returns the stored PDU*.

Caller must not delete the pointer.

See Also
Packet::release_pdu
PDU* Tins::Packet::release_pdu ( )
inline

Releases ownership of the stored PDU*.

This method returns the stored PDU* and sets the stored PDU* to a null pointer, so the destructor will be well behaved. Use this method if you want to keep the internal PDU* somewhere. Otherwise, when Packet's destructor is called, the stored pointer will be deleted.

const Timestamp& Tins::Packet::timestamp ( ) const
inline

Returns this Packet's timestamp.


The documentation for this class was generated from the following file: