/usr/include/ns3/pcap-test.h is in libns3-dev 3.13+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #ifndef PCAP_TEST_H
#define PCAP_TEST_H
#include <sstream>
#include <string>
#include <stdint.h>
#include "pcap-file.h"
#include "ns3/test.h"
/**
* \brief Test that a pair of reference/new pcap files are equal
*
* The filename is interpreted as a stream.
*
* \param filename The name of the file to read in the reference/temporary
* directories
*/
#define NS_PCAP_TEST_EXPECT_EQ(filename) \
do { \
std::ostringstream oss; \
oss << filename; \
std::string expected = CreateDataDirFilename (oss.str()); \
std::string got = CreateTempDirFilename (oss.str()); \
uint32_t sec(0), usec(0); \
/* TODO support default PcapWriter snap length here */ \
bool diff = PcapFile::Diff (got, expected, sec, usec); \
NS_TEST_EXPECT_MSG_EQ (diff, false, \
"PCAP traces " << got << " and " << expected \
<< " differ starting from " << sec << " s " \
<< usec << " us"); \
} while (false)
#endif /* PCAP_TEST_H */
|