X-Git-Url: https://git.distorted.org.uk/~mdw/zone/blobdiff_plain/b85ef4e407e433ec2b2b40c2a38957f955f827fc..446d97b75aed88b254cc1640fb91e110a2ca401b:/net.lisp diff --git a/net.lisp b/net.lisp index 40882de..751ecfd 100644 --- a/net.lisp +++ b/net.lisp @@ -1,7 +1,5 @@ ;;; -*-lisp-*- ;;; -;;; $Id$ -;;; ;;; Network (numbering) tools ;;; ;;; (c) 2006 Straylight/Edgeware @@ -13,12 +11,12 @@ ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; (at your option) any later version. -;;; +;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. -;;; +;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -27,14 +25,14 @@ ;;; Packaging. (defpackage #:net - (:use #:common-lisp #:mdw.base #:mdw.str #:collect) + (:use #:common-lisp #:mdw.base #:mdw.str #:collect #:net-sys) (:export #:ipaddr #:string-ipaddr #:ipaddr-byte #:ipaddr-string #:ipaddrp #:integer-netmask #:ipmask #:ipmask-cidl-slash #:make-ipnet #:string-ipnet #:ipnet #:ipnet-net #:ipnet-mask #:with-ipnet #:ipnet-pretty #:ipnet-string #:ipnet-broadcast #:ipnet-hosts #:ipnet-host #:ipaddr-networkp #:ipnet-subnetp #:ipnet-changeable-bytes - #:host-find# #:host-create #:defhost #:parse-ipaddr + #:host-find #:host-create #:defhost #:parse-ipaddr #:resolve-hostname #:canonify-hostname #:net #:net-find #:net-get-as-ipnet #:net-create #:defnet #:net-next-host #:net-host)) @@ -253,27 +251,6 @@ (return (- 4 i))))) ;;;-------------------------------------------------------------------------- -;;; Name resolution. - -(defun resolve-hostname (name) - "Resolve a hostname to an IP address using the DNS, or return nil." - #+cmu (let ((he (ext:lookup-host-entry name))) - (and he (ext:host-entry-addr he))) - #+clisp (let ((he (ext:resolve-host-ipaddr name))) - (and he (string-ipaddr (car (ext:hostent-addr-list he))))) - #+ecl (nth-value 2 (ext:lookup-host-entry name)) - #-(or cmu clisp ecl) nil) - -(defun canonify-hostname (name) - "Resolve a hostname to canonical form using the DNS, or return nil." - #+cmu (let ((he (ext:lookup-host-entry name))) - (and he (ext:host-entry-name he))) - #+clisp (let ((he (ext:resolve-host-ipaddr name))) - (and he (ext:hostent-name he))) - #+ecl (nth-value 0 (ext:lookup-host-entry name)) - #-(or cmu clisp ecl) name) - -;;;-------------------------------------------------------------------------- ;;; Host names and specifiers. (defun parse-ipaddr (addr)