/library/server/fcgi/implementation/windows/fcgi_c_api.e

http://github.com/jocelyn/EiffelWebReloaded · Specman e · 136 lines · 102 code · 18 blank · 16 comment · 1 complexity · a379487b8f0f794dc2c36d8157bba9dc MD5 · raw file

  1. note
  2. description: "Wrappers around FastCGI C API."
  3. legal: "See notice at end of class."
  4. status: "See notice at end of class."
  5. date: "$Date$"
  6. revision: "$Revision$"
  7. class
  8. FCGI_C_API
  9. feature -- Connections
  10. accept: INTEGER
  11. -- Accept a Fast CGI connection.
  12. -- Return 0 for successful calls, -1 otherwise.
  13. external
  14. "dll libfcgi.dll signature (): EIF_INTEGER use fcgi_stdio.h "
  15. alias
  16. "FCGI_Accept"
  17. end
  18. environ: POINTER
  19. -- Get the (char**) environ variable from the DLL.
  20. external
  21. "dll libfcgi.dll signature (): EIF_POINTER use fcgi_stdio.h "
  22. alias
  23. "FCGI_Environ"
  24. end
  25. finish
  26. -- Finished current request from HTTP server started from
  27. -- the most recent call to `accept'.
  28. external
  29. "dll libfcgi.dll signature () use fcgi_stdio.h "
  30. alias
  31. "FCGI_Finish"
  32. end
  33. set_exit_status (v: INTEGER)
  34. -- Set the exit status for the most recent request
  35. external
  36. "dll libfcgi.dll signature (EIF_INTEGER) use fcgi_stdio.h "
  37. alias
  38. "FCGI_SetExitStatus"
  39. end
  40. feature -- Input
  41. fread (v: POINTER; a_size: INTEGER; n: INTEGER; fp: POINTER): INTEGER
  42. -- FCGI_fread() read from input `fp' and put into `v'
  43. external
  44. "dll libfcgi.dll signature (EIF_POINTER, EIF_INTEGER, EIF_INTEGER, EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
  45. alias
  46. "FCGI_fread"
  47. end
  48. feof (v: POINTER): INTEGER
  49. -- FCGI_feof()
  50. external
  51. "dll libfcgi.dll signature (EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
  52. alias
  53. "FCGI_feof"
  54. end
  55. read_content_into (a_buffer: POINTER; a_length: INTEGER): INTEGER
  56. -- Read content stream into `a_buffer' but no more than `a_length' character.
  57. local
  58. i: INTEGER
  59. l_stdin: POINTER
  60. do
  61. l_stdin := stdin
  62. i := feof (l_stdin)
  63. if i /= 0 then
  64. Result := 0
  65. else
  66. Result := fread(a_buffer, 1, a_length, l_stdin)
  67. end
  68. end
  69. gets (s: POINTER): POINTER
  70. -- gets() reads a line from stdin into the buffer pointed to
  71. -- by `s' until either a terminating newline or EOF, which it
  72. -- replaces with '\0'
  73. -- No check for buffer overrun is performed
  74. external
  75. "dll libfcgi.dll signature (EIF_POINTER): EIF_POINTER use fcgi_stdio.h "
  76. alias
  77. "FCGI_gets"
  78. end
  79. feature -- Output
  80. put_string (v: POINTER; n: INTEGER)
  81. local
  82. i: INTEGER
  83. do
  84. i := fwrite (v, 1, n, stdout)
  85. end
  86. fwrite (v: POINTER; a_size: INTEGER; n: INTEGER; fp: POINTER): INTEGER
  87. -- FCGI_fwrite() ouput `v' to `fp'
  88. external
  89. "dll libfcgi.dll signature (EIF_POINTER, EIF_INTEGER, EIF_INTEGER, EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
  90. alias
  91. "FCGI_fwrite"
  92. end
  93. feature -- Access
  94. stdout: POINTER
  95. -- FCGI_stdout() return pointer on output FCGI_FILE
  96. external
  97. "C inline use %"fcgi_stdio.h%""
  98. alias
  99. "FCGI_stdout"
  100. end
  101. stdin: POINTER
  102. -- FCGI_stdin() return pointer on input FCGI_FILE
  103. external
  104. "C inline use %"fcgi_stdio.h%""
  105. alias
  106. "FCGI_stdin"
  107. end
  108. note
  109. copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
  110. license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
  111. source: "[
  112. Eiffel Software
  113. 5949 Hollister Ave., Goleta, CA 93117 USA
  114. Telephone 805-685-1006, Fax 805-685-6869
  115. Website http://www.eiffel.com
  116. Customer support http://support.eiffel.com
  117. ]"
  118. end