Rudiments
|
00001 // Copyright (c) 2011 David Muse 00002 // See the COPYING file for more information. 00003 00004 #ifndef RUDIMENTS_WINSOCK_H 00005 #define RUDIMENTS_WINSOCK_H 00006 00007 #include <rudiments/private/config.h> 00008 00009 #ifdef RUDIMENTS_HAVE_WINSOCK2_H 00010 #include <rudiments/mutex.h> 00011 #include <winsock2.h> 00012 #endif 00013 00014 // must be included after winsock2.h 00015 #ifdef RUDIMENTS_HAVE_WINDOWS_H 00016 #include <windows.h> 00017 #endif 00018 00019 #ifdef RUDIMENTS_NAMESPACE 00020 namespace rudiments { 00021 #endif 00022 00023 class winsock { 00024 public: 00025 static bool initWinsock(); 00026 static void shutDownWinsock(); 00027 private: 00028 #ifdef RUDIMENTS_HAVE_WINSOCK2_H 00029 static bool _initialized; 00030 static mutex _winsockmutex; 00031 static WSADATA _wsadata; 00032 #endif 00033 }; 00034 00035 #ifdef RUDIMENTS_NAMESPACE 00036 } 00037 #endif 00038 00039 #endif