VSM C++ SDK
Vehicle Specific Modules SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
android-linux/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 __unix__
12 #error "This header should be included only in linux build."
13 #endif
14 
15 #ifndef PLATFORM_SOCKETS_H_
16 #define PLATFORM_SOCKETS_H_
17 
18 #include <sys/select.h> // Android build needs this. Others include it implicitly.
19 #include <linux/stat.h> // Android build needs this. Others include it implicitly.
20 #include <sys/socket.h>
21 #include <arpa/inet.h> // inet_ntoa
22 #include <netdb.h> // addrinfo
23 
24 #define INVALID_SOCKET (-1)
25 #define SOCKET_ERROR (-1)
26 
27 namespace ugcs
28 {
29 namespace vsm
30 {
31 namespace sockets
32 {
33 // Linux specific socket handle
34 typedef int Socket_handle;
35 
36 // Linux uses MSG_NOSIGNAL to avoid SIGPIPE generation on send().
37 #ifdef MSG_NOSIGNAL
38 const int SEND_FLAGS = MSG_NOSIGNAL;
39 #else
40 const int SEND_FLAGS = 0;
41 #warning "SIGPIPE can get generated by send/write calls"
42 #endif
43 
44 }
45 }
46 }
47 
48 #endif /* PLATFORM_SOCKETS_H_ */