|
2250
|
1 /* ================================================================= |
|
|
2 * |
|
|
3 * handler.h |
|
|
4 * |
|
|
5 * Improved HTTPD server. |
|
|
6 * |
|
|
7 * ================================================================= |
|
|
8 * ####ECOSGPLCOPYRIGHTBEGIN#### |
|
|
9 * ------------------------------------------- |
|
|
10 * This file is part of eCos, the Embedded Configurable Operating |
|
|
11 * System. |
|
|
12 * Copyright (C) 2005 eCosCentric Ltd. |
|
|
13 * |
|
|
14 * eCos is free software; you can redistribute it and/or modify it |
|
|
15 * under the terms of the GNU General Public License as published by |
|
|
16 * the Free Software Foundation; either version 2 or (at your option) |
|
|
17 * any later version. |
|
|
18 * |
|
|
19 * eCos is distributed in the hope that it will be useful, but |
|
|
20 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
22 * General Public License for more details. |
|
|
23 * |
|
|
24 * You should have received a copy of the GNU General Public License |
|
|
25 * along with eCos; if not, write to the Free Software Foundation, |
|
|
26 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
|
27 * |
|
|
28 * As a special exception, if other files instantiate templates or |
|
|
29 * use macros or inline functions from this file, or you compile this |
|
|
30 * file and link it with other works to produce a work based on this |
|
|
31 * file, this file does not by itself cause the resulting work to be |
|
|
32 * covered by the GNU General Public License. However the source code |
|
|
33 * for this file must still be made available in accordance with |
|
|
34 * section (3) of the GNU General Public License. |
|
|
35 * |
|
|
36 * This exception does not invalidate any other reasons why a work |
|
|
37 * based on this file might be covered by the GNU General Public |
|
|
38 * License. |
|
|
39 * |
|
|
40 * ------------------------------------------- |
|
|
41 * ####ECOSGPLCOPYRIGHTEND#### |
|
|
42 * ================================================================= |
|
|
43 * #####DESCRIPTIONBEGIN#### |
|
|
44 * |
|
|
45 * Author(s): Anthony Tonizzo (atonizzo@gmail.com) |
|
|
46 * Contributors: |
|
|
47 * Date: 2006-06-12 |
|
|
48 * Purpose: |
|
|
49 * Description: |
|
|
50 * |
|
|
51 * ####DESCRIPTIONEND#### |
|
|
52 * |
|
|
53 * ================================================================= |
|
|
54 */ |
|
|
55 #ifndef __HANDLER_H__ |
|
|
56 #define __HANDLER_H__ |
|
|
57 |
|
|
58 // ============================================================================= |
|
|
59 // Internal Resources |
|
|
60 // ============================================================================= |
|
|
61 struct cyg_httpd_ires_table_entry |
|
|
62 { |
|
|
63 char *f_pname; |
|
|
64 char *f_ptr; |
|
|
65 int f_size; |
|
|
66 } CYG_HAL_TABLE_TYPE; |
|
|
67 |
|
|
68 typedef struct cyg_httpd_ires_table_entry cyg_httpd_ires_table_entry; |
|
|
69 |
|
|
70 #define CYG_HTTPD_IRES_TABLE_ENTRY(__name, __path_name, __pmem, __size) \ |
|
|
71 cyg_httpd_ires_table_entry __name \ |
|
|
72 CYG_HAL_TABLE_ENTRY(httpd_ires_table) = {(char*)__path_name, \ |
|
|
73 (char*)__pmem, (int)__size} |
|
|
74 |
|
|
75 cyg_httpd_ires_table_entry *cyg_httpd_find_ires(char *); |
|
|
76 void cyg_httpd_send_ires(cyg_httpd_ires_table_entry *); |
|
|
77 |
|
|
78 // ============================================================================= |
|
|
79 // C callbacks |
|
|
80 // ============================================================================= |
|
|
81 typedef cyg_int32 (*handler)(CYG_HTTPD_STATE*); |
|
|
82 struct cyg_httpd_handler_table_entry |
|
|
83 { |
|
|
84 char *path; |
|
|
85 handler h; |
|
|
86 } CYG_HAL_TABLE_TYPE; |
|
|
87 |
|
|
88 typedef struct cyg_httpd_handler_table_entry cyg_httpd_handler_table_entry; |
|
|
89 |
|
|
90 #define CYG_HTTPD_HANDLER_TABLE_ENTRY(__name, __pattern, __arg) \ |
|
|
91 cyg_httpd_handler_table_entry __name \ |
|
|
92 CYG_HAL_TABLE_ENTRY(httpd_handler_table) = { __pattern, __arg } |
|
|
93 |
|
|
94 handler cyg_httpd_find_handler(void); |
|
|
95 cyg_int32 cyg_httpd_exec_cgi(void); |
|
|
96 void cyg_httpd_send_directory_listing(char*); |
|
|
97 |
|
|
98 #endif |
|
|
99 |