Skip to content
This repository
Browse code

Merge pull request #3191 from wsoltys/remove_emu_socket

removed the emu_socket directory and files as its not in use for windows
  • Loading branch information...
commit 19392930084ad29026d336e5e71c6f88a5357439 2 parents 1759600 + 86bb472
Martijn Kaijser authored September 07, 2013
22  project/VS2010Express/XBMC.vcxproj
@@ -1886,27 +1886,6 @@
1886 1886
     <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_dummy.cpp" />
1887 1887
     <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_kernel32.cpp" />
1888 1888
     <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_msvcrt.cpp" />
1889  
-    <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_socket\inet_aton.c">
1890  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">CompileAsCpp</CompileAs>
1891  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug Testsuite|Win32'">CompileAsCpp</CompileAs>
1892  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug (OpenGL)|Win32'">CompileAsCpp</CompileAs>
1893  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">CompileAsCpp</CompileAs>
1894  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">CompileAsCpp</CompileAs>
1895  
-    </ClCompile>
1896  
-    <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_socket\inet_ntop.c">
1897  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">CompileAsCpp</CompileAs>
1898  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug Testsuite|Win32'">CompileAsCpp</CompileAs>
1899  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug (OpenGL)|Win32'">CompileAsCpp</CompileAs>
1900  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">CompileAsCpp</CompileAs>
1901  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">CompileAsCpp</CompileAs>
1902  
-    </ClCompile>
1903  
-    <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_socket\inet_pton.c">
1904  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">CompileAsCpp</CompileAs>
1905  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug Testsuite|Win32'">CompileAsCpp</CompileAs>
1906  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug (OpenGL)|Win32'">CompileAsCpp</CompileAs>
1907  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">CompileAsCpp</CompileAs>
1908  
-      <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">CompileAsCpp</CompileAs>
1909  
-    </ClCompile>
1910 1889
     <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\util\EmuFileWrapper.cpp" />
1911 1890
     <ClCompile Include="..\..\xbmc\cores\VideoRenderers\BaseRenderer.cpp" />
1912 1891
     <ClCompile Include="..\..\xbmc\cores\VideoRenderers\LinuxRendererGL.cpp">
@@ -2722,7 +2701,6 @@
2722 2701
     <ClInclude Include="..\..\xbmc\cores\DllLoader\exports\emu_dummy.h" />
2723 2702
     <ClInclude Include="..\..\xbmc\cores\DllLoader\exports\emu_kernel32.h" />
2724 2703
     <ClInclude Include="..\..\xbmc\cores\DllLoader\exports\emu_msvcrt.h" />
2725  
-    <ClInclude Include="..\..\xbmc\cores\DllLoader\exports\emu_socket\emu_socket.h" />
2726 2704
     <ClInclude Include="..\..\xbmc\cores\DllLoader\exports\util\EmuFileWrapper.h" />
2727 2705
     <ClInclude Include="..\..\xbmc\cores\VideoRenderers\BaseRenderer.h" />
2728 2706
     <ClInclude Include="..\..\xbmc\cores\VideoRenderers\LinuxRendererGL.h">
17  project/VS2010Express/XBMC.vcxproj.filters
@@ -46,9 +46,6 @@
46 46
     <Filter Include="cores\DllLoader\exports">
47 47
       <UniqueIdentifier>{aa32e9d0-5753-42d5-889b-3938ce6703a0}</UniqueIdentifier>
48 48
     </Filter>
49  
-    <Filter Include="cores\DllLoader\exports\emu_socket">
50  
-      <UniqueIdentifier>{280834b5-e3ce-48ec-a304-ec6c315beffe}</UniqueIdentifier>
51  
-    </Filter>
52 49
     <Filter Include="cores\DllLoader\exports\util">
53 50
       <UniqueIdentifier>{111c81df-dc5e-4b93-a21f-c2171434952b}</UniqueIdentifier>
54 51
     </Filter>
@@ -618,15 +615,6 @@
618 615
     <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_msvcrt.cpp">
619 616
       <Filter>cores\DllLoader\exports</Filter>
620 617
     </ClCompile>
621  
-    <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_socket\inet_aton.c">
622  
-      <Filter>cores\DllLoader\exports\emu_socket</Filter>
623  
-    </ClCompile>
624  
-    <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_socket\inet_ntop.c">
625  
-      <Filter>cores\DllLoader\exports\emu_socket</Filter>
626  
-    </ClCompile>
627  
-    <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\emu_socket\inet_pton.c">
628  
-      <Filter>cores\DllLoader\exports\emu_socket</Filter>
629  
-    </ClCompile>
630 618
     <ClCompile Include="..\..\xbmc\cores\DllLoader\exports\util\EmuFileWrapper.cpp">
631 619
       <Filter>cores\DllLoader\exports\util</Filter>
632 620
     </ClCompile>
@@ -3516,9 +3504,6 @@
3516 3504
     <ClInclude Include="..\..\xbmc\cores\DllLoader\exports\emu_msvcrt.h">
3517 3505
       <Filter>cores\DllLoader\exports</Filter>
3518 3506
     </ClInclude>
3519  
-    <ClInclude Include="..\..\xbmc\cores\DllLoader\exports\emu_socket\emu_socket.h">
3520  
-      <Filter>cores\DllLoader\exports\emu_socket</Filter>
3521  
-    </ClInclude>
3522 3507
     <ClInclude Include="..\..\xbmc\cores\DllLoader\exports\util\EmuFileWrapper.h">
3523 3508
       <Filter>cores\DllLoader\exports\util</Filter>
3524 3509
     </ClInclude>
@@ -6066,4 +6051,4 @@
6066 6051
       <Filter>interfaces\swig</Filter>
6067 6052
     </None>
6068 6053
   </ItemGroup>
6069  
-</Project>
  6054
