! This will test RMIF's ability send packets (RDP) from an RMIF instance to an
! ADDRessed RMIF remote test case.
!
! @bug     2138 RMIF (nxm273 to nxm280) can no longer send messages to existing
!               RMIF servers (nxm272 and prior) that have been ADDRressed.
! @author  Neon Ngo
!
! <sPort>     - The KNOWN port of the server.  Client uses any available port.
! <timeout>   - Timeout for this test case to run (seconds)
! <numPackets>- Number of packets for client to send to remote server
!
startmacro L:sPort[-1] D:timeout[10] L:numPackets[5]
  switch DEBUG         debug        GET DEF=false    SDEF=true
  switch DEBUGSERVER   debugs       GET DEF=^debug   SDEF=true
  switch DEBUGCLIENT   debugc       GET DEF=^debug   SDEF=true
  switch VERBOSE       verbose      GET DEF=false    SDEF=true
  switch VERBOSESERVER verboses     GET DEF=^verbose SDEF=true
  switch VERBOSECLIENT verbosec     GET DEF=^verbose SDEF=true
  switch STATEM        statemachine GET DEF=false    SDEF=true

  timer set

  if statemachine then
    INFO "^reg.main.name tries to send packages to a closed remote. Skipping test in /STATEM mode, as that is invalid"
  else 
    call standardSetup timeout sPort
    pipe on
      %test_rmif_addr_server/id=SERVER/STATEM=^statemachine/DEBUG=^debugs/VERBOSE=^verboses/BG this sPort numPackets=numPackets
      %test_rmif_addr_client/id=CLIENT/STATEM=^statemachine/DEBUG=^debugc/VERBOSE=^verbosec/BG this sPort numPackets=numPackets
    pipe off
  endif

  timer elapse
endmacro

!******************************************************************************!
procedure processMessage m:msg
  if debug then
    say "^reg.main.name: Got message name=^msg.name fid=^msg.fid info=^msg.info data=^msg.data"
  endif

  if false then ! Your message name goes here
    !
    ! Your message(s) processing goes here
    !
  else
    call processStandardMessages
  endif
return

! These are a set of standard procedures
include standard_rmif_procs.mminc
