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