Author: greatlrd
Date: Wed May 31 11:56:39 2006
New Revision: 22123
URL:
http://svn.reactos.ru/svn/reactos?rev=22123&view=rev
Log:
start implement WSHGetSockaddrType, it missing error code at return, and handling other
struct and sockeradr_in.
Code was done by me and irc : Elrond (from TNG), Arty please check this, Other people test
see if it works for u.
Modified:
trunk/reactos/drivers/network/wshtcpip/wshtcpip.c
Modified: trunk/reactos/drivers/network/wshtcpip/wshtcpip.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/network/wshtcpip/ws…
==============================================================================
--- trunk/reactos/drivers/network/wshtcpip/wshtcpip.c (original)
+++ trunk/reactos/drivers/network/wshtcpip/wshtcpip.c Wed May 31 11:56:39 2006
@@ -93,6 +93,11 @@
}
+/*
+Document from OSR how WSHGetSockaddrType works
+http://www.osronline.com/ddkx/network/37wshfun_5lyq.htm
+*/
+
INT
EXPORT
WSHGetSockaddrType(
@@ -100,10 +105,57 @@
IN DWORD SockaddrLength,
OUT PSOCKADDR_INFO SockaddrInfo)
{
- UNIMPLEMENTED
-
- return 0;
-}
+ PSOCKADDR_IN ipv4 = (PSOCKADDR_IN)Sockaddr;
+
+ if ((ipv4 != NULL)
+ && (SockaddrLength == sizeof(SOCKADDR_IN))
+ && (ipv4->sin_family == AF_INET)
+ && (SockaddrInfo != NULL))
+ {
+
+ switch (ntohl(ipv4->sin_addr.s_addr))
+ {
+ case INADDR_ANY:
+ SockaddrInfo->AddressInfo = SockaddrAddressInfoWildcard;
+ break;
+
+ case INADDR_BROADCAST:
+ SockaddrInfo->AddressInfo = SockaddrAddressInfoBroadcast;
+ break;
+
+ case INADDR_LOOPBACK:
+ SockaddrInfo->AddressInfo = SockaddrAddressInfoLoopback;
+ break;
+
+ default:
+ SockaddrInfo->AddressInfo = SockaddrAddressInfoNormal;
+ break;
+ }
+
+ SockaddrInfo->EndpointInfo = SockaddrEndpointInfoNormal;
+ if (ntohs(ipv4->sin_port) == 0)
+ SockaddrInfo->EndpointInfo = SockaddrEndpointInfoWildcard;
+ if (ntohs(ipv4->sin_port) < IPPORT_RESERVED)
+ SockaddrInfo->EndpointInfo = SockaddrEndpointInfoReserved;
+
+ return 0;
+ }
+
+ DPRINT1("FIXME WSHGetSockaddrType Unsupported Address Family or bad
parameters\n");
+ if (SockaddrInfo != NULL)
+ {
+ SockaddrInfo->AddressInfo = SockaddrAddressInfoNormal;
+ SockaddrInfo->EndpointInfo = SockaddrEndpointInfoNormal;
+ }
+
+ DPRINT1("Size of Address Family %d \n",SockaddrLength);
+
+ DPRINT1("FIXME WSHGetSockaddrType return Winsock error, but we do not return any
error\n");
+ return 0;
+}
+
+
+
INT