sockhdr.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* sockhdr.h Copyright (C) 1997 Codemist Ltd */
  2. /*
  3. * pull in headers suitable for socket-related code.
  4. */
  5. /* Signature: 07f55060 06-Sep-1997 */
  6. #ifdef __WATCOMC__
  7. /*
  8. * Use of Watcom C++: please compile in Windows NT/95 mode.
  9. * wcl386 -bt=nt webget.c
  10. */
  11. # include <conio.h>
  12. # define ms_windows 1
  13. #endif
  14. #ifdef _MSC_VER
  15. /*
  16. * Use of Microsoft Visual C++ version 5.0
  17. */
  18. # define ms_windows 1
  19. #endif
  20. #ifdef GCC386
  21. /*
  22. * At present GCC for DOS (the D J Delorie port) does not seem to have
  23. * socket support in its libraries (very reasonably) so I can not support
  24. * this code with it. But I want to be able to compile this file as part of
  25. * larger programs, so I can arrange to build a dummy version that always
  26. * reports failure to access any net resources!
  27. */
  28. # define NOT_SUPPORTED 1
  29. typedef int SOCKET;
  30. #else
  31. #ifdef GCCWIN
  32. /*
  33. * Use of Cygnus GCC for Win32. I have not yet managed to make this work
  34. * since both the Windows API headers and the relevant library stubs are
  35. * still in the process of emerging (Nov 1996), but it seems probable that
  36. * sometime during 1997 this will become a viable possibility, and anybody
  37. * who is keen to experiment is encouaged to do so (and report their
  38. * experiences back to me).
  39. */
  40. # define ms_windows 1
  41. #include <netdb.h>
  42. #include <mywinsock.h>
  43. #else
  44. #ifdef ms_windows
  45. #include <winsock.h>
  46. #else
  47. #define unix_posix 1 /* Assume all non-windows systems are Unix! */
  48. /*
  49. * There may well be terrible delicacies re different variants on Unix. I
  50. * have (initially) tested this using Solaris and Linux.
  51. */
  52. #include <sys/types.h>
  53. #include <sys/socket.h>
  54. #include <netinet/in.h>
  55. #include <netdb.h>
  56. #include <arpa/inet.h>
  57. #include <sys/time.h>
  58. #include <errno.h>
  59. #include <fcntl.h>
  60. #define WSAGetLastError() errno /* retrieve error code */
  61. #define WSACleanup() /* tidy up at end of day */
  62. #define closesocket(a) close(a)
  63. #define SOCKET int
  64. #define SOCKET_ERROR (-1)
  65. #ifndef INADDR_NONE
  66. # define INADDR_NONE 0xffffffff
  67. #endif
  68. #ifdef unix_posix
  69. #include <termios.h> /* So I can do non-echo terminal input */
  70. #endif
  71. #endif
  72. #endif
  73. #endif
  74. #define standard_ftp_port 21
  75. #define standard_gopher_port 70
  76. #define standard_telnet_port 23
  77. #define standard_wais_port 210
  78. #define standard_http_port 80
  79. #define standard_local_port (-1)
  80. #define default_csl_server_port 1206
  81. #define MAX_USERS 10 /* approx concurrent remote users */
  82. #define REMOTE_STORE 8000 /* Allow 8 Mbytes per remote user */
  83. #define MAX_CPU_TIME 300 /* Approx CPU limit (seconds) */
  84. #define MAX_ELAPSED_TIME 45 /* Approx elapsed time limit (mins) */
  85. extern clock_t cpu_timeout;
  86. extern time_t elapsed_timeout;
  87. /*
  88. * Now some declarations for my own variables and functions.
  89. */
  90. #ifndef header_tags_h
  91. /*
  92. * If used as part of the CSL Lisp system header_tags_h will already
  93. * be defined, and the type Lisp_Object will exist. Otherwise I should
  94. * define it here.
  95. */
  96. typedef int Lisp_Object;
  97. #endif
  98. #define PERMITTED_BACKLOG 5
  99. extern int sockets_ready;
  100. extern SOCKET socket_server;
  101. extern char *WSAErrName(int i);
  102. extern int ensure_sockets_ready();
  103. /* End of sockhdr.h */