Microchip® Advanced Software Framework

httpd-cgi.c File Reference
#include <stdio.h>
#include <string.h>
#include "contiki-net.h"
#include "httpd.h"
#include "httpd-cgi.h"
#include "httpd-fs.h"
#include "simple-rpl.h"
#include "net/rpl/rpl.h"
#include "net/rpl/rpl-private.h"
#include "lib/petsciiconv.h"
#include "simple-udp-ping.h"
#include "ip64-addrmap.h"
#include "network-reboot.h"

Macros

#define httpd_cgi_sprint_ip6   httpd_sprint_ip6
 
#define httpd_snprintf   snprintf
 
#define HTTPD_STRING_ATTR
 

Functions

static for (s->u.count=0;s->u.count< UIP_CONNS;++s->u.count)
 
 for (s->u.ptr=nbr_table_head(ds6_neighbors), nbr_no=1;s->u.ptr!=NULL;s->u.ptr=nbr_table_next(ds6_neighbors, s->u.ptr))
 
static unsigned short generate_file_stats (void *arg)
 
httpd_cgifunction httpd_cgi (char *name)
 
void httpd_cgi_add (struct httpd_cgi_call *c)
 
 HTTPD_CGI_CALL (file, file_name, file_stats)
 
 HTTPD_CGI_CALL (tcp, tcp_name, tcp_stats)
 
 HTTPD_CGI_CALL (proc, proc_name, processes)
 
 HTTPD_CGI_CALL (adrs, adrs_name, addresses)
 
 HTTPD_CGI_CALL (nbrs, nbrs_name, neighbors)
 
 HTTPD_CGI_CALL (nbrsping, nbrsping_name, neighborsping)
 
 HTTPD_CGI_CALL (nbrsled, nbrsled_name, neighborsled)
 
 HTTPD_CGI_CALL (rtes, rtes_name, routes)
 
 HTTPD_CGI_CALL (rtesping, rtesping_name, routesping)
 
 HTTPD_CGI_CALL (rplr, rplreset_name, rplreset)
 
 HTTPD_CGI_CALL (rplrt, rplroot_name, rplroot)
 
 HTTPD_CGI_CALL (amap, addrmap_name, addrmap)
 
 HTTPD_CGI_CALL (reboot, reboot_name, reboot_function)
 
void httpd_cgi_init (void)
 
 if (rpl_repair_root(RPL_DEFAULT_INSTANCE))
 
 if (ret==0)
 
static unsigned short make_addresses (void *p)
 
static unsigned short make_addrmap (void *p)
 
static unsigned short make_led_toggle (void *p)
 
static unsigned short make_neighbor (void *p)
 
static unsigned short make_neighbor_roomfor (void *p)
 
static unsigned short make_processes (void *p)
 
static unsigned short make_route (void *p)
 
static unsigned short make_routes_roomfor (void *p)
 
static unsigned short make_tcp_stats (void *arg)
 
 network_reboot_reboot (120)
 
static printf ("\n\r PT_THREAD, neighbors")
 
static printf ("\n\r PT_THREAD, neighborsping")
 
 printf ("\n\r PT_THREAD, neighborsled")
 
static printf ("\n\r PT_THREAD, routes")
 
static printf ("\n\r PT_THREAD, routesping")
 
static printf ("\n\r PT_THREAD, addrmap")
 
static printf ("\n\r PT_THREAD, rplreset")
 
 printf ("\n\r PT_THREAD, rplroot")
 
static printf ("\n\r PT_THREAD, reboot_function")
 
static PSOCK_GENERATOR_SENDs (void *)(strchr(ptr, ' ')+1)
 
static unsigned short write_mss_error (int code)
 

Variables

static const char called []
 
static struct httpd_cgi_callcalls = NULL
 
static const char closed []
 
static const char closing []
 
 else
 
static const char established []
 
static const char file_name []
 
static const char fin_wait_1 []
 
static const char fin_wait_2 []
 
static const char httpd_cgi_addrh[] HTTPD_STRING_ATTR = "<tr><td>"
 
static const char last_ack []
 
static uint8_t nbr_no = 1
 
static const char none []
 
static const char proc_name []
 
 ret = simple_rpl_init_dag_immediately()
 
static const char running []
 
static PSOCK_ENDs
 
static const char * states []
 
