- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# webserver.h

    00001 /*
    00002   FreeRTOS V4.0.1 - copyright (C) 2003-2006 Richard Barry.
    00003
    00004   This file is part of the FreeRTOS distribution.
    00005
    00006   FreeRTOS is free software; you can redistribute it and/or modify
    00007   it under the terms of the GNU General Public License as published by
    00008   the Free Software Foundation; either version 2 of the License, or
    00009   (at your option) any later version.
    00010
    00011   FreeRTOS is distributed in the hope that it will be useful,
    00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014   GNU General Public License for more details.
    00015
    00016   You should have received a copy of the GNU General Public License
    00017   along with FreeRTOS; if not, write to the Free Software
    00018   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00019
    00020   A special exception to the GPL can be applied should you wish to distribute
    00021   a combined work that includes FreeRTOS, without being obliged to provide
    00022   the source code for any proprietary components.  See the licensing section
    00023   of http://www.FreeRTOS.org for full details of how and when the exception
    00024   can be applied.
    00025
    00026   ***************************************************************************
    00027   See http://www.FreeRTOS.org for documentation, latest information, license
    00028   and contact details.  Please ensure to read the configuration and relevant
    00029   port sections of the online documentation.
    00030   ***************************************************************************
    00031 */
    00032
    00033 #ifndef WEB_SERVER_H
    00034 #define WEB_SERVER_H
    00035
    00036 #include "string.h"
    00037 #include "stdio.h"
    00038
    00039 #define MAX_FORM_ELEMENTS 10
    00040
    00041 /**
    00042   A structure that represents a key-value pair in an HTML form.
    00043   This structure only points at the data received by the web server - it does not copy it.  So be sure
    00044   to note that this structure becomes invalid as soon as the data used to create is gone.
    00045   \ingroup webserver
    00046 */
    00047 typedef struct
    00048 {
    00049   char *key;   /**< A pointer to the key of this element. */
    00050   char *value; /**< A pointer to the value of this element. */
    00051 } HtmlFormElement;
    00052
    00053 /**
    00054   A structure that represents a collection of HtmlFormElement structures.
    00055   If you need a larger form, you can adjust \b MAX_FORM_ELEMENTS in webserver.h it accommodates 10 by default.
    00056   \ingroup webserver
    00057 */
    00058 typedef struct
    00059 {
    00060   HtmlFormElement elements[MAX_FORM_ELEMENTS]; /**< An array of form elements. */
    00061   int count;                                   /**< The number of form elements contained in this form. */
    00062 } HtmlForm;
    00063
    00064 // Web Server Task
    00065 int WebServer_SetActive( int active );
    00066 int WebServer_GetActive( void );
    00067 int WebServer_SetListenPort( int port );
    00068 int WebServer_GetListenPort( void );
    00069
    00070 int WebServer_Route( char* address, int (*handler)( char* requestType, char* request, char* requestBuffer, int request_maxsize, void* socket, char* responseBuffer, int len )  );
    00071
    00072 // HTTP Helpers
    00073 int WebServer_WriteResponseOkHTML( void* socket );
    00074 int WebServer_WriteResponseOkPlain( void* socket );
    00075
    00076 // HTML Helpers
    00077 int WebServer_WriteHeader( int includeCSS, void* socket, char* buffer, int len );
    00078 int WebServer_WriteBodyStart( char* reloadAddress, void* socket, char* buffer, int len );
    00079 int WebServer_WriteBodyEnd( void* socket );
    00080
    00081 bool WebServer_GetPostData( void *socket, char *requestBuffer, int maxSize );
    00082 int WebServer_ParseFormElements( char *request, HtmlForm *form );
    00083
    00084 // OSC interface
    00085 const char* WebServerOsc_GetName( void );
    00086 int WebServerOsc_ReceiveMessage( int channel, char* message, int length );
    00087 int WebServerOsc_Async( int channel );
    00088
    00089 #endif  // WEB_SERVER_H
    00090

The Make Controller Kit is an open source project maintained by MakingThings.
MakingThings code is released under the Apache 2.0 license.
Bug tracker, development wiki and status can be found at http://dev.makingthings.com.
This document was last updated on 18 May 2009.