Add tag for the 120219 release.
[pub/lufa.git] / Projects / Webserver / Lib / HTTPServerApp.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2012.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7 */
8
9 /*
10 Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 *
33 * Header file for HTTPServerApp.c.
34 */
35
36 #ifndef _HTTPSERVER_APP_H_
37 #define _HTTPSERVER_APP_H_
38
39 /* Includes: */
40 #include <avr/pgmspace.h>
41 #include <string.h>
42
43 #include <LUFA/Version.h>
44
45 #include <uip.h>
46 #include <ff.h>
47
48 /* Enums: */
49 /** States for each HTTP connection to the webserver. */
50 enum Webserver_States_t
51 {
52 WEBSERVER_STATE_OpenRequestedFile, /**< Currently opening requested file */
53 WEBSERVER_STATE_SendResponseHeader, /**< Currently sending HTTP response headers to the client */
54 WEBSERVER_STATE_SendData, /**< Currently sending HTTP page data to the client */
55 WEBSERVER_STATE_Closing, /**< Ready to close the connection to the client */
56 WEBSERVER_STATE_Closed, /**< Connection closed after all data sent */
57 };
58
59 /* Type Defines: */
60 /** Type define for a MIME type handler. */
61 typedef struct
62 {
63 char* Extension; /**< File extension (no leading '.' character) */
64 char* MIMEType; /**< Appropriate MIME type to send when the extension is encountered */
65 } MIME_Type_t;
66
67 /* Macros: */
68 /** TCP listen port for incoming HTTP traffic. */
69 #define HTTP_SERVER_PORT 80
70
71 /* Function Prototypes: */
72 void HTTPServerApp_Init(void);
73 void HTTPServerApp_Callback(void);
74
75 #if defined(INCLUDE_FROM_HTTPSERVERAPP_C)
76 static void HTTPServerApp_OpenRequestedFile(void);
77 static void HTTPServerApp_SendResponseHeader(void);
78 static void HTTPServerApp_SendData(void);
79 #endif
80
81 #endif
82