PageRenderTime 41ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 19ms app.codeStats 0ms

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

http://github.com/jocelyn/EiffelWebReloaded
Specman e | 97 lines | 74 code | 12 blank | 11 comment | 2 complexity | 4e09ddc1d00db8a6530cb24e936dd0ae 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 -- Connection
12
13	accept: INTEGER
14			-- Accept a Fast CGI connection.
15			-- Return 0 for successful calls, -1 otherwise.
16		external
17			"C inline use %"fcgi_stdio.h%""
18		alias
19			"return FCGI_Accept();"
20		end
21
22	environ: POINTER
23			-- Get the (char**) environ variable from the DLL.
24		external
25			"C inline use %"fcgi_stdio.h%""
26		alias
27			"return (char**) environ;"
28		end
29
30	finish
31			-- Finished current request from HTTP server started from
32			-- the most recent call to `fcgi_accept'.
33		external
34			"C inline 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			"C inline use %"fcgi_stdio.h%""
43		alias
44			"FCGI_SetExitStatus($v);"
45		end
46
47feature -- Input
48
49	read_content_into (a_buffer: POINTER; a_length: INTEGER): INTEGER
50			-- Read content stream into `a_buffer' but no more than `a_length' character.
51		external
52			"C inline use %"fcgi_stdio.h%""
53		alias
54			"[
55				{
56					size_t n;
57					if (! FCGI_feof(FCGI_stdin)) {
58						n = FCGI_fread($a_buffer, 1, $a_length, FCGI_stdin);
59					} else {
60						 n = 0;
61					}
62					return n;
63				}
64			]"
65		end
66
67	gets (s: POINTER): POINTER
68			-- gets() reads a line from stdin into the buffer pointed to
69			-- by s until either a terminating newline or EOF, which it
70			-- replaces with '\0'
71			-- No check for buffer overrun is performed
72		external
73			"C inline use %"fcgi_stdio.h%""
74		alias
75			"return FCGI_gets($s);"
76		end
77
78feature -- Output
79
80	put_string (v: POINTER; n: INTEGER)
81		external
82			"C inline use %"fcgi_stdio.h%""
83		alias
84			"FCGI_fwrite($v, 1, $n, FCGI_stdout);"
85		end
86
87note
88	copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
89	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
90	source: "[
91			Eiffel Software
92			5949 Hollister Ave., Goleta, CA 93117 USA
93			Telephone 805-685-1006, Fax 805-685-6869
94			Website http://www.eiffel.com
95			Customer support http://support.eiffel.com
96		]"
97end