Loading examples/pingpong.1mbox.ucl 0 → 100644 +118 −0 Original line number Diff line number Diff line # # Simple ping pong arrangement bewteen a client and server with one # middlebox # # One context context { id = 1 tag = context-1 } # Behavior definition that the client will use activity { tag = send-ping match { at = 2000 # Start the action two seconds after connect every = 3000 # Then repeat the action every 3 seconds } action { # # For time triggered behavior on an endpoint, send-before, # send-replace, and send-after are equivalent. Here, # send-after is used. # send-after { context = context-1 # Send in context-1 data = "client-ping" # Send this data } } } # Behavior definition that the middlebox will use in the to-server # direction. activity { tag = mbox1-ping match { which = context-1 # Look for matches in context-1 data = "client-ping" # Look for this data } action { # Use send-replace to replace the matched data send-replace { context = context-1 # Send the replacement in context-1 data = "PING" # Send this as the replacement } } } # Behavior definition that the middlebox will use in the to-client # direction. activity { tag = mbox1-pong match { which = context-1 # Look for matches in context-1 data = "PONG" # Look for this data } action { # Use send-replace to replace the matched data send-replace { context = context-1 # Send the replacement in context-1 data = "server-pong" # Send this as the replacement } } } # Behavior definition that the server will use activity { tag = reply-pong match { which = * # Which contexts to look for a match in. # Endpoints have access to all contexts, so no # need to be specific. data = "PING" # Look for this data } action { send-replace { context = context-1 data = "PONG" } } } # Give the client an address and the send-ping behavior client { address = tlmsp://localhost function = send-ping } # Give the middlebox an address, give it read-write access to # context-1, and specify behaviors in the to-server and to-client # directions middlebox { tag = mbox1 address = tlmsp://localhost:20851 context { which = "context-1" access = rw } function-to-server = mbox1-ping function-to-client = mbox1-pong } # Give the server an address and the reply-pong behavior server { address = tlmsp://localhost:23812 function = reply-pong } Loading
examples/pingpong.1mbox.ucl 0 → 100644 +118 −0 Original line number Diff line number Diff line # # Simple ping pong arrangement bewteen a client and server with one # middlebox # # One context context { id = 1 tag = context-1 } # Behavior definition that the client will use activity { tag = send-ping match { at = 2000 # Start the action two seconds after connect every = 3000 # Then repeat the action every 3 seconds } action { # # For time triggered behavior on an endpoint, send-before, # send-replace, and send-after are equivalent. Here, # send-after is used. # send-after { context = context-1 # Send in context-1 data = "client-ping" # Send this data } } } # Behavior definition that the middlebox will use in the to-server # direction. activity { tag = mbox1-ping match { which = context-1 # Look for matches in context-1 data = "client-ping" # Look for this data } action { # Use send-replace to replace the matched data send-replace { context = context-1 # Send the replacement in context-1 data = "PING" # Send this as the replacement } } } # Behavior definition that the middlebox will use in the to-client # direction. activity { tag = mbox1-pong match { which = context-1 # Look for matches in context-1 data = "PONG" # Look for this data } action { # Use send-replace to replace the matched data send-replace { context = context-1 # Send the replacement in context-1 data = "server-pong" # Send this as the replacement } } } # Behavior definition that the server will use activity { tag = reply-pong match { which = * # Which contexts to look for a match in. # Endpoints have access to all contexts, so no # need to be specific. data = "PING" # Look for this data } action { send-replace { context = context-1 data = "PONG" } } } # Give the client an address and the send-ping behavior client { address = tlmsp://localhost function = send-ping } # Give the middlebox an address, give it read-write access to # context-1, and specify behaviors in the to-server and to-client # directions middlebox { tag = mbox1 address = tlmsp://localhost:20851 context { which = "context-1" access = rw } function-to-server = mbox1-ping function-to-client = mbox1-pong } # Give the server an address and the reply-pong behavior server { address = tlmsp://localhost:23812 function = reply-pong }