diff --git a/msg.rkt b/msg.rkt index 0f12a53..a01a8f2 100644 --- a/msg.rkt +++ b/msg.rkt @@ -101,6 +101,21 @@ 'msg (match msg [(msg:data _ _ data) data] [(msg:no-route _ _) (hash)] + + [(msg:update _ _ + (route _ + net + pref + self-orig? + as + org)) + (hash 'network (ip->string (subnet-ip net)) + 'netmask (ip->string (netmask-ip (subnet-mask net))) + 'localpref pref + 'selfOrigin self-orig? + 'ASPath as + 'origin (symbol->string org))] + [_ (error 'msg->jsexpr (format "unimplemented ~a" (msg-type msg)))]))) @@ -109,12 +124,12 @@ (jsexpr->bytes (msg->jsexpr msg))) (module+ test - #; (check-equal? (msg->jsexpr (msg:update (string->ip "1.2.3.4") (string->ip "1.2.3.7") - (route (subnet (string->ip "1.2.3.5") 7) + (route (string->ip "1.2.3.4") + (subnet (string->ip "1.2.3.5") 25) 100 #t '(1 2) @@ -143,7 +158,7 @@ (string->ip "1.2.3.4") (string->ip "1.2.3.7") (route (string->ip "1.2.3.4") - (subnet (string->ip "1.2.3.5") 7) + (subnet (string->ip "1.2.3.5") 25) 100 #t '(1 2)