123456789101112131415161718192021222324252627 |
- #include "test-utils.h"
- #include <arpa/inet.h>
- using namespace limbo;
- using namespace limbo::ip;
- IPv4Address make_address(const char *addr) {
- in_addr value;
- auto r = inet_pton(AF_INET, addr, &value);
- if (!r) {
- return IPv4Address();
- } else {
- return IPv4Address::from_network(value.s_addr);
- }
- }
- bool operator==(const Chunk &a, const Chunk &b) {
- if (a.size() == b.size()) {
- if (a.data() == b.data()) {
- return true;
- } else {
- return memcmp(a.data(), b.data(), a.size()) == 0;
- }
- }
- return false;
- }
|