mirror of
https://github.com/mfontanini/libtins
synced 2026-01-28 04:34:27 +01:00
Done minor modification, mostly on documentation.
This commit is contained in:
@@ -135,11 +135,6 @@ namespace Tins {
|
||||
*/
|
||||
EAPOL(uint8_t packet_type, EAPOLTYPE type);
|
||||
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
*/
|
||||
EAPOL(const EAPOL &other);
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates an EAPOL object from a buffer.
|
||||
* \param buffer The buffer from which this PDU will be constructed.
|
||||
@@ -147,8 +142,6 @@ namespace Tins {
|
||||
*/
|
||||
EAPOL(const uint8_t *buffer, uint32_t total_sz);
|
||||
|
||||
void copy_eapol_fields(const EAPOL *other);
|
||||
|
||||
TINS_BEGIN_PACK
|
||||
struct eapolhdr {
|
||||
uint8_t version, packet_type;
|
||||
|
||||
@@ -35,11 +35,22 @@
|
||||
#include "pdu.h"
|
||||
#include "timestamp.h"
|
||||
|
||||
/**
|
||||
* \namespace Tins
|
||||
*/
|
||||
namespace Tins {
|
||||
template<typename WrappedType, typename TimestampType>
|
||||
class PacketWrapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Thin wrapper over a PDU and Timestamp reference.
|
||||
*/
|
||||
typedef PacketWrapper<PDU&, const Timestamp&> RefPacket;
|
||||
|
||||
/**
|
||||
* \brief Thin wrapper over a PDU pointer and a Timestamp.
|
||||
*/
|
||||
typedef PacketWrapper<PDU*, Timestamp> PtrPacket;
|
||||
|
||||
/**
|
||||
@@ -109,7 +120,7 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Represents a sniffed packet.
|
||||
* \class Represents a sniffed packet.
|
||||
*
|
||||
* A Packet contains a PDU pointer and a Timestamp object. Packets
|
||||
* <b>will delete</b> the stored PDU* unless you call release_pdu at
|
||||
|
||||
@@ -89,18 +89,25 @@ namespace Tins {
|
||||
* object. This wrapper can be both implicitly converted to a
|
||||
* PDU* and a Packet object. So doing this:
|
||||
*
|
||||
* \code
|
||||
* Sniffer s(...);
|
||||
* // smart pointer? :D
|
||||
* PDU *pdu = s.next_packet();
|
||||
* // Packet takes care of the PDU*. \sa Packet::release_pdu
|
||||
* std::unique_ptr<PDU> pdu(s.next_packet());
|
||||
* // Packet takes care of the PDU*.
|
||||
* Packet packet(s.next_packet());
|
||||
* \endcode
|
||||
*
|
||||
* Is fine, but this:
|
||||
*
|
||||
* \code
|
||||
* // bad!!
|
||||
* PtrPacket p = s.next_packet();
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* Is not, since PtrPacket can't be copy constructed.
|
||||
*
|
||||
* \sa Packet::release_pdu
|
||||
*
|
||||
* \return The captured packet, matching the given filter.
|
||||
* If an error occured(probably compiling the filter), PtrPacket::pdu
|
||||
* will return 0. Caller takes ownership of the PDU * stored in
|
||||
@@ -115,8 +122,10 @@ namespace Tins {
|
||||
* The callback object must implement an operator with some of
|
||||
* the following(or compatible) signatures:
|
||||
*
|
||||
* \code
|
||||
* bool operator()(PDU&);
|
||||
* bool operator()(RefPacket&);
|
||||
* \endcode
|
||||
*
|
||||
* This operator will be called using the sniffed packets
|
||||
* as arguments. You can modify the parameter argument as you wish.
|
||||
@@ -125,12 +134,14 @@ namespace Tins {
|
||||
*
|
||||
* The callback taking a RefPacket will contain a timestamp
|
||||
* indicating the moment in which the packet was taken out of
|
||||
* the wire/pcap file. \sa RefPacket
|
||||
* the wire/pcap file.
|
||||
*
|
||||
* Note that the Functor object will be copied using its copy
|
||||
* constructor, so that object should be some kind of proxy to
|
||||
* another object which will process the packets(e.g. std::bind).
|
||||
*
|
||||
* \sa RefPacket
|
||||
*
|
||||
* \param cback_handler The callback handler object which should process packets.
|
||||
* \param max_packets The maximum amount of packets to sniff. 0 == infinite.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user