+</Project>
122  xbmc/cores/DllLoader/exports/emu_socket/addrinfo.h
... ...
@@ -1,122 +0,0 @@
1  
-/*
2  
- * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
3  
- * All rights reserved.
4  
- *
5  
- * Redistribution and use in source and binary forms, with or without
6  
- * modification, are permitted provided that the following conditions
7  
- * are met:
8  
- * 1. Redistributions of source code must retain the above copyright
9  
- *    notice, this list of conditions and the following disclaimer.
10  
- * 2. Redistributions in binary form must reproduce the above copyright
11  
- *    notice, this list of conditions and the following disclaimer in the
12  
- *    documentation and/or other materials provided with the distribution.
13  
- * 3. Neither the name of the project nor the names of its contributors
14  
- *    may be used to endorse or promote products derived from this software
15  
- *    without specific prior written permission.
16  
- *
17  
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18  
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21  
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  
- * SUCH DAMAGE.
28  
- */
29  
-
30  
-/* $Id$ */
31  
-
32  
-#ifndef HAVE_ADDRINFO
33  
-
34  
-/*
35  
- * Error return codes from getaddrinfo()
36  
- */
37  
-#define	EAI_ADDRFAMILY	 1	/* address family for hostname not supported */
38  
-#define	EAI_AGAIN	 2	/* temporary failure in name resolution */
39  
-#define	EAI_BADFLAGS	 3	/* invalid value for ai_flags */
40  
-#define	EAI_FAIL	 4	/* non-recoverable failure in name resolution */
41  
-#define	EAI_FAMILY	 5	/* ai_family not supported */
42  
-#define	EAI_MEMORY	 6	/* memory allocation failure */
43  
-#define	EAI_NODATA	 7	/* no address associated with hostname */
44  
-#define	EAI_NONAME	 8	/* hostname nor servname provided, or not known */
45  
-#define	EAI_SERVICE	 9	/* servname not supported for ai_socktype */
46  
-#define	EAI_SOCKTYPE	10	/* ai_socktype not supported */
47  
-#define	EAI_SYSTEM	11	/* system error returned in errno */
48  
-#define EAI_BADHINTS	12
49  
-#define EAI_PROTOCOL	13
50  
-#define EAI_MAX		14
51  
-
52  
-/* internal error */
53  
-#define	NETDB_INTERNAL	-1	/* see errno */
54  
-
55  
-/*
56  
- * Flag values for getaddrinfo()
57  
- */
58  
-#define	AI_PASSIVE	0x00000001 /* get address to use bind() */
59  
-#define	AI_CANONNAME	0x00000002 /* fill ai_canonname */
60  
-#define	AI_NUMERICHOST	0x00000004 /* prevent name resolution */
61  
-/* valid flags for addrinfo */
62  
-#define	AI_MASK		(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
63  
-
64  
-#define	AI_ALL		0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
65  
-#define	AI_V4MAPPED_CFG	0x00000200 /* accept IPv4-mapped if kernel supports */
66  
-#define	AI_ADDRCONFIG	0x00000400 /* only if any address is assigned */
67  
-#define	AI_V4MAPPED	0x00000800 /* accept IPv4-mapped IPv6 address */
68  
-/* special recommended flags for getipnodebyname */
69  
-#define	AI_DEFAULT	(AI_V4MAPPED_CFG | AI_ADDRCONFIG)
70  
-
71  
-struct addrinfo {
72  
-	int	ai_flags;	/* AI_PASSIVE, AI_CANONNAME */
73  
-	int	ai_family;	/* PF_xxx */
74  
-	int	ai_socktype;	/* SOCK_xxx */
75  
-	int	ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
76  
-	size_t	ai_addrlen;	/* length of ai_addr */
77  
-	char	*ai_canonname;	/* canonical name for hostname */
78  
-	struct sockaddr *ai_addr;	/* binary address */
79  
-	struct addrinfo *ai_next;	/* next structure in linked list */
80  
-};
81  
-
82  
-extern void freeaddrinfo (struct addrinfo *);
83  
-extern void freehostent (struct hostent *);
84  
-extern char *gai_strerror (int);
85  
-extern int getaddrinfo (const char *, const char *,
86  
-			    const struct addrinfo *, struct addrinfo **);
87  
-extern int getnameinfo (const struct sockaddr *, size_t, char *,
88  
-			    size_t, char *, size_t, int);
89  
-extern struct hostent *getipnodebyaddr (const void *, size_t, int, int *);
90  
-extern struct hostent *getipnodebyname (const char *, int, int, int *);
91  
-extern int inet_pton (int, const char *, void *);
92  
-extern const char *inet_ntop (int, const void *, char *, size_t);
93  
-#endif /* HAVE_ADDRINFO */
94  
-
95  
-/*
96  
- * Constants for getnameinfo()
97  
- */
98  
-#ifndef NI_MAXHOST
99  
-#define	NI_MAXHOST	1025
100  
-#endif
101  
-#ifndef NI_MAXSERV
102  
-#define	NI_MAXSERV	32
103  
-#endif
104  
-
105  
-/*
106  
- * Flag values for getnameinfo()
107  
- */
108  
-#ifndef NI_NOFQDN
109  
-#define	NI_NOFQDN	0x00000001
110  
-#endif
111  
-#ifndef NI_NUMERICHOST
112  
-#define	NI_NUMERICHOST	0x00000002
113  
-#endif
114  
-#ifndef NI_NAMEREQD
115  
-#define	NI_NAMEREQD	0x00000004
116  
-#endif
117  
-#ifndef NI_NUMERICSERV
118  
-#define	NI_NUMERICSERV	0x00000008
119  
-#endif
120  
-#ifndef NI_DGRAM
121  
-#define	NI_DGRAM	0x00000010
122  
-#endif
36  xbmc/cores/DllLoader/exports/emu_socket/addrsize.h
... ...
@@ -1,36 +0,0 @@
1  
-/*
2  
- * Copyright (C) 1999 WIDE Project.
3  
- * All rights reserved.
4  
- *
5  
- * Redistribution and use in source and binary forms, with or without
6  
- * modification, are permitted provided that the following conditions
7  
- * are met:
8  
- * 1. Redistributions of source code must retain the above copyright
9  
- *    notice, this list of conditions and the following disclaimer.
10  
- * 2. Redistributions in binary form must reproduce the above copyright
11  
- *    notice, this list of conditions and the following disclaimer in the
12  
- *    documentation and/or other materials provided with the distribution.
13  
- * 3. Neither the name of the project nor the names of its contributors
14  
- *    may be used to endorse or promote products derived from this software
15  
- *    without specific prior written permission.
16  
- *
17  
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18  
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21  
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  
- * SUCH DAMAGE.
28  
- */
29  
-#ifndef INADDRSZ
30  
-#define INADDRSZ 4		/* IPv4 T_A */
31  
-#endif
32  
-
33  
-#ifndef IN6ADDRSZ
34  
-#define IN6ADDRSZ	16	/* IPv6 T_AAAA */
35  
-#endif
36  
-
68  xbmc/cores/DllLoader/exports/emu_socket/bittypes.h
... ...
@@ -1,68 +0,0 @@
1  
-/*
2  
- * Copyright (C) 1999 WIDE Project.
3  
- * All rights reserved.
4  
- *
5  
- * Redistribution and use in source and binary forms, with or without
6  
- * modification, are permitted provided that the following conditions
7  
- * are met:
8  
- * 1. Redistributions of source code must retain the above copyright
9  
- *    notice, this list of conditions and the following disclaimer.
10  
- * 2. Redistributions in binary form must reproduce the above copyright
11  
- *    notice, this list of conditions and the following disclaimer in the
12  
- *    documentation and/or other materials provided with the distribution.
13  
- * 3. Neither the name of the project nor the names of its contributors
14  
- *    may be used to endorse or promote products derived from this software
15  
- *    without specific prior written permission.
16  
- *
17  
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18  
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21  
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  
- * SUCH DAMAGE.
28  
- */
29  
-#ifndef HAVE_U_INT8_T
30  
-
31  
-typedef unsigned __int8  u_int8_t;
32  
-typedef unsigned __int16 u_int16_t;
33  
-typedef unsigned __int32 u_int32_t;
34  
-typedef unsigned __int64 u_int64_t;
35  
-
36  
-#endif /* HAVE_U_INT64_T */
37  
-
38  
-#ifndef PRId64
39  
-#ifdef _MSC_EXTENSIONS
40  
-#define PRId64	"I64d"
41  
-#else /* _MSC_EXTENSIONS */
42  
-#define PRId64	"lld"
43  
-#endif /* _MSC_EXTENSIONS */
44  
-#endif /* PRId64 */
45  
-
46  
-#ifndef PRIo64
47  
-#ifdef _MSC_EXTENSIONS
48  
-#define PRIo64	"I64o"
49  
-#else /* _MSC_EXTENSIONS */
50  
-#define PRIo64	"llo"
51  
-#endif /* _MSC_EXTENSIONS */
52  
-#endif /* PRIo64 */
53  
-
54  
-#ifndef PRIx64
55  
-#ifdef _MSC_EXTENSIONS
56  
-#define PRIx64	"I64x"
57  
-#else /* _MSC_EXTENSIONS */
58  
-#define PRIx64	"llx"
59  
-#endif /* _MSC_EXTENSIONS */
60  
-#endif /* PRIx64 */
61  
-
62  
-#ifndef PRIu64
63  
-#ifdef _MSC_EXTENSIONS
64  
-#define PRIu64	"I64u"
65  
-#else /* _MSC_EXTENSIONS */
66  
-#define PRIu64	"llu"
67  
-#endif /* _MSC_EXTENSIONS */
68  
-#endif /* PRIu64 */
64  xbmc/cores/DllLoader/exports/emu_socket/emu_socket.h
... ...
@@ -1,64 +0,0 @@
1  
-#ifndef _EMU_SOCKET_EMU_SOCKET_H_
2  
-#define _EMU_SOCKET_EMU_SOCKET_H_
3  
-
4  
-/*
5  
- *      Copyright (C) 2005-2013 Team XBMC
6  
- *      http://xbmc.org
7  
- *
8  
- *  This Program is free software; you can redistribute it and/or modify
9  
- *  it under the terms of the GNU General Public License as published by
10  
- *  the Free Software Foundation; either version 2, or (at your option)
11  
- *  any later version.
12  
- *
13  
- *  This Program is distributed in the hope that it will be useful,
14  
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  
- *  GNU General Public License for more details.
17  
- *
18  
- *  You should have received a copy of the GNU General Public License
19  
- *  along with XBMC; see the file COPYING.  If not, see
20  
- *  <http://www.gnu.org/licenses/>.
21  
- *
22  
- */
23  
-
24  
-#define SOCK_RAW 3
25  
-
26  
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
27  
-
28  
-#define INET_ADDRSTRLEN 16
29  
-
30  
-struct mphostent {
31  
-	  char *h_name;	      /* official name of host */
32  
-	  char **h_aliases;   /* alias list */
33  
-	  short  h_addrtype;	  /* host address type	*/
34  
-	  short  h_length;	    /* length of	address	*/
35  
-	  char **h_addr_list; /* list of addresses	from name server */
36  
-};
37  
-
38  
-#ifndef IN_MULTICAST
39  
-#define IN_MULTICAST(i)	    (((i) & 0xf0000000U) == 0xe0000000U)
40  
-#endif
41  
-
42  
-#ifndef IN_EXPERIMENTAL
43  
-#define IN_EXPERIMENTAL(i)  (((i) & 0xe0000000U) == 0xe0000000U)
44  
-#endif
45  
-
46  
-#ifndef IN_LOOPBACKNET
47  
-#define IN_LOOPBACKNET	    127
48  
-#endif
49  
-
50  
-/*
51  
-typedef struct addrinfo
52  
-{
53  
-    int                 ai_flags;       // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST
54  
-    int                 ai_family;      // PF_xxx
55  
-    int                 ai_socktype;    // SOCK_xxx
56  
-    int                 ai_protocol;    // 0 or IPPROTO_xxx for IPv4 and IPv6
57  
-    size_t              ai_addrlen;     // Length of ai_addr
58  
-    char *              ai_canonname;   // Canonical name for nodename
59  
-    struct sockaddr *   ai_addr;        // Binary address
60  
-    struct addrinfo *   ai_next;        // Next structure in linked list
61  
-}
62  
-ADDRINFOA, *PADDRINFOA;
63  
-*/
64  
-#endif //_EMU_SOCKET_EMU_SOCKET_H_
646  xbmc/cores/DllLoader/exports/emu_socket/getaddrinfo.c
... ...
@@ -1,646 +0,0 @@
1  
-/*
2  
- * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3  
- * All rights reserved.
4  
- *
5  
- * Redistribution and use in source and binary forms, with or without
6  
- * modification, are permitted provided that the following conditions
7  
- * are met:
8  
- * 1. Redistributions of source code must retain the above copyright
9  
- *    notice, this list of conditions and the following disclaimer.
10  
- * 2. Redistributions in binary form must reproduce the above copyright
11  
- *    notice, this list of conditions and the following disclaimer in the
12  
- *    documentation and/or other materials provided with the distribution.
13  
- * 3. Neither the name of the project nor the names of its contributors
14  
- *    may be used to endorse or promote products derived from this software
15  
- *    without specific prior written permission.
16  
- *
17  
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18  
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21  
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  
- * SUCH DAMAGE.
28  
- */
29  
-
30  
-/*
31  
- * "#ifdef FAITH" part is local hack for supporting IPv4-v6 translator.
32  
- *
33  
- * Issues to be discussed:
34  
- * - Thread safe-ness must be checked.
35  
- * - Return values.  There are nonstandard return values defined and used
36  
- *   in the source code.  This is because RFC2553 is silent about which error
37  
- *   code must be returned for which situation.
38  
- * Note:
39  
- * - We use getipnodebyname() just for thread-safeness.  There's no intent
40  
- *   to let it do PF_UNSPEC (actually we never pass PF_UNSPEC to
41  
- *   getipnodebyname().
42  
- * - The code filters out AFs that are not supported by the kernel,
43  
- *   when globbing NULL hostname (to loopback, or wildcard).  Is it the right
44  
- *   thing to do?  What is the relationship with post-RFC2553 AI_ADDRCONFIG
45  
- *   in ai_flags?
46  
- */
47  
-
48  
-#include <windows.h>
49  
-#include <stddef.h>
50  
-#include "addrinfo.h"
51  
-#include "emu_socket.h"
52  
-#include <sys/types.h>
53  
-#include <string.h>
54  
-#include <stdlib.h>
55  
-#include <stddef.h>
56  
-#include <ctype.h>
57  
-#include <stdio.h>
58  
-#include <errno.h>
59  
-
60  
-#ifndef HAVE_U_INT32_T
61  
-#include "bittypes.h"
62  
-#endif
63  
-
64  
-#ifndef HAVE_SOCKADDR_STORAGE
65  
-#include "sockstorage.h"
66  
-#endif
67  
-
68  
-#ifdef NEED_ADDRINFO_H
69  
-#include "addrinfo.h"
70  
-#endif
71  
-
72  
-#if defined(__KAME__) && defined(ENABLE_IPV6)
73  
-# define FAITH
74  
-#endif
75  
-
76  
-#define SUCCESS 0
77  
-#define GAI_ANY 0
78  
-#define YES 1
79  
-#define NO  0
80  
-
81  
-#ifdef FAITH
82  
-static int translate = NO;
83  
-static struct in6_addr faith_prefix = IN6ADDR_GAI_ANY_INIT;
84  
-#endif
85  
-
86  
-static const char in_addrany[] = { 0, 0, 0, 0 };
87  
-static const char in6_addrany[] = {
88  
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
89  
-};
90  
-static const char in_loopback[] = { 127, 0, 0, 1 }; 
91  
-static const char in6_loopback[] = {
92  
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
93  
-};
94  
-
95  
-struct sockinet {
96  
-	u_char	si_len;
97  
-	u_char	si_family;
98  
-	u_short	si_port;
99  
-};
100  
-
101  
-static struct gai_afd {
102  
-	int a_af;
103  
-	int a_addrlen;
104  
-	int a_socklen;
105  
-	int a_off;
106  
-	const char *a_addrany;
107  
-	const char *a_loopback;	
108  
-} gai_afdl [] = {
109  
-#ifdef ENABLE_IPV6
110  
-#define N_INET6 0
111  
-	{PF_INET6, sizeof(struct in6_addr),
112  
-	 sizeof(struct sockaddr_in6),
113  
-	 offsetof(struct sockaddr_in6, sin6_addr),
114  
-	 in6_addrany, in6_loopback},
115  
-#define N_INET  1
116  
-#else
117  
-#define N_INET  0
118  
-#endif
119  
-	{PF_INET, sizeof(struct in_addr),
120  
-	 sizeof(struct sockaddr_in),
121  
-	 offsetof(struct sockaddr_in, sin_addr),
122  
-	 in_addrany, in_loopback},
123  
-	{0, 0, 0, 0, NULL, NULL},
124  
-};
125  
-
126  
-#ifdef ENABLE_IPV6
127  
-#define PTON_MAX	16
128  
-#else
129  
-#define PTON_MAX	4
130  
-#endif
131  
-
132  
-#ifndef IN_MULTICAST
133  
-#define IN_MULTICAST(i)	    (((i) & 0xf0000000U) == 0xe0000000U)
134  
-#endif
135  
-
136  
-#ifndef IN_EXPERIMENTAL
137  
-#define IN_EXPERIMENTAL(i)  (((i) & 0xe0000000U) == 0xe0000000U)
138  
-#endif
139  
-
140  
-#ifndef IN_LOOPBACKNET
141  
-#define IN_LOOPBACKNET	    127
142  
-#endif
143  
-
144  
-static int get_name (const char *, struct gai_afd *,  struct addrinfo **, char *, struct addrinfo *,  int);
145  
-static int get_addr (const char *, int, struct addrinfo **,
146  
-			struct addrinfo *, int);
147  
-static int str_isnumber (const char *);
148  
-	
149  
-static char *ai_errlist[] = {
150  
-	"success.",
151  
-	"address family for hostname not supported.",	/* EAI_ADDRFAMILY */
152  
-	"temporary failure in name resolution.",	/* EAI_AGAIN      */
153  
-	"invalid value for ai_flags.",		       	/* EAI_BADFLAGS   */
154  
-	"non-recoverable failure in name resolution.", 	/* EAI_FAIL       */
155  
-	"ai_family not supported.",			/* EAI_FAMILY     */
156  
-	"memory allocation failure.", 			/* EAI_MEMORY     */
157  
-	"no address associated with hostname.", 	/* EAI_NODATA     */
158  
-	"hostname nor servname provided, or not known.",/* EAI_NONAME     */
159  
-	"servname not supported for ai_socktype.",	/* EAI_SERVICE    */
160  
-	"ai_socktype not supported.", 			/* EAI_SOCKTYPE   */
161  
-	"system error returned in errno.", 		/* EAI_SYSTEM     */
162  
-	"invalid value for hints.",			/* EAI_BADHINTS	  */
163  
-	"resolved protocol is unknown.",		/* EAI_PROTOCOL   */
164  
-	"unknown error.", 				/* EAI_MAX        */
165  
-};
166  
-
167  
-#define GET_CANONNAME(ai, str) \
168  
-if (pai->ai_flags & AI_CANONNAME) {\
169  
-	if (((ai)->ai_canonname = (char *)malloc(strlen(str) + 1)) != NULL) {\
170  
-		strcpy((ai)->ai_canonname, (str));\
171  
-	} else {\
172  
-		error = EAI_MEMORY;\
173  
-		goto free;\
174  
-	}\
175  
-}
176  
-
177  
-#ifdef HAVE_SOCKADDR_SA_LEN
178  
-#define GET_AI(ai, gai_afd, addr, port) {\
179  
-	char *p;\
180  
-	if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\
181  
-					      ((gai_afd)->a_socklen)))\
182  
-	    == NULL) goto free;\
183  
-	memcpy(ai, pai, sizeof(struct addrinfo));\
184  
-	(ai)->ai_addr = (struct sockaddr *)((ai) + 1);\
185  
-	memset((ai)->ai_addr, 0, (gai_afd)->a_socklen);\
186  
-	(ai)->ai_addr->sa_len = (ai)->ai_addrlen = (gai_afd)->a_socklen;\
187  
-	(ai)->ai_addr->sa_family = (ai)->ai_family = (gai_afd)->a_af;\
188  
-	((struct sockinet *)(ai)->ai_addr)->si_port = port;\
189  
-	p = (char *)((ai)->ai_addr);\
190  
-	memcpy(p + (gai_afd)->a_off, (addr), (gai_afd)->a_addrlen);\
191  
-}
192  
-#else
193  
-#define GET_AI(ai, gai_afd, addr, port) {\
194  
-	char *p;\
195  
-	if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\
196  
-					      ((gai_afd)->a_socklen)))\
197  
-	    == NULL) goto free;\
198  
-	memcpy(ai, pai, sizeof(struct addrinfo));\
199  
-	(ai)->ai_addr = (struct sockaddr *)((ai) + 1);\
200  
-	memset((ai)->ai_addr, 0, (gai_afd)->a_socklen);\
201  
-	(ai)->ai_addrlen = (gai_afd)->a_socklen;\
202  
-	(ai)->ai_addr->sa_family = (ai)->ai_family = (gai_afd)->a_af;\
203  
-	((struct sockinet *)(ai)->ai_addr)->si_port = port;\
204  
-	p = (char *)((ai)->ai_addr);\
205  
-	memcpy(p + (gai_afd)->a_off, (addr), (gai_afd)->a_addrlen);\
206  
-}
207  
-#endif
208  
-
209  
-#define ERR(err) { error = (err); goto bad; }
210  
-
211  
-char *
212  
-gai_strerror(int ecode)
213  
-{
214  
-	if (ecode < 0 || ecode > EAI_MAX)
215  
-		ecode = EAI_MAX;
216  
-	return ai_errlist[ecode];
217  
-}
218  
-
219  
-void
220  
-freeaddrinfo(struct addrinfo *ai)
221  
-{
222  
-	struct addrinfo *next;
223  
-
224  
-	do {
225  
-		next = ai->ai_next;
226  
-		if (ai->ai_canonname)
227  
-			free(ai->ai_canonname);
228  
-		/* no need to free(ai->ai_addr) */
229  
-		free(ai);
230  
-	} while ((ai = next) != NULL);
231  
-}
232  
-
233  
-static int
234  
-str_isnumber(const char *p)
235  
-{
236  
-	unsigned char *q = (unsigned char *)p;
237  
-	while (*q) {
238  
-		if (! isdigit(*q))
239  
-			return NO;
240  
-		q++;
241  
-	}
242  
-	return YES;
243  
-}
244  
-
245  
-int
246  
-getaddrinfo(const char*hostname, const char*servname,
247  
-            const struct addrinfo *hints, struct addrinfo **res)
248  
-{
249  
-	struct addrinfo sentinel;
250  
-	struct addrinfo *top = NULL;
251  
-	struct addrinfo *cur;
252  
-	int i, error = 0;
253  
-	char pton[PTON_MAX];
254  
-	struct addrinfo ai;
255  
-	struct addrinfo *pai;
256  
-	u_short port;
257  
-
258  
-#ifdef FAITH
259  
-	static int firsttime = 1;
260  
-
261  
-	if (firsttime) {
262  
-		/* translator hack */
263  
-		{
264  
-			char *q = getenv("GAI");
265  
-			if (q && inet_pton(AF_INET6, q, &faith_prefix) == 1)
266  
-				translate = YES;
267  
-		}
268  
-		firsttime = 0;
269  
-	}
270  
-#endif
271  
-
272  
-	/* initialize file static vars */
273  
-	sentinel.ai_next = NULL;
274  
-	cur = &sentinel;
275  
-	pai = &ai;
276  
-	pai->ai_flags = 0;
277  
-	pai->ai_family = PF_UNSPEC;
278  
-	pai->ai_socktype = GAI_ANY;
279  
-	pai->ai_protocol = GAI_ANY;
280  
-	pai->ai_addrlen = 0;
281  
-	pai->ai_canonname = NULL;
282  
-	pai->ai_addr = NULL;
283  
-	pai->ai_next = NULL;
284  
-	port = GAI_ANY;
285  
-	
286  
-	if (hostname == NULL && servname == NULL)
287  
-		return EAI_NONAME;
288  
-	if (hints) {
289  
-		/* error check for hints */
290  
-		if (hints->ai_addrlen || hints->ai_canonname ||
291  
-		    hints->ai_addr || hints->ai_next)
292  
-			ERR(EAI_BADHINTS); /* xxx */
293  
-		if (hints->ai_flags & ~AI_MASK)
294  
-			ERR(EAI_BADFLAGS);
295  
-		switch (hints->ai_family) {
296  
-		case PF_UNSPEC:
297  
-		case PF_INET:
298  
-#ifdef ENABLE_IPV6
299  
-		case PF_INET6:
300  
-#endif
301  
-			break;
302  
-		default:
303  
-			ERR(EAI_FAMILY);
304  
-		}
305  
-		memcpy(pai, hints, sizeof(*pai));
306  
-		switch (pai->ai_socktype) {
307  
-		case GAI_ANY:
308  
-			switch (pai->ai_protocol) {
309  
-			case GAI_ANY:
310  
-				break;
311  
-			case IPPROTO_UDP:
312  
-				pai->ai_socktype = SOCK_DGRAM;
313  
-				break;
314  
-			case IPPROTO_TCP:
315  
-				pai->ai_socktype = SOCK_STREAM;
316  
-				break;
317  
-			default:
318  
-				pai->ai_socktype = SOCK_RAW;
319  
-				break;
320  
-			}
321  
-			break;
322  
-		case SOCK_DGRAM:
323  
-			if (pai->ai_protocol != IPPROTO_UDP &&
324  
-			    pai->ai_protocol != GAI_ANY)
325  
-				ERR(EAI_BADHINTS);	/*xxx*/
326  
-			pai->ai_protocol = IPPROTO_UDP;
327  
-			break;
328  
-		case SOCK_STREAM:
329  
-			if (pai->ai_protocol != IPPROTO_TCP &&
330  
-			    pai->ai_protocol != GAI_ANY)
331  
-				ERR(EAI_BADHINTS);	/*xxx*/
332  
-			pai->ai_protocol = IPPROTO_TCP;
333  
-			break;
334  
-		default:
335  
-			ERR(EAI_SOCKTYPE);
336  
-			/* unreachable */
337  
-		}
338  
-	}
339  
-
340  
-	/*
341  
-	 * service port
342  
-	 */
343  
-	if (servname) {
344  
-		if (str_isnumber(servname)) {
345  
-			if (pai->ai_socktype == GAI_ANY) {
346  
-				/* caller accept *GAI_ANY* socktype */
347  
-				pai->ai_socktype = SOCK_DGRAM;
348  
-				pai->ai_protocol = IPPROTO_UDP;
349  
-			}
350  
-			port = htons((u_short)atoi(servname));
351  
-		} else {
352  
-			struct servent *sp;
353  
-			char *proto;
354  
-
355  
-			proto = NULL;
356  
-			switch (pai->ai_socktype) {
357  
-			case GAI_ANY:
358  
-				proto = NULL;
359  
-				break;
360  
-			case SOCK_DGRAM:
361  
-				proto = "udp";
362  
-				break;
363  
-			case SOCK_STREAM:
364  
-				proto = "tcp";
365  
-				break;
366  
-			default:
367  
-				fprintf(stderr, "panic!\n");
368  
-				break;
369  
-			}
370  
-			if ((sp = getservbyname(servname, proto)) == NULL)
371  
-				ERR(EAI_SERVICE);
372  
-			port = sp->s_port;
373  
-			if (pai->ai_socktype == GAI_ANY) {
374  
-				if (strcmp(sp->s_proto, "udp") == 0) {
375  
-					pai->ai_socktype = SOCK_DGRAM;
376  
-					pai->ai_protocol = IPPROTO_UDP;
377  
-				} else if (strcmp(sp->s_proto, "tcp") == 0) {
378  
-                                        pai->ai_socktype = SOCK_STREAM;
379  
-                                        pai->ai_protocol = IPPROTO_TCP;
380  
-                                } else
381  
-                                        ERR(EAI_PROTOCOL);	/*xxx*/
382  
-                        }
383  
-		}
384  
-	}
385  
-	
386  
-	/*
387  
-	 * hostname == NULL.
388  
-	 * passive socket -> anyaddr (0.0.0.0 or ::)
389  
-	 * non-passive socket -> localhost (127.0.0.1 or ::1)
390  
-	 */
391  
-	if (hostname == NULL) {
392  
-		struct gai_afd *gai_afd;
393  
-
394  
-		for (gai_afd = &gai_afdl[0]; gai_afd->a_af; gai_afd++) {
395  
-			if (!(pai->ai_family == PF_UNSPEC
396  
-			   || pai->ai_family == gai_afd->a_af)) {
397  
-				continue;
398  
-			}
399  
-
400  
-			if (pai->ai_flags & AI_PASSIVE) {
401  
-				GET_AI(cur->ai_next, gai_afd, gai_afd->a_addrany, port);
402  
-				/* xxx meaningless?
403  
-				 * GET_CANONNAME(cur->ai_next, "anyaddr");
404  
-				 */
405  
-			} else {
406  
-				GET_AI(cur->ai_next, gai_afd, gai_afd->a_loopback,
407  
-					port);
408  
-				/* xxx meaningless?
409  
-				 * GET_CANONNAME(cur->ai_next, "localhost");
410  
-				 */
411  
-			}
412  
-			cur = cur->ai_next;
413  
-		}
414  
-		top = sentinel.ai_next;
415  
-		if (top)
416  
-			goto good;
417  
-		else
418  
-			ERR(EAI_FAMILY);
419  
-	}
420  
-	
421  
-	/* hostname as numeric name */
422  
-	for (i = 0; gai_afdl[i].a_af; i++) {
423  
-		if (inet_pton(gai_afdl[i].a_af, hostname, pton)) {
424  
-			u_long v4a;
425  
-#ifdef ENABLE_IPV6
426  
-			u_char pfx;
427  
-#endif
428  
-
429  
-			switch (gai_afdl[i].a_af) {
430  
-			case AF_INET:
431  
-				v4a = ((struct in_addr *)pton)->s_addr;
432  
-				v4a = ntohl(v4a);
433  
-				if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
434  
-					pai->ai_flags &= ~AI_CANONNAME;
435  
-				v4a >>= IN_CLASSA_NSHIFT;
436  
-				if (v4a == 0 || v4a == IN_LOOPBACKNET)
437  
-					pai->ai_flags &= ~AI_CANONNAME;
438  
-				break;
439  
-#ifdef ENABLE_IPV6
440  
-			case AF_INET6:
441  
-				pfx = ((struct in6_addr *)pton)->s6_addr8[0];
442  
-				if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
443  
-					pai->ai_flags &= ~AI_CANONNAME;
444  
-				break;
445  
-#endif
446  
-			}
447  
-			
448  
-			if (pai->ai_family == gai_afdl[i].a_af ||
449  
-			    pai->ai_family == PF_UNSPEC) {
450  
-				if (! (pai->ai_flags & AI_CANONNAME)) {
451  
-					GET_AI(top, &gai_afdl[i], pton, port);
452  
-					goto good;
453  
-				}
454  
-				/*
455  
-				 * if AI_CANONNAME and if reverse lookup
456  
-				 * fail, return ai anyway to pacify
457  
-				 * calling application.
458  
-				 *
459  
-				 * XXX getaddrinfo() is a name->address
460  
-				 * translation function, and it looks strange
461  
-				 * that we do addr->name translation here.
462  
-				 */
463  
-				get_name(pton, &gai_afdl[i], &top, pton, pai, port);
464  
-				goto good;
465  
-			} else 
466  
-				ERR(EAI_FAMILY);	/*xxx*/
467  
-		}
468  
-	}
469  
-
470  
-	if (pai->ai_flags & AI_NUMERICHOST)
471  
-		ERR(EAI_NONAME);
472  
-
473  
-	/* hostname as alphabetical name */
474  
-	error = get_addr(hostname, pai->ai_family, &top, pai, port);
475  
-	if (error == 0) {
476  
-		if (top) {
477  
- good:
478  
-			*res = top;
479  
-			return SUCCESS;
480  
-		} else
481  
-			error = EAI_FAIL;
482  
-	}
483  
- free:
484  
-	if (top)
485  
-		freeaddrinfo(top);
486  
- bad:
487  
-	*res = NULL;
488  
-	return error;
489  
-}
490  
-
491  
-static int
492  
-get_name(addr, gai_afd, res, numaddr, pai, port0)
493  
-	const char *addr;
494  
-	struct gai_afd *gai_afd;
495  
-	struct addrinfo **res;
496  
-	char *numaddr;
497  
-	struct addrinfo *pai;
498  
-	int port0;
499  
-{
500  
-	u_short port = port0 & 0xffff;
501  
-	struct hostent *hp;
502  
-	struct addrinfo *cur;
503  
-	int error = 0;
504  
-#ifdef ENABLE_IPV6
505  
-	int h_error;
506  
-#endif
507  
-	
508  
-#ifdef ENABLE_IPV6
509  
-	hp = getipnodebyaddr(addr, gai_afd->a_addrlen, gai_afd->a_af, &h_error);
510  
-#else
511  
-	hp = gethostbyaddr(addr, gai_afd->a_addrlen, AF_INET);
512  
-#endif
513  
-	if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
514  
-		GET_AI(cur, gai_afd, hp->h_addr_list[0], port);
515  
-		GET_CANONNAME(cur, hp->h_name);
516  
-	} else
517  
-		GET_AI(cur, gai_afd, numaddr, port);
518  
-	
519  
-#ifdef ENABLE_IPV6
520  
-	if (hp)
521  
-		freehostent(hp);
522  
-#endif
523  
-	*res = cur;
524  
-	return SUCCESS;
525  
- free:
526  
-	if (cur)
527  
-		freeaddrinfo(cur);
528  
-#ifdef ENABLE_IPV6
529  
-	if (hp)
530  
-		freehostent(hp);
531  
-#endif
532  
- /* bad: */
533  
-	*res = NULL;
534  
-	return error;
535  
-}
536  
-
537  
-static int
538  
-get_addr(hostname, af, res, pai, port0)
539  
-	const char *hostname;
540  
-	int af;
541  
-	struct addrinfo **res;
542  
-	struct addrinfo *pai;
543  
-	int port0;
544  
-{
545  
-	u_short port = port0 & 0xffff;
546  
-	struct addrinfo sentinel;
547  
-	struct hostent *hp;
548  
-	struct addrinfo *top, *cur;
549  
-	struct gai_afd *gai_afd;
550  
-	int i, error = 0, h_error;
551  
-	char *ap;
552  
-
553  
-	top = NULL;
554  
-	sentinel.ai_next = NULL;
555  
-	cur = &sentinel;
556  
-#ifdef ENABLE_IPV6
557  
-	if (af == AF_UNSPEC) {
558  
-		hp = getipnodebyname(hostname, AF_INET6,
559  
-				AI_ADDRCONFIG|AI_ALL|AI_V4MAPPED, &h_error);
560  
-	} else
561  
-		hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error);
562  
-#else
563  
-	hp = gethostbyname(hostname);
564  
-	h_error = h_errno;
565  
-#endif
566  
-	if (hp == NULL) {
567  
-		switch (h_error) {
568  
-		case HOST_NOT_FOUND:
569  
-		case NO_DATA:
570  
-			error = EAI_NODATA;
571  
-			break;
572  
-		case TRY_AGAIN:
573  
-			error = EAI_AGAIN;
574  
-			break;
575  
-		case NO_RECOVERY:
576  
-		default:
577  
-			error = EAI_FAIL;
578  
-			break;
579  
-		}
580  
-		goto free;
581  
-	}
582  
-
583  
-	if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
584  
-	    (hp->h_addr_list[0] == NULL)) {
585  
-		error = EAI_FAIL;
586  
-		goto free;
587  
-	}
588  
-	
589  
-	for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) {
590  
-		switch (af) {
591  
-#ifdef ENABLE_IPV6
592  
-		case AF_INET6:
593  
-			gai_afd = &gai_afdl[N_INET6];
594  
-			break;
595  
-#endif
596  
-#ifndef ENABLE_IPV6
597  
-		default:	/* AF_UNSPEC */
598  
-#endif
599  
-		case AF_INET:
600  
-			gai_afd = &gai_afdl[N_INET];
601  
-			break;
602  
-#ifdef ENABLE_IPV6
603  
-		default:	/* AF_UNSPEC */
604  
-			if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) {
605  
-				ap += sizeof(struct in6_addr) -
606  
-					sizeof(struct in_addr);
607  
-				gai_afd = &gai_afdl[N_INET];
608  
-			} else
609  
-				gai_afd = &gai_afdl[N_INET6];
610  
-			break;
611  
-#endif
612  
-		}
613  
-#ifdef FAITH
614  
-		if (translate && gai_afd->a_af == AF_INET) {
615  
-			struct in6_addr *in6;
616  
-
617  
-			GET_AI(cur->ai_next, &gai_afdl[N_INET6], ap, port);
618  
-			in6 = &((struct sockaddr_in6 *)cur->ai_next->ai_addr)->sin6_addr;
619  
-			memcpy(&in6->s6_addr32[0], &faith_prefix,
620  
-			    sizeof(struct in6_addr) - sizeof(struct in_addr));
621  
-			memcpy(&in6->s6_addr32[3], ap, sizeof(struct in_addr));
622  
-		} else
623  
-#endif /* FAITH */
624  
-		GET_AI(cur->ai_next, gai_afd, ap, port);
625  
-		if (cur == &sentinel) {
626  
-			top = cur->ai_next;
627  
-			GET_CANONNAME(top, hp->h_name);
628  
-		}
629  
-		cur = cur->ai_next;
630  
-	}
631  
-#ifdef ENABLE_IPV6
632  
-	freehostent(hp);
633  
-#endif
634  
-	*res = top;
635  
-	return SUCCESS;
636  
- free:
637  
-	if (top)
638  
-		freeaddrinfo(top);
639  
-#ifdef ENABLE_IPV6
640  
-	if (hp)
641  
-		freehostent(hp);
642  
-#endif
643  
-/* bad: */
644  
-	*res = NULL;
645  
-	return error;
646  
-}
230  xbmc/cores/DllLoader/exports/emu_socket/getnameinfo.c
... ...
@@ -1,230 +0,0 @@
1  
-/*
2  
- * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3  
- * All rights reserved.
4  
- *
5  
- * Redistribution and use in source and binary forms, with or without
6  
- * modification, are permitted provided that the following conditions
7  
- * are met:
8  
- * 1. Redistributions of source code must retain the above copyright
9  
- *    notice, this list of conditions and the following disclaimer.
10  
- * 2. Redistributions in binary form must reproduce the above copyright
11  
- *    notice, this list of conditions and the following disclaimer in the
12  
- *    documentation and/or other materials provided with the distribution.
13  
- * 3. Neither the name of the project nor the names of its contributors
14  
- *    may be used to endorse or promote products derived from this software
15  
- *    without specific prior written permission.
16  
- *
17  
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18  
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21  
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  
- * SUCH DAMAGE.
28  
- */
29  
-
30  
-/*
31  
- * Issues to be discussed:
32  
- * - Thread safe-ness must be checked
33  
- * - Return values.  There seems to be no standard for return value (RFC2553)
34  
- *   but INRIA implementation returns EAI_xxx defined for getaddrinfo().
35  
- * - RFC2553 says that we should raise error on short buffer.  X/Open says
36  
- *   we need to truncate the result.  We obey RFC2553 (and X/Open should be
37  
- *   modified).
38  
- */
39  
-
40  
-#include <windows.h>
41  
-#include <stddef.h>
42  
-#include "addrinfo.h"
43  
-#include "emu_socket.h"
44  
-#include <sys/types.h>
45  
-#include <string.h>
46  
-#include <stdlib.h>
47  
-#include <stddef.h>
48  
-#include <ctype.h>
49  
-#include <stdio.h>
50  
-#include <errno.h>
51  
-
52  
-extern struct servent* __stdcall dllgetservbyname(const char* name, const char* proto);
53  
-#define getservbyname(name, proto) dllgetservbyname(name, proto)
54  
-