Debian Codegraph @

3rdparty/iaxclient/lib/libiax2/src/winpoop.h

raw symbols SCIP
1 /*
2 * Functions Windows doesn't have... but should
3 * Copyright(C) 2001, Linux Support Services, Inc.
4 *
5 * Distributed under GNU LGPL.
6 *
7 * These are NOT fully compliant with BSD 4.3 and are not
8 * threadsafe.
9 *
10 */
11
12 #ifndef _winpoop_h
13 #define _winpoop_h
14
15 #if defined(_MSC_VER)
16 #define INLINE __inline
17 #define inline __inline
18
19 #if _MSC_VER < 1900
20 #define snprintf _snprintf
21 #endif
22
23 // should try without these
24 #pragma warning(disable: 4996 4244 4305 4018 4804)
25 #if defined(_WIN64)
26 typedef __int64 ssize_t;
27 #elif defined(_WIN32)
28 typedef __int32 ssize_t;
29 #endif
30 #else
31 #define INLINE inline
32 #endif
33
34 #include <winsock2.h> // this include <windows.h>
35 #include <io.h> // for open, close, write, read
36 #include <stdio.h>
37
38 void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz);
39
40 static INLINE int inet_aton(char *cp, struct in_addr *inp)
41 {
42 int a1, a2, a3, a4;
43 unsigned int saddr;
44
45 if (sscanf(cp, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4)
46 return 0;
47 a1 &= 0xff;
48 a2 &= 0xff;
49 a3 &= 0xff;
50 a4 &= 0xff;
51 saddr = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4;
52 inp->s_addr = htonl(saddr);
53 return 1;
54 }
55
56 #endif