2007-07-12 Joel Sherrill <joel.sherrill@oarcorp.com>

* shttpd/compat_rtems.c, shttpd/compat_rtems.h: Add port to listen on
	to shttpd initialization.
This commit is contained in:
Joel Sherrill
2007-07-12 20:01:35 +00:00
parent 962a025699
commit 83ca607775
3 changed files with 14 additions and 5 deletions

View File

@@ -1,3 +1,8 @@
2007-07-12 Joel Sherrill <joel.sherrill@oarcorp.com>
* shttpd/compat_rtems.c, shttpd/compat_rtems.h: Add port to listen on
to shttpd initialization.
2007-07-11 Joel Sherrill <joel.sherrill@oarcorp.com> 2007-07-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/src/malloc.c: Clean up Malloc debug code. * libcsupport/src/malloc.c: Clean up Malloc debug code.

View File

@@ -26,12 +26,13 @@
typedef struct RTEMS_HTTPD_ARGS { typedef struct RTEMS_HTTPD_ARGS {
rtems_shttpd_init init_callback; rtems_shttpd_init init_callback;
rtems_shttpd_addpages addpages_callback; rtems_shttpd_addpages addpages_callback;
unsigned int port;
char webroot[MAX_WEB_BASE_PATH_LENGTH]; char webroot[MAX_WEB_BASE_PATH_LENGTH];
} RTEMS_HTTPD_ARGS; } RTEMS_HTTPD_ARGS;
static int rtems_webserver_running = FALSE; //not running. static int rtems_webserver_running = FALSE; //not running.
static rtems_task rtems_httpd_daemon(rtems_task_argument args ) static rtems_task rtems_httpd_daemon(rtems_task_argument args)
{ {
RTEMS_HTTPD_ARGS *httpd_args = (RTEMS_HTTPD_ARGS*)args; RTEMS_HTTPD_ARGS *httpd_args = (RTEMS_HTTPD_ARGS*)args;
@@ -59,7 +60,7 @@ static rtems_task rtems_httpd_daemon(rtems_task_argument args )
free(httpd_args); free(httpd_args);
/* Open listening socket */ /* Open listening socket */
shttpd_listen(ctx, 9000); shttpd_listen(ctx, httpd_args->port);
rtems_webserver_running = TRUE; rtems_webserver_running = TRUE;
@@ -79,7 +80,8 @@ rtems_status_code rtems_initialize_webserver(rtems_task_priority initial_prior
rtems_attribute attribute_set, rtems_attribute attribute_set,
rtems_shttpd_init init_callback, rtems_shttpd_init init_callback,
rtems_shttpd_addpages addpages_callback, rtems_shttpd_addpages addpages_callback,
char *webroot char *webroot,
unsigned int port
) )
{ {
rtems_status_code sc; rtems_status_code sc;
@@ -95,6 +97,7 @@ rtems_status_code rtems_initialize_webserver(rtems_task_priority initial_prior
{ {
args->init_callback = init_callback; args->init_callback = init_callback;
args->addpages_callback = addpages_callback; args->addpages_callback = addpages_callback;
args->port = port;
strncpy(args->webroot,webroot,MAX_WEB_BASE_PATH_LENGTH); strncpy(args->webroot,webroot,MAX_WEB_BASE_PATH_LENGTH);
sc = rtems_task_create(rtems_build_name('H', 'T', 'P', 'D'), sc = rtems_task_create(rtems_build_name('H', 'T', 'P', 'D'),
@@ -119,7 +122,7 @@ rtems_status_code rtems_initialize_webserver(rtems_task_priority initial_prior
void rtems_terminate_webserver(void) void rtems_terminate_webserver(void)
{ {
rtems_webserver_running = FALSE; //not running, so terminate rtems_webserver_running = FALSE; // not running, so terminate
} }
int rtems_webserver_ok(void) int rtems_webserver_ok(void)

View File

@@ -56,7 +56,8 @@ rtems_status_code rtems_initialize_webserver(rtems_task_priority initial_prior
rtems_attribute attribute_set, rtems_attribute attribute_set,
rtems_shttpd_init init_callback, rtems_shttpd_init init_callback,
rtems_shttpd_addpages addpages_callback, rtems_shttpd_addpages addpages_callback,
char *webroot char *webroot,
unsigned int port
); );
void rtems_terminate_webserver(void); void rtems_terminate_webserver(void);
int rtems_webserver_ok(void); int rtems_webserver_ok(void);