# apps/webserver/httpd-cgi.h

Go to the documentation of this file.

    00001 /**
    00002  * \addtogroup httpd
    00003  * @{
    00004  */
    00005
    00006 /**
    00007  * \file
    00008  *         Web server script interface header file
    00009  * \author
    00010  *         Adam Dunkels <adam@sics.se>
    00011  *
    00012  */
    00013
    00014
    00015
    00016 /*
    00017  * Copyright (c) 2001, Adam Dunkels.
    00018  * All rights reserved.
    00019  *
    00020  * Redistribution and use in source and binary forms, with or without
    00021  * modification, are permitted provided that the following conditions
    00022  * are met:
    00023  * 1. Redistributions of source code must retain the above copyright
    00024  *    notice, this list of conditions and the following disclaimer.
    00025  * 2. Redistributions in binary form must reproduce the above copyright
    00026  *    notice, this list of conditions and the following disclaimer in the
    00027  *    documentation and/or other materials provided with the distribution.
    00028  * 3. The name of the author may not be used to endorse or promote
    00029  *    products derived from this software without specific prior
    00030  *    written permission.
    00031  *
    00032  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
    00033  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    00034  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00035  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    00036  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    00037  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
    00038  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    00039  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    00040  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    00041  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00042  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00043  *
    00044  * This file is part of the uIP TCP/IP stack.
    00045  *
    00046  * $Id: httpd-cgi.h,v 1.2 2006/06/11 21:46:38 adam Exp $
    00047  *
    00048  */
    00049
    00050 #ifndef __HTTPD_CGI_H__
    00051 #define __HTTPD_CGI_H__
    00052
    00053 #include "psock.h"
    00054 #include "httpd.h"
    00055
    00056 typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *));
    00057
    00058 httpd_cgifunction httpd_cgi(char *name);
    00059
    00060 struct httpd_cgi_call {
    00061   const char *name;
    00062   const httpd_cgifunction function;
    00063 };
    00064
    00065 /**
    00066  * \brief      HTTPD CGI function declaration
    00067  * \param name The C variable name of the function
    00068  * \param str  The string name of the function, used in the script file
    00069  * \param function A pointer to the function that implements it
    00070  *
    00071  *             This macro is used for declaring a HTTPD CGI
    00072  *             function. This function is then added to the list of
    00073  *             HTTPD CGI functions with the httpd_cgi_add() function.
    00074  *
    00075  * \hideinitializer
    00076  */
    00077 #define HTTPD_CGI_CALL(name, str, function) \
    00078 static PT_THREAD(function(struct httpd_state *, char *)); \
    00079 static const struct httpd_cgi_call name = {str, function}
    00080
    00081 void httpd_cgi_init(void);
    00082 #endif /* __HTTPD_CGI_H__ */
    00083
    00084 /** @} */