libtins  4.0
Public Types | Public Member Functions | Friends | List of all members
Tins::PacketWrapper< PDUType, TimestampType > Class Template Reference

Represents a sniffed packet. More...

#include <packet.h>

Public Types

typedef PDUType pdu_type
 
typedef TimestampType timestamp_type
 

Public Member Functions

 operator pdu_type ()
 User defined conversion to wrapped_type. More...
 
pdu_type pdu ()
 Returns the wrapped_type.
 
const pdu_type pdu () const
 Returns the PDU const reference.
 
const Timestamptimestamp () const
 Returns the packet timestamp. More...
 

Friends

class BaseSniffer
 
class SnifferIterator
 

Detailed Description

template<typename PDUType, typename TimestampType>
class Tins::PacketWrapper< PDUType, TimestampType >

Represents a sniffed packet.

RefPackets contain a PDU reference and a timestamp. The difference between this class and the Packet class is that this one contains a reference to a PDU, and not a pointer to one.

This class is only used in some BaseSniffer methods as a thin wrapper to a PDU pointer/reference. Only BaseSniffer and derived objects can create instances of it.

Member Function Documentation

template<typename PDUType , typename TimestampType >
Tins::PacketWrapper< PDUType, TimestampType >::operator pdu_type ( )
inline

User defined conversion to wrapped_type.

This conversion is defined so that BaseSniffer::sniff_loop callback or code that calls BaseSniffer::next_packet can still receive a PDU pointer/reference without modifying the code at all.

template<typename PDUType , typename TimestampType >
const Timestamp& Tins::PacketWrapper< PDUType, TimestampType >::timestamp ( ) const
inline

Returns the packet timestamp.

This is the timestamp in which the packet was taken out of the network interface/pcap file.


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