Changeset 19a33c6 in network-demos


Ignore:
Timestamp:
Aug 12, 1998, 11:06:42 PM (21 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master, netdemos-4-5-branch, network-demos-4-10-branch, network-demos-4-6-branch, network-demos-4-7-branch, network-demos-4-8-branch, network-demos-4-9-branch, rtems-4-5-branch
Children:
db1377f
Parents:
7c81a8b
Message:

Added support for non-bootp servers

Location:
tftpTest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tftpTest/init.c

    r7c81a8b r19a33c6  
    4343#include <confdefs.h>
    4444
     45#if (defined (USE_BOOTP))
    4546#include <bootp.h>
     47#endif
    4648extern void testTFTP (void);
    4749
     
    7072         * Hook up drivers
    7173         */
    72         if (rtems_ka9q_execute_command ("attach rtems broadcast n ether " MY_ETHERNET_ADDRESS))
     74#if (defined (USE_BOOTP))
     75        if (rtems_ka9q_execute_command ("attach rtems broadcast y"
     76                                        " ether " MY_ETHERNET_ADDRESS))
     77#else
     78        if (rtems_ka9q_execute_command ("attach rtems broadcast y"
     79                                        " ip " MY_IP_ADDRESS
     80                                        " ether " MY_ETHERNET_ADDRESS))
     81#endif
    7382                rtems_panic ("Can't attach Ethernet driver.\n");
    7483
     
    8594                rtems_panic ("Can't add broadcast entry to ARP table.\n");
    8695
     96#if (defined (USE_BOOTP))
     97        {
     98        int i;
    8799        /*
    88100         * Get BOOTP information
     
    93105                if (++i == 10)
    94106                        rtems_panic ("Can't get information from BOOTP server.\n");
    95                 rtems_task_wake_after (i * ticksPerSecond);
     107                delay_task (i);
    96108        }
     109        if (BootpFileName)
     110                printf ("BOOTP filename: `%s'\n", BootpFileName);
     111        else
     112                printf ("BOOTP -- No filename!\n");
     113        }
     114#else
     115        if (rtems_ka9q_execute_command ("ifconfig rtems netmask 255.255.255.0"))
     116                rtems_panic ("Can't set netmask.\n");
     117        if (rtems_ka9q_execute_command ("route add default rtems"))
     118                rtems_panic ("Can't add default route.\n");
     119        printf ("Routing table after adding default route\n");
     120        rtems_ka9q_execute_command ("route");
     121#endif
     122
    97123
    98124        /*
  • tftpTest/test.c

    r7c81a8b r19a33c6  
    2121#include <bootp.h>
    2222#include <netuser.h>
     23
     24#include "../usercfg.h"
    2325
    2426static char cbuf[1024];
     
    108110{
    109111        const char *hostname;
     112#if !defined(USE_BOOTP)
     113        static char name[16];
     114#endif
    110115
     116        printf( "makeFullname(0x08%x, %s)\n", host, file);
     117
     118#if (defined (USE_BOOTP))
    111119        if (host) {
    112120                hostname = rtems_hostname_for_address (BootpHost.s_addr, 0);
     
    115123                        return 0;
    116124                }
    117         }
    118         else {
     125        } else {
    119126                hostname = "";
    120127        }
     128#else
     129        if (host) {
     130                sprintf( name, "%d.%d.%d.%d", host >> 24, (host >> 16) & 0xff,
     131                        (host >> 8) & 0xff, host & 0xff
     132                );
     133                hostname = name;
     134        } else {
     135                hostname = "";
     136        }
     137#endif
    121138        fullname = realloc (fullname, 8 + strlen (file) + strlen (hostname));
    122139        sprintf (fullname, "/TFTP/%s/%s", hostname, file);
     
    147164         * Check read speed
    148165         */
     166#if (defined (USE_BOOTP))
    149167        if (BootpFileName == NULL) {
    150168                printf ("Nothing to read!\n");
     
    152170        }
    153171        if (makeFullname (BootpHost.s_addr, BootpFileName)) {
     172#else
     173        if (makeFullname (aton (DATA_SOURCE_HOST), DATA_SOURCE_FILE)) {
     174#endif
     175
    154176                testRawRead ();
    155177                testFread ();
    156178        }
    157179}
    158         #include <limits.h>
    159         int foo = INT_MAX;
Note: See TracChangeset for help on using the changeset viewer.