All Manuals > LispWorks® User Guide and Reference Manual > 32 The COMM Package

ssl-context-ref FLI Type Descriptor

Summary

A foreign pointer corresponding to the Apple Security Framework type SSLContextRef.

Package

comm

Syntax

ssl-context-ref

Description

Instances of the FLI type ssl-context-ref are FLI pointers corresponding to the C type SSLContextRef in the Apple Security Framework. When LispWorks itself creates such objects, it creates the FLI pointer. You can get such pointers by calling ssl-connection-ssl-ref on the SSL connection object (a socket-stream or an async-io-state). A ssl-context-ref is passed to the callback specified by apple-configure-callback in create-ssl-server-context and create-ssl-client-context, and to the callback specified by ssl-configure-callback (when not using an ssl-abstract-context, see 25.8.6 Keyword arguments for use with SSL).

ssl-context-ref is also a Lisp type, and can be used with typep, typecase and as a specializer in CLOS methods. This is useful if you want to write code that takes a SSL connection and want to do different things according to the implementation type.

You can also create a ssl-context-ref yourself using the functions from the Apple Security Framework, and then pass it with the :ssl-ctx keyword to attach-ssl, async-io-state-attach-ssl or make-instance with socket-stream. When you do that, it is your resposibility to perform all the required configurations except setting the I/O functions and connection, which LispWorks always sets itself. For example:

(fli:define-foreign-function (my-create-client-ssl-context-ref
                              "my_create_client_ssl_context_ref")
    ((options integer))
  :result-type comm:ssl-context-ref)
 
...
 
 (multiple-value-bind  (stream maybe-error) 
     (comm:open-tcp-stream server-name port-number)
   (if stream
       (progn 
         (comm:attach-ssl
          stream 
          :ssl-ctx (my-create-client-ssl-context-ref options))
         stream)
     (my-signal-failure-to-open server-name port-number maybe-error)))

Note: when a ssl-context-ref is passed to LispWorks using :ssl-ctx as above, LispWorks takes ownership of it and will release it when the stream is closed. You cannot use the object in the call to open-tcp-stream, because there would be no way to ensure that it is released correctly if an error is signaled.

See also

ssl-connection-ssl-ref
open-tcp-stream
create-async-io-state-and-connected-tcp-socket
socket-stream
accept-tcp-connections-creating-async-io-states
attach-ssl


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:26