diff options
Diffstat (limited to 'protocols/Xfire/src/Xfire_proxy.cpp')
-rw-r--r-- | protocols/Xfire/src/Xfire_proxy.cpp | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/protocols/Xfire/src/Xfire_proxy.cpp b/protocols/Xfire/src/Xfire_proxy.cpp deleted file mode 100644 index 8171ec5522..0000000000 --- a/protocols/Xfire/src/Xfire_proxy.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "stdafx.h"
-
-#include "Xfire_proxy.h"
-
-extern HANDLE hNetlib;
-HANDLE hBindPort = NULL;
-HANDLE netlibcon = NULL;
-
-void FromServerToClient(LPVOID lParam)
-{
- char buf[1024] = { 0 };
-
- HANDLE hConnection = (HANDLE)lParam;
- do {
- if (!hBindPort) return;
-
- int cbRead = Netlib_Recv(netlibcon, buf, sizeof(buf), 0);
- if (cbRead == SOCKET_ERROR)
- break;
-
- if (cbRead) {
- Netlib_Send(hConnection, buf, cbRead, 0);
- }
- } while (1);
-}
-
-//xfireclient baut verbindung auf
-void XfireclientConnecting(HANDLE hConnection, DWORD, void*)
-{
- char buf[1024] = { 0 };
-
- //verbindung zum richtigen xfire server aufbauen
- NETLIBOPENCONNECTION ncon = { 0 };
- ncon.cbSize = sizeof(ncon);
- ncon.szHost = "206.220.42.147";
- ncon.wPort = (WORD)atol("25999");
- ncon.timeout = 5;
- netlibcon = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlib, (LPARAM)& ncon);
-
- if (!netlibcon) {
- Netlib_CloseHandle(hConnection);
- }
-
- mir_forkthread(FromServerToClient, (LPVOID)hConnection);
-
- //schleife behandelt empfangende daten
- do {
- int cbRead = Netlib_Recv(hConnection, buf, sizeof(buf), 0);
- if (cbRead == SOCKET_ERROR) {
- Netlib_CloseHandle(hConnection);
- Netlib_CloseHandle(netlibcon);
- break;
- }
-
- if (cbRead) {
- if (!Netlib_Send(netlibcon, buf, cbRead, 0)) {
- Netlib_CloseHandle(hConnection);
- Netlib_CloseHandle(netlibcon);
- break;
- }
- }
- } while (1);
-}
-
-//inits nachdem alle module geladen wurden
-int AfterSystemModulesLoaded(WPARAM, LPARAM)
-{
- //init netlib handle
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_INCOMING;
- nlu.szSettingsModule = protocolname;
- nlu.szDescriptiveName = "XFire server connection";
- hNetlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)& nlu);
-
- //init socket server
- NETLIBBIND nb = { sizeof(nb) };
- nb.pfnNewConnectionV2 = XfireclientConnecting;
- nb.wPort = 25999;
- hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlib, (LPARAM)&nb);
- return 0;
-}
-
-int initXfireProxy()
-{
- //inits nach dem alle module geladen wurden
- HookEvent(ME_SYSTEM_MODULESLOADED, AfterSystemModulesLoaded);
- return 0;
-}
|