VSM C++ SDK
Vehicle Specific Modules SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
win/ugcs/vsm/platform_sockets.h
1 // Copyright (c) 2018, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
5 /*
6  * platform_sockets.h
7  *
8  * Defines platform specific parts of socket implementation.
9  */
10 
11 #ifndef _WIN32
12 #error "This header should be included only in Windows build."
13 #endif
14 
15 #ifndef PLATFORM_SOCKETS_H_
16 #define PLATFORM_SOCKETS_H_
17 
18 // default value for FD_SETSIZE in winsock is 64.
19 // it's too small if we are oprating large fleets.
20 #define FD_SETSIZE 1024
21 
22 // Windows specific headers for socket stuff
23 #include <winsock2.h>
24 #include <ws2tcpip.h> // for socklen_t
25 /* Some weird code can define these macros in Windows headers. */
26 #ifdef ERROR
27 #undef ERROR
28 #endif
29 #ifdef interface
30 #undef interface
31 #endif
32 #ifdef RELATIVE
33 #undef RELATIVE
34 #endif
35 #ifdef ABSOLUTE
36 #undef ABSOLUTE
37 #endif
38 
39 
40 namespace ugcs
41 {
42 namespace vsm
43 {
44 namespace sockets
45 {
46 
47 // Windows specific socket handle
48 typedef SOCKET Socket_handle; /* Win */
49 
50 // Only linux build sets SEND_FLAGS to nonzero.
51 const int SEND_FLAGS = 0;
52 
53 }// namespace platform
54 }
55 }
56 
57 #endif /* PLATFORM_SOCKETS_H_ */