Blame view

ext_dep/libvncserver/libvncserver-master/common/sockets.h 1.61 KB
8d728d065   신재종   add libvncserver ...
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
63
64
65
66
  /*
   *  LibVNCServer/LibVNCClient common platform socket defines and includes.
   *
   *  Copyright (C) 2020 Christian Beier <dontmind@freeshell.org>
   *
   *  This is free software; you can redistribute it and/or modify
   *  it under the terms of the GNU General Public License as published by
   *  the Free Software Foundation; either version 2 of the License, or
   *  (at your option) any later version.
   *
   *  This software is distributed in the hope that it will be useful,
   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *  GNU General Public License for more details.
   *
   *  You should have received a copy of the GNU General Public License
   *  along with this software; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
   *  USA.
   */
  
  #ifndef _RFB_COMMON_SOCKETS_H
  #define _RFB_COMMON_SOCKETS_H
  
  #ifdef WIN32
  /*
    Windows sockets
   */
  #include <winsock2.h>
  #include <ws2tcpip.h>
  
  #undef EWOULDBLOCK
  #define EWOULDBLOCK WSAEWOULDBLOCK
  
  #undef ETIMEDOUT
  #define ETIMEDOUT WSAETIMEDOUT
  
  #undef EINTR
  #define EINTR WSAEINTR
  
  #undef EINVAL
  #define EINVAL WSAEINVAL
  
  /* MinGW has those, but MSVC not */
  #ifdef _MSC_VER
  #define SHUT_RD   SD_RECEIVE
  #define SHUT_WR   SD_SEND
  #define SHUT_RDWR SD_BOTH
  #endif
  
  #define read(sock,buf,len) recv(sock,buf,len,0)
  #define write(sock,buf,len) send(sock,buf,len,0)
  
  #else
  /*
    Unix sockets
   */
  #include <sys/socket.h>
  #include <sys/un.h>
  #include <netinet/in.h>
  #include <arpa/inet.h>
  #include <netinet/tcp.h>
  #include <netdb.h>
  #endif
  
  #endif /* _RFB_COMMON_SOCKETS_H */