static const char syn_rcvd []
 
static const char syn_sent []
 
static const char tcp_name []
 
static const char time_wait []
 
uip_ds6_netif_t uip_ds6_if
 
uip_ds6_nbr_t uip_ds6_nbr_cache []
 

#define httpd_cgi_sprint_ip6   httpd_sprint_ip6
#define HTTPD_STRING_ATTR

for ( s->u.  count = 0; s->u.count < UIP_CONNS; ++s->u.count)
Initial value:
{
PSOCK_BEGIN(&s->sout)
#define PSOCK_BEGIN(psock)
Start the protosocket protothread in a function.
Definition: psock.h:164
PSOCK_END & s
Definition: wireless/SmartConnect_6LoWPAN/apps/ip64-webserver/httpd.c:132

References httpd_state::count, make_tcp_stats(), PSOCK_GENERATOR_SEND, httpd_state::sout, httpd_state::u, UIP_CLOSED, and UIP_TS_MASK.

Referenced by _rww_eeprom_emulator_move_data_to_spare(), tal_init(), tal_pib_set(), transmit_frame(), uhc_enumeration_step18_lpm(), and write_all_tal_pib_to_trx().

for ( s->u.  ptr = nbr_table_head(ds6_neighbors),
nbr_no  = 1; s->u.ptr != NULLs->u.ptr = nbr_table_next(ds6_neighbors, s->u.ptr) 
)
static unsigned short generate_file_stats ( void *  arg)
static
httpd_cgifunction httpd_cgi ( char *  name)
void httpd_cgi_add ( struct httpd_cgi_call c)

References c, httpd_cgi_call::next, and NULL.

Referenced by httpd_cgi_init().

HTTPD_CGI_CALL ( file  ,
file_name  ,
file_stats   
)
HTTPD_CGI_CALL ( tcp  ,
tcp_name  ,
tcp_stats   
)
HTTPD_CGI_CALL ( proc  ,
proc_name  ,
processes   
)
HTTPD_CGI_CALL ( adrs  ,
adrs_name  ,
addresses   
)
HTTPD_CGI_CALL ( nbrs  ,
nbrs_name  ,
neighbors   
)
HTTPD_CGI_CALL ( nbrsping  ,
nbrsping_name  ,
neighborsping   
)
HTTPD_CGI_CALL ( nbrsled  ,
nbrsled_name  ,
neighborsled   
)
HTTPD_CGI_CALL ( rtes  ,
rtes_name  ,
routes   
)
HTTPD_CGI_CALL ( rtesping  ,
rtesping_name  ,
routesping   
)
HTTPD_CGI_CALL ( rplr  ,
rplreset_name  ,
rplreset   
)
HTTPD_CGI_CALL ( rplrt  ,
rplroot_name  ,
rplroot   
)
HTTPD_CGI_CALL ( amap  ,
addrmap_name  ,
addrmap   
)
HTTPD_CGI_CALL ( reboot  ,
reboot_name  ,
reboot_function   
)
void httpd_cgi_init ( void  )

References httpd_cgi_add(), and simple_udp_ping_init().

Referenced by httpd_init().

else if ( ret  = = 0)
static unsigned short make_led_toggle ( void *  p)
static
static unsigned short make_neighbor_roomfor ( void *  p)
static
static unsigned short make_processes ( void *  p)
static
network_reboot_reboot ( 120  )
static printf ( "\n\r  PT_THREAD,
neighbors"   
)
static printf ( "\n\r  PT_THREAD,
neighborsping"   
)
printf ( "\n\r  PT_THREAD,
neighborsled"   
)
static printf ( "\n\r  PT_THREAD,
routes"   
)
static printf ( "\n\r  PT_THREAD,
routesping"   
)
static printf ( "\n\r  PT_THREAD,
addrmap"   
)
static printf ( "\n\r  PT_THREAD,
rplreset"   
)
printf ( "\n\r  PT_THREAD,
rplroot"   
)
static printf ( "\n\r  PT_THREAD,
reboot_function"   
)
static PSOCK_GENERATOR_SEND& s ( void *  )
static unsigned short write_mss_error ( int  code)
static

const char called[]
static
Initial value:
=
{ 0x43, 0x41, 0x4c, 0x4c, 0x45, 0x44, 0 }
struct httpd_cgi_call* calls = NULL
static
const char closed[]
static
Initial value:
=
{ 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0 }
const char closing[]
static
Initial value:
=
{ 0x43, 0x4c, 0x4f, 0x53, 0x49,
0x4e, 0x47, 0
}
else
Initial value:
{
PSOCK_SEND_STR(&s->sout, "Could not start global network repair")
#define PSOCK_SEND_STR(psock, str)
Send a null-terminated string.
Definition: psock.h:197
PSOCK_END & s
Definition: wireless/SmartConnect_6LoWPAN/apps/ip64-webserver/httpd.c:132
const char established[]
static
Initial value:
=
{ 0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49,
0x53, 0x48, 0x45, 0x44, 0
}
const char file_name[]
static
Initial value:
=
{ 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74,
0x61, 0x74, 0x73, 0
}
const char fin_wait_1[]
static
Initial value:
=
{ 0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,
0x54, 0x2d, 0x31, 0
}
const char fin_wait_2[]
static
Initial value:
=
{ 0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,
0x54, 0x2d, 0x32, 0
}
const char reboot_name [] HTTPD_STRING_ATTR = "<tr><td>"
static
const char last_ack[]
static
Initial value:
=
{ 0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43,
0x4b, 0
}
uint8_t nbr_no = 1
static
const char none[]
static
Initial value:
=
{ 0x4e, 0x4f, 0x4e, 0x45, 0 }
const char proc_name[]
static
Initial value:
=
{ 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x65, 0x73, 0
}

Referenced by _exosite_example_configure_http_client(), _sd_init(), anp_client_discovery_complete_handler(), app_debounce_button(), app_wifi_init(), ble_scan_duplication_check(), BuildServerX509CertChain(), burn_certificates(), call_process(), Cert_ComputeTBSCertHash(), chip_apply_conf(), chip_deinit(), chip_reset(), chip_reset_and_cpu_halt(), chip_sleep(), chip_wake(), configure_http_client(), cpu_halt(), cpu_start(), CryptoDecodeRsaPrivKey(), CryptoX509CertDecode(), DecodeBase64File(), demo_start(), EcdsaBuildServerX509CertChain(), enable_disable_ap_mode(), enable_interrupts(), enter_wifi_firmware_download(), execute_state_machine(), exosite_example_activiate(), exosite_example_read_and_write(), get_gpio_val(), get_sensor_value(), GetRootCertificate(), gpio_ioctl(), handle_incoming_rrep(), handle_incoming_rreq(), hif_check_compatibility(), hif_chip_sleep(), hif_chip_wake(), hif_deinit(), hif_enable_access(), hif_handle_isr(), hif_init(), hif_isr(), hif_receive(), hif_register_cb(), hif_send(), hif_set_rx_done(), iot_tls_connect(), iot_tls_read(), iot_tls_write(), IperfCreate(), IperfSocketEventHandler(), IperfTCP_SendTestPacket(), IperfUDP_SendTestPacket(), is_exist_file(), m2m_ota_abort(), m2m_ota_get_firmware_version(), m2m_ota_init(), m2m_ota_notif_check_for_update(), m2m_ota_notif_sched(), m2m_ota_notif_set_url(), m2m_ota_rollback(), m2m_ota_start_update(), m2m_ota_switch_firmware(), m2m_wifi_check_ota_rb(), m2m_wifi_connect_1x_mschap2(), m2m_wifi_connect_1x_tls(), m2m_wifi_connect_open(), m2m_wifi_connect_prepare_msg(), m2m_wifi_connect_psk(), m2m_wifi_connect_wep(), m2m_wifi_disable_ap(), m2m_wifi_download_mode(), m2m_wifi_enable_ap_ext(), m2m_wifi_enable_firmware_logs(), m2m_wifi_get_firmware_version(), m2m_wifi_get_mac_address(), m2m_wifi_get_otp_mac_address(), m2m_wifi_handle_events(), m2m_wifi_init(), m2m_wifi_init_hold(), m2m_wifi_init_start(), m2m_wifi_p2p(), m2m_wifi_p2p_disconnect(), m2m_wifi_prng_get_random_bytes(), m2m_wifi_reinit(), m2m_wifi_req_client_ctrl(), m2m_wifi_req_curr_rssi(), m2m_wifi_req_restrict_ble(), m2m_wifi_req_scan_result(), m2m_wifi_req_server_init(), m2m_wifi_req_unrestrict_ble(), m2m_wifi_request_sleep(), m2m_wifi_set_battery_voltage(), m2m_wifi_set_cust_InfoElement(), m2m_wifi_set_gain_table_idx(), m2m_wifi_set_gains(), m2m_wifi_set_power_profile(), m2m_wifi_set_sleep_mode(), m2m_wifi_set_tx_power(), m2m_wifi_wps_disable(), main(), nbr_table_remove(), netstack_aes_decrypt(), netstack_aes_encrypt(), netstack_aes_verify(), nm_bus_iface_deinit(), nm_bus_iface_init(), nm_bus_iface_reconfigure(), nm_bus_reset(), nm_cpu_start(), nm_drv_deinit(), nm_drv_init(), nm_drv_init_download_mode(), nm_drv_init_hold(), nm_drv_init_start(), nm_get_firmware_full_info(), nm_get_firmware_info(), nm_get_hif_info(), nm_get_ota_firmware_info(), nmi_get_mac_address(), nmi_get_otp_mac_address(), output(), overwrite_efuse_struct(), ParsePrivKey(), ParseRsaPrivKey(), platform_init(), qsend_list(), qsend_packet(), ReadServerX509Chain(), RsaBuildServerX509CertChain(), rtimer_arch_init(), run_sample_test_app(), run_udp_client(), send_one_packet(), send_packet(), set_gpio_dir(), set_gpio_val(), spi_flash_erase(), spi_flash_load_to_cortus_mem(), spi_flash_page_program(), spi_flash_pp(), spi_flash_rdid(), spi_flash_read(), spi_flash_read_internal(), spi_flash_read_status_reg(), spi_flash_sector_erase(), spi_flash_write(), spi_flash_write_disable(), spi_flash_write_enable(), store_file_packet(), tcpip_input(), tcpip_output(), test_call(), test_case_run(), test_suite_run(), tick_counter_check_timer(), TlsSrvSecFwrite(), TlsSrvSecWriteCertChain(), trx_bit_read(), uip_udp_packet_send(), uip_udp_packet_sendto(), update_control_structure(), ValidateKeyMaterial(), wait_for_bootrom(), wait_for_firmware_start(), websocket_open(), wifi_ap_provision(), winc_flash_compare(), winc_flash_write_verify(), winc_init(), WriteRootCertificate(), WriteTlsCertificate(), and WriteTlsServerKeyMaterial().

const char running[]
static
Initial value:
=
{ 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47,
0
}
Initial value:
{
PSOCK_BEGIN(&s->sout)
#define PSOCK_BEGIN(psock)
Start the protosocket protothread in a function.
Definition: psock.h:164
PSOCK_END & s
Definition: wireless/SmartConnect_6LoWPAN/apps/ip64-webserver/httpd.c:132
const char* states[]
static
Initial value:
= {
}
static const char called[]
Definition: httpd-cgi.c:106
static const char syn_sent[]
Definition: httpd-cgi.c:72
static const char syn_rcvd[]
Definition: httpd-cgi.c:68
static const char closed[]
Definition: httpd-cgi.c:66
static const char closing[]
Definition: httpd-cgi.c:88
static const char running[]
Definition: httpd-cgi.c:102
static const char fin_wait_2[]
Definition: httpd-cgi.c:84
static const char fin_wait_1[]
Definition: httpd-cgi.c:80
static const char last_ack[]
Definition: httpd-cgi.c:96
static const char none[]
Definition: httpd-cgi.c:100
static const char time_wait[]
Definition: httpd-cgi.c:92
static const char established[]
Definition: httpd-cgi.c:76

Referenced by make_processes(), and make_tcp_stats().

const char syn_rcvd[]
static
Initial value:
=
{ 0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56,
0x44, 0
}
const char syn_sent[]
static
Initial value:
=
{ 0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e,
0x54, 0
}
const char tcp_name[]
static
Initial value:
=
{ 0x74, 0x63, 0x70, 0x2d, 0x63, 0x6f, 0x6e,
0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0
}
const char time_wait[]
static
Initial value:
=
{ 0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41,
0x49, 0x54, 0
}
uip_ds6_nbr_t uip_ds6_nbr_cache[]