Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenwinsock.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS Winsock 2 SPI 00004 * FILE: lib/mswsock/lib/init.c 00005 * PURPOSE: DLL Initialization 00006 */ 00007 00008 /* INCLUDES ******************************************************************/ 00009 #include "precomp.h" 00010 00011 /* DATA **********************************************************************/ 00012 00013 /* FUNCTIONS *****************************************************************/ 00014 00015 /* 00016 * @implemented 00017 */ 00018 BOOL 00019 WINAPI 00020 WSAttemptAutodialAddr(IN CONST SOCKADDR FAR *Name, 00021 IN INT NameLength) 00022 { 00023 PSOCKADDR_IN Ip = (PSOCKADDR_IN)Name; 00024 PSOCKADDR_NB NetBios = (PSOCKADDR_NB)Name; 00025 AUTODIAL_ADDR AutodialAdddress; 00026 00027 /* Check the family type */ 00028 switch (Name->sa_family) 00029 { 00030 case AF_INET: 00031 /* Normal IPv4, set the Autodial Address Data */ 00032 AutodialAdddress.Family = AutoDialIp; 00033 AutodialAdddress.Ip4Address = Ip->sin_addr; 00034 break; 00035 00036 case AF_NETBIOS: 00037 /* NetBIOS, set the Autodial Address Data*/ 00038 AutodialAdddress.Family = AutoDialNetBios; 00039 RtlCopyMemory(&AutodialAdddress.NetBiosAddress, 00040 NetBios->snb_name, 00041 NETBIOS_NAME_LENGTH); 00042 break; 00043 00044 default: 00045 /* Unsupported family type */ 00046 return FALSE; 00047 } 00048 00049 /* Call the public routine */ 00050 return AcsHlpAttemptConnection(&AutodialAdddress); 00051 } 00052 00053 /* 00054 * @implemented 00055 */ 00056 BOOL 00057 WINAPI 00058 WSAttemptAutodialName(IN CONST LPWSAQUERYSETW Restrictions) 00059 { 00060 AUTODIAL_ADDR AutodialAdddress; 00061 CHAR AnsiIp[17]; 00062 LPGUID Guid = Restrictions->lpServiceClassId; 00063 00064 /* Make sure we actually have a name */ 00065 if (!Restrictions->lpszServiceInstanceName) return FALSE; 00066 00067 /* Check if this is the Hostname GUID */ 00068 if (!memcmp(Guid, &HostnameGuid, sizeof(GUID))) 00069 { 00070 /* It is. Set up the Autodial Address Data */ 00071 AutodialAdddress.Family = AutoDialIpHost; 00072 WideCharToMultiByte(CP_ACP, 00073 0, 00074 Restrictions->lpszServiceInstanceName, 00075 -1, 00076 AutodialAdddress.HostName, 00077 INTERNET_MAX_PATH_LENGTH - 1, 00078 0, 00079 0); 00080 00081 /* Call the public routine */ 00082 return AcsHlpAttemptConnection(&AutodialAdddress); 00083 } 00084 else if (!memcmp(Guid, &AddressGuid, sizeof(GUID))) 00085 { 00086 /* It's actually the IP String GUID */ 00087 AutodialAdddress.Family = AutoDialIp; 00088 00089 /* Convert the IP String to ANSI and then convert it to IP */ 00090 WideCharToMultiByte(CP_ACP, 00091 0, 00092 Restrictions->lpszServiceInstanceName, 00093 -1, 00094 AnsiIp, 00095 sizeof(AnsiIp) - 1, 00096 0, 00097 0); 00098 _strlwr(AnsiIp); 00099 AutodialAdddress.Ip4Address.S_un.S_addr = inet_addr(AnsiIp); 00100 00101 /* Make sure the IP is valid */ 00102 if (AutodialAdddress.Ip4Address.S_un.S_addr == -1) return FALSE; 00103 00104 /* Call the public routine */ 00105 return AcsHlpAttemptConnection(&AutodialAdddress); 00106 } 00107 else 00108 { 00109 /* Unknown GUID type */ 00110 return FALSE; 00111 } 00112 } 00113 00114 /* 00115 * @implemented 00116 */ 00117 VOID 00118 WINAPI 00119 WSNoteSuccessfulHostentLookup(IN CONST CHAR FAR *Name, 00120 IN CONST ULONG Address) 00121 { 00122 AUTODIAL_ADDR AutodialAdddress; 00123 AUTODIAL_CONN AutodialConnection; 00124 00125 /* Make sure there actually is a name */ 00126 if (!(Name) || !strlen(Name)) return; 00127 00128 /* Setup the Address */ 00129 AutodialAdddress.Family = AutoDialIpHost; 00130 strcpy(AutodialAdddress.HostName, Name); 00131 00132 /* Setup the new connection */ 00133 AutodialConnection.Family = ConnectionIp; 00134 AutodialConnection.Ip4Address = Address; 00135 AcsHlpNoteNewConnection(&AutodialAdddress, &AutodialConnection); 00136 } 00137 Generated on Sun May 27 2012 04:25:56 for ReactOS by
1.7.6.1
|