A.8. Using the Null ICP_IP Device

    #--------------------------------------------------------------------------#
    # Another way to use the Message Switch is to use the ipnull ICP_IP        #
    # device directly.  This allows an extremely simple client application     #
    # program, written without any calls to DLI, to send and receive data      #
    # from a Freeway.  Here's how the bootcfg file might be set up:            #
    #                                                                          #
    #    device_name          =  icp1                                          #
    #    device_type          =  icp_ip                                        #
    #    socket_type          =  sock_dgram                                    #
    #    local_address        =  0.0.0.0                                       #
    #    local_port_base      =  0x3100                                        #
    #    foreign_address      =  192.168.100.100                               #
    #    foreign_port_base    =  0x3100                                        #
    #    internal_protocol    =  ipnull                                        #
    #                                                                          #
    # And the switch.cfg file contained:                                       #
    #                                                                          #
    #    icp1port0 > icp0port0                                                 #
    #    icp0port0 > icp1port0                                                 #
    #                                                                          #
    # Then an application program running on a machine at 192.168.100.100      #
    # could simply create a socket, bind to port 0x3100, and send UDP          #
    # datagrams to the IP address of the Freeway; the Message Switch           #
    # would send that data to icp0port0 to be sent out with whatever           #
    # protocol settings were specified for that port in the swdcfg file        #
    # (and any data received on that port would be sent to the UDP client      #
    # application program at 192.168.100.100).                                 #
    #                                                                          #
    # The UDP datagrams must follow the format specified for the protocol      #
    # module loaded into the corresponding ICP_IP device.  For the ipnull      #
    # protocol, which is builtin to all Freeway images, there is no format;    #
    # it simply treats each UDP packet as a block of raw data, to be packaged  #
    # up and sent to the Message Switch.  This makes it extremely easy to      #
    # write application programs which send and receive data to/from a         #
    # Freeway.  A very short example program which does just that is in        #
    # freeway/client/test/switch/apisim.c .  This is the program which can be  #
    # used to create the apinull0, apinull1, apinull2, and apinull3            #
    # executables which are used to test the Message Switch, as shown in the   #
    # examples below.                                                          #
    #                                                                          #
    #--------------------------------------------------------------------------#
    #
    #
    #
    #--------------------------------------------------------------------------#
    #                                                                          #
    # EXAMPLES:                                                                #
    #                                                                          #
    # The following example switch specifications can be used with the         #
    # bootcfg.sw file provided with the Message Switch to test various         #
    # configurations.                                                          #
    # They expect that all data sent to the Freeway will be from either a      #
    # DLI client using FMP, or from the "apinull" sample programs which are    #
    # also included with this software.                                        #
    #                                                                          #
    #--------------------------------------------------------------------------#
       

A.8.1. UDP/IP Example (apinull0)

Note: The example program apinull0 is supplied for testing the Message Switch (see test step 10 in section Section 2.3).

    #
    # apinull0 can be used to send packets to icp1port0; this switch
    # specification causes each packet received to be transmitted back to
    # apinull0.
    
    icp1port0 > icp1port0
         

A.8.2. UDP/IP Example (apinull1)

Note: The example program apinull1 is supplied for testing the Message Switch (see test step 11 in section Section 2.3).

    # apinull1 can be used to send packets to icp1port1; these switch
    # specifications cause each packet received to be transmitted to 3 other
    # places, in addition to being transmitted back to apinull1.
    
    icp1port1 > icp6port0
    icp1port1 > icp6port1
    icp1port1 > icp7port0
    icp1port1 > icp1port1
    
    # these switch specifications allow a normal loopback test program, such
    # as fmpalp, to work correctly between icp2port0 and icp2port1, if the
    # bootcfg file sets up icp2 and icp3 as shown above, and loads the
    # appropriate protocol module into the ICP_IP devices at icp2 and icp3.
    # (These 2 specifications take the place of the loopback cable).
    
    icp3port0 > icp3port1
    icp3port1 > icp3port0
    
    # these switch specifications allow a normal loopback test program, such
    # as fmpalp, to work correctly between icp4port0 and icp4port1, if the
    # bootcfg file sets up icp4 and icp5 as shown above, and loads the
    # appropriate protocol module into the ICP_IP devices at icp4 and icp5.
    # (These 2 specifications take the place of the loopback cable).
    # Uncomment these 2 lines if you are using a multicast-capable Freeway
    # server, and wish to test the icp4/icp5 link.
    
    # icp5port0 > icp5port1
    # icp5port1 > icp5port0
         

A.8.3. UDP/IP Example (apinull2)

