Lifted types & main openssl lib to separate files.
Noticed that typed wrappers for some other libs (e.g., db) would use the types but not necessarily the functions, so it seems logical to separate the types. Also, after I built Racket on my Mac, it failed to find openssl/main.rkt named as it was — signaled an error that indicated it was looking in <my git repo>/pkgs/htdp-pkgs/htdp-lib/typed/openssl.rkt — so I lifted openssl/main.rkt out to openssl.rkt
This commit is contained in:
parent
a651845605
commit
44460d383d
|
@ -1,14 +1,6 @@
|
||||||
#lang typed/racket/base
|
#lang typed/racket/base
|
||||||
|
|
||||||
(require/opaque-type SSL-Client-Context ssl-client-context? openssl)
|
(require "openssl/types.rkt")
|
||||||
(define-type SSL-Protocol
|
|
||||||
(U 'sslv2-or-v3 'sslv2 'sslv3 'tls))
|
|
||||||
(provide SSL-Client-Context
|
|
||||||
ssl-client-context?
|
|
||||||
SSL-Protocol)
|
|
||||||
|
|
||||||
(require/opaque-type SSL-Listener ssl-listener? openssl)
|
|
||||||
|
|
||||||
|
|
||||||
(require/typed/provide openssl
|
(require/typed/provide openssl
|
||||||
[ssl-available? Boolean]
|
[ssl-available? Boolean]
|
||||||
|
@ -28,17 +20,6 @@
|
||||||
[ssl-make-client-context (SSL-Protocol -> SSL-Client-Context)]
|
[ssl-make-client-context (SSL-Protocol -> SSL-Client-Context)]
|
||||||
)
|
)
|
||||||
|
|
||||||
;;;; Ports ;;;;
|
|
||||||
|
|
||||||
(require/typed/provide openssl
|
|
||||||
;; XXX Would be better if we could make SSL-Port be a subtype
|
|
||||||
;; of Port, but for now that's impossible so we'll just provide
|
|
||||||
;; this predicate.
|
|
||||||
[ssl-port? (-> Any Boolean)]
|
|
||||||
)
|
|
||||||
|
|
||||||
(require/opaque-type SSL-Server-Context ssl-server-context? openssl)
|
|
||||||
|
|
||||||
;;;; 2: TCP-like Server Procedures
|
;;;; 2: TCP-like Server Procedures
|
||||||
(require/typed/provide openssl
|
(require/typed/provide openssl
|
||||||
[ssl-listen (->* (Exact-Positive-Integer) ;; port, <= 65535
|
[ssl-listen (->* (Exact-Positive-Integer) ;; port, <= 65535
|
||||||
|
@ -74,14 +55,6 @@
|
||||||
|
|
||||||
;;;; 4: Context Procedures
|
;;;; 4: Context Procedures
|
||||||
|
|
||||||
(define-type SSL-Context (U SSL-Client-Context SSL-Server-Context))
|
|
||||||
|
|
||||||
(define-type SSL-Verify-Source
|
|
||||||
(U Path-String
|
|
||||||
(List 'directory Path-String)
|
|
||||||
(List 'win32-store String)
|
|
||||||
(List 'macosx-keychain Path-String)))
|
|
||||||
|
|
||||||
(require/typed/provide openssl
|
(require/typed/provide openssl
|
||||||
[ssl-load-verify-source!
|
[ssl-load-verify-source!
|
||||||
(-> SSL-Context SSL-Verify-Source [#:try? Any] Void)]
|
(-> SSL-Context SSL-Verify-Source [#:try? Any] Void)]
|
|
@ -0,0 +1,43 @@
|
||||||
|
#lang typed/racket/base
|
||||||
|
|
||||||
|
#| Datatypes used by typed/openssl, based on the untyped openssl module. |#
|
||||||
|
|
||||||
|
(provide SSL-Protocol
|
||||||
|
SSL-Client-Context ssl-client-context?
|
||||||
|
SSL-Server-Context ssl-server-context?
|
||||||
|
SSL-Context
|
||||||
|
SSL-Listener ssl-listener?
|
||||||
|
;; ssl-port? is provided below
|
||||||
|
SSL-Verify-Source
|
||||||
|
)
|
||||||
|
|
||||||
|
(define-type SSL-Protocol
|
||||||
|
(U 'sslv2-or-v3 'sslv2 'sslv3 'tls))
|
||||||
|
|
||||||
|
(require/opaque-type SSL-Client-Context ssl-client-context? openssl)
|
||||||
|
|
||||||
|
(require/opaque-type SSL-Listener ssl-listener? openssl)
|
||||||
|
(provide SSL-Listener ssl-listener?)
|
||||||
|
|
||||||
|
(require/typed/provide openssl
|
||||||
|
;; XXX Would be better if we could make a type SSL-Port as a subtype
|
||||||
|
;; of Port, but for now that's impossible so we'll just provide this
|
||||||
|
;; predicate that guarantees Port-ness.
|
||||||
|
[ssl-port? (-> Any Boolean ;; TODO: Add this --> : #:+ Port
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
|
||||||
|
(require/opaque-type SSL-Server-Context ssl-server-context? openssl)
|
||||||
|
|
||||||
|
(define-type SSL-Context (U SSL-Client-Context SSL-Server-Context))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;;; Host Verification ;;;;
|
||||||
|
|
||||||
|
(define-type SSL-Verify-Source
|
||||||
|
(U Path-String
|
||||||
|
(List 'directory Path-String)
|
||||||
|
(List 'win32-store String)
|
||||||
|
(List 'macosx-keychain Path-String)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user