1/* $Id: miniupnpc_socketdef.h,v 1.1 2018/03/13 23:44:10 nanard Exp $ */
2/* Miniupnp project : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
3 * Author : Thomas Bernard
4 * Copyright (c) 2018 Thomas Bernard
5 * This software is subject to the conditions detailed in the
6 * LICENCE file provided within this distribution */
7#ifndef MINIUPNPC_SOCKETDEF_H_INCLUDED
8#define MINIUPNPC_SOCKETDEF_H_INCLUDED
9
10#ifdef _WIN32
11
12#define ISINVALID(s) (INVALID_SOCKET==(s))
13
14#else
15
16#ifndef SOCKET
17#define SOCKET int
18#endif
19#ifndef SSIZE_T
20#define SSIZE_T ssize_t
21#endif
22#ifndef INVALID_SOCKET
23#define INVALID_SOCKET (-1)
24#endif
25#ifndef ISINVALID
26#define ISINVALID(s) ((s)<0)
27#endif
28
29#endif
30
31#ifdef _MSC_VER
32#define MSC_CAST_INT (int)
33#else
34#define MSC_CAST_INT
35#endif
36
37/* definition of PRINT_SOCKET_ERROR */
38#ifdef _WIN32
39#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
40#else
41#define PRINT_SOCKET_ERROR(x) perror(x)
42#endif
43
44#endif /* MINIUPNPC_SOCKETDEF_H_INCLUDED */
45