/* SHTTPD Extensions * * $Id$ */ #if defined(USE_SIMPLE_HTTPD) #include #include #include #include #include #define START_HTML_BODY \ "HTTP/1.1 200 OK\r\n" \ "Content-Type: text/html\r\n\r\n" \ "\r\n" #define END_HTML_BODY \ void example_shttpd_callback(struct shttpd_arg *arg) { const char *query; query = shttpd_get_env(arg, "QUERY_STRING" ); if ( !query ) query = ""; /* fprintf( stderr, "RTEMS Request -%s-\n", query ); */ if ( !strcmp( query, "cpuuse_report" ) ) { rtems_cpu_usage_report_with_handler( arg, shttpd_printf ); } else if ( !strcmp( query, "cpuuse_reset" ) ) { rtems_cpu_usage_reset(); shttpd_printf( arg, START_HTML_BODY "

CPU Usage data reset -- return to the previous page

" END_HTML_BODY ); } else if ( !strcmp( query, "stackuse_report" ) ) { rtems_stack_checker_report_usage_with_handler( arg, shttpd_printf ); } else { shttpd_printf( arg, START_HTML_BODY "

Unknown Request

" "

URI: %s
" " Arguments: %s

" END_HTML_BODY, shttpd_get_env(arg, "REQUEST_URI"), query ); } arg->flags |= SHTTPD_END_OF_OUTPUT; } void example_shttpd_addpages(struct shttpd_ctx *ctx) { shttpd_register_uri( ctx, "/queries*", example_shttpd_callback, NULL ); } #endif