diff --git a/scsh/network.scm b/scsh/network.scm index 9f22f7c..33ec5f8 100644 --- a/scsh/network.scm +++ b/scsh/network.scm @@ -146,6 +146,15 @@ (byte-vector-ref address 1) (byte-vector-ref address 0))) +;;; This proc and its inverse should be in a general IP module. +(define (internet-host-address->dotted-string bv) + (let* ((byte0 (byte-vector-ref bv 0)) + (byte1 (byte-vector-ref bv 1)) + (byte2 (byte-vector-ref bv 2)) + (byte3 (byte-vector-ref bv 3))) + (string-append (number->string byte3) "." (number->string byte2) "." + (number->string byte1) "." (number->string byte0)))) + (define (internet-host-address-to-number address) (byte-vector->integer address)) diff --git a/scsh/scsh-interfaces.scm b/scsh/scsh-interfaces.scm index ce638b4..7a6b1c5 100644 --- a/scsh/scsh-interfaces.scm +++ b/scsh/scsh-interfaces.scm @@ -669,6 +669,7 @@ internet-host-address-from-bytes internet-host-address-to-number internet-host-address-to-bytes + internet-host-address->dotted-string host-info host-info?