mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 20:35:06 -05:00
cmdmon: define 64-bit integer
Add a structure for 64-bit integers without requiring 64-bit alignment to be usable in CMD_Reply without struct packing. Add utility functions for conversion to/from network order. Avoid using be64toh() and htobe64() as they don't seem to be available on all supported systems.
This commit is contained in:
@@ -40,6 +40,7 @@ test_unit(void)
|
||||
double x, y, nan, inf;
|
||||
IPAddr ip, ip2, ip3;
|
||||
IPSockAddr ip_saddr;
|
||||
Integer64 integer64;
|
||||
Timespec tspec;
|
||||
Float f;
|
||||
int i, j, c;
|
||||
@@ -565,6 +566,10 @@ test_unit(void)
|
||||
UTI_TimespecNetworkToHost(&tspec, &ts2);
|
||||
TEST_CHECK(!UTI_CompareTimespecs(&ts, &ts2));
|
||||
|
||||
integer64 = UTI_Integer64HostToNetwork(0x1234567890ABCDEFULL);
|
||||
TEST_CHECK(memcmp(&integer64, "\x12\x34\x56\x78\x90\xab\xcd\xef", 8) == 0);
|
||||
TEST_CHECK(UTI_Integer64NetworkToHost(integer64) == 0x1234567890ABCDEFULL);
|
||||
|
||||
TEST_CHECK(UTI_CmacNameToAlgorithm("AES128") == CMC_AES128);
|
||||
TEST_CHECK(UTI_CmacNameToAlgorithm("AES256") == CMC_AES256);
|
||||
TEST_CHECK(UTI_CmacNameToAlgorithm("NOSUCHCMAC") == CMC_INVALID);
|
||||
|
||||
Reference in New Issue
Block a user