1 |
577 |
jeremybenn |
/**
|
2 |
|
|
* \addtogroup httpd
|
3 |
|
|
* @{
|
4 |
|
|
*/
|
5 |
|
|
|
6 |
|
|
/**
|
7 |
|
|
* \file
|
8 |
|
|
* Web server script interface header file
|
9 |
|
|
* \author
|
10 |
|
|
* Adam Dunkels <adam@sics.se>
|
11 |
|
|
*
|
12 |
|
|
*/
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
/*
|
17 |
|
|
* Copyright (c) 2001, Adam Dunkels.
|
18 |
|
|
* All rights reserved.
|
19 |
|
|
*
|
20 |
|
|
* Redistribution and use in source and binary forms, with or without
|
21 |
|
|
* modification, are permitted provided that the following conditions
|
22 |
|
|
* are met:
|
23 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
24 |
|
|
* notice, this list of conditions and the following disclaimer.
|
25 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
26 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
27 |
|
|
* documentation and/or other materials provided with the distribution.
|
28 |
|
|
* 3. The name of the author may not be used to endorse or promote
|
29 |
|
|
* products derived from this software without specific prior
|
30 |
|
|
* written permission.
|
31 |
|
|
*
|
32 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
33 |
|
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
34 |
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
35 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
36 |
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
37 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
38 |
|
|
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
39 |
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
40 |
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
41 |
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
42 |
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
43 |
|
|
*
|
44 |
|
|
* This file is part of the uIP TCP/IP stack.
|
45 |
|
|
*
|
46 |
|
|
* $Id: httpd-cgi.h 2 2011-07-17 20:13:17Z filepang@gmail.com $
|
47 |
|
|
*
|
48 |
|
|
*/
|
49 |
|
|
|
50 |
|
|
#ifndef __HTTPD_CGI_H__
|
51 |
|
|
#define __HTTPD_CGI_H__
|
52 |
|
|
|
53 |
|
|
#include "psock.h"
|
54 |
|
|
#include "httpd.h"
|
55 |
|
|
|
56 |
|
|
typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *));
|
57 |
|
|
|
58 |
|
|
httpd_cgifunction httpd_cgi(char *name);
|
59 |
|
|
|
60 |
|
|
struct httpd_cgi_call {
|
61 |
|
|
const char *name;
|
62 |
|
|
const httpd_cgifunction function;
|
63 |
|
|
};
|
64 |
|
|
|
65 |
|
|
/**
|
66 |
|
|
* \brief HTTPD CGI function declaration
|
67 |
|
|
* \param name The C variable name of the function
|
68 |
|
|
* \param str The string name of the function, used in the script file
|
69 |
|
|
* \param function A pointer to the function that implements it
|
70 |
|
|
*
|
71 |
|
|
* This macro is used for declaring a HTTPD CGI
|
72 |
|
|
* function. This function is then added to the list of
|
73 |
|
|
* HTTPD CGI functions with the httpd_cgi_add() function.
|
74 |
|
|
*
|
75 |
|
|
* \hideinitializer
|
76 |
|
|
*/
|
77 |
|
|
#define HTTPD_CGI_CALL(name, str, function) \
|
78 |
|
|
static PT_THREAD(function(struct httpd_state *, char *)); \
|
79 |
|
|
static const struct httpd_cgi_call name = {str, function}
|
80 |
|
|
|
81 |
|
|
void httpd_cgi_init(void);
|
82 |
|
|
#endif /* __HTTPD_CGI_H__ */
|
83 |
|
|
|
84 |
|
|
/** @} */
|