From 60b2ba6ef9ed779d750958b6422f05c93a4a2d91 Mon Sep 17 00:00:00 2001 From: sr Date: Mon, 3 Sep 2012 21:00:26 +0200 Subject: [SERVER] Check which dnbd3 devices are idle and ready to use for proxy mode [SERVER] Skeleton of server-to-server communication [SERVER] Update access-time of images in use by actual clients [*] Add dnbd3_host_t type to handle address+port+addrtype consistently across the project --- src/types.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/types.h') diff --git a/src/types.h b/src/types.h index d41111a..22fbc50 100644 --- a/src/types.h +++ b/src/types.h @@ -60,12 +60,19 @@ static const uint16_t dnbd3_packet_magic = (0x73) | (0x72 << 8); #error "Unknown Endianness" #endif +#pragma pack(1) +typedef struct +{ + uint8_t addr[16]; // 16byte (network representation, so it can be directly passed to socket functions) + uint16_t port; // 2byte (network representation, so it can be directly passed to socket functions) + uint8_t type; // 1byte (ip version. AF_INET or AF_INET6. 0 means this struct is empty and should be ignored) +} dnbd3_host_t; +#pragma pack(0) + typedef struct { uint16_t len; - uint8_t addrtype; - uint8_t addr[16]; // network representation - uint16_t port; // network representation + dnbd3_host_t host; uint16_t imgnamelen; char *imgname; int rid; @@ -106,10 +113,8 @@ typedef struct #pragma pack(1) typedef struct { - uint8_t hostaddr[16]; // 16byte (network representation, so it can be directly passed to socket functions) - uint16_t port; // 2byte (network representation, so it can be directly passed to socket functions) - uint8_t hostaddrtype; // 1byte (ip version. AF_INET or AF_INET6. 0 means this struct is empty and should be ignored) - uint8_t failures; // 1byte (number of times server has been consecutively unreachable) + dnbd3_host_t host; + uint8_t failures; // 1byte (number of times server has been consecutively unreachable) } dnbd3_server_entry_t; #pragma pack(0) -- cgit v1.2.3-55-g7522