address-info

Check-in [ce0ff4b2a5]
Login

Check-in [ce0ff4b2a5]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ported the egg to CHICKEN 5
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | chicken-5
Files: files | file ages | folders
SHA3-256: ce0ff4b2a59c44e49c536cf937118ae37c82c38aacf5ffc77b92f32cbaba5c3d
User & Date: murphy 2018-08-12 12:50:31.642
Context
2018-08-14
11:29
Added #! line to build script check-in: 429766d9ff user: murphy tags: chicken-5
2018-08-12
12:50
Ported the egg to CHICKEN 5 check-in: ce0ff4b2a5 user: murphy tags: chicken-5
2017-09-01
11:54
pointed release information to main repository Leaf check-in: dc32c551b5 user: murphy tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Name change from address-info.meta to address-info.egg.
1
2
3
4
5
6
7



8
9
((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: ;;




|
<
|
>
>
>


1
2
3
4
5

6
7
8
9
10
11
((category net)
 (synopsis "Network address information access")
 (license "BSD")
 (author "Thomas Chust")
 (version "1.0.1")

 (test-dependencies test)
 (components
   (extension address-info
     (custom-build "build-address-info"))))

;; vim: set ai et ts=4 sts=2 sw=2 ft=scheme: ;;
Changes to address-info.scm.
23
24
25
26
27
28
29


30
31
32
33
34
35
36
37
38
39
40
41

(module address-info
  (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)

(declare
  (usual-integrations)
  (no-procedure-checks-for-usual-bindings))

#>
#include <errno.h>







>
>
|
<
|
<
|







23
24
25
26
27
28
29
30
31
32

33

34
35
36
37
38
39
40
41

(module address-info
  (make-address-info address-info?
   address-info-family address-info-type address-info-host address-info-port
   address-infos)

(import
  scheme
  (chicken base)
  (chicken foreign)

  (chicken condition)

  (only (srfi 1) unfold))

(declare
  (usual-integrations)
  (no-procedure-checks-for-usual-bindings))

#>
#include <errno.h>
Deleted address-info.setup.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(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: ;;
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































Added build-address-info.


>
1
"$CHICKEN_CSC" -O2 -d1 -C "$CFLAGS" -L "$LDFLAGS" "$@"
Added build-address-info.bat.




>
>
1
2
@echo off
%CHICKEN_CSC% -O2 -d1 -C %CFLAGS% -L -lws2_32 -L %LDFLAGS% %*
Name change from test/run.scm to tests/run.scm.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

;; 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)))))









|















>
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
;; 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)