* SOFTWARE.
*/
+#include <stdbool.h>
+
#ifdef __MINGW32__
#include <winsock2.h>
#define BT_SOCKET SOCKET
static inline
-int bt_socket_init(void)
+int bt_socket_init(int log_level)
{
WORD verreq;
WSADATA wsa;
ret = WSAStartup(verreq, &wsa);
if (ret != 0) {
-#ifdef BT_LOGE
- BT_LOGE("Winsock init failed with error: %d", ret);
+#ifdef BT_LOG_WRITE_CUR_LVL
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ "Winsock init failed with error: %d", ret);
#endif
goto end;
}
if (LOBYTE(wsa.wVersion) != 2 || HIBYTE(wsa.wVersion) != 2) {
-#ifdef BT_LOGE_STR
- BT_LOGE_STR("Could not init winsock 2.2 support");
+#ifdef BT_LOG_WRITE_CUR_LVL
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ "Could not init winsock 2.2 support");
#endif
WSACleanup();
ret = -1;
#else /* __MINGW32__ */
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+#include <errno.h>
#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include <glib.h>
#define BT_INVALID_SOCKET -1
#define BT_SOCKET_ERROR -1
#define BT_SOCKET int
static inline
-int bt_socket_init(void)
+int bt_socket_init(int log_level)
{
return 0;
}