!
! RMIF RDP received buffer test case
!
! When bursting lots of SET messages, we are seeing the following LINKERR PKTRQCHK
! on the receiving side (which causes some messages to get lost) without them
! being accounted for via RDP.
!
! <sPort>   - The KNOWN port of the server.  Client uses any available port.
! <msgCnt>  - The number of messages the client (sender) will send out.
!             Note, if you increase this, you may also have to increase the
!             test timeout value.
! <timeout> - The timeout (max time) that this test should run before aborting
! <sizeMul> - Packet size multipler for messages the client sends out. [1..460]
!
! @bug     1193
! @author  Neon Ngo
! @since   NeXtMidas 2.5.1
!
startmacro L:sPort[-1] L:msgCnt[1000] D:timeout[40] L:size[250]
  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

  invoke headless nxm.sys.lib.Shell.isHeadless()
  if statemachine and headless then
    info "SKIPPING ^reg.main.name because this test intermittently fails with /STATEM in HEADLESS mode."
  else
    timer set

    ! call RMIF test framewwork standard setup (see included standard_rmif_procs.mminc)
    call standardSetup timeout sPort
    pipe on
      %test_rmif_recv_buffer_server/id=SERVER/STATEM=^statemachine/DEBUG=^debugs/VERBOSE=^verboses/BG this ^sPort ^msgCnt
      %test_rmif_recv_buffer_client/id=CLIENT/STATEM=^statemachine/DEBUG=^debugc/VERBOSE=^verbosec/BG this ^sPort ^msgCnt ^size
    pipe off

    timer elapse
  endif
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