diff --git a/msg.rkt b/msg.rkt index ffbc50f..5d73ece 100644 --- a/msg.rkt +++ b/msg.rkt @@ -12,7 +12,7 @@ (struct msg [src dst] #:transparent) -(struct msg:update msg [subnet pref self-origin? as-path origin] +(struct route [subnet pref self-origin? as-path origin] ;; subnet : Subnet ;; pref : Int ;; self-origin? : Boolean @@ -20,6 +20,10 @@ ;; origin : (U 'IGP 'EGP 'UNK) #:transparent) +(struct msg:update msg [route] + ;; route : Route + #:transparent) + (struct msg:revoke msg [networks] ;; networks : [Listof Subnet] #:transparent) @@ -62,11 +66,11 @@ (match type ["update" (msg:update src dst - (hash->subnet data) - (hash-ref data 'localpref) - (hash-ref data 'selfOrigin) - (hash-ref data 'ASPath) - (string->symbol (hash-ref data 'origin)))] + (route (hash->subnet data) + (hash-ref data 'localpref) + (hash-ref data 'selfOrigin) + (hash-ref data 'ASPath) + (string->symbol (hash-ref data 'origin))))] ["revoke" (msg:revoke src dst (map hash->subnet data))] @@ -101,8 +105,8 @@ (msg:update (string->ip "1.2.3.4") (string->ip "1.2.3.7") - (subnet (string->ip "1.2.3.5") 7) - 100 - #t - '(1 2) - 'UNK))) + (route (subnet (string->ip "1.2.3.5") 7) + 100 + #t + '(1 2) + 'UNK))))