chiark / gitweb /
Concentrate knowledge about the `pcre' API in one place.
[disorder] / lib / disorder-win32.h
CommitLineData
9e42afcd
RK
1/*
2 * This file is part of DisOrder.
3 * Copyright (C) 2013 Richard Kettlewell
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18/** @file lib/disorder-win32.h
19 * @brief Windows support
20 */
21#ifndef DISORDER_WIN32_H
22# define DISORDER_WIN32_H
23
24#define HAVE_WS2TCPIP_H 1
25#define HAVE_SHLOBJ_H 1
26#define HAVE_BCRYPT_H 1
27#define HAVE_CLOSESOCKET 1
28
29#include <WinSock2.h>
30#include <io.h>
31
32#define access _access /* quieten compiler */
33
34#include <time.h>
35
36#define attribute(x) /* nothing */
37#define declspec(x) __declspec(x)
38#define inline __inline
39#define DEFAULT_SOX_GENERATION 1
40#define F_OK 0
41#define W_OK 2
42#define R_OK 4
43#define LOG_EMERG 0
44#define LOG_ALERT 1
45#define LOG_CRIT 2
46#define LOG_ERR 3
47#define LOG_WARNING 4
48#define LOG_NOTICE 5
49#define LOG_INFO 6
50#define LOG_DEBUG 7
51#define S_ISREG(mode) ((mode) & _S_IFREG)
52#define S_ISDIR(mode) ((mode) & _S_IFDIR)
53#define strcasecmp _stricmp
54
55#ifdef _WIN64
56typedef long long ssize_t;
57#else
58typedef long ssize_t;
59#endif
60typedef int socklen_t;
61typedef long long int64_t;
62typedef unsigned long long uint64_t;
63typedef int pid_t;
64
65struct timezone;
66
67int gettimeofday(struct timeval *tv, struct timezone *tz);
68char *win_wtomb(const wchar_t *ws);
69void network_init(void);
70
71#define socket_error() (WSAGetLastError())
72#define system_error() (GetLastError())
73
74#pragma comment(lib, "Ws2_32.lib")
75
76#endif