1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-26 12:01:34 +01:00

Added Loopback::matches_response.

This commit is contained in:
Matias Fontanini
2014-10-25 00:23:52 -05:00
parent 23a5cfb0c4
commit c4609fedd6
5 changed files with 63 additions and 4 deletions

35
tests/src/loopback.cpp Normal file
View File

@@ -0,0 +1,35 @@
#include <gtest/gtest.h>
#include <cstring>
#include <string>
#include <stdint.h>
#include "macros.h"
#ifndef WIN32
#include <sys/socket.h>
#ifdef BSD
#include <net/if_dl.h>
#include <netinet/in.h>
#include <net/ethernet.h>
#endif
#endif
#include "loopback.h"
#include "ip.h"
#include "tcp.h"
using namespace std;
using namespace Tins;
class LoopbackTest : public testing::Test {
public:
};
#ifndef WIN32
TEST_F(LoopbackTest, MatchesResponse) {
Loopback loop1 = Loopback() / IP("192.168.0.1", "192.168.0.2") / TCP(22, 21);
loop1.family(PF_INET);
Loopback loop2 = Loopback() / IP("192.168.0.2", "192.168.0.1") / TCP(21, 22);
loop2.family(PF_INET);
PDU::serialization_type buffer = loop2.serialize();
EXPECT_TRUE(loop1.matches_response(&buffer[0], buffer.size()));
}
#endif // WIN32