#include <stdio.h>
#include <string.h>
#include "contiki-net.h"
#include "httpd-fs.h"
#include "httpd-cgi.h"
#include "lib/petsciiconv.h"
#include "ip64-webserver-http-strings.h"
#include "httpd.h"
#include "ledctrl.h"
Macros | |
#define | CONNS UIP_CONNS |
#define | ISO_ampersand 0x26 |
#define | ISO_bang 0x21 |
#define | ISO_colon 0x3a |
#define | ISO_nl 0x0a |
#define | ISO_percent 0x25 |
#define | ISO_period 0x2e |
#define | ISO_question 0x3F |
#define | ISO_slash 0x2f |
#define | ISO_space 0x20 |
#define | SEND_STRING(s, str) PSOCK_SEND(s, (uint8_t *)str, (unsigned int)strlen(str)) |
#define | STATE_OUTPUT 1 |
#define | STATE_WAITING 0 |
Functions | |
static unsigned short | generate (void *state) |
static void | handle_connection (struct httpd_state *s) |
void | httpd_appcall (void *state) |
void | httpd_init (void) |
uint8_t | httpd_sprint_ip4 (const uip_ip4addr_t *addr, char *result) |
uint8_t | httpd_sprint_ip6 (const uip_ip6addr_t *addr, char *result) |
if (ptr==NULL) | |
else | if (strncmp(ip64_webserver_http_html, ptr, 5)==0||strncmp(ip64_webserver_http_shtml, ptr, 6)==0) |
else | if (strncmp(ip64_webserver_http_css, ptr, 4)==0) |
else | if (strncmp(ip64_webserver_http_png, ptr, 4)==0) |
else | if (strncmp(ip64_webserver_http_gif, ptr, 4)==0) |
else | if (strncmp(ip64_webserver_http_jpg, ptr, 4)==0) |
if (!httpd_fs_open(s->filename,&s->file)) | |
if (ptr!=NULL &&strncmp(ptr, ip64_webserver_http_shtml, 6)==0) | |
if (strncmp(s->inputbuf, ip64_webserver_http_get, 4)!=0) | |
if (s->inputbuf[0]!=ISO_slash) | |
if (s->inputbuf[1]==ISO_space) | |
void | led_socket_callback (struct udp_socket *c, void *ptr, const uip_ipaddr_t *source_addr, uint16_t source_port, const uip_ipaddr_t *dest_addr, uint16_t dest_port, const uint8_t *data, uint16_t datalen) |
MEMB (conns, struct httpd_state, CONNS) | |
static void | next_scriptstate (struct httpd_state *s) |
petsciiconv_toascii (s->filename, sizeof(s->filename)) | |
petsciiconv_topetscii (s->filename, sizeof(s->filename)) | |
static PSOCK_SEND & | s (uint8_t *) s->file.data, s->len |
int | simple_udp_ping_send_ping (const uip_ipaddr_t *addr) |
strncpy (s->filename, s->inputbuf, sizeof(s->filename)) | |
while (s->file.len > 0) | |
while (1) | |
Variables | |
const uip_ipaddr_t * | addr = NULL |
s file | data = s->len |
static | do |
else | |
struct udp_socket | led_socket |
s file | len = s->len |
uint8_t | nbr_action |
uint8_t | nbr_id |
ptr = strrchr(s->filename, ISO_period) | |
PSOCK_END & | s |
s | state = STATE_OUTPUT |
static void * | uptr |
#define CONNS UIP_CONNS |
#define ISO_ampersand 0x26 |
#define ISO_bang 0x21 |
Referenced by while().
#define ISO_colon 0x3a |
Referenced by while().
#define ISO_nl 0x0a |
Referenced by next_scriptstate(), and while().
#define ISO_percent 0x25 |
Referenced by while().
#define ISO_period 0x2e |
#define ISO_question 0x3F |
#define ISO_slash 0x2f |
#define ISO_space 0x20 |
#define SEND_STRING | ( | s, | |
str | |||
) | PSOCK_SEND(s, (uint8_t *)str, (unsigned int)strlen(str)) |
#define STATE_OUTPUT 1 |
Referenced by handle_connection().
#define STATE_WAITING 0 |
Referenced by httpd_appcall().
|
static |
References httpd_fs_file::data, httpd_state::file, httpd_fs_file::len, httpd_state::len, s, uip_appdata, and uip_mss.
Referenced by PT_THREAD().
|
static |
References httpd_state::state, and STATE_OUTPUT.
Referenced by httpd_appcall().
void httpd_appcall | ( | void * | state | ) |
References handle_connection(), httpd_state::inputbuf, memb_alloc(), memb_free(), NULL, PSOCK_INIT, PT_INIT, httpd_state::sout, httpd_state::state, STATE_WAITING, tcp_markconn, httpd_state::timer, uip_abort, uip_aborted, uip_closed, uip_connected, uip_poll, and uip_timedout.
Referenced by PROCESS_THREAD().
void httpd_init | ( | void | ) |
References httpd_cgi_init(), led_socket, led_socket_callback(), LED_UDP_PORT, memb_init(), NULL, tcp_listen(), udp_socket_bind(), and udp_socket_register().
Referenced by PROCESS_THREAD().
uint8_t httpd_sprint_ip4 | ( | const uip_ip4addr_t * | addr, |
char * | result | ||
) |
References uip_ipaddr_to_quad.
Referenced by make_addrmap().
uint8_t httpd_sprint_ip6 | ( | const uip_ip6addr_t * | addr, |
char * | result | ||
) |
References i, and uip_ip6addr_t::u16.
Referenced by make_tcp_stats().
References ip64_webserver_http_content_type_binary.
else if | ( | strncmp(ip64_webserver_http_html, ptr, 5) | = = 0 || strncmp(ip64_webserver_http_shtml, ptr, 6) == 0 | ) |
else if | ( | strncmp(ip64_webserver_http_css, ptr, 4) | = = 0 | ) |
else if | ( | strncmp(ip64_webserver_http_png, ptr, 4) | = = 0 | ) |
else if | ( | strncmp(ip64_webserver_http_gif, ptr, 4) | = = 0 | ) |
else if | ( | strncmp(ip64_webserver_http_jpg, ptr, 4) | = = 0 | ) |
if | ( | ! | httpd_fs_opens->filename,&s->file | ) |
if | ( | ptr! | = NULL && strncmp(ptr, ip64_webserver_http_shtml, 6) == 0 | ) |
References PT_INIT, PT_WAIT_THREAD, and httpd_state::scriptpt.
if | ( | strncmp(s->inputbuf, ip64_webserver_http_get, 4)! | = 0 | ) |
References PSOCK_CLOSE_EXIT.
References PSOCK_CLOSE_EXIT.
References httpd_state::filename, ip64_webserver_http_index_html, and strncpy().
void led_socket_callback | ( | struct udp_socket * | c, |
void * | ptr, | ||
const uip_ipaddr_t * | source_addr, | ||
uint16_t | source_port, | ||
const uip_ipaddr_t * | dest_addr, | ||
uint16_t | dest_port, | ||
const uint8_t * | data, | ||
uint16_t | datalen | ||
) |
Referenced by httpd_init().
MEMB | ( | conns | , |
struct httpd_state | , | ||
CONNS | |||
) |
|
static |
References ISO_nl, NULL, httpd_state::scriptlen, and httpd_state::scriptptr.
Referenced by while().
Referenced by make_processes().
static PSOCK_SEND& s | ( | uint8_t * | ) | -> file.data, s->len |
int simple_udp_ping_send_ping | ( | const uip_ipaddr_t * | addr | ) |
while | ( | s->file. | len, |
0 | |||
) |
while | ( | 1 | ) |
References httpd_state::inputbuf, ip64_webserver_http_referer, ISO_nl, petsciiconv_topetscii(), PSOCK_DATALEN, and PSOCK_READTO.
const uip_ipaddr_t* addr = NULL |
do |
else |
struct udp_socket led_socket |
Referenced by httpd_init().
Referenced by _read(), _write(), acked(), casecmp(), cbcmac_calc(), cbcmac_verify(), crc16_data(), create(), dao_input(), decode_name(), dio_input(), event(), get_match_length(), handle_incoming_rreq(), input_callback(), ksz8851snl_read(), mdns_lookup(), mdns_query(), newdata(), output(), packetbuf_compact(), packetbuf_copyfrom(), packetbuf_reference(), packetbuf_set_datalen(), parse(), parse_headers(), parse_options(), parse_statusline(), PROCESS_THREAD(), PT_THREAD(), read(), receive_header_byte(), remove_trailing_dots(), rf212_read(), rpl_set_prefix(), send_one_packet(), send_packet(), send_rreq(), senddata(), sensors_find(), slip_poll_handler(), slip_write(), tcp_socket_send(), uip_packetqueue_set_buflen(), uip_udp_packet_send(), uiplib_ip6addrconv(), uncompress_hdr_hc06(), websocket_http_client_datahandler(), websocket_http_client_send(), and window_copy().
uint8_t nbr_action |
uint8_t nbr_id |
ptr = strrchr(s->filename, ISO_period) |
Referenced by ctimer_set(), event(), input(), memb_free(), packet_sent(), packet_timedout(), packetbuf_reference(), packetqueue_enqueue_packetbuf(), PROCESS_THREAD(), rtimer_set(), send_packet(), slip_send(), slip_write(), slipdev_send(), tcp_socket_register(), transmit_packet_list(), trickle_timer_set(), and udp_socket_register().
s state = STATE_OUTPUT |