From e3f2877ab92779078850c2a83796ca02fbd43a54 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Sun, 24 Sep 2000 20:51:04 +0000 Subject: [PATCH] added internet-address->dotted-string --- scsh/network.scm | 9 +++++++++ scsh/scsh-interfaces.scm | 1 + 2 files changed, 10 insertions(+) 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?