Contiki 2.6

httpd.h

00001 /*
00002  * Copyright (c) 2001-2005, Adam Dunkels.
00003  * All rights reserved. 
00004  *
00005  * Redistribution and use in source and binary forms, with or without 
00006  * modification, are permitted provided that the following conditions 
00007  * are met: 
00008  * 1. Redistributions of source code must retain the above copyright 
00009  *    notice, this list of conditions and the following disclaimer. 
00010  * 2. Redistributions in binary form must reproduce the above copyright 
00011  *    notice, this list of conditions and the following disclaimer in the 
00012  *    documentation and/or other materials provided with the distribution. 
00013  * 3. The name of the author may not be used to endorse or promote
00014  *    products derived from this software without specific prior
00015  *    written permission.  
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00018  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00021  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00023  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00025  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00026  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00027  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
00028  *
00029  * This file is part of the uIP TCP/IP stack.
00030  *
00031  * $Id: httpd.h,v 1.1 2007/11/28 09:40:13 matsutsuka Exp $
00032  *
00033  */
00034 
00035 #ifndef __HTTPD_H__
00036 #define __HTTPD_H__
00037 
00038 
00039 #include "contiki-net.h"
00040 #include "httpd-fs.h"
00041 
00042 #ifndef HTTPD_CONF_CGI
00043 #define HTTPD_CONF_CGI          1
00044 #endif
00045 #ifndef HTTPD_CONF_SCRIPT
00046 #define HTTPD_CONF_SCRIPT       1
00047 #endif
00048 
00049 struct httpd_state {
00050   unsigned char timer;
00051   struct psock sin, sout;
00052   struct pt outputpt
00053 #if HTTPD_CONF_SCRIPT
00054   , scriptpt;
00055 #else
00056   ;
00057 #endif /* HTTPD_CONF_SCRIPT */
00058   char inputbuf[50];
00059   char filename[20];
00060   char state;
00061   struct httpd_fs_file file;  
00062   int len;
00063 #if HTTPD_CONF_SCRIPT
00064   char *scriptptr;
00065   int scriptlen;
00066 #endif /* HTTPD_CONF_SCRIPT */
00067   union {
00068     unsigned short count;
00069     void *ptr;
00070   } u;
00071 };
00072 
00073 
00074 void httpd_init(void);
00075 void httpd_appcall(void *state);
00076 
00077 #endif /* __HTTPD_H__ */