summaryrefslogtreecommitdiffstats
path: root/client/windows
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2009-10-16 00:21:43 +0200
committerYaniv Kamay <ykamay@redhat.com>2009-10-18 17:42:37 +0200
commitef213c66c19d265140e9a55519b174d34ff1f16b (patch)
tree0a8e58217f5757881d4d4798d1316dbb3809f37a /client/windows
parent308e4545cbf8d26d5d47ad6ab9f2c6e6e6648003 (diff)
tunnel
Diffstat (limited to 'client/windows')
-rw-r--r--client/windows/platform_utils.cpp17
-rw-r--r--client/windows/platform_utils.h22
-rw-r--r--client/windows/redc.vcproj16
3 files changed, 49 insertions, 6 deletions
diff --git a/client/windows/platform_utils.cpp b/client/windows/platform_utils.cpp
index 6b9049a0..9b809c87 100644
--- a/client/windows/platform_utils.cpp
+++ b/client/windows/platform_utils.cpp
@@ -90,7 +90,7 @@ HBITMAP get_alpha_bitmap_res(int id)
AutoDC auto_dc(create_compatible_dc());
BITMAPINFO dest_info;
- uint8_t *dest;
+ uint8_t* dest;
dest_info.bmiHeader.biSize = sizeof(dest_info.bmiHeader);
dest_info.bmiHeader.biWidth = src_info.bmWidth;
dest_info.bmiHeader.biHeight = -src_info.bmHeight;
@@ -102,7 +102,7 @@ HBITMAP get_alpha_bitmap_res(int id)
dest_info.bmiHeader.biClrUsed = 0;
dest_info.bmiHeader.biClrImportant = 0;
- HBITMAP ret = CreateDIBSection(auto_dc.get(), &dest_info, 0, (VOID **)&dest, NULL, 0);
+ HBITMAP ret = CreateDIBSection(auto_dc.get(), &dest_info, 0, (VOID**)&dest, NULL, 0);
if (!ret) {
THROW("create bitmap failed, %u", GetLastError());
}
@@ -139,7 +139,7 @@ const char* sys_err_to_str(int error)
msg = new char[BUF_SIZE];
_snprintf(msg, BUF_SIZE, "errno %d", error);
} else {
- char *new_line;
+ char* new_line;
if ((new_line = strrchr(msg, '\r'))) {
*new_line = 0;
}
@@ -149,3 +149,14 @@ const char* sys_err_to_str(int error)
return errors_map[error];
}
+int inet_aton(const char* ip, struct in_addr* in_addr)
+{
+ unsigned long addr = inet_addr(ip);
+
+ if (addr == INADDR_NONE) {
+ return 0;
+ }
+ in_addr->S_un.S_addr = addr;
+ return 1;
+}
+
diff --git a/client/windows/platform_utils.h b/client/windows/platform_utils.h
index 95b04fcb..299f70b1 100644
--- a/client/windows/platform_utils.h
+++ b/client/windows/platform_utils.h
@@ -18,13 +18,17 @@
#ifndef _H_PLATFORM_UTILS
#define _H_PLATFORM_UTILS
+#include <winsock.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+
#define mb() __asm {lock add [esp], 0}
template<class T, class FreeRes = FreeObject<T>, T invalid = NULL >
class AutoRes {
public:
- AutoRes() : res (invalid) {}
- AutoRes(T inRes) : res (inRes) {}
+ AutoRes() : res(invalid) {}
+ AutoRes(T inRes) : res(inRes) {}
~AutoRes() { set(invalid); }
void set(T inRes) {if (res != invalid) free_res(res); res = inRes; }
@@ -67,7 +71,7 @@ HBITMAP get_alpha_bitmap_res(int id);
class WindowDC {
public:
- WindowDC(HWND window) : _window (window), _dc (GetDC(window)) {}
+ WindowDC(HWND window): _window (window), _dc (GetDC(window)) {}
~WindowDC() { ReleaseDC(_window, _dc);}
HDC operator * () { return _dc;}
@@ -80,5 +84,17 @@ typedef AutoRes<HDC, Delete_DC> AutoReleaseDC;
const char* sys_err_to_str(int error);
+#define SHUT_WR SD_SEND
+#define SHUT_RD SD_RECEIVE
+#define SHUT_RDWR SD_BOTH
+#define MSG_NOSIGNAL 0
+
+#define SHUTDOWN_ERR WSAESHUTDOWN
+#define INTERRUPTED_ERR WSAEINTR
+#define WOULDBLOCK_ERR WSAEWOULDBLOCK
+#define sock_error() WSAGetLastError()
+#define sock_err_message(err) sys_err_to_str(err)
+int inet_aton(const char* ip, struct in_addr* in_addr);
+
#endif
diff --git a/client/windows/redc.vcproj b/client/windows/redc.vcproj
index 25ff3259..90d235ca 100644
--- a/client/windows/redc.vcproj
+++ b/client/windows/redc.vcproj
@@ -205,6 +205,10 @@
>
</File>
<File
+ RelativePath="..\client_net_socket.cpp"
+ >
+ </File>
+ <File
RelativePath="..\cmd_line_parser.cpp"
>
</File>
@@ -379,6 +383,10 @@
>
</File>
<File
+ RelativePath="..\tunnel_channel.cpp"
+ >
+ </File>
+ <File
RelativePath="..\utils.cpp"
>
</File>
@@ -405,6 +413,10 @@
>
</File>
<File
+ RelativePath="..\client_net_socket.h"
+ >
+ </File>
+ <File
RelativePath="..\common.h"
>
</File>
@@ -557,6 +569,10 @@
>
</File>
<File
+ RelativePath="..\tunnel_channel.h"
+ >
+ </File>
+ <File
RelativePath="..\utils.h"
>
</File>