; SNAP SVC TEST PACKET ; ; snap prototype packet ; ; (c) 2003, Willem de Bruijn ; all code is licensed under the BSD License ; NB: this does not necessary apply to the SNAP interpreter code ; written by Jonathan Moore of the University of Pennsylvania dforw ; continue until at route destination ; test if this is a special case: first hop stackempty bez normalhop-pc ; not empty? continue to normalhop push 0 ; start with an empty counter for our function getdst ; push the incoming ip (is the IP destfield) normalhop: ; if we are at the destination execute the requests ; EXAMPLE : count all received packets pull 1 push "ipInReceives.0" calls "snmp_getsingle" add ; rearrange the stack to have the incoming ip on top pull 1 print ; test if our resource bound is getting low. if so, go home getrb lti 3 ; less then minimum? bne gohome-pc ; go home immediately ; select a new hop based on our incoming ip ; NB: it expects incoming ip as top stackvalue ; pull the address from below possiblly previously pushed values calls "if_getnexthop" ; resend to next host, save only the top 2 stackvalues push 0 ; execute from the start push 2 ; copy only top 2 values getrb ; use up all rb (== 1) pull 3 ; copy the topvalue for if_getnexthop at next hop send exit ; go to source gohome: pop ; remove the now useless incoming ip value push atsource ; execute directly from atsource push 2 ; copy entire stack getrb ; use up all rb (== 1) getsrc dsend ; dsend uses direct send: no additional RB necessary exit atsource: ; at the source: return result lti 40000 ; define a threshold, demux only accepts strings (for now) bne totalok-pc push "not ok" ji returnok-pc totalok: push "ok" returnok: push 7777 demux