- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software without specific, written prior permission.
The author disclaim all warranties with regard to this
/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given
* given URL is invalid, and gives extra error information.
*/
/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given
* given URL is invalid, and gives extra error information.
*/
/** HTTP page to serve to the host when a HTTP request is made. This page is too long for a single response, thus it is automatically
* broken up into smaller blocks and sent as a series of packets each time the webserver application callback is run.
*/
/** HTTP page to serve to the host when a HTTP request is made. This page is too long for a single response, thus it is automatically
* broken up into smaller blocks and sent as a series of packets each time the webserver application callback is run.
*/
" <p>"
" Hello! Welcome to the LUFA RNDIS Demo Webserver test page, running on your USB AVR via the LUFA library. This demonstrates the HTTP webserver, TCP/IP stack and RNDIS demo all running atop the LUFA USB stack."
" <br /><br />"
" <p>"
" Hello! Welcome to the LUFA RNDIS Demo Webserver test page, running on your USB AVR via the LUFA library. This demonstrates the HTTP webserver, TCP/IP stack and RNDIS demo all running atop the LUFA USB stack."
" <br /><br />"
{
/* Returns true if the non null terminated string in RequestHeader matches the null terminated string Command */
return (strncmp((char*)RequestHeader, Command, strlen(Command)) == 0);
{
/* Returns true if the non null terminated string in RequestHeader matches the null terminated string Command */
return (strncmp((char*)RequestHeader, Command, strlen(Command)) == 0);
* \param[in] ConnectionState Pointer to a TCP Connection State structure giving connection information
* \param[in,out] Buffer Pointer to the application's send/receive packet buffer
*/
* \param[in] ConnectionState Pointer to a TCP Connection State structure giving connection information
* \param[in,out] Buffer Pointer to the application's send/receive packet buffer
*/
-void Webserver_ApplicationCallback(TCP_ConnectionState_t* ConnectionState, TCP_ConnectionBuffer_t* Buffer)
+void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
+ TCP_ConnectionBuffer_t* const Buffer)
/* Check to see if a packet has been received on the HTTP port from a remote host */
if (TCP_APP_HAS_RECEIVED_PACKET(Buffer))
{
/* Check to see if a packet has been received on the HTTP port from a remote host */
if (TCP_APP_HAS_RECEIVED_PACKET(Buffer))
{
/* Copy the HTTP 200 response header into the packet buffer */
strcpy_P(BufferDataStr, HTTP200Header);
/* Copy the HTTP 200 response header into the packet buffer */
strcpy_P(BufferDataStr, HTTP200Header);
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
{
/* Copy the HTTP 404 response header into the packet buffer */
strcpy_P(BufferDataStr, HTTP404Header);
{
/* Copy the HTTP 404 response header into the packet buffer */
strcpy_P(BufferDataStr, HTTP404Header);
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
strcpy_P(BufferDataStr, HTTP404Header);
/* Send the buffer contents to the host */
strcpy_P(BufferDataStr, HTTP404Header);
/* Send the buffer contents to the host */
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
{
/* Echo the host's query back to the host */
TCP_APP_SEND_BUFFER(Buffer, Buffer->Length);
{
/* Echo the host's query back to the host */
TCP_APP_SEND_BUFFER(Buffer, Buffer->Length);
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
/* Copy the next buffer sized block of the page to the packet buffer */
strncpy_P(BufferDataStr, &HTTPPage[PageBlock * HTTP_REPLY_BLOCK_SIZE], Length);
/* Copy the next buffer sized block of the page to the packet buffer */
strncpy_P(BufferDataStr, &HTTPPage[PageBlock * HTTP_REPLY_BLOCK_SIZE], Length);
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, Length);
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, Length);
{
/* Unlock the buffer so that the host can fill it with future packets */
TCP_APP_RELEASE_BUFFER(Buffer);
{
/* Unlock the buffer so that the host can fill it with future packets */
TCP_APP_RELEASE_BUFFER(Buffer);