ADDED address-info.egg Index: address-info.egg ================================================================== --- /dev/null +++ address-info.egg @@ -0,0 +1,16 @@ +((category net) + (synopsis "Network address information access") + (license "BSD") + (author "Thomas Chust") + (version "1.0.5") + (dependencies + srfi-1) + (test-dependencies + test) + (components + (extension address-info + (cond-expand + [windows (csc-options -L -lws2_32)] + [else])))) + +;; vim: set ai et ts=4 sts=2 sw=2 ft=scheme: ;; DELETED address-info.meta Index: address-info.meta ================================================================== --- address-info.meta +++ /dev/null @@ -1,9 +0,0 @@ -((category net) - (synopsis "Network address information access") - (license "BSD") - (author "Thomas Chust") - (doc-from-wiki) - (needs) - (test-depends test)) - -;; vim: set ai et ts=4 sts=2 sw=2 ft=scheme: ;; Index: address-info.release-info ================================================================== --- address-info.release-info +++ address-info.release-info @@ -1,7 +1,9 @@ (repo fossil "https://chust.org/repos/chicken-{egg-name}") (uri targz "https://chust.org/repos/chicken-{egg-name}/tarball/{egg-name}.tar.gz?uuid=v{egg-release}") -(release "1.0.1") -(release "1.0.0") +(release "1.0.5") +(release "1.0.4") +(release "1.0.3") +(release "1.0.2") ;; vim: set ai et ts=4 sts=2 sw=2 ft=scheme: ;; Index: address-info.scm ================================================================== --- address-info.scm +++ address-info.scm @@ -25,15 +25,15 @@ (make-address-info address-info? address-info-family address-info-type address-info-host address-info-port address-infos) (import - scheme chicken foreign - (only srfi-1 unfold) lolevel) - -(require-library - srfi-1 lolevel) + scheme + (chicken base) + (chicken foreign) + (chicken condition) + (only (srfi 1) unfold)) (declare (usual-integrations) (no-procedure-checks-for-usual-bindings)) @@ -48,10 +48,11 @@ #else # include # include # include # include +# include #endif <# (define-foreign-type addrinfo (c-pointer (struct "addrinfo"))) DELETED address-info.setup Index: address-info.setup ================================================================== --- address-info.setup +++ /dev/null @@ -1,37 +0,0 @@ -(compile -s -O2 -d1 "address-info.scm" -j address-info - ,@(cond-expand - (windows - '("-lws2_32")) - (else - '()))) - -(cond-expand - (enable-static - (compile -c -O2 -d1 "address-info.scm" -unit address-info)) - (else - )) - -(compile -s -O2 -d0 "address-info.import.scm") - -(install-extension - 'address-info - `("address-info.so" - ,@(cond-expand - (enable-static - '("address-info.o")) - (else - '())) - "address-info.import.so") - `((version "1.0.0") - ,@(cond-expand - (enable-static - `((static "address-info.o") - ,@(cond-expand - (windows - '((static-options "-lws2_32"))) - (else - '())))) - (else - '())))) - -;; vim: set ai et ts=4 sts=2 sw=2 ft=scheme: ;; Index: address-info.wiki ================================================================== --- address-info.wiki +++ address-info.wiki @@ -1,11 +1,11 @@

Address Info API

This CHICKEN module exposes getaddrinfo(3) functionality to Scheme. - (require-extension address-info) + (import address-info)

Address Info Record

DELETED test/run.scm Index: test/run.scm ================================================================== --- test/run.scm +++ /dev/null @@ -1,39 +0,0 @@ -;; This file is part of address-info for CHICKEN -;; Copyright (c) 2017 by Thomas Chust. All rights reserved. -;; -;; Permission is hereby granted, free of charge, to any person -;; obtaining a copy of this software and associated documentation -;; files (the Software), to deal in the Software without restriction, -;; including without limitation the rights to use, copy, modify, -;; merge, publish, distribute, sublicense, and/or sell copies of the -;; Software, and to permit persons to whom the Software is furnished -;; to do so, subject to the following conditions: -;; -;; The above copyright notice and this permission notice shall be -;; included in all copies or substantial portions of the Software. -;; -;; THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, -;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -;; SOFTWARE. - -(require-extension - address-info test) - -(test-group "client mode" - (test-assert "bad hostname" (not (address-infos "!foo/bar.invalid"))) - (test-assert "symbolic localhost" (list? (address-infos "localhost"))) - (test-assert "numeric ipv4 localhost" (member (make-address-info 'ipv4 'tcp "127.0.0.1" #f) (address-infos "127.0.0.1" type: 'stream numeric?: #t))) - (test-assert "numeric ipv6 localhost" (member (make-address-info 'ipv6 'tcp "::1" #f) (address-infos "::1" type: 'stream numeric?: #t))) - (test "port lookup" 80 (address-info-port (car (address-infos "example.com" port: "http"))))) - -(test-group "server mode" - (test-assert "bad port" (not (address-infos #f port: "!foo/bar"))) - (test "port lookup" 80 (address-info-port (car (address-infos #f port: "http")))) - (test "ipv4 wildcard lookup" "0.0.0.0" (address-info-host (car (address-infos #f port: "http" family: 'ipv4)))) - (test "ipv6 wildcard lookup" "::" (address-info-host (car (address-infos #f port: "http" family: 'ipv6))))) - ADDED tests/run.scm Index: tests/run.scm ================================================================== --- /dev/null +++ tests/run.scm @@ -0,0 +1,40 @@ +;; This file is part of address-info for CHICKEN +;; Copyright (c) 2017 by Thomas Chust. All rights reserved. +;; +;; Permission is hereby granted, free of charge, to any person +;; obtaining a copy of this software and associated documentation +;; files (the Software), to deal in the Software without restriction, +;; including without limitation the rights to use, copy, modify, +;; merge, publish, distribute, sublicense, and/or sell copies of the +;; Software, and to permit persons to whom the Software is furnished +;; to do so, subject to the following conditions: +;; +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +(import + address-info test) + +(test-group "client mode" + (test-assert "bad hostname" (not (address-infos "!foo/bar.invalid"))) + (test-assert "symbolic localhost" (list? (address-infos "localhost"))) + (test-assert "numeric ipv4 localhost" (member (make-address-info 'ipv4 'tcp "127.0.0.1" #f) (address-infos "127.0.0.1" type: 'stream numeric?: #t))) + (test-assert "numeric ipv6 localhost" (member (make-address-info 'ipv6 'tcp "::1" #f) (address-infos "::1" type: 'stream numeric?: #t))) + (test "port lookup" 80 (address-info-port (car (address-infos "example.com" port: "http"))))) + +(test-group "server mode" + (test-assert "bad port" (not (address-infos #f port: "!foo/bar"))) + (test "port lookup" 80 (address-info-port (car (address-infos #f port: "http")))) + (test "ipv4 wildcard lookup" "0.0.0.0" (address-info-host (car (address-infos #f port: "http" family: 'ipv4)))) + (test "ipv6 wildcard lookup" "::" (address-info-host (car (address-infos #f port: "http" family: 'ipv6))))) + +(test-exit)