httpd-cgi.h 2.7 KB

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