Move DebugLogger to zeek namespaces

This commit is contained in:
Tim Wojtulewicz 2020-07-21 14:16:42 -07:00
parent a2a435360a
commit 886fc102b8
40 changed files with 358 additions and 317 deletions

View file

@ -107,7 +107,7 @@ bool BinarySerializationFormat::Read(int* v, const char* tag)
return false;
*v = (int) ntohl(tmp);
DBG_LOG(DBG_SERIAL, "Read int %d [%s]", *v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Read int %d [%s]", *v, tag);
return true;
}
@ -117,7 +117,7 @@ bool BinarySerializationFormat::Read(uint16_t* v, const char* tag)
return false;
*v = ntohs(*v);
DBG_LOG(DBG_SERIAL, "Read uint16_t %hu [%s]", *v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Read uint16_t %hu [%s]", *v, tag);
return true;
}
@ -127,7 +127,7 @@ bool BinarySerializationFormat::Read(uint32_t* v, const char* tag)
return false;
*v = ntohl(*v);
DBG_LOG(DBG_SERIAL, "Read uint32_t %" PRIu32 " [%s]", *v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Read uint32_t %" PRIu32 " [%s]", *v, tag);
return true;
}
@ -139,7 +139,7 @@ bool BinarySerializationFormat::Read(int64_t* v, const char* tag)
return false;
*v = ((int64_t(ntohl(x[0]))) << 32) | ntohl(x[1]);
DBG_LOG(DBG_SERIAL, "Read int64_t %" PRId64 " [%s]", *v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Read int64_t %" PRId64 " [%s]", *v, tag);
return true;
}
@ -150,7 +150,7 @@ bool BinarySerializationFormat::Read(uint64_t* v, const char* tag)
return false;
*v = ((uint64_t(ntohl(x[0]))) << 32) | ntohl(x[1]);
DBG_LOG(DBG_SERIAL, "Read uint64_t %" PRIu64 " [%s]", *v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Read uint64_t %" PRIu64 " [%s]", *v, tag);
return true;
}
@ -161,7 +161,7 @@ bool BinarySerializationFormat::Read(bool* v, const char* tag)
return false;
*v = c == '\1' ? true : false;
DBG_LOG(DBG_SERIAL, "Read bool %s [%s]", *v ? "true" : "false", tag);
DBG_LOG(zeek::DBG_SERIAL, "Read bool %s [%s]", *v ? "true" : "false", tag);
return true;
}
@ -171,14 +171,14 @@ bool BinarySerializationFormat::Read(double* d, const char* tag)
return false;
*d = ntohd(*d);
DBG_LOG(DBG_SERIAL, "Read double %.6f [%s]", *d, tag);
DBG_LOG(zeek::DBG_SERIAL, "Read double %.6f [%s]", *d, tag);
return true;
}
bool BinarySerializationFormat::Read(char* v, const char* tag)
{
bool ret = ReadData(v, 1);
DBG_LOG(DBG_SERIAL, "Read char %s [%s]", fmt_bytes(v, 1), tag);
DBG_LOG(zeek::DBG_SERIAL, "Read char %s [%s]", fmt_bytes(v, 1), tag);
return ret;
}
@ -216,7 +216,7 @@ bool BinarySerializationFormat::Read(char** str, int* len, const char* tag)
*str = s;
DBG_LOG(DBG_SERIAL, "Read %d bytes |%s| [%s]", l, fmt_bytes(*str, l), tag);
DBG_LOG(zeek::DBG_SERIAL, "Read %d bytes |%s| [%s]", l, fmt_bytes(*str, l), tag);
return true;
}
@ -301,34 +301,34 @@ bool BinarySerializationFormat::Read(struct in6_addr* addr, const char* tag)
bool BinarySerializationFormat::Write(char v, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write char %s [%s]", fmt_bytes(&v, 1), tag);
DBG_LOG(zeek::DBG_SERIAL, "Write char %s [%s]", fmt_bytes(&v, 1), tag);
return WriteData(&v, 1);
}
bool BinarySerializationFormat::Write(uint16_t v, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write uint16_t %hu [%s]", v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Write uint16_t %hu [%s]", v, tag);
v = htons(v);
return WriteData(&v, sizeof(v));
}
bool BinarySerializationFormat::Write(uint32_t v, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write uint32_t %" PRIu32 " [%s]", v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Write uint32_t %" PRIu32 " [%s]", v, tag);
v = htonl(v);
return WriteData(&v, sizeof(v));
}
bool BinarySerializationFormat::Write(int v, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write int %d [%s]", v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Write int %d [%s]", v, tag);
uint32_t tmp = htonl((uint32_t) v);
return WriteData(&tmp, sizeof(tmp));
}
bool BinarySerializationFormat::Write(uint64_t v, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write uint64_t %" PRIu64 " [%s]", v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Write uint64_t %" PRIu64 " [%s]", v, tag);
uint32_t x[2];
x[0] = htonl(v >> 32);
x[1] = htonl(v & 0xffffffff);
@ -337,7 +337,7 @@ bool BinarySerializationFormat::Write(uint64_t v, const char* tag)
bool BinarySerializationFormat::Write(int64_t v, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write int64_t %" PRId64 " [%s]", v, tag);
DBG_LOG(zeek::DBG_SERIAL, "Write int64_t %" PRId64 " [%s]", v, tag);
uint32_t x[2];
x[0] = htonl(v >> 32);
x[1] = htonl(v & 0xffffffff);
@ -346,14 +346,14 @@ bool BinarySerializationFormat::Write(int64_t v, const char* tag)
bool BinarySerializationFormat::Write(double d, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write double %.6f [%s]", d, tag);
DBG_LOG(zeek::DBG_SERIAL, "Write double %.6f [%s]", d, tag);
d = htond(d);
return WriteData(&d, sizeof(d));
}
bool BinarySerializationFormat::Write(bool v, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write bool %s [%s]", v ? "true" : "false", tag);
DBG_LOG(zeek::DBG_SERIAL, "Write bool %s [%s]", v ? "true" : "false", tag);
char c = v ? '\1' : '\0';
return WriteData(&c, 1);
}
@ -432,7 +432,7 @@ bool BinarySerializationFormat::WriteSeparator()
bool BinarySerializationFormat::Write(const char* buf, int len, const char* tag)
{
DBG_LOG(DBG_SERIAL, "Write bytes |%s| [%s]", fmt_bytes(buf, len), tag);
DBG_LOG(zeek::DBG_SERIAL, "Write bytes |%s| [%s]", fmt_bytes(buf, len), tag);
uint32_t l = htonl(len);
return WriteData(&l, sizeof(l)) && WriteData(buf, len);
}