/library/server/fcgi/spec/include/libfcgi/fcgios.h

http://github.com/jocelyn/EiffelWebReloaded · C++ Header · 130 lines · 84 code · 20 blank · 26 comment · 4 complexity · d7f7c1317851bd53dfd4a631ac9694fd MD5 · raw file

  1. /*
  2. * fcgios.h --
  3. *
  4. * Description of file.
  5. *
  6. *
  7. * Copyright (c) 1996 Open Market, Inc.
  8. * All rights reserved.
  9. *
  10. * This file contains proprietary and confidential information and
  11. * remains the unpublished property of Open Market, Inc. Use,
  12. * disclosure, or reproduction is prohibited except as permitted by
  13. * express written license agreement with Open Market, Inc.
  14. *
  15. * Bill Snapper
  16. * snapper@openmarket.com
  17. */
  18. #ifndef _FCGIOS_H
  19. #define _FCGIOS_H
  20. #ifdef _WIN32
  21. #define WIN32_LEAN_AND_MEAN
  22. #include <windows.h>
  23. #include <winsock2.h>
  24. #endif
  25. #include "fcgi_config.h"
  26. #ifdef HAVE_SYS_TIME_H
  27. #include <sys/time.h>
  28. #endif
  29. #ifdef HAVE_SYS_TYPES_H
  30. #include <sys/types.h>
  31. #endif
  32. #if defined (c_plusplus) || defined (__cplusplus)
  33. extern "C" {
  34. #endif
  35. #ifdef _WIN32
  36. #define OS_Errno GetLastError()
  37. #define OS_SetErrno(err) SetLastError(err)
  38. #ifndef O_NONBLOCK
  39. #define O_NONBLOCK 0x0004 /* no delay */
  40. #endif
  41. #else /* !_WIN32 */
  42. #define OS_Errno errno
  43. #define OS_SetErrno(err) errno = (err)
  44. #endif /* !_WIN32 */
  45. #ifndef DLLAPI
  46. #ifdef _WIN32
  47. #define DLLAPI __declspec(dllimport)
  48. #else
  49. #define DLLAPI
  50. #endif
  51. #endif
  52. /* This is the initializer for a "struct timeval" used in a select() call
  53. * right after a new request is accept()ed to determine readablity. Its
  54. * a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets).
  55. * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware.
  56. * Making this as small as possible, yet remain reliable would be best.
  57. * 2 seconds is very conservative. 0,0 is not reliable. The shorter the
  58. * timeout, the faster request processing will recover. The longer the
  59. * timeout, the more likely this application being "busy" will cause other
  60. * requests to abort and cause more dead sockets that need this timeout. */
  61. #define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0
  62. #ifndef STDIN_FILENO
  63. #define STDIN_FILENO 0
  64. #endif
  65. #ifndef STDOUT_FILENO
  66. #define STDOUT_FILENO 1
  67. #endif
  68. #ifndef STDERR_FILENO
  69. #define STDERR_FILENO 2
  70. #endif
  71. #ifndef MAXPATHLEN
  72. #define MAXPATHLEN 1024
  73. #endif
  74. #ifndef X_OK
  75. #define X_OK 0x01
  76. #endif
  77. #ifndef _CLIENTDATA
  78. # if defined(__STDC__) || defined(__cplusplus)
  79. typedef void *ClientData;
  80. # else
  81. typedef int *ClientData;
  82. # endif /* __STDC__ */
  83. #define _CLIENTDATA
  84. #endif
  85. typedef void (*OS_AsyncProc) (ClientData clientData, int len);
  86. DLLAPI int OS_LibInit(int stdioFds[3]);
  87. DLLAPI void OS_LibShutdown(void);
  88. DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog);
  89. DLLAPI int OS_FcgiConnect(char *bindPath);
  90. DLLAPI int OS_Read(int fd, char * buf, size_t len);
  91. DLLAPI int OS_Write(int fd, char * buf, size_t len);
  92. DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
  93. DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
  94. ClientData clientData);
  95. DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
  96. OS_AsyncProc procPtr, ClientData clientData);
  97. DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
  98. OS_AsyncProc procPtr, ClientData clientData);
  99. DLLAPI int OS_Close(int fd);
  100. DLLAPI int OS_CloseRead(int fd);
  101. DLLAPI int OS_DoIo(struct timeval *tmo);
  102. DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
  103. DLLAPI int OS_IpcClose(int ipcFd);
  104. DLLAPI int OS_IsFcgi(int sock);
  105. DLLAPI void OS_SetFlags(int fd, int flags);
  106. DLLAPI void OS_ShutdownPending(void);
  107. #if defined (__cplusplus) || defined (c_plusplus)
  108. } /* terminate extern "C" { */
  109. #endif
  110. #endif /* _FCGIOS_H */