; ================================================================
; Start a test step:
;   - retrieve parameters
;   - reset and and update the filters
;   - deactivate the circuit
;   - setup circuit parameters
;   - activate the circuit
;   - activate the X25 traces
;   - optionaly generate a join event
;   - start data exchange and wait for a while
;   - optionaly perform handoff and wait for a while
;   - reset local variables
; ================================================================
;  Parameters:                           (related filter if applicable)
;     MOBCIRNAME                         ()
;     DEFLBITS
;       0x01: deflate on                 (d)
;       0x02: deflate maintenance on     (e)
;     LREFBITS
;       0x01: lref on                    (l)
;       0x02: lref maintenance on        (m)
;       0x04: lref cancel on             (n)
;     DICTBITS
;       0x01: ICAO 1 v1                  (w)
;       0x02: ICAO 1 v2                  (x)
;       0x10: IATA 1 v1                  (y)
;       0x20: IATA 1 v2                  (z)
;     FLAGS
;       0x01: fast select on             (f)
;       0x02: mobile SNDCF in version 1  (v)
;       0x04: prefer deflate maintenance (p)
;     EVTS       
;       0x01: issue join event           (j)
;       0x02: issue handoff event        (h)
;       0x04: transport data flow        (t)
;     REMADDR                            ()
;     JOINNEXTHOP                        ()
;     HANDOFFNEXTHOP                     ()
; ================================================================
;
; retrieve parameters
;
define MOBCIRNAME      '$1'
define DEFLBITS        '$2'
define LREFBITS        '$3'
define DICTBITS        '$4'
define FLAGS           '$5'
define EVTS            '$6'
define REMADDR         '$7'
define JOINNEXTHOP     '$8'
define HANDOFFNEXTHOP  '$9'
;
; reset and and update the filters
;
-*
(0x01 & ${DEFLBITS}) +d
(0x02 & ${DEFLBITS}) +e
(0x01 & ${LREFBITS}) +l
(0x02 & ${LREFBITS}) +m
(0x04 & ${LREFBITS}) +n
(0x01 & ${DICTBITS}) +w
(0x02 & ${DICTBITS}) +x
(0x10 & ${DICTBITS}) +y
(0x20 & ${DICTBITS}) +z
(0x01 & ${FLAGS})    +f
(0x02 & ${FLAGS})    +v
(0x04 & ${FLAGS})    +p
(0x01 & ${EVTS})     +j
(0x02 & ${EVTS})     +h
(0x04 & ${EVTS})     +t
;
; deactivate the circuit
;
circuit deactivate $MOBCIRNAME
;
; setup circuit parameters
;
&vp   define MOBCIRFLAGS 0x00050000
&v~p  define MOBCIRFLAGS 0x00010000
&~vp  define MOBCIRFLAGS 0x00040000
&~v~p define MOBCIRFLAGS 0x00000000
      circuit mobile set flags          $MOBCIRNAME $MOBCIRFLAGS
&d    circuit mobile set deflate on     $MOBCIRNAME
&~d   circuit mobile set deflate off    $MOBCIRNAME
&e    circuit mobile set deflMainte on  $MOBCIRNAME
&~e   circuit mobile set deflMainte off $MOBCIRNAME
&l    circuit mobile set lref on        $MOBCIRNAME
&~l   circuit mobile set lref off       $MOBCIRNAME
&m    circuit mobile set lrefMainte on  $MOBCIRNAME
&~m   circuit mobile set lrefMainte off $MOBCIRNAME
&n    circuit mobile set lrefCancel on  $MOBCIRNAME
&~n   circuit mobile set lrefCancel off $MOBCIRNAME
&f    circuit mobile set fastselect     $MOBCIRNAME 1
&~f   circuit mobile set fastselect     $MOBCIRNAME 3
      circuit mobile dictionary reset   $MOBCIRNAME
&w~x  circuit mobile dictionary add     $MOBCIRNAME 0x01 0x01
&x    circuit mobile dictionary add     $MOBCIRNAME 0x01 0x02
&y~z  circuit mobile dictionary add     $MOBCIRNAME 0x41 0x01
&z    circuit mobile dictionary add     $MOBCIRNAME 0x41 0x02
      circuit mobile set priority       $MOBCIRNAME
      circuit mobile set priIdleTime    $MOBCIRNAME 3
      circuit show                      $MOBCIRNAME
      circuit mobile dictionary show    $MOBCIRNAME
;
; activate the circuit
;
circuit activate $MOBCIRNAME
;
; activate the X25 traces
;
      trace size set 8192
&j    trace x25 on
;
; generate a join event
;
&j    rif joinevent $REMADDR $MOBCIRNAME $JOINNEXTHOP
&j    suspend 5
;
; start data exchange and wait for a while
;
;   constant traffic: minSz=maxSz=thruput=512, data=01234567890123...
&j    define SIMDELAY "?"
&~j   define SIMDELAY 7
&~t   test  simulate rcvClnp 10
&~t   test  simulate sndClnp 20 ${REMOTE_NET}10 512 512 512 0 ? ? ? ? $SIMDELAY
&~tj  suspend 5
&t~j  start strxt -w /dev/cots$INSTANCE -f $XFER_FILE
&tj   start sttxt -w /dev/cots$INSTANCE -n ${REMOTE_NET}01 -f $XFER_FILE
&tj   suspend 2 500
;&tj   suspend 1 500
;
; optionaly perform handoff and wait for a while
;
&h  rif handoffevent $REMADDR $MOBCIRNAME $HANDOFFNEXTHOP
|jh suspend 15
;
; reset filters and local variables
;
-*
undef MOBCIRNAME
undef DEFLBITS
undef LREFBITS
undef DICTBITS
undef FLAGS
undef EVTS
undef REMADDR
undef JOINNEXTHOP
undef HANDOFFNEXTHOP
undef MOBCIRFLAGS
undef SIMDELAY
