syndicate-2017/examples/netstack/demo-config.rkt

26 lines
1.0 KiB
Racket
Raw Normal View History

2015-10-18 00:33:10 +00:00
#lang racket/base
;; Demonstration stack configuration for various hosts.
(require racket/match)
2016-04-01 23:53:46 +00:00
(require syndicate-monolithic)
2015-10-18 00:33:10 +00:00
(require (only-in mzlib/os gethostname))
(require "configuration.rkt")
(provide spawn-demo-config)
(define (spawn-demo-config)
(spawn (lambda (e s) #f)
(void)
(match (gethostname)
["skip"
(scn/union (assertion (gateway-route (bytes 0 0 0 0) 0 (bytes 192 168 1 1) "en0"))
(assertion (host-route (bytes 192 168 1 222) 24 "en0")))]
2015-10-18 00:33:10 +00:00
[(or "hop" "walk")
(scn/union (assertion (gateway-route (bytes 0 0 0 0) 0 (bytes 192 168 1 1) "wlan0"))
(assertion (host-route (bytes 192 168 1 222) 24 "wlan0")))]
2015-10-18 00:33:10 +00:00
["stockholm.ccs.neu.edu"
(scn/union (assertion (host-route (bytes 129 10 115 94) 24 "eth0"))
(assertion (gateway-route (bytes 0 0 0 0) 0 (bytes 129 10 115 1) "eth0")))]
2015-10-18 00:33:10 +00:00
[else
(error 'spawn-demo-config "No setup for hostname ~a" (gethostname))])))