46#include "lwip/apps/httpd.h"
50#include "lwip/tcpip.h"
56#if !defined(LWIP_HTTPD_CGI)
57#error "http_rest requires HTTPD CGI"
79static const char*
cgi_set_string(
int index,
int nparams,
char *params[],
char *values[])
85 for (i = 0; i < nparams; i++)
87 if (!strncmp(params[i],
"value",
sizeof(
"value")))
90 return "success.html";
116 static const char successhtml[] =
"<html><body>Success</body></html>";
118 restfs_write_const(fil, successhtml);
128 static const char failedhtml[] =
"<html><body>Failed</body></html>";
130 restfs_write_const(fil, failedhtml);
140 restfs_alloc_buffer(fil, 20);
142 restfs_printf(fil,
"Hello World");
174 printf(
"\n\nMorse HTTP Demo (Built " __DATE__
" " __TIME__
")\n\n");
static bool mmosal_safer_strcpy(char *dst, const char *src, size_t size)
A safer version of strncpy.
static void rest_ep_failed(struct restfs_file *fil)
Example endpoint to return fixed html string.
static const char * cgi_set_string(int index, int nparams, char *params[], char *values[])
Example CGI handler to set a global variable based on query parameters.
static const struct rest_endpoint rest_endpoints[]
Vector table of rest endpoints.
static void rest_ep_success(struct restfs_file *fil)
Example endpoint to return fixed html string.
static const tCGI cgi_endpoints[]
Vector table of LWIP CGI endpoints.
static void rest_ep_getstring(struct restfs_file *fil)
Get the string previously set by set_string.
static void rest_ep_hello(struct restfs_file *fil)
Hello world example endpoint.
static char cgi_string[32]
Buffer to store the string set by cgi_set_string()
void app_init(void)
Main entry point to the application.
Morse Micro application helper routines for initializing/de-initializing the Wireless LAN interface a...
void app_wlan_init(void)
Initializes the WLAN interface (and dependencies) using settings specified in the config store.
void app_wlan_start(void)
Starts the WLAN interface and connects to Wi-Fi using settings specified in the config store.
Opaque object used for writing REST output data.