Files
EWF/library/server/libfcgi/implementation/linux/fcgi_c_api.e
Jocelyn Fiat f74ac66569 First integration of the new GW_ design more centralized on connector, and does not require specific feature on GW_APPLICATION depending on the connector.
So this is really more flexible this way, and much easier to write application supporting CGI, FCGI, Nino and so on .. as demonstrated in hello_world

This is a first version, more will come later, mainly migrating from Eiffel Web Reloaded to this Eiffel Web Framework project.
2011-07-12 11:53:00 +02:00

98 lines
2.1 KiB
Plaintext

note
description: "Wrappers around FastCGI C API."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
FCGI_C_API
feature -- Connection
accept: INTEGER
-- Accept a Fast CGI connection.
-- Return 0 for successful calls, -1 otherwise.
external
"C inline use %"fcgi_stdio.h%""
alias
"return FCGI_Accept();"
end
environ: POINTER
-- Get the (char**) environ variable from the DLL.
external
"C inline use %"fcgi_stdio.h%""
alias
"return (char**) environ;"
end
finish
-- Finished current request from HTTP server started from
-- the most recent call to `fcgi_accept'.
external
"C inline use %"fcgi_stdio.h%""
alias
"FCGI_Finish();"
end
set_exit_status (v: INTEGER)
-- Set the exit status for the most recent request
external
"C inline use %"fcgi_stdio.h%""
alias
"FCGI_SetExitStatus($v);"
end
feature -- Input
read_content_into (a_buffer: POINTER; a_length: INTEGER): INTEGER
-- Read content stream into `a_buffer' but no more than `a_length' character.
external
"C inline use %"fcgi_stdio.h%""
alias
"[
{
size_t n;
if (! FCGI_feof(FCGI_stdin)) {
n = FCGI_fread($a_buffer, 1, $a_length, FCGI_stdin);
} else {
n = 0;
}
return n;
}
]"
end
gets (s: POINTER): POINTER
-- gets() reads a line from stdin into the buffer pointed to
-- by s until either a terminating newline or EOF, which it
-- replaces with '\0'
-- No check for buffer overrun is performed
external
"C inline use %"fcgi_stdio.h%""
alias
"return FCGI_gets($s);"
end
feature -- Output
put_string (v: POINTER; n: INTEGER)
external
"C inline use %"fcgi_stdio.h%""
alias
"FCGI_fwrite($v, 1, $n, FCGI_stdout);"
end
note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end