#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 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 | ) |
Referenced by main(), and 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, result, uip_ip6addr_t::u16, and uip_ntohs.
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 | ) |
Referenced by _load_setting_from_sd(), addToAckWaitList(), demo_wifi_state(), extractClientToken(), FreeRTOS_CLIProcessCommand(), http_socket_get(), http_socket_post(), if(), m2m_wifi_state(), make_processes(), parse_headers(), parse_url(), prvHelpCommand(), prvInitialiseTCBVariables(), rename_to_unique(), websocket_http_client_get(), websocket_open(), and window_copy().
while | ( | s->file. | len, |
0 | |||
) |
References httpd_fs_file::data, httpd_state::file, httpd_cgi(), httpd_fs_open(), ISO_bang, ISO_colon, ISO_percent, httpd_fs_file::len, httpd_state::len, next_scriptstate(), NULL, PT_WAIT_THREAD, httpd_state::scriptlen, httpd_state::scriptpt, httpd_state::scriptptr, and uip_mss.
Referenced by uhi_cdc_install().
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(), app_wifi_init(), base64decode(), ble_trans_service_send_buf(), casecmp(), cbcmac_calc(), cbcmac_verify(), cgi_GetStaus(), crc16_data(), crc7(), create(), csc_app_send_buf(), csc_serv_init(), cycle(), dao_input(), decodePacket(), dio_input(), dsu_crc32_cal(), dump_hex_buffer(), eddystone_set_encoded_url(), event(), fetch_data(), fmp_target_connected_state_handler(), get_length(), get_match_length(), getLenStringLen(), handle_incoming_rreq(), handlePublish(), handlePubrec(), hid_get_reportchar(), hid_get_reportid(), hid_serv_report_map(), http_send_data(), http_write(), input_callback(), iot_tls_read(), iot_tls_write(), isSubStr(), keepalive(), ksz8851snl_read(), ksz8851snl_update(), m2m_wifi_ble_api_send(), m2m_wifi_connect_sc(), main(), MQTTConnect(), MQTTDeserialize_connect(), MQTTDisconnect(), MQTTPacket_decode(), MQTTPacket_read(), MQTTPublish(), MQTTResubscribe(), MQTTSerialize_connect(), MQTTSerialize_connectLength(), MQTTSerialize_GetConnectLength(), MQTTSerialize_GetPublishLength(), MQTTSerialize_GetSubscribePacketLength(), MQTTSerialize_GetUnsubscribePacketLength(), MQTTSerialize_publishLength(), MQTTSerialize_subscribeLength(), MQTTSerialize_unsubscribeLength(), MQTTstrlen(), MQTTSubscribe(), MQTTUnsubscribe(), newdata(), numtostring(), output(), packetbuf_compact(), packetbuf_copyfrom(), packetbuf_reference(), packetbuf_set_datalen(), parse(), parse_headers(), parse_options(), parse_statusline(), pbuf_clen(), pbuf_copy(), pbuf_copy_partial(), pbuf_header(), pbuf_take(), pds_calc_crc(), pds_nvm_read(), pds_write(), platform_interface_callback(), platform_send_sync(), PROCESS_THREAD(), PT_THREAD(), pxp_reporter_connected_state_handler(), read(), readInt(), readPacket(), readPacketId(), receive_header_byte(), rf212_read(), rf233_read(), rpl_set_prefix(), send_one_packet(), send_packet(), send_rreq(), senddata(), sensors_find(), set_dev_name_to_mac(), slip_poll_handler(), slip_write(), slipdev_init(), slipdev_poll(), tcp_socket_send(), uhc_enumeration_step17_lpm(), uip_packetqueue_set_buflen(), uip_udp_packet_send(), uiplib_ip6addrconv(), uncompress_hdr_hc06(), uncompress_hdr_hc1(), websocket_http_client_datahandler(), websocket_http_client_send(), wifiscan_print_char(), WINC1500_read(), WINC1500_write(), window_copy(), and writeCString().
uint8_t nbr_action |
uint8_t nbr_id |
ptr = strrchr(s->filename, ISO_period) |
Referenced by _http_client_handle_header(), _http_client_request(), _json_parse(), _load_setting_from_sd(), ctimer_set(), event(), inet_ntoa(), input(), json_find(), json_get_child(), json_get_child_count(), mem_malloc(), mem_trim(), memb_free(), MQTTSerialize_ack(), MQTTSerialize_connack(), MQTTSerialize_connect(), MQTTSerialize_publish(), MQTTSerialize_suback(), MQTTSerialize_subscribe(), MQTTSerialize_unsuback(), MQTTSerialize_unsubscribe(), MQTTSerialize_zero(), packet_sent(), packet_timedout(), packetbuf_reference(), packetqueue_enqueue_packetbuf(), PROCESS_THREAD(), readInt(), readPacketId(), readSizeT(), rtimer_set(), sam_ba_monitor_run(), send_packet(), slip_send(), slip_write(), slipdev_send(), tal_pib_set(), tcp_socket_register(), tis_current_time_read_response(), transmit_packet_list(), trickle_timer_set(), and udp_socket_register().
PT_END & s |
Referenced by add_req_ipaddr(), add_server_id(), appcall(), create_msg(), dhcpc_init(), dhcpc_request(), event(), generate(), http_socket_close(), if(), ifft(), inform_wifi_connection_state(), input(), ip64_dhcpc_init(), ip64_dhcpc_request(), mem_cmp(), mem_cpy(), msg_for_me(), parse_msg(), parse_options(), phase_wait(), PROCESS_THREAD(), provisioning_app_processing(), rime_sniffer_add(), start_provisioning_app(), websocket_http_client_aborted(), websocket_http_client_appcall(), websocket_http_client_closed(), websocket_http_client_connected(), websocket_http_client_datahandler(), websocket_http_client_timedout(), while(), wifi_provision_app_credentials_update(), wifi_provision_set_state(), wifi_provision_svc_changed_handler(), and wificon_connect_noti().
s state = STATE_OUTPUT |
Referenced by appcall(), get_global_addr(), ip64_init(), make_processes(), netif_add(), nwkFrameAlloc(), platform_interface_callback(), resolve_cb(), rf233_transmit(), run_ac_single_shot_test(), run_ac_window_mode_test(), rxbuf_init(), sd_mmc_select_slot(), set_global_address(), set_main_state(), set_state(), simple_rpl_global_address(), simple_rpl_init_dag_immediately(), slip_input_byte(), slip_poll_handler(), socket_cb(), uip_ds6_nbr_add(), wait_for_event(), and websocket_http_client_appcall().