Changeset d51420e in network-demos


Ignore:
Timestamp:
Jul 12, 2007, 7:05:08 PM (12 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master, network-demos-4-10-branch, network-demos-4-8-branch, network-demos-4-9-branch
Children:
20ce4cb
Parents:
f655979
Message:

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

  • ChangeLog?, Makefile, init.c: No switchable from GoAhead? to SHTTPD but defaults to SHTTPD. The displayed index.html will indicate which httpd implementation is enabled. The user should edit the Makefile to switch settings.
  • index.html.in: New file.
  • rootfs/index.html: Removed.
Location:
http
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • http/ChangeLog

    rf655979 rd51420e  
     12007-07-12      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * ChangeLog, Makefile, init.c: No switchable from GoAhead to SHTTPD but
     4        defaults to SHTTPD. The displayed index.html will indicate which
     5        httpd implementation is enabled. The user should edit the Makefile to
     6        switch settings.
     7        * index.html.in: New file.
     8        * rootfs/index.html: Removed.
     9
     102007-07-12      Joel Sherrill <joel.sherrill@oarcorp.com>
     11
     12        * Makefile, init.c: No switchable from GoAhead to SHTTPD but defaults
     13        to SHTTPD. The displayed index.html will indicate which httpd
     14        implementation is enabled. The user should edit the Makefile to
     15        switch settings.
     16        * index.html.in: New file.
     17        * rootfs/index.html: Removed.
     18
    1192007-07-11      Joel Sherrill <joel.sherrill@oarcorp.com>
    220
  • http/Makefile

    rf655979 rd51420e  
    1919
    2020SRCS=$(DOCS) $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
    21 OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
     21OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) $(ARCH)/tarfile.o
    2222
    2323PRINT_SRCS=$(DOCS)
     
    3535DEFINES  +=
    3636CPPFLAGS +=
    37 CFLAGS   += -DWEBS -DUEMF
    3837CFLAGS_LD += -Wl,--defsym -Wl,HeapSize=0xC0000
    3938CFLAGS_OPTIMIZE_V   +=
     
    4140
    4241LD_PATHS  +=
    43 LD_LIBS   += -lhttpd
    44 LD_LIBS   += -lftpd
     42
    4543#NATIVE_OBJ = $(shell $(OBJCOPY) 2>&1  | grep copy: | cut -d':' -f3 | cut -d' ' -f2)
    4644OBJDUMP=$(OBJCOPY:copy=dump)
     45
     46USE_GOHEAD=no
     47USE_SIMPLE=yes
     48USE_FTPD=yes
     49ifeq ($(USE_GOHEAD),yes)
     50  HTTPD     = GoAhead Web Server
     51  CFLAGS   += -DWEBS -DUEMF -DUSE_GOAHEAD_HTTPD
     52  LD_LIBS  += -lhttpd
     53endif
     54
     55ifeq ($(USE_SIMPLE),yes)
     56  HTTPD     = Simple HTTPD Web Server
     57  CFLAGS   += -DUSE_SIMPLE_HTTPD
     58  LD_LIBS  += -lshttpd
     59endif
     60
     61ifeq ($(USE_FTPD),yes)
     62  CFLAGS   += -DUSE_FTPD
     63  LD_LIBS  += -lftpd
     64endif
    4765
    4866#
     
    5371#
    5472
    55 CLEAN_ADDITIONS += tarfile obj_format
     73CLEAN_ADDITIONS += tarfile obj_format stamp-index-html rootfs/index.html
    5674CLOBBER_ADDITIONS +=
    5775
     
    6583            sed -e 's/^.*format //' >obj_format
    6684
    67 ${PGM}: $(OBJS) obj_format $(LINK_FILES)
     85${PGM}: $(OBJS) $(LINK_FILES)
     86        $(make-exe)
     87
     88$(ARCH)/tarfile.o: $(ARCH) stamp-index-html obj_format
    6889        cd rootfs ; tar cf ../$(ARCH)/tarfile --exclude CVS .
    6990        cp $(ARCH)/tarfile .
    7091        $(OBJCOPY) -I binary -O `cat obj_format` tarfile $(ARCH)/tarfile.o
    71         $(LD) $(LD_CPU_CFLAGS) -r -o $(ARCH)/temp.o \
    72             $(ARCH)/init.o $(ARCH)/tarfile.o
    73         $(MV) $(ARCH)/temp.o  $(ARCH)/init.o
    74         $(RM) $(ARCH)/temp.o
    75         $(make-exe)
     92        $(LD) $(LD_CPU_CFLAGS) -r -o $(ARCH)/temp.o $(ARCH)/tarfile.o
     93
     94stamp-index-html: index.html.in
     95ifneq ($(HTTPD),)
     96        sed -e 's/@SERVER@/$(HTTPD)/' <index.html.in >rootfs/index.html
     97endif
     98        touch stamp-index-html
    7699
    77100# Install the program(s), appending _g or _p as appropriate.
  • http/index.html.in

    rf655979 rd51420e  
    11<HTML>
    2 <HEAD><TITLE>RTEMS GoAhead Test Page</TITLE></HEAD>
     2<HEAD><TITLE>RTEMS @SERVER@ Test Page</TITLE></HEAD>
    33<BODY BGCOLOR="FFFFFF">
    44<center>
    5 <H1>RTEMS GoAhead Web Server Test Page</H1>
     5<H1>RTEMS @SERVER@ Test Page</H1>
    66<A HREF="http://www.rtems.org">
    77  <IMG align=center BORDER=0 SRC="rtems_logo.jpg" ALT="RTEMS"> </A>
    88
    99<P><big>Congratulations, you have successfully loaded your first page
    10 from the GoAhead Web Server running on RTEMS.</big></P>
     10from the @SERVER@ running on RTEMS.</big></P>
    1111</center>
    1212</BODY></HTML>
  • http/init.c

    rf655979 rd51420e  
    55 *  Don't forget to change the IP addresses
    66 */
    7 
    8 #define USE_HTTPD
    9 #define USE_FTPD
    10 #define TEST_INIT
    117
    128#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     
    7369
    7470#if defined(USE_FTPD)
    75 struct rtems_ftpd_configuration rtems_ftpd_configuration = {
    76    10,                     /* FTPD task priority            */
    77    1024,                   /* Maximum buffersize for hooks  */
    78    21,                     /* Well-known port     */
    79    NULL                    /* List of hooks       */
    80 };
     71  boolean FTPD_enabled = TRUE;
     72  struct rtems_ftpd_configuration rtems_ftpd_configuration = {
     73    10,                     /* FTPD task priority            */
     74    1024,                   /* Maximum buffersize for hooks  */
     75    21,                     /* Well-known port     */
     76    NULL                    /* List of hooks       */
     77 };
     78#else
     79 boolean FTPD_enabled = FALSE;
    8180#endif
    8281
    83 /* GoAhead Trace Handler */
    84 #include <goahead/uemf.h>
    85 void quietTraceHandler(int level, char *buf)
    86 {
    87   /* do nothing */
    88 }
     82#if defined(USE_GOAHEAD_HTTPD)
     83  boolean GoAhead_HTTPD_enabled = TRUE;
     84
     85  /* GoAhead Trace Handler */
     86  #include <goahead/uemf.h>
     87  void quietTraceHandler(int level, char *buf)
     88  {
     89    /* do nothing */
     90  }
     91#else
     92  boolean GoAhead_HTTPD_enabled = FALSE;
     93#endif
     94
     95#if defined(USE_SIMPLE_HTTPD)
     96  boolean Simple_HTTPD_enabled = TRUE;
     97
     98  #include <shttpd/shttpd.h>
     99#else
     100  boolean Simple_HTTPD_enabled = FALSE;
     101#endif
     102
     103#define bool2string(_b) ((_b) ? "true" : "false")
    89104
    90105rtems_task Init(
     
    95110
    96111  printf("\n\n*** HTTP TEST ***\n\r" );
     112  printf("GoAhead HTTPD Enabled: %s\n", bool2string(GoAhead_HTTPD_enabled) );
     113  printf("Simple HTTPD Enabled: %s\n", bool2string(Simple_HTTPD_enabled) );
     114  printf("FTPD Enabled: %s\n", bool2string(FTPD_enabled) );
     115  printf("\n");
    97116
     117  /*
     118   * Load filesystem image
     119   */
     120  printf("Loading filesystem image");
    98121  status = Untar_FromMemory((void *)(&TARFILE_START), (size_t)&TARFILE_SIZE);
    99122   
     123  printf("Initializing Network");
    100124  rtems_bsdnet_initialize_network ();
    101 #if defined(USE_FTPD)
    102   rtems_initialize_ftpd();
    103 #endif
    104125
    105 #if defined(USE_HTTPD)
    106   if ( rtems_initialize_webserver() )
    107     printf( "ERROR -- failed to initialize webserver\n" );
     126  #if defined(USE_FTPD)
     127    printf( "Initializing FTPD\n" );
     128    rtems_initialize_ftpd();
     129  #endif
    108130
    109   traceSetHandler( quietTraceHandler );
    110 #endif
     131  #if defined(USE_GOAHEAD_HTTPD)
     132    printf( "Initializing GoAhead HTTPD\n" );
     133    status = rtems_initialize_webserver();
     134    if ( status )
     135      printf( "ERROR -- failed to initialize webserver\n" );
     136
     137    traceSetHandler( quietTraceHandler );
     138  #endif
     139
     140  #if defined(USE_SIMPLE_HTTPD)
     141    printf( "Initializing Simple HTTPD\n" );
     142    status = rtems_initialize_webserver(
     143      100,                             /* initial priority */
     144      RTEMS_MINIMUM_STACK_SIZE * 2,    /* stack size */
     145      RTEMS_DEFAULT_MODES,             /* initial modes */
     146      RTEMS_DEFAULT_ATTRIBUTES,        /* attributes */
     147      NULL,                            /* init_callback */
     148      NULL,                            /* addpages_callback */
     149      "/"                              /* initial priority */
     150    );
     151    if ( status )
     152      printf( "ERROR -- failed to initialize webserver\n" );
     153
     154  #endif
    111155
    112156  status = rtems_task_delete( RTEMS_SELF );
Note: See TracChangeset for help on using the changeset viewer.