/*---------------------------------------------------------------------------*/ static unsigned short generate_header(void *hstr) { uint8_t slen = httpd_strlen((char *) hstr); httpd_memcpy(uip_appdata, httpd_str_content, sizeof (httpd_str_content) - 1); httpd_memcpy(uip_appdata + sizeof (httpd_str_content) - 1, (char *) hstr, slen); slen += sizeof (httpd_str_content) - 1; httpd_memcpy(uip_appdata + slen, httpd_str_crlf, sizeof (httpd_str_crlf) - 1); return slen + 4; }
/*---------------------------------------------------------------------------*/ static unsigned short generate_status(void *sstr) { uint8_t slen = httpd_strlen((char *) sstr); httpd_memcpy(uip_appdata, httpd_str_http, sizeof (httpd_str_http) - 1); httpd_memcpy(uip_appdata + sizeof (httpd_str_http) - 1, (char *) sstr, slen); slen += sizeof (httpd_str_http) - 1; httpd_memcpy(uip_appdata + slen, httpd_str_server, sizeof (httpd_str_server) - 1); return slen + sizeof (httpd_str_server) - 1; }
/*---------------------------------------------------------------------------*/ httpd_cgifunction httpd_cgi(char *name) { struct httpd_cgi_call *f; /* Find the matching name in the table, return the function. */ for(f = calls; f != NULL; f = f->next) { if(httpd_strncmp(name, f->name, httpd_strlen(f->name)) == 0) { return f->function; } } return nullfunction; }