PageRenderTime 78ms CodeModel.GetById 74ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 1ms

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