summaryrefslogtreecommitdiffstats
path: root/src/types.h
diff options
context:
space:
mode:
authorsr2012-09-03 21:00:26 +0200
committersr2012-09-03 21:00:26 +0200
commit60b2ba6ef9ed779d750958b6422f05c93a4a2d91 (patch)
tree46fdacf6a9439947e91af4c3d9de3006d41e5380 /src/types.h
parent[*] Fixed and unified formatting (diff)
downloaddnbd3-60b2ba6ef9ed779d750958b6422f05c93a4a2d91.tar.gz
dnbd3-60b2ba6ef9ed779d750958b6422f05c93a4a2d91.tar.xz
dnbd3-60b2ba6ef9ed779d750958b6422f05c93a4a2d91.zip
[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
Diffstat (limited to 'src/types.h')
-rw-r--r--src/types.h19
1 files changed, 12 insertions, 7 deletions
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)