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
static struct dhcpc_state s
Definition: dhcpc.c:45

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

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")
static struct dhcpc_state s
Definition: dhcpc.c:45
#define PSOCK_SEND_STR(psock, str)
Send a null-terminated string.
Definition: psock.h:197
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
}
const char running[]
static
Initial value:
=
{ 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47,
0
}
PSOCK_END & s
Initial value:
{
PSOCK_BEGIN(&s->sout)
#define PSOCK_BEGIN(psock)
Start the protosocket protothread in a function.
Definition: psock.h:164
static struct dhcpc_state s
Definition: dhcpc.c:45
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[]