Tidied up http/lwip interface
Removed file httpd.c and moved its functions into Network.cpp. This gives us type-checking across more interface boundaries and eliminates a number of global functions. Also removed unused files fs.c, fsdata.c, httpd-original.c.
This commit is contained in:
parent
68e6ed2575
commit
db3f5adda9
17 changed files with 335 additions and 1210 deletions
|
@ -24,7 +24,7 @@ Licence: GPL
|
|||
#define CONFIGURATION_H
|
||||
|
||||
#define NAME "RepRapFirmware"
|
||||
#define VERSION "0.57z-alpha-dc42"
|
||||
#define VERSION "0.57z-alpha2-dc42"
|
||||
#define DATE "2014-04-06"
|
||||
#define LAST_AUTHOR "dc42"
|
||||
|
||||
|
|
354
Network.cpp
354
Network.cpp
|
@ -2,39 +2,57 @@
|
|||
|
||||
RepRapFirmware - Network: RepRapPro Ormerod with Arduino Due controller
|
||||
|
||||
Separated out from Platform.cpp by dc42, 2014-04-05
|
||||
2014-04-05 Created from portions taken out of Platform.cpp by dc42
|
||||
2014-04-07 Added portions of httpd.c. These portions are subject to the following copyright notice:
|
||||
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* (end httpd.c copyright notice)
|
||||
|
||||
****************************************************************************************************/
|
||||
|
||||
#include "RepRapFirmware.h"
|
||||
#include "DueFlashStorage.h"
|
||||
|
||||
const uint8_t windowedSendPackets = 2;
|
||||
|
||||
|
||||
//***************************************************************************************************
|
||||
|
||||
// Network/Ethernet class
|
||||
|
||||
// C calls to interface with LWIP (http://savannah.nongnu.org/projects/lwip/)
|
||||
// These are implemented in, and called from, a modified version of httpd.c
|
||||
// in the network directory.
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
// Transmit data to the Network
|
||||
#include "lwipopts.h"
|
||||
#include "lwip/src/include/lwip/debug.h"
|
||||
#include "lwip/src/include/lwip/stats.h"
|
||||
#include "lwip/src/include/lwip/tcp.h"
|
||||
|
||||
void RepRapNetworkSendOutput(char* data, int length, void* pcb, void* hs);
|
||||
|
||||
// Ask whether it is OK to send
|
||||
int RepRapNetworkCanSend(void* hs);
|
||||
|
||||
void RepRapNetworkConnectionError(void* h)
|
||||
{
|
||||
reprap.GetPlatform()->GetNetwork()->ConnectionError(h);
|
||||
}
|
||||
|
||||
const uint8_t windowedSendPackets = 2;
|
||||
|
||||
// Called to put out a message via the RepRap firmware.
|
||||
|
||||
void RepRapNetworkMessage(const char* s)
|
||||
|
@ -42,22 +60,258 @@ void RepRapNetworkMessage(const char* s)
|
|||
reprap.GetPlatform()->Message(HOST_MESSAGE, s);
|
||||
}
|
||||
|
||||
// Called to push data into the RepRap firmware.
|
||||
|
||||
void RepRapNetworkReceiveInput(const char* data, int length, void* pcb, void* hs)
|
||||
static void SendData(struct tcp_pcb *pcb, HttpState *hs)
|
||||
{
|
||||
reprap.GetPlatform()->GetNetwork()->ReceiveInput(data, length, pcb, hs);
|
||||
err_t err;
|
||||
u16_t len;
|
||||
|
||||
/* We cannot send more data than space available in the send buffer. */
|
||||
if (tcp_sndbuf(pcb) < hs->left)
|
||||
{
|
||||
len = tcp_sndbuf(pcb);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = hs->left;
|
||||
}
|
||||
|
||||
// RepRapNetworkMessage("Sending ");
|
||||
// sprintf(scratch, "%d", len);
|
||||
// RepRapNetworkMessage(scratch);
|
||||
// RepRapNetworkMessage("..");
|
||||
|
||||
do {
|
||||
err = tcp_write(pcb, hs->file, len, 0); // Final arg - 1 means make a copy
|
||||
if (err == ERR_MEM) {
|
||||
len /= 2;
|
||||
}
|
||||
} while (err == ERR_MEM && len > 1);
|
||||
|
||||
if (err == ERR_OK)
|
||||
{
|
||||
tcp_output(pcb);
|
||||
hs->file += len;
|
||||
hs->left -= len;
|
||||
} else
|
||||
{
|
||||
RepRapNetworkMessage("send_data: error\n");
|
||||
//%s len %d %d\n", lwip_strerr(err), len, tcp_sndbuf(pcb));
|
||||
}
|
||||
}
|
||||
|
||||
// Called when transmission of outgoing data is complete to allow
|
||||
// the RepRap firmware to write more.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void RepRapNetworkSentPacketAcknowledged(void *hs)
|
||||
extern "C"
|
||||
{
|
||||
reprap.GetPlatform()->GetNetwork()->SentPacketAcknowledged(hs);
|
||||
|
||||
// Callback functions called by LWIP
|
||||
|
||||
static void conn_err(void *arg, err_t err)
|
||||
{
|
||||
// Report the error to the monitor
|
||||
RepRapNetworkMessage("Network connection error, code ");
|
||||
{
|
||||
char tempBuf[10];
|
||||
snprintf(tempBuf, sizeof(tempBuf)/sizeof(char), "%d\n", err);
|
||||
RepRapNetworkMessage(tempBuf);
|
||||
}
|
||||
|
||||
HttpState *hs = (HttpState*)arg;
|
||||
reprap.GetPlatform()->GetNetwork()->ConnectionError(hs); // tell the higher levels about the error
|
||||
mem_free(hs); // release the state data
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t http_poll(void *arg, struct tcp_pcb *pcb)
|
||||
{
|
||||
HttpState *hs = (HttpState*)arg;
|
||||
|
||||
if (hs == NULL)
|
||||
{
|
||||
RepRapNetworkMessage("Null, abort\n");
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
else
|
||||
{
|
||||
++hs->retries;
|
||||
if (hs->retries == 4)
|
||||
{
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
SendData(pcb, hs);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||
{
|
||||
HttpState *hs = (HttpState*)arg;
|
||||
|
||||
LWIP_UNUSED_ARG(len);
|
||||
|
||||
hs->retries = 0;
|
||||
|
||||
//RepRapNetworkMessage("..sent\n");
|
||||
|
||||
if (hs->left > 0)
|
||||
{
|
||||
SendData(pcb, hs);
|
||||
}
|
||||
else
|
||||
{
|
||||
// See if there is more to send
|
||||
reprap.GetPlatform()->GetNetwork()->SentPacketAcknowledged(hs);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
{
|
||||
HttpState *hs = (HttpState*)arg;
|
||||
|
||||
if (err == ERR_OK && p != NULL)
|
||||
{
|
||||
/* Inform TCP that we have taken the data. */
|
||||
tcp_recved(pcb, p->tot_len);
|
||||
|
||||
if (hs->file == NULL)
|
||||
{
|
||||
hs->pb = p;
|
||||
reprap.GetPlatform()->GetNetwork()->ReceiveInput((const char*)(p->payload), p->len, pcb, hs);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We are already sending data on this connection, so not expecting any messages on it
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t http_accept(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
{
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
LWIP_UNUSED_ARG(err);
|
||||
|
||||
tcp_setprio(pcb, TCP_PRIO_MIN);
|
||||
|
||||
//RepRapNetworkMessage("http_accept\n");
|
||||
|
||||
HttpState *hs = (HttpState*)mem_malloc(sizeof(HttpState));
|
||||
|
||||
if (hs == NULL)
|
||||
{
|
||||
RepRapNetworkMessage("Out of memory!\n");
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
/* Initialize the structure. */
|
||||
hs->pb = NULL;
|
||||
hs->file = NULL;
|
||||
hs->left = 0;
|
||||
hs->retries = 0;
|
||||
|
||||
/* Tell TCP that this is the structure we wish to be passed for our callbacks. */
|
||||
tcp_arg(pcb, hs);
|
||||
|
||||
/* Tell TCP that we wish to be informed of incoming data by a call to the http_recv() function. */
|
||||
tcp_recv(pcb, http_recv);
|
||||
|
||||
tcp_err(pcb, conn_err);
|
||||
|
||||
tcp_poll(pcb, http_poll, 4);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
// This function (is)x should be called only once at the start.
|
||||
|
||||
void httpd_init(void)
|
||||
{
|
||||
static int initCount = 0;
|
||||
|
||||
|
||||
initCount++;
|
||||
if (initCount > 1)
|
||||
{
|
||||
RepRapNetworkMessage("httpd_init() called more than once.\n");
|
||||
}
|
||||
|
||||
struct tcp_pcb* pcb = tcp_new();
|
||||
tcp_bind(pcb, IP_ADDR_ANY, 80);
|
||||
pcb = tcp_listen(pcb);
|
||||
tcp_accept(pcb, http_accept);
|
||||
}
|
||||
|
||||
} // end extern "C"
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void close_conn(struct tcp_pcb *pcb, HttpState *hs)
|
||||
{
|
||||
// RepRapNetworkMessage("close_conn called.\n");
|
||||
tcp_arg(pcb, NULL);
|
||||
tcp_sent(pcb, NULL);
|
||||
tcp_recv(pcb, NULL);
|
||||
mem_free(hs);
|
||||
tcp_close(pcb);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
// RepRap calls this with data to send.
|
||||
// A null transmission implies the end of the data to be sent.
|
||||
|
||||
void RepRapNetworkSendOutput(char* data, int length, void* pc, void* h)
|
||||
{
|
||||
struct tcp_pcb* pcb = (tcp_pcb*)pc;
|
||||
HttpState* hs = (HttpState*)h;
|
||||
|
||||
if (hs == 0)
|
||||
{
|
||||
RepRapNetworkMessage("Attempt to write with null structure.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (hs->pb != NULL)
|
||||
{
|
||||
pbuf_free(hs->pb);
|
||||
hs->pb = NULL;
|
||||
}
|
||||
|
||||
if (length <= 0)
|
||||
{
|
||||
close_conn(pcb, hs);
|
||||
return;
|
||||
}
|
||||
|
||||
hs->file = data;
|
||||
hs->left = length;
|
||||
hs->retries = 0;
|
||||
|
||||
SendData(pcb, hs);
|
||||
|
||||
/* Tell TCP that we wish be to informed of data that has been successfully sent by a call to the http_sent() function. */
|
||||
|
||||
tcp_sent(pcb, http_sent);
|
||||
}
|
||||
|
||||
|
||||
//***************************************************************************************************
|
||||
|
||||
// Network/Ethernet class
|
||||
|
||||
Network::Network()
|
||||
{
|
||||
|
@ -74,11 +328,11 @@ Network::Network()
|
|||
closingTransactions = NULL;
|
||||
for (int8_t i = 0; i < HTTP_STATE_SIZE; i++)
|
||||
{
|
||||
freeTransactions = new NetRing(freeTransactions);
|
||||
freeTransactions = new RequestState(freeTransactions);
|
||||
}
|
||||
}
|
||||
|
||||
void Network::AppendTransaction(NetRing** list, NetRing *r)
|
||||
void Network::AppendTransaction(RequestState** list, RequestState *r)
|
||||
{
|
||||
r->next = NULL;
|
||||
while (*list != NULL)
|
||||
|
@ -102,7 +356,7 @@ void Network::Spin()
|
|||
ethernet_task(); // keep the Ethernet running
|
||||
|
||||
// See if we can send anything
|
||||
NetRing* r = writingTransactions;
|
||||
RequestState* r = writingTransactions;
|
||||
if (r != NULL)
|
||||
{
|
||||
bool doClose = r->TrySendData(); // we must leave r on the list for now because of possible callback to release the input buffer
|
||||
|
@ -163,9 +417,9 @@ void Network::Write(const char* s)
|
|||
}
|
||||
}
|
||||
|
||||
void Network::SentPacketAcknowledged(void *hs)
|
||||
void Network::SentPacketAcknowledged(HttpState *hs)
|
||||
{
|
||||
NetRing *r = writingTransactions;
|
||||
RequestState *r = writingTransactions;
|
||||
while (r != NULL && r->hs != hs)
|
||||
{
|
||||
r = r->next;
|
||||
|
@ -189,13 +443,13 @@ void Network::SentPacketAcknowledged(void *hs)
|
|||
debugPrintf("Network SentPacketAcknowledged: didn't find hs=%08x\n", (unsigned int)hs);
|
||||
}
|
||||
|
||||
void Network::ConnectionError(void* hs)
|
||||
void Network::ConnectionError(HttpState* hs)
|
||||
{
|
||||
// h points to an http state block that the caller is about to release, so we need to stop referring to it.
|
||||
debugPrintf("Network: ConnectionError\n");
|
||||
|
||||
// See if it's a ready transaction
|
||||
NetRing* r = readyTransactions;
|
||||
RequestState* r = readyTransactions;
|
||||
while (r != NULL && r->hs == hs)
|
||||
{
|
||||
r = r->next;
|
||||
|
@ -234,9 +488,9 @@ void Network::ConnectionError(void* hs)
|
|||
debugPrintf("Network ConnectionError: didn't find hs=%08x\n", (unsigned int)hs);
|
||||
}
|
||||
|
||||
void Network::ReceiveInput(const char* data, int length, void* pcb, void* hs)
|
||||
void Network::ReceiveInput(const char* data, int length, void* pcb, HttpState* hs)
|
||||
{
|
||||
NetRing* r = freeTransactions;
|
||||
RequestState* r = freeTransactions;
|
||||
if (r == NULL)
|
||||
{
|
||||
reprap.GetPlatform()->Message(HOST_MESSAGE, "Network::ReceiveInput() - no free transactions!\n");
|
||||
|
@ -254,7 +508,7 @@ void Network::ReceiveInput(const char* data, int length, void* pcb, void* hs)
|
|||
// The file may be too large for our buffer, so we may have to send it in multiple transactions.
|
||||
void Network::SendAndClose(FileStore *f)
|
||||
{
|
||||
NetRing *r = readyTransactions;
|
||||
RequestState *r = readyTransactions;
|
||||
if (r != NULL)
|
||||
{
|
||||
readyTransactions = r->next;
|
||||
|
@ -291,11 +545,11 @@ bool Network::Active() const
|
|||
|
||||
|
||||
// NetRing class members
|
||||
NetRing::NetRing(NetRing* n) : next(n)
|
||||
RequestState::RequestState(RequestState* n) : next(n)
|
||||
{
|
||||
}
|
||||
|
||||
void NetRing::Set(const char* d, int l, void* pc, void* h)
|
||||
void RequestState::Set(const char* d, int l, void* pc, HttpState* h)
|
||||
{
|
||||
pcb = pc;
|
||||
hs = h;
|
||||
|
@ -309,7 +563,7 @@ void NetRing::Set(const char* d, int l, void* pc, void* h)
|
|||
|
||||
// Webserver calls this to read bytes that have come in from the network
|
||||
|
||||
bool NetRing::Read(char& b)
|
||||
bool RequestState::Read(char& b)
|
||||
{
|
||||
if (LostConnection() || inputPointer >= inputLength)
|
||||
{
|
||||
|
@ -323,7 +577,7 @@ bool NetRing::Read(char& b)
|
|||
|
||||
// Webserver calls this to write bytes that need to go out to the network
|
||||
|
||||
void NetRing::Write(char b)
|
||||
void RequestState::Write(char b)
|
||||
{
|
||||
if (LostConnection()) return;
|
||||
|
||||
|
@ -344,7 +598,7 @@ void NetRing::Write(char b)
|
|||
// so it should never overflow the buffer (which is checked
|
||||
// anyway).
|
||||
|
||||
void NetRing::Write(const char* s)
|
||||
void RequestState::Write(const char* s)
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
|
@ -353,14 +607,14 @@ void NetRing::Write(const char* s)
|
|||
}
|
||||
|
||||
// Send some data if we can, returning true if all data has been sent
|
||||
bool NetRing::TrySendData()
|
||||
bool RequestState::TrySendData()
|
||||
{
|
||||
if (LostConnection())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!RepRapNetworkCanSend(hs))
|
||||
if (hs->SendInProgress())
|
||||
{
|
||||
// debugPrintf("Send busy\n");
|
||||
return false;
|
||||
|
@ -404,7 +658,7 @@ bool NetRing::TrySendData()
|
|||
}
|
||||
}
|
||||
|
||||
void NetRing::SentPacketAcknowledged()
|
||||
void RequestState::SentPacketAcknowledged()
|
||||
{
|
||||
if (sentPacketsOutstanding != 0)
|
||||
{
|
||||
|
@ -413,7 +667,7 @@ void NetRing::SentPacketAcknowledged()
|
|||
}
|
||||
|
||||
// Close this connection. Return true if it really is closed, false if it needs to go in the deferred close list.
|
||||
bool NetRing::Close()
|
||||
bool RequestState::Close()
|
||||
{
|
||||
if (LostConnection())
|
||||
{
|
||||
|
@ -425,12 +679,12 @@ bool NetRing::Close()
|
|||
return true; // try not using deferred close for now
|
||||
}
|
||||
|
||||
void NetRing::SetConnectionLost()
|
||||
void RequestState::SetConnectionLost()
|
||||
{
|
||||
hs = NULL;
|
||||
}
|
||||
|
||||
bool NetRing::LostConnection() const
|
||||
bool RequestState::LostConnection() const
|
||||
{
|
||||
return hs == NULL;
|
||||
}
|
||||
|
|
45
Network.h
45
Network.h
|
@ -32,16 +32,31 @@ Separated out from Platform.h by dc42
|
|||
// and therefore avoids additional memory use and fragmentation.
|
||||
const unsigned int httpOutputBufferSize = 2 * 1432;
|
||||
|
||||
// Start with a ring buffer to hold input from the network that needs to be responded to.
|
||||
// HttpState structure that we use to track Http connections. This could be combined with class RequestState.
|
||||
|
||||
class NetRing
|
||||
struct HttpState
|
||||
{
|
||||
// Receive fields
|
||||
struct pbuf *pb;
|
||||
|
||||
// Transmit fields
|
||||
char *file;
|
||||
uint16_t left;
|
||||
uint8_t retries;
|
||||
|
||||
bool SendInProgress() const { return left > 0; }
|
||||
};
|
||||
|
||||
// Start with a class to hold input and output from the network that needs to be responded to.
|
||||
|
||||
class RequestState
|
||||
{
|
||||
public:
|
||||
friend class Network;
|
||||
|
||||
protected:
|
||||
NetRing(NetRing* n);
|
||||
void Set(const char* d, int l, void* pc, void* h);
|
||||
RequestState(RequestState* n);
|
||||
void Set(const char* d, int l, void* pc, HttpState* h);
|
||||
bool Read(char& b);
|
||||
void SentPacketAcknowledged();
|
||||
void Write(char b);
|
||||
|
@ -54,9 +69,9 @@ protected:
|
|||
private:
|
||||
void Reset();
|
||||
void* pcb;
|
||||
void* hs;
|
||||
HttpState* hs;
|
||||
|
||||
NetRing* next;
|
||||
RequestState* next;
|
||||
const char* inputData;
|
||||
int inputLength;
|
||||
int inputPointer;
|
||||
|
@ -74,10 +89,10 @@ class Network
|
|||
{
|
||||
public:
|
||||
|
||||
void ReceiveInput(const char* data, int length, void* pc, void* h);
|
||||
void InputBufferReleased(void *hs, void* pb);
|
||||
void SentPacketAcknowledged(void *hs);
|
||||
void ConnectionError(void* h);
|
||||
void ReceiveInput(const char* data, int length, void* pc, HttpState* h);
|
||||
void InputBufferReleased(HttpState *hs, void* pb);
|
||||
void SentPacketAcknowledged(HttpState *hs);
|
||||
void ConnectionError(HttpState* h);
|
||||
bool Active() const;
|
||||
bool LinkIsUp();
|
||||
bool Read(char& b);
|
||||
|
@ -92,12 +107,12 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
void AppendTransaction(NetRing** list, NetRing *r);
|
||||
void AppendTransaction(RequestState** list, RequestState *r);
|
||||
|
||||
NetRing *freeTransactions;
|
||||
NetRing *readyTransactions;
|
||||
NetRing *writingTransactions;
|
||||
NetRing *closingTransactions;
|
||||
RequestState *freeTransactions;
|
||||
RequestState *readyTransactions;
|
||||
RequestState *writingTransactions;
|
||||
RequestState *closingTransactions;
|
||||
bool active;
|
||||
};
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -69,10 +69,6 @@
|
|||
#include "lwip/src/include/netif/etharp.h"
|
||||
#include "lwip/src/sam/include/netif/ethernetif.h"
|
||||
|
||||
#if defined(HTTP_RAW_USED)
|
||||
#include "httpd.h"
|
||||
#endif
|
||||
|
||||
#include "lwip_test.h"
|
||||
|
||||
/* Global variable containing MAC Config (hw addr, IP, GW, ...) */
|
||||
|
|
64
network/fs.c
64
network/fs.c
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwipopts.h"
|
||||
#if defined(HTTP_RAW_USED)
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "lwip/src/include/lwip/def.h"
|
||||
#include "fs.h"
|
||||
#include "fsdata.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
fs_open(char *name, struct fs_file *file)
|
||||
{
|
||||
struct fsdata_file_noconst *f;
|
||||
|
||||
for(f = (struct fsdata_file_noconst *)FS_ROOT;
|
||||
f != NULL;
|
||||
f = (struct fsdata_file_noconst *)f->next) {
|
||||
if (!strcmp(name, (char *)f->name)) {
|
||||
file->data = (char *)f->data;
|
||||
file->len = f->len;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
44
network/fs.h
44
network/fs.h
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __FS_H__
|
||||
#define __FS_H__
|
||||
|
||||
struct fs_file {
|
||||
char *data;
|
||||
int len;
|
||||
};
|
||||
|
||||
/* file must be allocated by caller and will be filled in
|
||||
by the function. */
|
||||
int fs_open(char *name, struct fs_file *file);
|
||||
|
||||
#endif /* __FS_H__ */
|
339
network/fsdata.c
339
network/fsdata.c
|
@ -1,339 +0,0 @@
|
|||
#include "lwipopts.h"
|
||||
#if defined(HTTP_RAW_USED)
|
||||
|
||||
#include <string.h>
|
||||
#include "fsdata.h"
|
||||
|
||||
static const unsigned char data_img_sics_gif[] = {
|
||||
/* /img/sics.gif */
|
||||
0x2f, 0x69, 0x6d, 0x67, 0x2f, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x69, 0x66, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x6c, 0x77, 0x49, 0x50, 0x2f,
|
||||
0x70, 0x72, 0x65, 0x2d, 0x30, 0x2e, 0x36, 0x20, 0x28, 0x68,
|
||||
0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e,
|
||||
0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61,
|
||||
0x64, 0x61, 0x6d, 0x2f, 0x6c, 0x77, 0x69, 0x70, 0x2f, 0x29,
|
||||
0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d,
|
||||
0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67,
|
||||
0x65, 0x2f, 0x67, 0x69, 0x66, 0xd, 0xa, 0xd, 0xa, 0x47,
|
||||
0x49, 0x46, 0x38, 0x39, 0x61, 0x46, 00, 0x22, 00, 0xa5,
|
||||
00, 00, 0xd9, 0x2b, 0x39, 0x6a, 0x6a, 0x6a, 0xbf, 0xbf,
|
||||
0xbf, 0x93, 0x93, 0x93, 0xf, 0xf, 0xf, 0xb0, 0xb0, 0xb0,
|
||||
0xa6, 0xa6, 0xa6, 0x80, 0x80, 0x80, 0x76, 0x76, 0x76, 0x1e,
|
||||
0x1e, 0x1e, 0x9d, 0x9d, 0x9d, 0x2e, 0x2e, 0x2e, 0x49, 0x49,
|
||||
0x49, 0x54, 0x54, 0x54, 0x8a, 0x8a, 0x8a, 0x60, 0x60, 0x60,
|
||||
0xc6, 0xa6, 0x99, 0xbd, 0xb5, 0xb2, 0xc2, 0xab, 0xa1, 0xd9,
|
||||
0x41, 0x40, 0xd5, 0x67, 0x55, 0xc0, 0xb0, 0xaa, 0xd5, 0x5e,
|
||||
0x4e, 0xd6, 0x50, 0x45, 0xcc, 0x93, 0x7d, 0xc8, 0xa1, 0x90,
|
||||
0xce, 0x8b, 0x76, 0xd2, 0x7b, 0x65, 0xd1, 0x84, 0x6d, 0xc9,
|
||||
0x99, 0x86, 0x3a, 0x3a, 0x3a, 00, 00, 00, 0xb8, 0xb8,
|
||||
0xb8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0x2c, 00, 00, 00, 00, 0x46,
|
||||
00, 0x22, 00, 00, 0x6, 0xfe, 0x40, 0x90, 0x70, 0x48,
|
||||
0x2c, 0x1a, 0x8f, 0xc8, 0xa4, 0x72, 0xc9, 0x6c, 0x3a, 0x9f,
|
||||
0xd0, 0xa8, 0x74, 0x4a, 0xad, 0x5a, 0xaf, 0xd8, 0xac, 0x76,
|
||||
0xa9, 0x40, 0x4, 0xbe, 0x83, 0xe2, 0x60, 0x3c, 0x50, 0x20,
|
||||
0xd, 0x8e, 0x6f, 00, 0x31, 0x28, 0x1c, 0xd, 0x7, 0xb5,
|
||||
0xc3, 0x60, 0x75, 0x24, 0x3e, 0xf8, 0xfc, 0x87, 0x11, 0x6,
|
||||
0xe9, 0x3d, 0x46, 0x7, 0xb, 0x7a, 0x7a, 0x7c, 0x43, 0x6,
|
||||
0x1e, 0x84, 0x78, 0xb, 0x7, 0x6e, 0x51, 0x1, 0x8a, 0x84,
|
||||
0x8, 0x7e, 0x79, 0x80, 0x87, 0x89, 0x91, 0x7a, 0x93, 0xa,
|
||||
0x4, 0x99, 0x78, 0x96, 0x4f, 0x3, 0x9e, 0x79, 0x1, 0x94,
|
||||
0x9f, 0x43, 0x9c, 0xa3, 0xa4, 0x5, 0x77, 0xa3, 0xa0, 0x4e,
|
||||
0x98, 0x79, 0xb, 0x1e, 0x83, 0xa4, 0xa6, 0x1f, 0x96, 0x5,
|
||||
0x9d, 0xaa, 0x78, 0x1, 0x7, 0x84, 0x4, 0x1e, 0x1e, 0xbb,
|
||||
0xb8, 0x51, 0x84, 0xe, 0x43, 0x5, 0x7, 0x77, 0xa5, 0x7f,
|
||||
0x42, 0xb1, 0xb2, 0x1, 0x63, 0x8, 0xd, 0xbb, 0x1, 0xc,
|
||||
0x7a, 0xd, 0x44, 0xe, 0xd8, 0xaf, 0x4c, 0x5, 0x7a, 0x4,
|
||||
0x47, 0x7, 0x7, 0xb7, 0x80, 0xa2, 0xe1, 0x7d, 0x44, 0x5,
|
||||
0x1, 0x4, 0x1, 0xd0, 0xea, 0x87, 0x93, 0x4f, 0xe0, 0x9a,
|
||||
0x49, 0xce, 0xd8, 0x79, 0x4, 0x66, 0x20, 0x15, 0x10, 0x10,
|
||||
0x11, 0x92, 0x29, 0x80, 0xb6, 0xc0, 0x91, 0x15, 0x45, 0x1e,
|
||||
0x90, 0x19, 0x71, 0x46, 0xa8, 0x5c, 0x4, 0xe, 00, 0x22,
|
||||
0x4e, 0xe8, 0x40, 0x24, 0x9f, 0x3e, 0x4, 0x6, 0xa7, 0x58,
|
||||
0xd4, 0x93, 0xa0, 0x1c, 0x91, 0x3f, 0xe8, 0xf0, 0x88, 0x3,
|
||||
0xb1, 0x21, 0xa2, 0x49, 00, 0x19, 0x86, 0xfc, 0x52, 0x44,
|
||||
0xe0, 0x1, 0x9d, 0x29, 0x21, 0x15, 0x25, 0x50, 0xf7, 0x67,
|
||||
0x25, 0x1e, 0x6, 0xfd, 0x4e, 0x9a, 0xb4, 0x90, 0xac, 0x15,
|
||||
0xfa, 0xcb, 0x52, 0x53, 0x1e, 0x8c, 0xf2, 0xf8, 0x7, 0x92,
|
||||
0x2d, 0x8, 0x3a, 0x4d, 0x12, 0x49, 0x95, 0x49, 0xdb, 0x14,
|
||||
0x4, 0xc4, 0x14, 0x85, 0x29, 0xaa, 0xe7, 0x1, 0x8, 0xa4,
|
||||
0x49, 0x1, 0x14, 0x51, 0xe0, 0x53, 0x91, 0xd5, 0x29, 0x6,
|
||||
0x1a, 0x64, 0x2, 0xf4, 0xc7, 0x81, 0x9e, 0x5, 0x20, 0x22,
|
||||
0x64, 0xa5, 0x30, 0xae, 0xab, 0x9e, 0x97, 0x53, 0xd8, 0xb9,
|
||||
0xfd, 0x50, 0xef, 0x93, 0x2, 0x42, 0x74, 0x34, 0xe8, 0x9c,
|
||||
0x20, 0x21, 0xc9, 0x1, 0x68, 0x78, 0xe6, 0x55, 0x29, 0x20,
|
||||
0x56, 0x4f, 0x4c, 0x40, 0x51, 0x71, 0x82, 0xc0, 0x70, 0x21,
|
||||
0x22, 0x85, 0xbe, 0x4b, 0x1c, 0x44, 0x5, 0xea, 0xa4, 0x1,
|
||||
0xbf, 0x22, 0xb5, 0xf0, 0x1c, 0x6, 0x51, 0x38, 0x8f, 0xe0,
|
||||
0x22, 0xec, 0x18, 0xac, 0x39, 0x22, 0xd4, 0xd6, 0x93, 0x44,
|
||||
0x1, 0x32, 0x82, 0xc8, 0xfc, 0x61, 0xb3, 0x1, 0x45, 0xc,
|
||||
0x2e, 0x83, 0x30, 0xd0, 0xe, 0x17, 0x24, 0xf, 0x70, 0x85,
|
||||
0x94, 0xee, 0x5, 0x5, 0x53, 0x4b, 0x32, 0x1b, 0x3f, 0x98,
|
||||
0xd3, 0x1d, 0x29, 0x81, 0xb0, 0xae, 0x1e, 0x8c, 0x7e, 0x68,
|
||||
0xe0, 0x60, 0x5a, 0x54, 0x8f, 0xb0, 0x78, 0x69, 0x73, 0x6,
|
||||
0xa2, 00, 0x6b, 0x57, 0xca, 0x3d, 0x11, 0x50, 0xbd, 0x4,
|
||||
0x30, 0x4b, 0x3a, 0xd4, 0xab, 0x5f, 0x1f, 0x9b, 0x3d, 0x13,
|
||||
0x74, 0x27, 0x88, 0x3c, 0x25, 0xe0, 0x17, 0xbe, 0x7a, 0x79,
|
||||
0x45, 0xd, 0xc, 0xb0, 0x8b, 0xda, 0x90, 0xca, 0x80, 0x6,
|
||||
0x5d, 0x17, 0x60, 0x1c, 0x22, 0x4c, 0xd8, 0x57, 0x22, 0x6,
|
||||
0x20, 00, 0x98, 0x7, 0x8, 0xe4, 0x56, 0x80, 0x80, 0x1c,
|
||||
0xc5, 0xb7, 0xc5, 0x82, 0xc, 0x36, 0xe8, 0xe0, 0x83, 0x10,
|
||||
0x46, 0x28, 0xe1, 0x84, 0x14, 0x56, 0x68, 0xa1, 0x10, 0x41,
|
||||
00, 00, 0x3b, };
|
||||
|
||||
static const unsigned char data_404_html[] = {
|
||||
/* /404.html */
|
||||
0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34,
|
||||
0x30, 0x34, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f,
|
||||
0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xd, 0xa, 0x53,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x6c, 0x77, 0x49,
|
||||
0x50, 0x2f, 0x70, 0x72, 0x65, 0x2d, 0x30, 0x2e, 0x36, 0x20,
|
||||
0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77,
|
||||
0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f,
|
||||
0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x6c, 0x77, 0x69, 0x70,
|
||||
0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
|
||||
0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65,
|
||||
0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa, 0xd,
|
||||
0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c, 0x68,
|
||||
0x65, 0x61, 0x64, 0x3e, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65,
|
||||
0x3e, 0x6c, 0x77, 0x49, 0x50, 0x20, 0x2d, 0x20, 0x41, 0x20,
|
||||
0x4c, 0x69, 0x67, 0x68, 0x74, 0x77, 0x65, 0x69, 0x67, 0x68,
|
||||
0x74, 0x20, 0x54, 0x43, 0x50, 0x2f, 0x49, 0x50, 0x20, 0x53,
|
||||
0x74, 0x61, 0x63, 0x6b, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c,
|
||||
0x65, 0x3e, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa,
|
||||
0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f,
|
||||
0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65,
|
||||
0x22, 0x20, 0x74, 0x65, 0x78, 0x74, 0x3d, 0x22, 0x62, 0x6c,
|
||||
0x61, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x20,
|
||||
0x20, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69,
|
||||
0x64, 0x74, 0x68, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22,
|
||||
0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74,
|
||||
0x72, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3d, 0x22,
|
||||
0x74, 0x6f, 0x70, 0x22, 0x3e, 0x3c, 0x74, 0x64, 0x20, 0x77,
|
||||
0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x38, 0x30, 0x22, 0x3e,
|
||||
0x9, 0x20, 0x20, 0xa, 0x9, 0x20, 0x20, 0x3c, 0x61, 0x20,
|
||||
0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70,
|
||||
0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63,
|
||||
0x73, 0x2e, 0x73, 0x65, 0x2f, 0x22, 0x3e, 0x3c, 0x69, 0x6d,
|
||||
0x67, 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x69, 0x6d, 0x67,
|
||||
0x2f, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x69, 0x66, 0x22,
|
||||
0xa, 0x9, 0x20, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72,
|
||||
0x3d, 0x22, 0x30, 0x22, 0x20, 0x61, 0x6c, 0x74, 0x3d, 0x22,
|
||||
0x53, 0x49, 0x43, 0x53, 0x20, 0x6c, 0x6f, 0x67, 0x6f, 0x22,
|
||||
0x20, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3d, 0x22, 0x53, 0x49,
|
||||
0x43, 0x53, 0x20, 0x6c, 0x6f, 0x67, 0x6f, 0x22, 0x3e, 0x3c,
|
||||
0x2f, 0x61, 0x3e, 0xa, 0x9, 0x3c, 0x2f, 0x74, 0x64, 0x3e,
|
||||
0x3c, 0x74, 0x64, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d,
|
||||
0x22, 0x35, 0x30, 0x30, 0x22, 0x3e, 0x9, 0x20, 0x20, 0xa,
|
||||
0x9, 0x20, 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x6c, 0x77, 0x49,
|
||||
0x50, 0x20, 0x2d, 0x20, 0x41, 0x20, 0x4c, 0x69, 0x67, 0x68,
|
||||
0x74, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x54, 0x43,
|
||||
0x50, 0x2f, 0x49, 0x50, 0x20, 0x53, 0x74, 0x61, 0x63, 0x6b,
|
||||
0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x3c,
|
||||
0x68, 0x32, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, 0x20, 0x50,
|
||||
0x61, 0x67, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f,
|
||||
0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x32, 0x3e, 0xa, 0x9,
|
||||
0x20, 0x20, 0x3c, 0x70, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x20,
|
||||
0x20, 0x53, 0x6f, 0x72, 0x72, 0x79, 0x2c, 0x20, 0x74, 0x68,
|
||||
0x65, 0x20, 0x70, 0x61, 0x67, 0x65, 0x20, 0x79, 0x6f, 0x75,
|
||||
0x20, 0x61, 0x72, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x61, 0x73, 0x20,
|
||||
0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20,
|
||||
0x6f, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0xa, 0x9, 0x20,
|
||||
0x20, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e,
|
||||
0x20, 0xa, 0x9, 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa,
|
||||
0x9, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e,
|
||||
0xa, 0x9, 0x20, 0x20, 0x26, 0x6e, 0x62, 0x73, 0x70, 0x3b,
|
||||
0xa, 0x9, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74,
|
||||
0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c,
|
||||
0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x2f,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74,
|
||||
0x6d, 0x6c, 0x3e, 0xa, };
|
||||
|
||||
static const unsigned char data_index_html[] = {
|
||||
/* /index.html */
|
||||
0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x6c, 0x77, 0x49, 0x50, 0x2f,
|
||||
0x70, 0x72, 0x65, 0x2d, 0x30, 0x2e, 0x36, 0x20, 0x28, 0x68,
|
||||
0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e,
|
||||
0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61,
|
||||
0x64, 0x61, 0x6d, 0x2f, 0x6c, 0x77, 0x69, 0x70, 0x2f, 0x29,
|
||||
0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d,
|
||||
0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74,
|
||||
0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa, 0xd, 0xa, 0x3c,
|
||||
0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c, 0x68, 0x65, 0x61,
|
||||
0x64, 0x3e, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0x6c,
|
||||
0x77, 0x49, 0x50, 0x20, 0x2d, 0x20, 0x41, 0x20, 0x4c, 0x69,
|
||||
0x67, 0x68, 0x74, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20,
|
||||
0x54, 0x43, 0x50, 0x2f, 0x49, 0x50, 0x20, 0x53, 0x74, 0x61,
|
||||
0x63, 0x6b, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e,
|
||||
0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x3c, 0x62,
|
||||
0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f,
|
||||
0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22, 0x20,
|
||||
0x74, 0x65, 0x78, 0x74, 0x3d, 0x22, 0x62, 0x6c, 0x61, 0x63,
|
||||
0x6b, 0x22, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c,
|
||||
0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74,
|
||||
0x68, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0xa,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x74, 0x72, 0x20,
|
||||
0x76, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3d, 0x22, 0x74, 0x6f,
|
||||
0x70, 0x22, 0x3e, 0x3c, 0x74, 0x64, 0x20, 0x77, 0x69, 0x64,
|
||||
0x74, 0x68, 0x3d, 0x22, 0x38, 0x30, 0x22, 0x3e, 0x9, 0x20,
|
||||
0x20, 0xa, 0x9, 0x20, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72,
|
||||
0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e,
|
||||
0x73, 0x65, 0x2f, 0x22, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20,
|
||||
0x73, 0x72, 0x63, 0x3d, 0x22, 0x69, 0x6d, 0x67, 0x2f, 0x73,
|
||||
0x69, 0x63, 0x73, 0x2e, 0x67, 0x69, 0x66, 0x22, 0xa, 0x9,
|
||||
0x20, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, 0x22,
|
||||
0x30, 0x22, 0x20, 0x61, 0x6c, 0x74, 0x3d, 0x22, 0x53, 0x49,
|
||||
0x43, 0x53, 0x20, 0x6c, 0x6f, 0x67, 0x6f, 0x22, 0x20, 0x74,
|
||||
0x69, 0x74, 0x6c, 0x65, 0x3d, 0x22, 0x53, 0x49, 0x43, 0x53,
|
||||
0x20, 0x6c, 0x6f, 0x67, 0x6f, 0x22, 0x3e, 0x3c, 0x2f, 0x61,
|
||||
0x3e, 0xa, 0x9, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74,
|
||||
0x64, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x35,
|
||||
0x30, 0x30, 0x22, 0x3e, 0x9, 0x20, 0x20, 0xa, 0x9, 0x20,
|
||||
0x20, 0x3c, 0x68, 0x31, 0x3e, 0x6c, 0x77, 0x49, 0x50, 0x20,
|
||||
0x2d, 0x20, 0x41, 0x20, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x77,
|
||||
0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x54, 0x43, 0x50, 0x2f,
|
||||
0x49, 0x50, 0x20, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x3c, 0x2f,
|
||||
0x68, 0x31, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x3c, 0x70, 0x3e,
|
||||
0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x54, 0x68, 0x65, 0x20,
|
||||
0x77, 0x65, 0x62, 0x20, 0x70, 0x61, 0x67, 0x65, 0x20, 0x79,
|
||||
0x6f, 0x75, 0x20, 0x61, 0x72, 0x65, 0x20, 0x77, 0x61, 0x74,
|
||||
0x63, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x61, 0x73, 0x20,
|
||||
0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20,
|
||||
0x61, 0x20, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x77,
|
||||
0x65, 0x62, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69,
|
||||
0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x70, 0x20,
|
||||
0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, 0x67,
|
||||
0x68, 0x74, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x54,
|
||||
0x43, 0x50, 0x2f, 0x49, 0x50, 0x20, 0x73, 0x74, 0x61, 0x63,
|
||||
0x6b, 0x20, 0x3c, 0x61, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20,
|
||||
0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70,
|
||||
0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63,
|
||||
0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d,
|
||||
0x2f, 0x6c, 0x77, 0x69, 0x70, 0x2f, 0x22, 0x3e, 0x6c, 0x77,
|
||||
0x49, 0x50, 0x3c, 0x2f, 0x61, 0x3e, 0x2e, 0xa, 0x9, 0x20,
|
||||
0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x3c,
|
||||
0x70, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x77,
|
||||
0x49, 0x50, 0x20, 0x69, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x6f,
|
||||
0x70, 0x65, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||
0x20, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x54, 0x43, 0x50, 0x2f, 0x49, 0x50, 0xa,
|
||||
0x9, 0x20, 0x20, 0x20, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x63, 0x6f, 0x6c, 0x20, 0x73, 0x75, 0x69, 0x74, 0x65, 0x20,
|
||||
0x74, 0x68, 0x61, 0x74, 0x20, 0x77, 0x61, 0x73, 0x20, 0x6f,
|
||||
0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x6c, 0x79, 0x20,
|
||||
0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x62, 0x79,
|
||||
0x20, 0x41, 0x64, 0x61, 0x6d, 0x20, 0x44, 0x75, 0x6e, 0x6b,
|
||||
0x65, 0x6c, 0x73, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x6f,
|
||||
0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x53, 0x77, 0x65, 0x64,
|
||||
0x69, 0x73, 0x68, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x69, 0x74,
|
||||
0x75, 0x74, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x43, 0x6f, 0x6d,
|
||||
0x70, 0x75, 0x74, 0x65, 0x72, 0x20, 0x53, 0x63, 0x69, 0x65,
|
||||
0x6e, 0x63, 0x65, 0x20, 0x62, 0x75, 0x74, 0x20, 0x6e, 0x6f,
|
||||
0x77, 0x20, 0x69, 0x73, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20,
|
||||
0x62, 0x65, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x63, 0x74, 0x69,
|
||||
0x76, 0x65, 0x6c, 0x79, 0x20, 0x64, 0x65, 0x76, 0x65, 0x6c,
|
||||
0x6f, 0x70, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x20,
|
||||
0x74, 0x65, 0x61, 0x6d, 0x20, 0x6f, 0x66, 0x20, 0x64, 0x65,
|
||||
0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0xa, 0x9,
|
||||
0x20, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69,
|
||||
0x62, 0x75, 0x74, 0x65, 0x64, 0x20, 0x77, 0x6f, 0x72, 0x6c,
|
||||
0x64, 0x2d, 0x77, 0x69, 0x64, 0x65, 0x2e, 0x20, 0x53, 0x69,
|
||||
0x6e, 0x63, 0x65, 0x20, 0x69, 0x74, 0x27, 0x73, 0x20, 0x72,
|
||||
0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2c, 0x20, 0x6c, 0x77,
|
||||
0x49, 0x50, 0x20, 0x68, 0x61, 0x73, 0xa, 0x9, 0x20, 0x20,
|
||||
0x20, 0x20, 0x73, 0x70, 0x75, 0x72, 0x72, 0x65, 0x64, 0x20,
|
||||
0x61, 0x20, 0x6c, 0x6f, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x69,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x20, 0x61, 0x6e,
|
||||
0x64, 0x20, 0x68, 0x61, 0x73, 0x20, 0x62, 0x65, 0x65, 0x6e,
|
||||
0x20, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6f,
|
||||
0x20, 0x73, 0x65, 0x76, 0x65, 0x72, 0x61, 0x6c, 0xa, 0x9,
|
||||
0x20, 0x20, 0x20, 0x20, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f,
|
||||
0x72, 0x6d, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x70,
|
||||
0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x79,
|
||||
0x73, 0x74, 0x65, 0x6d, 0x73, 0x2e, 0x20, 0x6c, 0x77, 0x49,
|
||||
0x50, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x75,
|
||||
0x73, 0x65, 0x64, 0x20, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72,
|
||||
0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x77, 0x69, 0x74, 0x68,
|
||||
0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
|
||||
0x74, 0x20, 0x61, 0x6e, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72,
|
||||
0x6c, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x4f, 0x53, 0x2e, 0xa,
|
||||
0x9, 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0x9, 0x20,
|
||||
0x20, 0x3c, 0x70, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20,
|
||||
0x54, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x63, 0x75, 0x73, 0x20,
|
||||
0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x77, 0x49,
|
||||
0x50, 0x20, 0x54, 0x43, 0x50, 0x2f, 0x49, 0x50, 0x20, 0x69,
|
||||
0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x74, 0x6f, 0x20,
|
||||
0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0xa, 0x9, 0x20, 0x20,
|
||||
0x20, 0x20, 0x74, 0x68, 0x65, 0x20, 0x52, 0x41, 0x4d, 0x20,
|
||||
0x75, 0x73, 0x61, 0x67, 0x65, 0x20, 0x77, 0x68, 0x69, 0x6c,
|
||||
0x65, 0x20, 0x73, 0x74, 0x69, 0x6c, 0x6c, 0x20, 0x68, 0x61,
|
||||
0x76, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x66, 0x75, 0x6c,
|
||||
0x6c, 0x20, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x54, 0x43,
|
||||
0x50, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0xa, 0x9, 0x20,
|
||||
0x20, 0x20, 0x20, 0x6d, 0x61, 0x6b, 0x65, 0x73, 0x20, 0x6c,
|
||||
0x77, 0x49, 0x50, 0x20, 0x73, 0x75, 0x69, 0x74, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x75, 0x73, 0x65,
|
||||
0x20, 0x69, 0x6e, 0x20, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64,
|
||||
0x65, 0x64, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x73,
|
||||
0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x65, 0x6e, 0x73,
|
||||
0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x66, 0x20, 0x6b,
|
||||
0x69, 0x6c, 0x6f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x6f,
|
||||
0x66, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20, 0x52, 0x41, 0x4d,
|
||||
0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x6f, 0x6f, 0x6d, 0x20,
|
||||
0x66, 0x6f, 0x72, 0x20, 0x61, 0x72, 0x6f, 0x75, 0x6e, 0x64,
|
||||
0x20, 0x34, 0x30, 0x20, 0x6b, 0x69, 0x6c, 0x6f, 0x62, 0x79,
|
||||
0x74, 0x65, 0x73, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x6f,
|
||||
0x66, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x52, 0x4f, 0x4d,
|
||||
0x2e, 0xa, 0x9, 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa,
|
||||
0x9, 0x20, 0x20, 0x3c, 0x70, 0x3e, 0xa, 0x9, 0x20, 0x20,
|
||||
0x20, 0x20, 0x4d, 0x6f, 0x72, 0x65, 0x20, 0x69, 0x6e, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61,
|
||||
0x62, 0x6f, 0x75, 0x74, 0x20, 0x6c, 0x77, 0x49, 0x50, 0x20,
|
||||
0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x66, 0x6f, 0x75,
|
||||
0x6e, 0x64, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20,
|
||||
0x6c, 0x77, 0x49, 0x50, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20,
|
||||
0x68, 0x6f, 0x6d, 0x65, 0x70, 0x61, 0x67, 0x65, 0x20, 0x61,
|
||||
0x74, 0x20, 0x3c, 0x61, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20,
|
||||
0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70,
|
||||
0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63,
|
||||
0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d,
|
||||
0x2f, 0x6c, 0x77, 0x69, 0x70, 0x2f, 0x22, 0x3e, 0x68, 0x74,
|
||||
0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73,
|
||||
0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64,
|
||||
0x61, 0x6d, 0x2f, 0x6c, 0x77, 0x69, 0x70, 0x2f, 0x3c, 0x2f,
|
||||
0x61, 0x3e, 0x2e, 0xa, 0x9, 0x20, 0x20, 0x3c, 0x2f, 0x70,
|
||||
0x3e, 0xa, 0x9, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74,
|
||||
0x64, 0x3e, 0xa, 0x9, 0x20, 0x20, 0x26, 0x6e, 0x62, 0x73,
|
||||
0x70, 0x3b, 0xa, 0x9, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x2f, 0x74, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x3c, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa,
|
||||
0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f,
|
||||
0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0xa, };
|
||||
|
||||
const struct fsdata_file file_img_sics_gif[] = {{NULL, data_img_sics_gif, data_img_sics_gif + 14, sizeof(data_img_sics_gif) - 14}};
|
||||
|
||||
const struct fsdata_file file_404_html[] = {{file_img_sics_gif, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}};
|
||||
|
||||
const struct fsdata_file file_index_html[] = {{file_404_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __FSDATA_H__
|
||||
#define __FSDATA_H__
|
||||
|
||||
struct fsdata_file {
|
||||
const struct fsdata_file *next;
|
||||
const unsigned char *name;
|
||||
const unsigned char *data;
|
||||
const int len;
|
||||
};
|
||||
|
||||
struct fsdata_file_noconst {
|
||||
struct fsdata_file *next;
|
||||
unsigned char *name;
|
||||
unsigned char *data;
|
||||
int len;
|
||||
};
|
||||
|
||||
#define FS_ROOT file_index_html
|
||||
#define FS_NUMFILES 3
|
||||
|
||||
extern const struct fsdata_file file_img_sics_gif[];
|
||||
extern const struct fsdata_file file_404_html[];
|
||||
extern const struct fsdata_file file_index_html[];
|
||||
|
||||
|
||||
#endif /* __FSDATA_H__ */
|
|
@ -1,255 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
#include "lwipopts.h"
|
||||
#if defined(HTTP_RAW_USED)
|
||||
|
||||
#include <string.h>
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "httpd.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "fs.h"
|
||||
|
||||
struct http_state {
|
||||
char *file;
|
||||
u16_t left;
|
||||
u8_t retries;
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
conn_err(void *arg, err_t err)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
LWIP_UNUSED_ARG(err);
|
||||
|
||||
hs = arg;
|
||||
mem_free(hs);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
close_conn(struct tcp_pcb *pcb, struct http_state *hs)
|
||||
{
|
||||
tcp_arg(pcb, NULL);
|
||||
tcp_sent(pcb, NULL);
|
||||
tcp_recv(pcb, NULL);
|
||||
mem_free(hs);
|
||||
tcp_close(pcb);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
send_data(struct tcp_pcb *pcb, struct http_state *hs)
|
||||
{
|
||||
err_t err;
|
||||
u16_t len;
|
||||
|
||||
/* We cannot send more data than space available in the send
|
||||
buffer. */
|
||||
if (tcp_sndbuf(pcb) < hs->left) {
|
||||
len = tcp_sndbuf(pcb);
|
||||
} else {
|
||||
len = hs->left;
|
||||
}
|
||||
|
||||
do {
|
||||
err = tcp_write(pcb, hs->file, len, 0);
|
||||
if (err == ERR_MEM) {
|
||||
len /= 2;
|
||||
}
|
||||
} while (err == ERR_MEM && len > 1);
|
||||
|
||||
if (err == ERR_OK) {
|
||||
hs->file += len;
|
||||
hs->left -= len;
|
||||
/* } else {
|
||||
printf("send_data: error %s len %d %d\n", lwip_strerr(err), len, tcp_sndbuf(pcb));*/
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
http_poll(void *arg, struct tcp_pcb *pcb)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
hs = arg;
|
||||
|
||||
/* printf("Polll\n");*/
|
||||
if (hs == NULL) {
|
||||
/* printf("Null, close\n");*/
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
} else {
|
||||
++hs->retries;
|
||||
if (hs->retries == 4) {
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
send_data(pcb, hs);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
LWIP_UNUSED_ARG(len);
|
||||
|
||||
hs = arg;
|
||||
|
||||
hs->retries = 0;
|
||||
|
||||
if (hs->left > 0) {
|
||||
send_data(pcb, hs);
|
||||
} else {
|
||||
close_conn(pcb, hs);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
{
|
||||
int i;
|
||||
char *data;
|
||||
struct fs_file file;
|
||||
struct http_state *hs;
|
||||
|
||||
hs = arg;
|
||||
|
||||
if (err == ERR_OK && p != NULL) {
|
||||
|
||||
/* Inform TCP that we have taken the data. */
|
||||
tcp_recved(pcb, p->tot_len);
|
||||
|
||||
if (hs->file == NULL) {
|
||||
data = p->payload;
|
||||
|
||||
if (strncmp(data, "GET ", 4) == 0) {
|
||||
for(i = 0; i < 40; i++) {
|
||||
if (((char *)data + 4)[i] == ' ' ||
|
||||
((char *)data + 4)[i] == '\r' ||
|
||||
((char *)data + 4)[i] == '\n') {
|
||||
((char *)data + 4)[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (*(char *)(data + 4) == '/' &&
|
||||
*(char *)(data + 5) == 0) {
|
||||
fs_open("/index.html", &file);
|
||||
} else if (!fs_open((char *)data + 4, &file)) {
|
||||
fs_open("/404.html", &file);
|
||||
}
|
||||
|
||||
hs->file = file.data;
|
||||
hs->left = file.len;
|
||||
/* printf("data %p len %ld\n", hs->file, hs->left);*/
|
||||
|
||||
pbuf_free(p);
|
||||
send_data(pcb, hs);
|
||||
|
||||
/* Tell TCP that we wish be to informed of data that has been
|
||||
successfully sent by a call to the http_sent() function. */
|
||||
tcp_sent(pcb, http_sent);
|
||||
} else {
|
||||
pbuf_free(p);
|
||||
close_conn(pcb, hs);
|
||||
}
|
||||
} else {
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
if (err == ERR_OK && p == NULL) {
|
||||
close_conn(pcb, hs);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
http_accept(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
LWIP_UNUSED_ARG(err);
|
||||
|
||||
tcp_setprio(pcb, TCP_PRIO_MIN);
|
||||
|
||||
/* Allocate memory for the structure that holds the state of the
|
||||
connection. */
|
||||
hs = (struct http_state *)mem_malloc(sizeof(struct http_state));
|
||||
|
||||
if (hs == NULL) {
|
||||
//printf("http_accept: Out of memory\n");
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
/* Initialize the structure. */
|
||||
hs->file = NULL;
|
||||
hs->left = 0;
|
||||
hs->retries = 0;
|
||||
|
||||
/* Tell TCP that this is the structure we wish to be passed for our
|
||||
callbacks. */
|
||||
tcp_arg(pcb, hs);
|
||||
|
||||
/* Tell TCP that we wish to be informed of incoming data by a call
|
||||
to the http_recv() function. */
|
||||
tcp_recv(pcb, http_recv);
|
||||
|
||||
tcp_err(pcb, conn_err);
|
||||
|
||||
tcp_poll(pcb, http_poll, 4);
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
httpd_init(void)
|
||||
{
|
||||
struct tcp_pcb *pcb;
|
||||
|
||||
pcb = tcp_new();
|
||||
tcp_bind(pcb, IP_ADDR_ANY, 80);
|
||||
pcb = tcp_listen(pcb);
|
||||
tcp_accept(pcb, http_accept);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
344
network/httpd.c
344
network/httpd.c
|
@ -1,344 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Heavily modified by Adrian
|
||||
*
|
||||
* RepRapPro Ltd
|
||||
* http://reprappro.com
|
||||
*
|
||||
* 2 October 2013
|
||||
*
|
||||
*/
|
||||
|
||||
//#include "lwipopts.h"
|
||||
//#if defined(HTTP_RAW_USED)
|
||||
//
|
||||
//#include <string.h>
|
||||
//#include "lwip/debug.h"
|
||||
//#include "lwip/stats.h"
|
||||
//#include "httpd.h"
|
||||
//#include "lwip/tcp.h"
|
||||
//#include "fs.h"
|
||||
|
||||
#include "lwipopts.h"
|
||||
#if defined(HTTP_RAW_USED)
|
||||
|
||||
#include <string.h>
|
||||
#include "lwip/src/include/lwip/debug.h"
|
||||
#include "lwip/src/include/lwip/stats.h"
|
||||
#include "httpd.h"
|
||||
#include "lwip/src/include/lwip/tcp.h"
|
||||
#include "fs.h"
|
||||
|
||||
struct http_state
|
||||
{
|
||||
// Receive fields
|
||||
struct pbuf *pb;
|
||||
// Transmit fields
|
||||
char *file;
|
||||
u16_t left;
|
||||
u8_t retries;
|
||||
};
|
||||
|
||||
// Prototypes for the RepRap functions in Platform.cpp that we need to call.
|
||||
|
||||
void RepRapNetworkReceiveInput(const char* ip, int length, void* pcb, void* hs);
|
||||
void RepRapNetworkConnectionError(void* hs);
|
||||
void RepRapNetworkMessage(const char* s);
|
||||
void RepRapNetworkSentPacketAcknowledged(void *hs);
|
||||
|
||||
// Sanity check on initialisations.
|
||||
|
||||
static int initCount = 0;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
conn_err(void *arg, err_t err)
|
||||
{
|
||||
// Report the error to the monitor
|
||||
RepRapNetworkMessage("Network connection error, code ");
|
||||
{
|
||||
char tempBuf[10];
|
||||
snprintf(tempBuf, sizeof(tempBuf)/sizeof(char), "%d\n", err);
|
||||
RepRapNetworkMessage(tempBuf);
|
||||
}
|
||||
|
||||
struct http_state *hs = arg;
|
||||
RepRapNetworkConnectionError(hs); // tell the higher levels about the error
|
||||
mem_free(hs); // release the state data
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
close_conn(struct tcp_pcb *pcb, struct http_state *hs)
|
||||
{
|
||||
// RepRapNetworkMessage("close_conn called.\n");
|
||||
tcp_arg(pcb, NULL);
|
||||
tcp_sent(pcb, NULL);
|
||||
tcp_recv(pcb, NULL);
|
||||
mem_free(hs);
|
||||
tcp_close(pcb);
|
||||
}
|
||||
|
||||
//char scratch[40];
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
send_data(struct tcp_pcb *pcb, struct http_state *hs)
|
||||
{
|
||||
err_t err;
|
||||
u16_t len;
|
||||
|
||||
/* We cannot send more data than space available in the send
|
||||
buffer. */
|
||||
if (tcp_sndbuf(pcb) < hs->left) {
|
||||
len = tcp_sndbuf(pcb);
|
||||
} else {
|
||||
len = hs->left;
|
||||
}
|
||||
|
||||
// RepRapNetworkMessage("Sending ");
|
||||
// sprintf(scratch, "%d", len);
|
||||
// RepRapNetworkMessage(scratch);
|
||||
// RepRapNetworkMessage("..");
|
||||
|
||||
do {
|
||||
err = tcp_write(pcb, hs->file, len, 0); // Final arg - 1 means make a copy
|
||||
if (err == ERR_MEM) {
|
||||
len /= 2;
|
||||
}
|
||||
} while (err == ERR_MEM && len > 1);
|
||||
|
||||
if (err == ERR_OK)
|
||||
{
|
||||
tcp_output(pcb);
|
||||
hs->file += len;
|
||||
hs->left -= len;
|
||||
} else
|
||||
{
|
||||
RepRapNetworkMessage("send_data: error\n");
|
||||
//%s len %d %d\n", lwip_strerr(err), len, tcp_sndbuf(pcb));
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
http_poll(void *arg, struct tcp_pcb *pcb)
|
||||
{
|
||||
struct http_state *hs = arg;
|
||||
|
||||
if (hs == NULL)
|
||||
{
|
||||
RepRapNetworkMessage("Null, abort\n");
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
else
|
||||
{
|
||||
++hs->retries;
|
||||
if (hs->retries == 4)
|
||||
{
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
send_data(pcb, hs);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||
{
|
||||
struct http_state *hs = arg;
|
||||
|
||||
LWIP_UNUSED_ARG(len);
|
||||
|
||||
hs->retries = 0;
|
||||
|
||||
//RepRapNetworkMessage("..sent\n");
|
||||
|
||||
if (hs->left > 0)
|
||||
{
|
||||
send_data(pcb, hs);
|
||||
}
|
||||
else
|
||||
{
|
||||
// See if there is more to send
|
||||
RepRapNetworkSentPacketAcknowledged(hs);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
// RepRap calls this with data to send.
|
||||
// A null transmission implies the end of the data to be sent.
|
||||
|
||||
void RepRapNetworkSendOutput(char* data, int length, void* pc, void* h)
|
||||
{
|
||||
struct tcp_pcb* pcb = pc;
|
||||
struct http_state* hs = h;
|
||||
|
||||
if (hs == 0)
|
||||
{
|
||||
RepRapNetworkMessage("Attempt to write with null structure.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (hs->pb != NULL)
|
||||
{
|
||||
pbuf_free(hs->pb);
|
||||
hs->pb = NULL;
|
||||
}
|
||||
|
||||
if (length <= 0)
|
||||
{
|
||||
close_conn(pcb, hs);
|
||||
return;
|
||||
}
|
||||
|
||||
hs->file = data;
|
||||
hs->left = length;
|
||||
hs->retries = 0;
|
||||
|
||||
send_data(pcb, hs);
|
||||
|
||||
/* Tell TCP that we wish be to informed of data that has been successfully sent by a call to the http_sent() function. */
|
||||
|
||||
tcp_sent(pcb, http_sent);
|
||||
}
|
||||
|
||||
|
||||
// Return 1 if sending is OK, i.e. there is no send in progress, else 0
|
||||
int RepRapNetworkCanSend(void *arg)
|
||||
{
|
||||
struct http_state *hs = arg;
|
||||
return hs->left <= 0;
|
||||
}
|
||||
|
||||
static err_t
|
||||
http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
{
|
||||
struct http_state *hs = arg;
|
||||
|
||||
if (err == ERR_OK && p != NULL)
|
||||
{
|
||||
/* Inform TCP that we have taken the data. */
|
||||
tcp_recved(pcb, p->tot_len);
|
||||
|
||||
if (hs->file == NULL)
|
||||
{
|
||||
hs->pb = p;
|
||||
RepRapNetworkReceiveInput(p->payload, p->len, pcb, hs);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We are already sending data on this connection, so not expecting any messages on it
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
http_accept(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
{
|
||||
struct http_state *hs;
|
||||
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
LWIP_UNUSED_ARG(err);
|
||||
|
||||
tcp_setprio(pcb, TCP_PRIO_MIN);
|
||||
|
||||
//RepRapNetworkMessage("http_accept\n");
|
||||
|
||||
hs = (struct http_state *)mem_malloc(sizeof(struct http_state));
|
||||
|
||||
if (hs == NULL)
|
||||
{
|
||||
RepRapNetworkMessage("Out of memory!\n");
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
/* Initialize the structure. */
|
||||
hs->pb = NULL;
|
||||
hs->file = NULL;
|
||||
hs->left = 0;
|
||||
hs->retries = 0;
|
||||
|
||||
/* Tell TCP that this is the structure we wish to be passed for our callbacks. */
|
||||
tcp_arg(pcb, hs);
|
||||
|
||||
/* Tell TCP that we wish to be informed of incoming data by a call to the http_recv() function. */
|
||||
tcp_recv(pcb, http_recv);
|
||||
|
||||
tcp_err(pcb, conn_err);
|
||||
|
||||
tcp_poll(pcb, http_poll, 4);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
// This function (is)x should be called only once at the start.
|
||||
|
||||
void
|
||||
httpd_init(void)
|
||||
{
|
||||
struct tcp_pcb* pcb;
|
||||
|
||||
initCount++;
|
||||
if(initCount > 1)
|
||||
{
|
||||
RepRapNetworkMessage("httpd_init() called more than once.\n");
|
||||
}
|
||||
|
||||
pcb = tcp_new();
|
||||
tcp_bind(pcb, IP_ADDR_ANY, 80);
|
||||
pcb = tcp_listen(pcb);
|
||||
tcp_accept(pcb, http_accept);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __HTTPD_H__
|
||||
#define __HTTPD_H__
|
||||
|
||||
void httpd_init(void);
|
||||
|
||||
#endif /* __HTTPD_H__ */
|
Reference in a new issue