/* H-soubor pro http.c */
#ifndef _HTTP_H
#define _HTTP_H

// Include
#include "stdint.h"

// Definice
#define HTTP_MAX_STATUSCODE_LEN			45

// Ofsety

// Metody REQUEST
#define HTTP_REQ_METOD_GET				1
#define HTTP_REQ_METOD_POST				2

// ID stavovych kodu
#define HTTP_STATUSCODE_200				0
#define HTTP_STATUSCODE_400				1
#define HTTP_STATUSCODE_403				2
#define HTTP_STATUSCODE_404				3
#define HTTP_STATUSCODE_418				4
#define HTTP_STATUSCODE_500				5
#define HTTP_STATUSCODE_505				6

// Stavove kody
static const uint8_t HTTP_HeaderStatusCode[7][HTTP_MAX_STATUSCODE_LEN] = 
{
	{"HTTP/1.1 200 OK\r\n"},
	{"HTTP/1.1 400 Bad Request\r\n"},
	{"HTTP/1.1 403 Forbidden\r\n"},
	{"HTTP/1.1 404 Not Found\r\n"},
	{"HTTP/1.1 418 I'm a teapot\r\n"},
	{"HTTP/1.1 500 Internal Server Error\r\n"},
	{"HTTP/1.1 505 HTTP Version Not Supported\r\n"}
};

// Hlavicka HTTP protokolu - odezvy (bez stavoveho kodu)
static const uint8_t HTTP_ServerHeader1[] = 
{
	"Server: SimpleServer by Satora/1.0.0 (ARM-STM32F100/FreeRTOS)\r\n"
	"Accept-Ranges: bytes\r\n"
	"Connection: close\r\n"
};		//	"Allow: GET, POST\r\n"

static const uint8_t HTTP_ServerHeaderContent[] =
{
	"Content-Type: text/html; charset=windows-1250\r\n"
	"\r\n"
}; 

static const uint8_t HTTP_ServerHeader2[] = 
{	
	"\r\n"
};

// Pole pro vlozeni delky obsahu HTTP odezvy
static const uint8_t HTTP_ServerHeaderContentLen[] = {"Content-Length: "};

// Prototypy funkci
uint8_t HTTP_GetRequestMetod(uint8_t *RX_Buffer);
uint8_t HTTP_GetRequestFromGET(uint8_t *RX_Buffer, uint16_t *ZacatekRequestu);
uint16_t HTTP_SetHeader(uint8_t HTTP_Status, uint8_t *TX_Buffer, uint8_t *RX_buffer);
#endif

/* Konec souboru */
