1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 7 #ifndef _MINGW_IP_TYPES_H 8 #define _MINGW_IP_TYPES_H 9 10 #ifdef __LP64__ 11 #pragma push_macro("u_long") 12 #undef u_long 13 #define u_long __ms_u_long 14 #endif 15 16 #include <_bsd_types.h> 17 18 #ifndef __INSIDE_CYGWIN__ 19 20 #include <inaddr.h> 21 #include <_timeval.h> 22 23 #define h_addr h_addr_list[0] 24 25 struct hostent { 26 char *h_name; 27 char **h_aliases; 28 short h_addrtype; 29 short h_length; 30 char **h_addr_list; 31 }; 32 33 struct netent { 34 char *n_name; 35 char **n_aliases; 36 short n_addrtype; 37 u_long n_net; 38 }; 39 40 struct servent { 41 char *s_name; 42 char **s_aliases; 43 #ifdef _WIN64 44 char *s_proto; 45 short s_port; 46 #else 47 short s_port; 48 char *s_proto; 49 #endif 50 }; 51 52 struct protoent { 53 char *p_name; 54 char **p_aliases; 55 short p_proto; 56 }; 57 58 struct sockproto { 59 u_short sp_family; 60 u_short sp_protocol; 61 }; 62 63 struct linger { 64 u_short l_onoff; 65 u_short l_linger; 66 }; 67 68 #endif /* !__INSIDE_CYGWIN__ */ 69 70 struct sockaddr { 71 u_short sa_family; 72 char sa_data[14]; 73 }; 74 75 struct sockaddr_in { 76 short sin_family; 77 u_short sin_port; 78 struct in_addr sin_addr; 79 char sin_zero[8]; 80 }; 81 82 typedef struct hostent HOSTENT; 83 typedef struct hostent *PHOSTENT; 84 typedef struct hostent *LPHOSTENT; 85 86 typedef struct servent SERVENT; 87 typedef struct servent *PSERVENT; 88 typedef struct servent *LPSERVENT; 89 90 typedef struct protoent PROTOENT; 91 typedef struct protoent *PPROTOENT; 92 typedef struct protoent *LPPROTOENT; 93 94 typedef struct sockaddr SOCKADDR; 95 typedef struct sockaddr *PSOCKADDR; 96 typedef struct sockaddr *LPSOCKADDR; 97 98 typedef struct sockaddr_in SOCKADDR_IN; 99 typedef struct sockaddr_in *PSOCKADDR_IN; 100 typedef struct sockaddr_in *LPSOCKADDR_IN; 101 102 typedef struct linger LINGER; 103 typedef struct linger *PLINGER; 104 typedef struct linger *LPLINGER; 105 106 #ifdef __LP64__ 107 struct __ms_timeval { 108 __LONG32 tv_sec; 109 __LONG32 tv_usec; 110 }; 111 typedef struct __ms_timeval TIMEVAL; 112 typedef struct __ms_timeval *PTIMEVAL; 113 typedef struct __ms_timeval *LPTIMEVAL; 114 #else 115 typedef struct timeval TIMEVAL; 116 typedef struct timeval *PTIMEVAL; 117 typedef struct timeval *LPTIMEVAL; 118 #endif 119 120 #ifdef __LP64__ 121 #pragma pop_macro("u_long") 122 #endif 123 124 #endif /* _MINGW_IP_TYPES_H */ 125 126