Migrate demo-config.rkt to syndicate/actor
This commit is contained in:
parent
fb5b6e80b8
commit
b444bccb80
|
@ -1,25 +1,21 @@
|
||||||
#lang racket/base
|
#lang syndicate/actor
|
||||||
;; Demonstration stack configuration for various hosts.
|
;; Demonstration stack configuration for various hosts.
|
||||||
|
|
||||||
(require racket/match)
|
(require racket/match)
|
||||||
(require syndicate/monolithic)
|
|
||||||
(require (only-in mzlib/os gethostname))
|
(require (only-in mzlib/os gethostname))
|
||||||
(require "configuration.rkt")
|
(require "configuration.rkt")
|
||||||
|
|
||||||
(provide spawn-demo-config)
|
(actor
|
||||||
|
(react
|
||||||
(define (spawn-demo-config)
|
(match (gethostname)
|
||||||
(spawn (lambda (e s) #f)
|
["skip"
|
||||||
(void)
|
(assert (gateway-route (bytes 0 0 0 0) 0 (bytes 192 168 1 1) "en0"))
|
||||||
(match (gethostname)
|
(assert (host-route (bytes 192 168 1 222) 24 "en0"))]
|
||||||
["skip"
|
[(or "hop" "walk")
|
||||||
(scn/union (assertion (gateway-route (bytes 0 0 0 0) 0 (bytes 192 168 1 1) "en0"))
|
(assert (gateway-route (bytes 0 0 0 0) 0 (bytes 192 168 1 1) "wlan0"))
|
||||||
(assertion (host-route (bytes 192 168 1 222) 24 "en0")))]
|
(assert (host-route (bytes 192 168 1 222) 24 "wlan0"))]
|
||||||
[(or "hop" "walk")
|
["stockholm.ccs.neu.edu"
|
||||||
(scn/union (assertion (gateway-route (bytes 0 0 0 0) 0 (bytes 192 168 1 1) "wlan0"))
|
(assert (host-route (bytes 129 10 115 94) 24 "eth0"))
|
||||||
(assertion (host-route (bytes 192 168 1 222) 24 "wlan0")))]
|
(assert (gateway-route (bytes 0 0 0 0) 0 (bytes 129 10 115 1) "eth0"))]
|
||||||
["stockholm.ccs.neu.edu"
|
[other
|
||||||
(scn/union (assertion (host-route (bytes 129 10 115 94) 24 "eth0"))
|
(error 'demo-config "No setup for hostname ~a" other)])))
|
||||||
(assertion (gateway-route (bytes 0 0 0 0) 0 (bytes 129 10 115 1) "eth0")))]
|
|
||||||
[else
|
|
||||||
(error 'spawn-demo-config "No setup for hostname ~a" (gethostname))])))
|
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
#lang syndicate/monolithic
|
#lang syndicate/monolithic
|
||||||
|
|
||||||
(require/activate syndicate/drivers/timer)
|
|
||||||
(require/activate "ethernet.rkt")
|
|
||||||
(require/activate "arp.rkt")
|
|
||||||
|
|
||||||
(require syndicate/demand-matcher)
|
(require syndicate/demand-matcher)
|
||||||
(require "demo-config.rkt")
|
|
||||||
(require "ip.rkt")
|
(require "ip.rkt")
|
||||||
(require "tcp.rkt")
|
(require "tcp.rkt")
|
||||||
(require "udp.rkt")
|
(require "udp.rkt")
|
||||||
|
|
||||||
;;(log-events-and-actions? #t)
|
;;(log-events-and-actions? #t)
|
||||||
|
|
||||||
|
(require/activate syndicate/drivers/timer)
|
||||||
|
(require/activate "ethernet.rkt")
|
||||||
|
(require/activate "arp.rkt")
|
||||||
(spawn-ip-driver)
|
(spawn-ip-driver)
|
||||||
(spawn-tcp-driver)
|
(spawn-tcp-driver)
|
||||||
(spawn-udp-driver)
|
(spawn-udp-driver)
|
||||||
(spawn-demo-config)
|
(require/activate "demo-config.rkt")
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue