po: Update Lithuanian translation.
[wine] / include / ws2tcpip.h
index 16efab6..b1c296c 100644 (file)
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #ifndef __WS2TCPIP__
 #define __WS2TCPIP__
 
+#include <winsock2.h>
+#include <ws2ipdef.h>
+#include <limits.h>
+
 #ifdef USE_WS_PREFIX
 #define WS(x)    WS_##x
 #else
 #define WS(x)    x
 #endif
 
-/* FIXME: This gets defined by some Unix (Linux) header and messes things */
-#undef s6_addr
-
 /* for addrinfo calls */
 typedef struct WS(addrinfo)
 {
@@ -53,129 +54,19 @@ typedef struct WS(addrinfoW)
     struct WS(addrinfoW)*   ai_next;
 } ADDRINFOW, *PADDRINFOW;
 
-typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
-
-/*
- * Multicast group information
- */
-
-struct WS(ip_mreq)
-{
-    struct WS(in_addr) imr_multiaddr;
-    struct WS(in_addr) imr_interface;
-};
-
-struct WS(ip_mreq_source) {
-    struct WS(in_addr) imr_multiaddr;
-    struct WS(in_addr) imr_sourceaddr;
-    struct WS(in_addr) imr_interface;
-};
-
-struct WS(ip_msfilter) {
-    struct WS(in_addr) imsf_multiaddr;
-    struct WS(in_addr) imsf_interface;
-    u_long             imsf_fmode;
-    u_long             imsf_numsrc;
-    struct WS(in_addr) imsf_slist[1];
-};
-
-typedef struct WS(in_addr6)
-{
-   u_char s6_addr[16];   /* IPv6 address */
-} IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
+typedef int WS(socklen_t);
 
-/* check for sockaddr_in6 / sockaddr_in6_old madness:
- * http://msdn.microsoft.com/library/en-us/winsock/winsock/sockaddr_2.asp
- */
-typedef struct WS(sockaddr_in6)
-{
-   short   sin6_family;            /* AF_INET6 */
-   u_short sin6_port;              /* Transport level port number */
-   u_long  sin6_flowinfo;          /* IPv6 flow information */
-   struct  WS(in_addr6) sin6_addr; /* IPv6 address */
-   u_long  sin6_scope_id;          /* IPv6 scope id */
-} SOCKADDR_IN6,*PSOCKADDR_IN6, *LPSOCKADDR_IN6;
-
-typedef struct WS(sockaddr_in6_old)
-{
-   short   sin6_family;            /* AF_INET6 */
-   u_short sin6_port;              /* Transport level port number */
-   u_long  sin6_flowinfo;          /* IPv6 flow information */
-   struct  WS(in_addr6) sin6_addr; /* IPv6 address */
-} SOCKADDR_IN6_OLD,*PSOCKADDR_IN6_OLD, *LPSOCKADDR_IN6_OLD;
-
-typedef union sockaddr_gen
-{
-   struct WS(sockaddr) Address;
-   struct WS(sockaddr_in)  AddressIn;
-   struct WS(sockaddr_in6_old) AddressIn6;
-} WS(sockaddr_gen);
-
-/* Structure to keep interface specific information */
-typedef struct _INTERFACE_INFO
-{
-    u_long            iiFlags;             /* Interface flags */
-    WS(sockaddr_gen)  iiAddress;           /* Interface address */
-    WS(sockaddr_gen)  iiBroadcastAddress;  /* Broadcast address */
-    WS(sockaddr_gen)  iiNetmask;           /* Network mask */
-} INTERFACE_INFO, * LPINTERFACE_INFO;
-
-/* Possible flags for the  iiFlags - bitmask  */
-#ifndef USE_WS_PREFIX
-#define IFF_UP                0x00000001 /* Interface is up */
-#define IFF_BROADCAST         0x00000002 /* Broadcast is  supported */
-#define IFF_LOOPBACK          0x00000004 /* this is loopback interface */
-#define IFF_POINTTOPOINT      0x00000008 /* this is point-to-point interface */
-#define IFF_MULTICAST         0x00000010 /* multicast is supported */
-#else
-#define WS_IFF_UP             0x00000001 /* Interface is up */
-#define WS_IFF_BROADCAST      0x00000002 /* Broadcast is  supported */
-#define WS_IFF_LOOPBACK       0x00000004 /* this is loopback interface */
-#define WS_IFF_POINTTOPOINT   0x00000008 /* this is point-to-point interface */
-#define WS_IFF_MULTICAST      0x00000010 /* multicast is supported */
-#endif /* USE_WS_PREFIX */
-
-#ifndef USE_WS_PREFIX
-#define IP_OPTIONS                      1
-#define IP_HDRINCL                      2
-#define IP_TOS                          3
-#define IP_TTL                          4
-#define IP_MULTICAST_IF                 9
-#define IP_MULTICAST_TTL                10
-#define IP_MULTICAST_LOOP               11
-#define IP_ADD_MEMBERSHIP               12
-#define IP_DROP_MEMBERSHIP              13
-#define IP_DONTFRAGMENT                 14
-#define IP_ADD_SOURCE_MEMBERSHIP        15
-#define IP_DROP_SOURCE_MEMBERSHIP       16
-#define IP_BLOCK_SOURCE                 17
-#define IP_UNBLOCK_SOURCE               18
-#define IP_PKTINFO                      19
-#define IP_RECEIVE_BROADCAST            22
-#else
-#define WS_IP_OPTIONS                   1
-#define WS_IP_HDRINCL                   2
-#define WS_IP_TOS                       3
-#define WS_IP_TTL                       4
-#define WS_IP_MULTICAST_IF              9
-#define WS_IP_MULTICAST_TTL             10
-#define WS_IP_MULTICAST_LOOP            11
-#define WS_IP_ADD_MEMBERSHIP            12
-#define WS_IP_DROP_MEMBERSHIP           13
-#define WS_IP_DONTFRAGMENT              14
-#define WS_IP_ADD_SOURCE_MEMBERSHIP     15
-#define WS_IP_DROP_SOURCE_MEMBERSHIP    16
-#define WS_IP_BLOCK_SOURCE              17
-#define WS_IP_UNBLOCK_SOURCE            18
-#define WS_IP_PKTINFO                   19
-#define WS_IP_RECEIVE_BROADCAST         22
-#endif /* USE_WS_PREFIX */
+typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
 
 /* Possible Windows flags for getaddrinfo() */
 #ifndef USE_WS_PREFIX
-# define AI_PASSIVE     0x0001
-# define AI_CANONNAME   0x0002
-# define AI_NUMERICHOST 0x0004
+# define AI_PASSIVE                0x00000001
+# define AI_CANONNAME              0x00000002
+# define AI_NUMERICHOST            0x00000004
+# define AI_ADDRCONFIG             0x00000400
+# define AI_NON_AUTHORITATIVE      0x00004000
+# define AI_SECURE                 0x00008000
+# define AI_RETURN_PREFERRED_NAMES 0x00010000
 /* getaddrinfo error codes */
 # define EAI_AGAIN     WSATRY_AGAIN
 # define EAI_BADFLAGS  WSAEINVAL
@@ -187,9 +78,13 @@ typedef struct _INTERFACE_INFO
 # define EAI_SERVICE   WSATYPE_NOT_FOUND
 # define EAI_SOCKTYPE  WSAESOCKTNOSUPPORT
 #else
-# define WS_AI_PASSIVE     0x0001
-# define WS_AI_CANONNAME   0x0002
-# define WS_AI_NUMERICHOST 0x0004
+# define WS_AI_PASSIVE                0x00000001
+# define WS_AI_CANONNAME              0x00000002
+# define WS_AI_NUMERICHOST            0x00000004
+# define WS_AI_ADDRCONFIG             0x00000400
+# define WS_AI_NON_AUTHORITATIVE      0x00004000
+# define WS_AI_SECURE                 0x00008000
+# define WS_AI_RETURN_PREFERRED_NAMES 0x00010000
 /* getaddrinfo error codes */
 # define WS_EAI_AGAIN  WSATRY_AGAIN
 # define WS_EAI_BADFLAGS       WSAEINVAL
@@ -202,11 +97,66 @@ typedef struct _INTERFACE_INFO
 # define WS_EAI_SOCKTYPE       WSAESOCKTNOSUPPORT
 #endif
 
+#ifndef USE_WS_PREFIX
+# define NI_MAXHOST         1025
+# define NI_MAXSERV         32
+#else
+# define WS_NI_MAXHOST      1025
+# define WS_NI_MAXSERV      32
+#endif
+
+/* Possible Windows flags for getnameinfo() */
+#ifndef USE_WS_PREFIX
+# define NI_NOFQDN          0x01
+# define NI_NUMERICHOST     0x02
+# define NI_NAMEREQD        0x04
+# define NI_NUMERICSERV     0x08
+# define NI_DGRAM           0x10
+#else
+# define WS_NI_NOFQDN       0x01
+# define WS_NI_NUMERICHOST  0x02
+# define WS_NI_NAMEREQD     0x04
+# define WS_NI_NUMERICSERV  0x08
+# define WS_NI_DGRAM        0x10
+#endif
+
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#define GAI_STRERROR_BUFFER_SIZE        1024
+
+static inline char *gai_strerrorA(int errcode)
+{
+    static char buffer[GAI_STRERROR_BUFFER_SIZE + 1];
+
+    /* FIXME: should format message from system, ignoring inserts in neutral
+     * language */
+    buffer[0] = '\0';
+
+    return buffer;
+}
+
+static inline WCHAR *gai_strerrorW(int errcode)
+{
+    static WCHAR buffer[GAI_STRERROR_BUFFER_SIZE + 1];
+
+    /* FIXME: should format message from system, ignoring inserts in neutral
+     * language */
+    buffer[0] = '\0';
+
+    return buffer;
+}
+
+#ifdef USE_WS_PREFIX
+# define WS_gai_strerror WINELIB_NAME_AW(gai_strerror)
+#elif defined(WINE_NO_UNICODE_MACROS)
+# define gai_strerror gai_strerrorA
+#else
+# define gai_strerror WINELIB_NAME_AW(gai_strerror)
+#endif
+
 void WINAPI WS(freeaddrinfo)(LPADDRINFO);
 #define     FreeAddrInfoA WS(freeaddrinfo)
 void WINAPI FreeAddrInfoW(PADDRINFOW);
@@ -215,10 +165,18 @@ int WINAPI  WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,s
 #define     GetAddrInfoA WS(getaddrinfo)
 int WINAPI  GetAddrInfoW(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
 #define     GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
-int WINAPI  WS(getnameinfo)(const struct WS(sockaddr)*,socklen_t,char*,DWORD,char*,DWORD,int);
+int WINAPI  WS(getnameinfo)(const SOCKADDR*,WS(socklen_t),PCHAR,DWORD,PCHAR,DWORD,INT);
 #define     GetNameInfoA WS(getnameinfo)
-INT WINAPI  GetNameInfoW(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT);
+INT WINAPI  GetNameInfoW(const SOCKADDR*,WS(socklen_t),PWCHAR,DWORD,PWCHAR,DWORD,INT);
 #define     GetNameInfo WINELIB_NAME_AW(GetNameInfo)
+PCSTR WINAPI WS(inet_ntop)(INT,PVOID,PSTR,SIZE_T);
+#define     InetNtopA WS(inet_ntop)
+PCWSTR WINAPI InetNtopW(INT,PVOID,PWSTR,SIZE_T);
+#define     InetNtop WINELIB_NAME_AW(InetNtop)
+int WINAPI  WS(inet_pton)(INT,PCSTR,PVOID);
+#define     InetPtonA WS(inet_pton)
+int WINAPI  InetPtonW(INT,PCWSTR,PVOID);
+#define     InetPton WINELIB_NAME_AW(InetPton)
 
 /*
  * Ws2tcpip Function Typedefs