! This will test RMIF's ability send pipe data from server to client remote
!
! @bug     2146 RMIF: incorrect internal packet buffer size
! @bug     2756 RMIF: serving properties (channels) can cause RMIF to close
! @author  Neon Ngo
!
! <sPort>     - The KNOWN port of the server.  Client uses any available port.
! <timeout>   - Timeout for this test case to run (seconds)
! <size>      - Size of frame for served type 2000 pipe (in bytes),
!               default=32K to test max RMIF data packet size
!
startmacro L:sPort[-1] D:timeout[20] L:size[32K]
  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

  call standardSetup timeout sPort
  pipe on
    %test_rmif_pipe_server/id=SERVER/STATEM=^statemachine/DEBUG=^debugs/VERBOSE=^verboses/BG this ^sPort frameSize=^size
    %test_rmif_pipe_client/id=CLIENT/STATEM=^statemachine/DEBUG=^debugc/VERBOSE=^verbosec/BG this ^sPort frameSize=^size
  pipe off

  if this.verbose then say "=== Testing BUG 2756: send data > max allowable RMIF packet size ==="
  call standardSetup timeout
  calc L:sizeLargerThanMax 64K
  pipe on
    %test_rmif_pipe_server/id=SERVER/STATEM=^statemachine/DEBUG=^debugs/VERBOSE=^verboses/BG this ^sPort frameSize=^sizeLargerThanMax waitTime=10.0
    %test_rmif_pipe_client/id=CLIENT/STATEM=^statemachine/DEBUG=^debugc/VERBOSE=^verbosec/BG this ^sPort frameSize=^sizeLargerThanMax
  pipe off

  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
