route struct
This commit is contained in:
parent
a603926b94
commit
edc229cb07
14
msg.rkt
14
msg.rkt
|
@ -12,7 +12,7 @@
|
||||||
(struct msg [src dst]
|
(struct msg [src dst]
|
||||||
#:transparent)
|
#:transparent)
|
||||||
|
|
||||||
(struct msg:update msg [subnet pref self-origin? as-path origin]
|
(struct route [subnet pref self-origin? as-path origin]
|
||||||
;; subnet : Subnet
|
;; subnet : Subnet
|
||||||
;; pref : Int
|
;; pref : Int
|
||||||
;; self-origin? : Boolean
|
;; self-origin? : Boolean
|
||||||
|
@ -20,6 +20,10 @@
|
||||||
;; origin : (U 'IGP 'EGP 'UNK)
|
;; origin : (U 'IGP 'EGP 'UNK)
|
||||||
#:transparent)
|
#:transparent)
|
||||||
|
|
||||||
|
(struct msg:update msg [route]
|
||||||
|
;; route : Route
|
||||||
|
#:transparent)
|
||||||
|
|
||||||
(struct msg:revoke msg [networks]
|
(struct msg:revoke msg [networks]
|
||||||
;; networks : [Listof Subnet]
|
;; networks : [Listof Subnet]
|
||||||
#:transparent)
|
#:transparent)
|
||||||
|
@ -62,11 +66,11 @@
|
||||||
(match type
|
(match type
|
||||||
["update"
|
["update"
|
||||||
(msg:update src dst
|
(msg:update src dst
|
||||||
(hash->subnet data)
|
(route (hash->subnet data)
|
||||||
(hash-ref data 'localpref)
|
(hash-ref data 'localpref)
|
||||||
(hash-ref data 'selfOrigin)
|
(hash-ref data 'selfOrigin)
|
||||||
(hash-ref data 'ASPath)
|
(hash-ref data 'ASPath)
|
||||||
(string->symbol (hash-ref data 'origin)))]
|
(string->symbol (hash-ref data 'origin))))]
|
||||||
["revoke"
|
["revoke"
|
||||||
(msg:revoke src dst
|
(msg:revoke src dst
|
||||||
(map hash->subnet data))]
|
(map hash->subnet data))]
|
||||||
|
@ -101,8 +105,8 @@
|
||||||
(msg:update
|
(msg:update
|
||||||
(string->ip "1.2.3.4")
|
(string->ip "1.2.3.4")
|
||||||
(string->ip "1.2.3.7")
|
(string->ip "1.2.3.7")
|
||||||
(subnet (string->ip "1.2.3.5") 7)
|
(route (subnet (string->ip "1.2.3.5") 7)
|
||||||
100
|
100
|
||||||
#t
|
#t
|
||||||
'(1 2)
|
'(1 2)
|
||||||
'UNK)))
|
'UNK))))
|
||||||
|
|
Loading…
Reference in New Issue