Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.7 KiB

  1. //====== Copyright 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef NET_WS_HEADERS_H
  7. #define NET_WS_HEADERS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #ifdef _WIN32
  12. #if !defined( _X360 )
  13. #include "winlite.h"
  14. #endif
  15. #endif
  16. #include "vstdlib/random.h"
  17. #include "convar.h"
  18. #include "tier0/icommandline.h"
  19. #include "filesystem_engine.h"
  20. #include "proto_oob.h"
  21. #include "net_chan.h"
  22. #include "inetmsghandler.h"
  23. #include "protocol.h" // CONNECTIONLESS_HEADER
  24. #include "sv_filter.h"
  25. #include "sys.h"
  26. #include "tier0/tslist.h"
  27. #include "tier1/mempool.h"
  28. #include "../utils/bzip2/bzlib.h"
  29. #if defined(_WIN32)
  30. #if !defined( _X360 )
  31. #include <winsock2.h>
  32. #else
  33. #include "winsockx.h"
  34. #endif
  35. // #include <process.h>
  36. typedef int socklen_t;
  37. #elif defined POSIX
  38. #include <unistd.h>
  39. #include <sys/socket.h>
  40. #include <netinet/in.h>
  41. #include <arpa/inet.h>
  42. #include <netinet/tcp.h>
  43. #include <netdb.h>
  44. #ifdef _PS3
  45. #include <netex/errno.h>
  46. #include <netex/net.h>
  47. #include <netex/libnetctl.h>
  48. #include <sys/time.h>
  49. #include <sys/select.h>
  50. #define PF_INET AF_INET
  51. #define WSA_SOCKET_ERROR_CODE_FIXUP( ecode ) SYS_NET_##ecode
  52. #define select socketselect
  53. #define WSAGetLastError() sys_net_errno
  54. #else
  55. #include <sys/param.h>
  56. #include <sys/ioctl.h>
  57. #include <sys/uio.h>
  58. #define WSA_SOCKET_ERROR_CODE_FIXUP( ecode ) ecode
  59. #define WSAGetLastError() errno
  60. #endif
  61. #include <errno.h>
  62. #include <string.h>
  63. #include <stdlib.h>
  64. #ifdef WSA_SOCKET_ERROR_CODE_FIXUP
  65. #define WSAEWOULDBLOCK WSA_SOCKET_ERROR_CODE_FIXUP( EWOULDBLOCK )
  66. #define WSAEMSGSIZE WSA_SOCKET_ERROR_CODE_FIXUP( EMSGSIZE )
  67. #define WSAEADDRNOTAVAIL WSA_SOCKET_ERROR_CODE_FIXUP( EADDRNOTAVAIL )
  68. #define WSAEAFNOSUPPORT WSA_SOCKET_ERROR_CODE_FIXUP( EAFNOSUPPORT )
  69. #define WSAECONNRESET WSA_SOCKET_ERROR_CODE_FIXUP( ECONNRESET )
  70. #define WSAECONNREFUSED WSA_SOCKET_ERROR_CODE_FIXUP( ECONNREFUSED )
  71. #define WSAEADDRINUSE WSA_SOCKET_ERROR_CODE_FIXUP( EADDRINUSE )
  72. #define WSAENOTCONN WSA_SOCKET_ERROR_CODE_FIXUP( ENOTCONN )
  73. #endif
  74. #define ioctlsocket ioctl
  75. #define closesocket close
  76. #undef SOCKET
  77. typedef int SOCKET;
  78. #define FAR
  79. #ifdef _PS3
  80. #define ioctl( s, cmd, pVal ) setsockopt( s, SOL_SOCKET, cmd, pVal, sizeof( *( pVal ) ) )
  81. #define FIONBIO SO_NBIO
  82. #endif
  83. #endif
  84. #include "sv_rcon.h"
  85. #ifndef DEDICATED
  86. #include "cl_rcon.h"
  87. #endif
  88. #if defined( _X360 )
  89. #include "xbox/xbox_win32stubs.h"
  90. #endif
  91. void Con_RunFrame( void ); // call to handle socket updates, etc.
  92. #ifdef _PS3
  93. //#define ONLY_USE_STEAM_SOCKETS 1
  94. #endif
  95. #ifdef ONLY_USE_STEAM_SOCKETS
  96. #define OnlyUseSteamSockets() true
  97. #else
  98. #define OnlyUseSteamSockets() false
  99. #endif
  100. #endif // NET_WS_HEADERS_H