File: UpnpInet.h

package info (click to toggle)
pupnp 1%3A1.14.20-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,440 kB
  • sloc: ansic: 34,488; xml: 1,173; cpp: 573; makefile: 341; sh: 130; python: 51; javascript: 7
file content (62 lines) | stat: -rw-r--r-- 1,339 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
#ifndef UPNPINET_H
#define UPNPINET_H

/*!
 * \addtogroup Sock
 *
 * @{
 *
 * \file
 *
 * \brief Provides a platform independent way to include TCP/IP types and
 * functions.
 */

#include "UpnpUniStd.h" /* for close() */

#ifdef _WIN32
	#include <stdarg.h>
	#include <winsock2.h>
	#include <ws2tcpip.h>

	#define UpnpCloseSocket closesocket

	#if (_WIN32_WINNT < 0x0600)
typedef short sa_family_t;
	#else
typedef ADDRESS_FAMILY sa_family_t;
	#endif

#else /* _WIN32 */
	#include <sys/param.h>
	#if defined(__sun)
		#include <fcntl.h>
		#include <sys/sockio.h>
	#elif (defined(BSD) && BSD >= 199306) || defined(__FreeBSD_kernel__)
		#include <ifaddrs.h>
		/* Do not move or remove the include below for "sys/socket"!
		 * Will break FreeBSD builds. */
		#include <sys/socket.h>
	#endif
	#include <arpa/inet.h> /* for inet_pton() */
	#include <net/if.h>
	#include <netinet/in.h>

/*! This typedef makes the code slightly more WIN32 tolerant.
 * On WIN32 systems, SOCKET is unsigned and is not a file
 * descriptor. */
typedef int SOCKET;

	/*! INVALID_SOCKET is unsigned on win32. */
	#define INVALID_SOCKET (-1)

	/*! select() returns SOCKET_ERROR on win32. */
	#define SOCKET_ERROR (-1)

	/*! Alias to close() to make code more WIN32 tolerant. */
	#define UpnpCloseSocket close
#endif /* _WIN32 */

/* @} Sock */

#endif /* UPNPINET_H */