1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-30 21:44:26 +01:00

Added documentation to PacketWriter.

This commit is contained in:
Matias Fontanini
2012-09-06 20:57:32 -03:00
parent 9981819b71
commit 10681eee8f
3 changed files with 68 additions and 40 deletions

View File

@@ -27,19 +27,50 @@
namespace Tins {
class PDU;
/**
* \class PacketWriter
* \brief Writes PDUs to a pcap format file.
*/
class PacketWriter {
public:
/**
* \brief The type of PDUs that will be written to this file.
*
* This flag should match the type of the lowest layer PDU to be
* written.
*/
enum LinkType {
RADIOTAP = DLT_IEEE802_11_RADIO,
ETH2 = DLT_EN10MB
};
/**
* \brief Constructs a PacketWriter.
* \param file_name The file in which to store the written PDUs.
* \param lt The link type which will be written to this file.
* \sa LinkType.
*/
PacketWriter(const std::string &file_name, LinkType lt);
/**
* Destructor.
*/
~PacketWriter();
/**
* \brief Writes a PDU to this file.
*/
void write(PDU *pdu);
/**
* \brief Writes all the PDUs in the range [start, end)
* \param start A forward iterator pointing to the first PDU
* to be written.
* \param end A forward iterator pointing to one past the last
* PDU in the range.
* \return ForwardIterator which will be a copy of end.
*/
template<typename ForwardIterator>
ForwardIterator write(ForwardIterator start, ForwardIterator end) {
while(start != end)

View File

@@ -73,7 +73,8 @@ namespace Tins {
*
* This operator will be called using the sniffed packets
* as arguments. The callback object <b>must not</b> delete the
* PDU parameter.
* PDU parameter. You can modify it as you wish, though. Calling
* PDU methods like PDU::release_inner_pdu is perfectly valid.
*
* Note that the Functor object will be copied using its copy
* constructor, so that object should be some kind of proxy to