Note: The example program apinull2 is supplied for testing the Message Switch (see test step 12 in section Section 2.3).

    # apinull2 can be used to send packets to icp1port2; these switch
    # specifications cause each packet received to be transmitted through the
    # icp2/icp3 connection, looped back (the icp3port2 and port3 specifications),
    # and returned to apinull2.  The bootcfg file must have set up icp2 and
    # icp3 as shown above.
    
    icp1port2 > icp2port2
    icp3port2 > icp3port3
    icp2port3 > icp1port2
    
    # The same thing could be done using the icp4/icp5 connection:
    # icp1port2 > icp4port2
    # icp5port2 > icp5port3
    # icp4port3 > icp1port2
    
         

A.8.4. UDP/IP Example (apinull3)

Note: The example program apinull3 is supplied for testing the Message Switch (see test step 32 in section Section 2.3).

    # apinull3 can be used to send packets to icp1port3; these switch
    # specifications cause each packet received to be transmitted through 
    # icp0 (which is assumed to have a loopback cable installed between
    # icp0port2 and icp0port3), and returned to apinull3.
    # To test this configuration, uncomment the 2 switch configuration lines
    # here and change bootcfg.sw to include a definition for icp0 which includes
    # the loading of the fmp protocol; also make sure there is a loopback
    # cable installed between links 2 and 3 of icp0.
    
    # icp1port3 > icp0port2
    # icp0port3 > icp1port3
         

A.8.5. TCP/IP "Listening" Connections

Note: The following examples are for testing the TCP/IP listening capabilities of the Message Switch and Freeway (see test steps 13 through 18 in section Section 2.3).

    # The following switch settings allow testing of TCP listening ICP_IP devices.
    # These devices listen at a specified TCP/IP port on the Freeway, waiting
    # for client application programs to connect to that port.  For these
    # examples, we will use the "telnet" client program to connect to the
    # Freeway at the specified ports.
    
    # The following switch settings will cause the Message Switch to switch
    # all data between icp6port0 and icp6port1; these are configured in the
    # bootcfg.sw file as TCP sockets listening on ports 0x3600 and 0x3601
    # (13824 and 13825).  To test, use telnet to connect to those ports on
    # the Freeway -- for example, if your Freeway IP address is 192.168.135.22,
    # then execute these commands from two different windows:
    #
    #     telnet 192.168.135.22 13824      (in first  window)
    #     telnet 192.168.135.22 13825      (in second window)
    #
    # Then everything you type in the first window will be copied to the second
    # window, and vice-versa.
    
    icp6port0 >> icp6port1
    icp6port1 >> icp6port0
    
    # You can also configure additional ports to receive data.  The following
    # switch setting will cause all data you type in your first telnet window
    # to be copied to a third telnet window in addition to the second window.
    # You can retrieve the data from icp6port2 with the command:
    #
    #     telnet 192.168.135.22 13826      (in third window)
    icp6port0 >> icp6port2
    
    # The following switch setting causes all data received by icp3port0 to be
    # sent to icp6port3.  To see this data, telnet to your Freeway at the
    # icp6port3 port (Simpact settings are 0x3600 + 3 = 0x3603, # or 13827).
    # For example:  telnet 192.168.135.22 13827 
    #
    # Then use your normal loopback test program (for example, fmpalp) to
    # send data between icp2port0 and icp2port1.  The data sent from icp2port0
    # to icp3port0 will be sent by the Message Switch to icp3port1 (where it
    # will be returned to icp2port1, to satisfy the loopback program) and to
    # icp6port3, where it will be sent to your telnet session.
    
    icp3port0 >> icp6port3
         

A.8.6. TCP/IP "Connecting" Connections

Note: The following examples are for testing the TCP/IP connecting capabilities of the Message Switch and Freeway (see test steps 19 through 26 in section Section 2.3). These tests require use of the loopback test program and build script (loopback.c and makeloop) which are supplied with the Freeway software distribution in the freeway/client/test/iploop subdirectory.

    # The following switch settings allow testing of a TCP connect ICP_IP device.
    # These devices connect to a specified TCP/IP port at a specified IP
    # address.  For this example we will use the
    # freeway/client/test/iploop/tcploop2120 loopback test program, to serve as
    # a TCP listener for the Message Switch to connect to.  When tcploop2120 is
    # running, and the Freeway has connected to both ports (tcploop2120 will
    # report "sockA and sockB ready."), then telnet clients can be used to
    # connect to icp6port4 and icp6port5 to send and receive data:
    #
    #     telnet 192.168.135.22 13828
    #     telnet 192.168.135.22 13829
    #
    # The data goes from the telnet client (via Message Switch) to icp7port0,
    # which sends it to tcploop2120, which returns it to icp7port1, and the
    # Message Switch sends it to icp6port4 where it is received by the telnet
    # client at icp6port5.  The bootcfg.sw file must be modified to set the
    # foreign_address of icp7 to the IP address of the machine where
    # tcploop2120 is run.
    
    icp6port4 > icp7port0
    icp7port1 > icp6port5
    
    # and the reverse direction of data flow is defined like this:
    
    icp6port5 > icp7port1
    icp7port0 > icp6port4