38static const WCHAR wszClassName[] = {
'T',
'h',
'o',
'r',
'C',
'o',
'n',
'n',
'W',
'n',
'd',
'C',
'l',
'a',
's',
's',0};
40#define IX_READ (WM_USER + 0)
41#define IX_READLINE (WM_USER + 1)
42#define IX_WRITE (WM_USER + 2)
58 return IXP_E_NOT_CONNECTED;
60 *pInetServer =
This->ServerInfo;
67 FIXME(
"(%p, %p): stub\n", pAccount, pInetServer);
72 LPINETSERVER pInetServer,
boolean fAuthenticate,
boolean fCommandLogging)
81 return IXP_E_ALREADY_CONNECTED;
83 This->ServerInfo = *pInetServer;
84 This->fCommandLogging = fCommandLogging;
86 This->hwnd =
CreateWindowW(
wszClassName,
wszClassName, 0, 0, 0, 0, 0,
NULL,
NULL,
NULL, 0);
100 snprintf(szPort,
sizeof(szPort),
"%d", (
unsigned short)pInetServer->
dwPort);
107 ERR(
"getaddrinfo failed: %d\n",
ret);
108 return IXP_E_CANT_FIND_HOST;
111 for (ai_cur = ai; ai_cur; ai_cur = ai->
ai_next)
120 host,
sizeof(
host), service,
sizeof(service),
130 WARN(
"socket() failed\n");
139 WARN(
"connect() failed\n");
148 TRACE(
"connected\n");
154 return IXP_E_CANT_FIND_HOST;
159 if (!
This->pCallback)
162 ITransportCallback_Release(
This->pCallback);
171 return IXP_E_NOT_CONNECTED;
188 *pCurrentStatus =
This->Status;
196 ITransportCallback_OnStatus(
This->pCallback,
Status,
205 return IXP_E_NOT_CONNECTED;
207 if (
This->fnCompletion)
210 This->fnCompletion = fnCompletion;
212 This->cbBuffer = 1024;
214 This->iCurrentBufferOffset = 0;
230 return IXP_E_NOT_CONNECTED;
232 if (
This->fnCompletion)
252 return IXP_E_NOT_CONNECTED;
254 if (
This->fnCompletion)
257 if (
This->pCallback &&
This->fCommandLogging)
259 ITransportCallback_OnCommand(
This->pCallback, CMD_SEND, (
LPSTR)pszCommand, 0,
272 if (!
This->fnCompletion)
275 while (
This->iCurrentBufferOffset <
This->cbBuffer)
277 if (
recv(
This->Socket, &
This->pBuffer[
This->iCurrentBufferOffset], 1, 0) <= 0)
286 This->iCurrentBufferOffset++;
288 if (
This->iCurrentBufferOffset ==
This->cbBuffer)
297 This->iCurrentBufferOffset);
314 if (!
This->fnCompletion)
317 while (
This->iCurrentBufferOffset <
This->cbBuffer - 1)
321 if (
recv(
This->Socket, &
This->pBuffer[
This->iCurrentBufferOffset], 1, 0) <= 0)
331 if (
This->pBuffer[
This->iCurrentBufferOffset] ==
'\n')
337 This->pBuffer[
This->iCurrentBufferOffset++] =
'\0';
342 This->iCurrentBufferOffset);
347 if (
This->pBuffer[
This->iCurrentBufferOffset] !=
'\r')
348 This->iCurrentBufferOffset++;
353 if (
This->iCurrentBufferOffset ==
This->cbBuffer - 1)
375 memset(&cls, 0,
sizeof(cls));
ACPI_SIZE strlen(const char *String)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define HeapFree(x, y, z)
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
INT WSAAPI WSAAsyncSelect(IN SOCKET s, IN HWND hWnd, IN UINT wMsg, IN LONG lEvent)
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
enum tagIXPSTATUS IXPSTATUS
void(* INETXPORT_COMPLETION_FUNCTION)(IInternetTransport *, char *, int)
HRESULT InternetTransport_Connect(InternetTransport *This, LPINETSERVER pInetServer, boolean fAuthenticate, boolean fCommandLogging)
static LRESULT CALLBACK InternetTransport_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT InternetTransport_Write(InternetTransport *This, const char *pvData, int cbSize, INETXPORT_COMPLETION_FUNCTION fnCompletion)
HRESULT InternetTransport_Init(InternetTransport *This)
HRESULT InternetTransport_ChangeStatus(InternetTransport *This, IXPSTATUS Status)
HRESULT InternetTransport_DoCommand(InternetTransport *This, LPCSTR pszCommand, INETXPORT_COMPLETION_FUNCTION fnCompletion)
void InternetTransport_UnregisterClass(HINSTANCE hInstance)
HRESULT InternetTransport_GetServerInfo(InternetTransport *This, LPINETSERVER pInetServer)
HRESULT InternetTransport_InetServerFromAccount(InternetTransport *This, IImnAccount *pAccount, LPINETSERVER pInetServer)
HRESULT InternetTransport_ReadLine(InternetTransport *This, INETXPORT_COMPLETION_FUNCTION fnCompletion)
BOOL InternetTransport_RegisterClass(HINSTANCE hInstance)
static const WCHAR wszClassName[]
HRESULT InternetTransport_DropConnection(InternetTransport *This)
HRESULT InternetTransport_HandsOffCallback(InternetTransport *This)
HRESULT InternetTransport_GetStatus(InternetTransport *This, IXPSTATUS *pCurrentStatus)
namespace GUID const ADDRINFOEXW * hints
INT WSAAPI shutdown(IN SOCKET s, IN INT how)
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
CHAR szServerName[CCHMAX_SERVER_NAME]
struct sockaddr * ai_addr
struct addrinfo * ai_next
DWORD WINAPI GetLastError(void)
_In_ ULONG _In_opt_ PVOID pvData
#define HRESULT_FROM_WIN32(x)
int PASCAL FAR WSAGetLastError(void)
int PASCAL FAR WSACleanup(void)
#define GetWindowLongPtrW
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
#define SetWindowLongPtrW
BOOL WINAPI DestroyWindow(_In_ HWND)