|
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 | #ifndefHAVE_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 | typedefunsigned shortsa_family_t;
|
52 | 42 | #endif
|
53 | 43 |
|
| 44 | +/* This must exactly match the non-padding fields of sockaddr_storage! */ |
| 45 | +structnopad_sockaddr_storage { |
| 46 | +#ifdefSALEN |
| 47 | +uint8__ss_len;/* address length */ |
| 48 | +#endif |
| 49 | +sa_family_tss_family;/* address family */ |
| 50 | + |
| 51 | +int64__ss_align;/* ensures struct is properly aligned */ |
| 52 | +}; |
| 53 | + |
54 | 54 | structsockaddr_storage {
|
55 | 55 | #ifdefSALEN
|
56 |
| -uint8_t__ss_len;/* address length */ |
| 56 | +uint8__ss_len;/* address length */ |
57 | 57 | #endif
|
58 |
| -sa_family_tss_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_tss_family;/* address family */ |
| 59 | + |
| 60 | +int64__ss_align;/* ensures struct is properly aligned */ |
| 61 | + |
| 62 | +char__ss_pad[_SS_MAXSIZE-sizeof(structnopad_sockaddr_storage)]; |
| 63 | +/* ensures struct has desired size */ |
71 | 64 | };
|
| 65 | + |
72 | 66 | #elif !defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
|
73 | 67 | # ifdefHAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
|
74 | 68 | # definess_family __ss_family
|
|