]> git.donarmstrong.com Git - qmk_firmware.git/blob - lib/lufa/Projects/Webserver/Lib/HTTPServerApp.h
Merge commit '60b30c036397cb5627fa374bb930794b225daa29' as 'lib/lufa'
[qmk_firmware.git] / lib / lufa / Projects / Webserver / Lib / HTTPServerApp.h
1 /*
2              LUFA Library
3      Copyright (C) Dean Camera, 2017.
4
5   dean [at] fourwalledcubicle [dot] com
6            www.lufa-lib.org
7 */
8
9 /*
10   Copyright 2017  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 disclaims 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 "Config/AppConfig.h"
46
47                 #include <uip.h>
48                 #include <ff.h>
49
50         /* Enums: */
51                 /** States for each HTTP connection to the webserver. */
52                 enum Webserver_States_t
53                 {
54                         WEBSERVER_STATE_OpenRequestedFile, /**< Currently opening requested file */
55                         WEBSERVER_STATE_SendResponseHeader, /**< Currently sending HTTP response headers to the client */
56                         WEBSERVER_STATE_SendData, /**< Currently sending HTTP page data to the client */
57                         WEBSERVER_STATE_Closing, /**< Ready to close the connection to the client */
58                         WEBSERVER_STATE_Closed, /**< Connection closed after all data sent */
59                 };
60
61         /* Type Defines: */
62                 /** Type define for a MIME type handler. */
63                 typedef struct
64                 {
65                         char* Extension; /**< File extension (no leading '.' character) */
66                         char* MIMEType;  /**< Appropriate MIME type to send when the extension is encountered */
67                 } MIME_Type_t;
68
69         /* Macros: */
70                 /** TCP listen port for incoming HTTP traffic. */
71                 #define HTTP_SERVER_PORT  80
72
73         /* Function Prototypes: */
74                 void HTTPServerApp_Init(void);
75                 void HTTPServerApp_Callback(void);
76
77                 #if defined(INCLUDE_FROM_HTTPSERVERAPP_C)
78                         static void HTTPServerApp_OpenRequestedFile(void);
79                         static void HTTPServerApp_SendResponseHeader(void);
80                         static void HTTPServerApp_SendData(void);
81                 #endif
82
83 #endif
84