From cf8fbc710f02f2c828ee56b12f55fa1f793e3efd Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Wed, 11 Jan 2006 22:56:05 +0000 Subject: * include/winsock2.h (struct sockaddr_storage): Use RFC 2553 names for padding size constants. --- winsup/w32api/ChangeLog | 5 +++++ winsup/w32api/include/winsock2.h | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'winsup/w32api') diff --git a/winsup/w32api/ChangeLog b/winsup/w32api/ChangeLog index 3430be4cc..37b913993 100644 --- a/winsup/w32api/ChangeLog +++ b/winsup/w32api/ChangeLog @@ -1,3 +1,8 @@ +2006-01-12 Danny Smith + + * include/winsock2.h (struct sockaddr_storage): Use RFC 2553 + names for padding size constants. + 2006-01-12 Danny Smith * include/aclapi.h (WINADVAPI): Add to prototypes. diff --git a/winsup/w32api/include/winsock2.h b/winsup/w32api/include/winsock2.h index 2bc8689ce..d90a7a595 100644 --- a/winsup/w32api/include/winsock2.h +++ b/winsup/w32api/include/winsock2.h @@ -330,14 +330,26 @@ struct sockaddr { char sa_data[14]; }; -/* Portable IPv6/IPv4 version of sockaddr. - Uses padding to force 8 byte alignment - and maximum size of 128 bytes */ +/* Portable IPv6/IPv4 version of sockaddr. Based on RFC 2553. + Pad to force 8 byte alignment and maximum size of 128 bytes. */ + +/* + * Desired design of maximum size and alignment + */ +#define _SS_MAXSIZE 128 +#define _SS_ALIGNSIZE (sizeof (__int64)) +/* + * Definitions used for sockaddr_storage structure paddings design. + */ +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (short)) +#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (short) \ + + _SS_PAD1SIZE \ + + _SS_ALIGNSIZE)) struct sockaddr_storage { short ss_family; - char __ss_pad1[6]; /* pad to 8 */ - __int64 __ss_align; /* force alignment */ - char __ss_pad2[112]; /* pad to 128 */ + char __ss_pad1[_SS_PAD1SIZE]; /* pad to 8 */ + __int64 __ss_align; /* force alignment */ + char __ss_pad2[_SS_PAD2SIZE]; /* pad to 128 */ }; #endif /* ! (__INSIDE_CYGWIN__ || __INSIDE_MSYS__) */ -- cgit v1.2.3