blob: b5e56665ca7217f70dd1b7ffc5746813b5f0ebdf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include "disgrace.h"
#if defined(OS_WINDOWS)
#include <winsock2.h>
#include <windows.h>
#if defined(MSVC_COMPILER)
#pragma comment(lib, "Ws2_32.lib")
#endif
enum {
D_TYPE_TCP,
D_TYPE_UDP
};
typedef struct DHandle {
u64 type;
} DHandle;
b32 d_init(void) {
WSADATA data;
int error;
if (WSAStartup(MAKEWORD(2, 2), &data)) {
error = WSAGetLastError();
cyn_log_write_cstring(CYN_LOG_ERROR, (u8*) "WsaStartup failed, code: %d.", (s64)error);
return false;
}
return true;
}
#include "d_tcp_win.c"
#include "d_udp_win.c"
#elif defined(OS_LINUX)
b32 d_init(void) {
return true;
}
// #error "Linux todo"
// #include "d_udp_linux.c"
#else
#error "unknown platform"
#endif
|