diff options
author | George Hazan <george.hazan@gmail.com> | 2012-05-27 21:30:30 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-05-27 21:30:30 +0000 |
commit | 8549e48fbb8520027d4d8ba74b6f12f3042faebc (patch) | |
tree | f4aa951f6c13d179ca711ae5977eb38698dcaf52 /src/modules/netlib/netlib.cpp | |
parent | d27904ad1988ba6f85228f3c0cb7de8379a3147b (diff) |
ipv6 sync
git-svn-id: http://svn.miranda-ng.org/main/trunk@205 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib/netlib.cpp')
-rw-r--r-- | src/modules/netlib/netlib.cpp | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index 000639474f..7cd39b1d7a 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -242,9 +242,11 @@ void NetlibDoClose(NetlibConnection *nlc, bool noShutdown) INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
{
- switch(GetNetlibHandleType(wParam)) {
+ switch(GetNetlibHandleType(wParam))
+ {
case NLH_USER:
- { struct NetlibUser *nlu=(struct NetlibUser*)wParam;
+ {
+ struct NetlibUser *nlu=(struct NetlibUser*)wParam;
int i;
EnterCriticalSection(&csNetlibUser);
@@ -323,21 +325,24 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM) static INT_PTR NetlibGetSocket(WPARAM wParam, LPARAM)
{
SOCKET s;
- if(wParam==0) {
- s=INVALID_SOCKET;
+ if (wParam == 0)
+ {
+ s = INVALID_SOCKET;
SetLastError(ERROR_INVALID_PARAMETER);
}
- else {
+ else
+ {
WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
- switch(GetNetlibHandleType(wParam)) {
+ switch (GetNetlibHandleType(wParam))
+ {
case NLH_CONNECTION:
- s=((struct NetlibConnection*)wParam)->s;
+ s = ((struct NetlibConnection*)wParam)->s;
break;
case NLH_BOUNDPORT:
- s=((struct NetlibBoundPort*)wParam)->s;
+ s = ((struct NetlibBoundPort*)wParam)->s;
break;
default:
- s=INVALID_SOCKET;
+ s = INVALID_SOCKET;
SetLastError(ERROR_INVALID_PARAMETER);
break;
}
@@ -346,6 +351,35 @@ static INT_PTR NetlibGetSocket(WPARAM wParam, LPARAM) return s;
}
+INT_PTR NetlibStringToAddressSrv(WPARAM wParam, LPARAM lParam)
+{
+ return (INT_PTR)!NetlibStringToAddress((char*)wParam, (SOCKADDR_INET_M*)lParam);
+}
+
+INT_PTR NetlibAddressToStringSrv(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam)
+ {
+ SOCKADDR_INET_M iaddr = {0};
+ iaddr.Ipv4.sin_family = AF_INET;
+ iaddr.Ipv4.sin_addr.s_addr = htonl((unsigned)lParam);
+ return (INT_PTR)NetlibAddressToString(&iaddr);
+ }
+ else
+ return (INT_PTR)NetlibAddressToString((SOCKADDR_INET_M*)lParam);
+}
+
+INT_PTR NetlibGetConnectionInfoSrv(WPARAM wParam, LPARAM lParam)
+{
+ NetlibGetConnectionInfo((NetlibConnection*)wParam, (NETLIBCONNINFO*)lParam);
+ return 0;
+}
+
+INT_PTR NetlibGetMyIp(WPARAM wParam, LPARAM)
+{
+ return (INT_PTR)GetMyIp((unsigned)wParam);
+}
+
INT_PTR NetlibShutdown(WPARAM wParam, LPARAM)
{
if (wParam)
@@ -623,6 +657,10 @@ int LoadNetlibModule(void) CreateServiceFunction(MS_NETLIB_GETMOREPACKETS,NetlibPacketRecverGetMore);
CreateServiceFunction(MS_NETLIB_SETPOLLINGTIMEOUT,NetlibHttpSetPollingTimeout);
CreateServiceFunction(MS_NETLIB_STARTSSL,NetlibStartSsl);
+ CreateServiceFunction(MS_NETLIB_STARINGTOADDRESS,NetlibStringToAddressSrv);
+ CreateServiceFunction(MS_NETLIB_ADDRESSTOSTRING,NetlibAddressToStringSrv);
+ CreateServiceFunction(MS_NETLIB_GETCONNECTIONINFO,NetlibGetConnectionInfoSrv);
+ CreateServiceFunction(MS_NETLIB_GETMYIP,NetlibGetMyIp);
hRecvEvent = CreateHookableEvent(ME_NETLIB_FASTRECV);
hSendEvent = CreateHookableEvent(ME_NETLIB_FASTSEND);
|