|
9 | 9 | * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
10 | 10 | * Portions Copyright (c) 1994, Regents of the University of California
|
11 | 11 | *
|
12 |
| - * $Id: pqcomm.h,v 1.88 2003/06/24 01:49:22 momjian Exp $ |
| 12 | + * $Id: pqcomm.h,v 1.89 2003/07/15 17:54:34 tgl Exp $ |
13 | 13 | *
|
14 | 14 | *-------------------------------------------------------------------------
|
15 | 15 | */
|
|
34 | 34 |
|
35 | 35 | #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
|
36 | 36 | /* Define a struct sockaddr_storage if we don't have one. */
|
37 |
| -/* |
38 |
| - * Desired design of maximum size and alignment |
39 |
| - */ |
40 |
| -#define _SS_MAXSIZE 128 /* Implementation specific max size */ |
41 |
| -#define _SS_ALIGNSIZE (sizeof (int64_t)) |
42 |
| - /* Implementation specific desired alignment */ |
43 |
| -/* |
44 |
| - * Definitions used for sockaddr_storage structure paddings design. |
45 |
| - */ |
46 |
| -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (sa_family_t)) |
47 |
| -#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (sa_family_t) + \ |
48 |
| - _SS_PAD1SIZE + _SS_ALIGNSIZE)) |
| 37 | + |
| 38 | +#define _SS_MAXSIZE 128 /* Implementation specific max size */ |
49 | 39 |
|
50 | 40 | #ifdef __CYGWIN__
|
51 | 41 | typedef unsigned short sa_family_t;
|
52 | 42 | #endif
|
53 | 43 |
|
| 44 | +/* This must exactly match the non-padding fields of sockaddr_storage! */ |
| 45 | +struct nopad_sockaddr_storage { |
| 46 | +#ifdef SALEN |
| 47 | + uint8 __ss_len; /* address length */ |
| 48 | +#endif |
| 49 | + sa_family_t ss_family; /* address family */ |
| 50 | + |
| 51 | + int64 __ss_align; /* ensures struct is properly aligned */ |
| 52 | +}; |
| 53 | + |
54 | 54 | struct sockaddr_storage {
|
55 | 55 | #ifdef SALEN
|
56 |
| - uint8_t __ss_len; /* address length */ |
| 56 | + uint8 __ss_len; /* address length */ |
57 | 57 | #endif
|
58 |
| - sa_family_t ss_family; /* address family */ |
59 |
| - |
60 |
| - char __ss_pad1[_SS_PAD1SIZE]; |
61 |
| - /* 6 byte pad, this is to make implementation |
62 |
| - * specific pad up to alignment field that |
63 |
| - * follows explicit in the data structure */ |
64 |
| - int64_t __ss_align; |
65 |
| - /* field to force desired structure |
66 |
| - * storage alignment */ |
67 |
| - char __ss_pad2[_SS_PAD2SIZE]; |
68 |
| - /* 112 byte pad to achieve desired size, |
69 |
| - * _SS_MAXSIZE value minus size of ss_family |
70 |
| - * __ss_pad1, __ss_align fields is 112 */ |
| 58 | + sa_family_t ss_family; /* address family */ |
| 59 | + |
| 60 | + int64 __ss_align; /* ensures struct is properly aligned */ |
| 61 | + |
| 62 | + char __ss_pad[_SS_MAXSIZE - sizeof(struct nopad_sockaddr_storage)]; |
| 63 | + /* ensures struct has desired size */ |
71 | 64 | };
|
| 65 | + |
72 | 66 | #elif !defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
|
73 | 67 | # ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
|
74 | 68 | # define ss_family __ss_family
|
|
0 commit comments