1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

root/branches/releases/v1.0/mingw-w64-headers/include/mingw_inc/_ip_types.h @ 2444

Revision 2444, 1.8 KB (checked in by sezero, 4 years ago)

2010-05-26 Ozkan Sezer <sezeroz@…>

In case winsock2.h is included after winsock.h, probably by way of
windows.h, perform a "winsock2 upgrade" on top of winsock1 by splitting
the headers into some helpers holding shared data types and undefining
macros when necessary:

  • mingw_inc/_bsd_types.h: New.
  • mingw_inc/_fd_types.h: New.
  • mingw_inc/_ip_mreq1.h: New.
  • mingw_inc/_ip_types.h: New.
  • mingw_inc/_socket_types.h: New.
  • mingw_inc/_ws1_undef.h: New.
  • mingw_inc/_wsa_errnos.h: New.
  • mingw_inc/_wsadata.h: New.
  • mingw_inc/_xmitfile.h: New.
  • _timeval.h: New.
  • inaddr.h: New.
  • in6addr.h: New.
  • time.h: Include _timeval.h. Move struct timeval, timerisset, timercmp and timerclear to _timeval.h.
  • sys/time.h: Likewise.
  • ipexport.h: Include inaddr.h and in6addr.h. Move struct in6_addr and its related macros to in6addr.h. Move struct in_addr and its related macros to inaddr.h.
  • mswsock.h: Include mingw_inc/_xmitfile.h. Move struct _TRANSMIT_FILE_BUFFERS to mingw_inc/_xmitfile.h. Guard WSARecvEx, TransmitFile?, AcceptEx? and GetAcceptExSockaddrs? prototypes by MSWSOCK_WS1_SHARED ifdefs.
  • winsock.h: Include _timeval.h, inaddr.h, mingw_inc/_bsd_types.h, mingw_inc/_socket_types.h, mingw_inc/_fd_types.h, mingw_inc/_ip_types.h, mingw_inc/_ip_mreq1.h, mingw_inc/_wsadata.h and mingw_inc/_xmitfile.h. Define WINSOCK_API_LINKAGE and WSAAPI at the top and undefine them at the end of the file. Move struct timeval, timerisset,timercmp and timerclear to _timeval.h. Move struct in_addr and its related macros to inaddr.h. Move u_char, u_short, u_int, u_long and u_int64 to mingw_inc/_bsd_types.h. Move SOCKET, INVALID_SOCKET and SOCKET_ERROR to mingw_inc/_socket_types.h. Move struct fd_set and FD_SETSIZE to mingw_inc/_fd_types.h. Move struct ip_mreq to mingw_inc/_ip_mreq1.h. Move structs hostent, netent, servent, protoent, sockaddr_in, sockaddr, sockproto and linger to mingw_inc/_ip_types.h. Moved struct WSAData to mingw_inc/_wsadata.h. Move WSA error macros to mingw_inc/_wsa_errnos.h. Move struct _TRANSMIT_FILE_BUFFERS to mingw_inc/_xmitfile.h. Define WINSOCK_WS1_SHARED and MSWSOCK_WS1_SHARED.
  • winsock2.h: Do not re-define _WINSOCKAPI_. If it is already defined, do a #warning that winsock2.h must be included before windows.h. Include mingw_inc/_ws1_undef.h to make sure that macros from winsock.h are undefined. Include _timeval.h, inaddr.h, mingw_inc/_bsd_types.h, mingw_inc/_socket_types.h, mingw_inc/_fd_types.h, mingw_inc/_ip_types.h and mingw_inc/_wsadata.h. Move struct timeval, timerisset,timercmp and timerclear to _timeval.h. Move struct in_addr and its related macros to inaddr.h. Move u_char, u_short, u_int, u_long and u_int64 to mingw_inc/_bsd_types.h. Move SOCKET, INVALID_SOCKET and SOCKET_ERROR to mingw_inc/_socket_types.h. Move struct fd_set and FD_SETSIZE to mingw_inc/_fd_types.h. Move structs hostent, netent, servent, protoent, sockaddr_in, sockaddr, sockproto and linger to mingw_inc/_ip_types.h. Moved struct WSAData to mingw_inc/_wsadata.h. Move WSA error macros to mingw_inc/_wsa_errnos.h. Guard the 46 functions shared by 1.1 api using WINSOCK_WS1_SHARED ifdefs.
  • ws2tcpip.h: Include mingw_inc/_ip_mreq1.h. Move struct ip_mreq to mingw_inc/_ip_mreq1.h. Move struct in6_addr, IN6_ADDR, PIN6_ADDR, LPIN6_ADDR to in6addr.h.
  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-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#include <mingw_inc/_bsd_types.h>
11
12#define h_addr h_addr_list[0]
13
14struct hostent {
15        char    *h_name;
16        char    **h_aliases;
17        short   h_addrtype;
18        short   h_length;
19        char    **h_addr_list;
20};
21
22struct netent {
23        char    *n_name;
24        char    **n_aliases;
25        short   n_addrtype;
26        u_long  n_net;
27};
28
29struct servent {
30        char    *s_name;
31        char    **s_aliases;
32#ifdef _WIN64
33        char    *s_proto;
34        short   s_port;
35#else
36        short   s_port;
37        char    *s_proto;
38#endif
39};
40
41struct protoent {
42        char    *p_name;
43        char    **p_aliases;
44        short   p_proto;
45};
46
47typedef struct hostent          HOSTENT;
48typedef struct hostent          *PHOSTENT;
49typedef struct hostent          *LPHOSTENT;
50
51typedef struct servent          SERVENT;
52typedef struct servent          *PSERVENT;
53typedef struct servent          *LPSERVENT;
54
55typedef struct protoent         PROTOENT;
56typedef struct protoent         *PPROTOENT;
57typedef struct protoent         *LPPROTOENT;
58
59
60#include <inaddr.h>
61
62struct sockaddr_in {
63        short   sin_family;
64        u_short sin_port;
65        struct in_addr  sin_addr;
66        char    sin_zero[8];
67};
68
69struct sockaddr {
70        u_short sa_family;
71        char    sa_data[14];
72};
73
74struct sockproto {
75        u_short sp_family;
76        u_short sp_protocol;
77};
78
79struct linger {
80        u_short l_onoff;
81        u_short l_linger;
82};
83
84typedef struct sockaddr         SOCKADDR;
85typedef struct sockaddr         *PSOCKADDR;
86typedef struct sockaddr         *LPSOCKADDR;
87
88typedef struct sockaddr_in      SOCKADDR_IN;
89typedef struct sockaddr_in      *PSOCKADDR_IN;
90typedef struct sockaddr_in      *LPSOCKADDR_IN;
91
92typedef struct linger           LINGER;
93typedef struct linger           *PLINGER;
94typedef struct linger           *LPLINGER;
95
96
97#include <_timeval.h>
98
99typedef struct timeval          TIMEVAL;
100typedef struct timeval          *PTIMEVAL;
101typedef struct timeval          *LPTIMEVAL;
102
103#endif  /* _MINGW_IP_TYPES_H */
104
Note: See TracBrowser for help on using the browser.