#include "ipaddr.h"
+#include "ipheader.h"
#include <iostream>
int main()
{
+ // Addr
IPAddr ip1(0x0a0a0a05);
IPAddr ip2("10.10.10.1");
IPAddr ip3(10, 10, 10, 2);
std::cout << "IP1 = " << ip1 << "\n";
std::cout << "IP2 = " << ip2 << "\n";
std::cout << "IP3 = " << ip3 << "\n";
+ // Header
+ IPHeader h1(4, 20, 1, 1, 0, 0, 64, 0x11, ip1, ip2);
+ std::cout << "Header1 = " << h1 << "\n";
+ if (h1.check_checksum())
+ std::cout << "Checksum OK\n";
+ else
+ std::cout << "Checksum MAL!\n";
+ h1.checksum = 1;
+ if (h1.check_checksum())
+ std::cout << "Checksum OK\n";
+ else
+ std::cout << "Checksum MAL!\n";
+ return 0;
}
// vim: set et sw=4 sts=4 :