; 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 bne atsource-pc ; at dest. 1st dest or return trip? ; if we are at the destination execute the requests ; INSERT PROCESSING ACTIONS HERE push 1 ; prototype action ; choose between normal run and flood send bez normalrun-pc getdst calls "if_getallneighbours" ; spread until stack==empty ; NB: this means only the returnvalues of the call above are allowed stackvalues resendloop: stackempty bne errorrun-pc ; go home if stack == empty ; prepare the send intruction (takes top 4 values as input) push 0 ; entrypoint == packet start push 0 ; copy nothing push 4 ; give a marginal resource bound pull 3 ; copy top IP send pop ; pop the top IP ; now resend to ourselves (creating a while loop) push resendloop ; go to beginning of loop push -1 ; copy entire stack (this is why we popped above) getrb ; use up all resource bound here ; push a local address dsend ; send packet exit ; exit current flow ; go to source errorrun: push "error" ji sendhome-pc normalrun: push "run went ok" sendhome: push 1 getsrc dforwto pop ; if current location==dest, dforwto falls through atsource: ; at the source: print result push 7777 demux #data 0 ; compile time stack entry