]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/openssl/libssl/libssl.factor
use radix literals
[factor.git] / basis / openssl / libssl / libssl.factor
index 1c6fbec011d6fae6262eba924e533375da2f94ab..efef9f3bc5b421b6cce2d6b3186f789f967ebb5b 100644 (file)
@@ -3,16 +3,14 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.syntax combinators kernel
 system namespaces assocs parser lexer sequences words
-quotations math.bitwise alien.libraries ;
+quotations math.bitwise alien.libraries literals ;
 
 IN: openssl.libssl
 
 << {
-    { [ os openbsd? ] [ ] } ! VM is linked with it
-    { [ os netbsd? ] [ ] }
-    { [ os winnt? ] [ "libssl" "ssleay32.dll" "cdecl" add-library ] }
-    { [ os macosx? ] [ "libssl" "libssl.dylib" "cdecl" add-library ] }
-    { [ os unix? ] [ "libssl" "libssl.so" "cdecl" add-library ] }
+    { [ os windows? ] [ "libssl" "ssleay32.dll" cdecl add-library ] }
+    { [ os macosx? ] [ "libssl" "libssl.dylib" cdecl add-library ] }
+    { [ os unix? ] [ "libssl" "libssl.so" cdecl add-library ] }
 } cond >>
 
 CONSTANT: X509_FILETYPE_PEM       1
@@ -109,7 +107,7 @@ FUNCTION: X509_NAME* X509_get_subject_name ( X509* a ) ;
 ! ssl.h
 ! ===============================================
 
-FUNCTION: char* SSL_get_version ( SSL* ssl ) ;
+FUNCTION: c-string SSL_get_version ( SSL* ssl ) ;
 
 ! Maps OpenSSL errors to strings
 FUNCTION: void SSL_load_error_strings (  ) ;
@@ -143,7 +141,7 @@ FUNCTION: SSL_CTX* SSL_CTX_new ( ssl-method method ) ;
 
 ! Load the certificates and private keys into the SSL_CTX
 FUNCTION: int SSL_CTX_use_certificate_chain_file ( SSL_CTX* ctx,
-                                                   char* file ) ; ! PEM type
+                                                   c-string file ) ; ! PEM type
 
 FUNCTION: SSL* SSL_new ( SSL_CTX* ctx ) ;
 
@@ -174,7 +172,7 @@ CONSTANT: SSL_RECEIVED_SHUTDOWN 2
 
 FUNCTION: int SSL_get_shutdown ( SSL* ssl ) ;
 
-FUNCTION: int SSL_CTX_set_session_id_context ( SSL_CTX* ctx, char* sid_ctx, uint len ) ;
+FUNCTION: int SSL_CTX_set_session_id_context ( SSL_CTX* ctx, c-string sid_ctx, uint len ) ;
 
 FUNCTION: SSL_SESSION* SSL_get1_session ( SSL* ssl ) ;
 
@@ -197,17 +195,17 @@ FUNCTION: void SSL_CTX_free ( SSL_CTX* ctx ) ;
 
 FUNCTION: void RAND_seed ( void* buf, int num ) ;
 
-FUNCTION: int SSL_set_cipher_list ( SSL* ssl, char* str ) ;
+FUNCTION: int SSL_set_cipher_list ( SSL* ssl, c-string str ) ;
 
-FUNCTION: int SSL_use_RSAPrivateKey_file ( SSL* ssl, char* str ) ;
+FUNCTION: int SSL_use_RSAPrivateKey_file ( SSL* ssl, c-string str ) ;
 
 FUNCTION: int SSL_CTX_use_RSAPrivateKey_file ( SSL_CTX* ctx, int type ) ;
 
 FUNCTION: int SSL_use_certificate_file ( SSL* ssl,
-                                         char* str, int type ) ;
+                                         c-string str, int type ) ;
 
-FUNCTION: int SSL_CTX_load_verify_locations ( SSL_CTX* ctx, char* CAfile,
-                                              char* CApath ) ;
+FUNCTION: int SSL_CTX_load_verify_locations ( SSL_CTX* ctx, c-string CAfile,
+                                              c-string CApath ) ;
 
 FUNCTION: int SSL_CTX_set_default_verify_paths ( SSL_CTX* ctx ) ;
 
@@ -220,7 +218,7 @@ FUNCTION: void SSL_CTX_set_verify ( SSL_CTX* ctx, int mode, void* callback ) ;
 
 FUNCTION: void SSL_CTX_set_client_CA_list ( SSL_CTX* ctx, SSL* list ) ;
 
-FUNCTION: SSL* SSL_load_client_CA_file ( char* file ) ;
+FUNCTION: SSL* SSL_load_client_CA_file ( c-string file ) ;
 
 ! Used to manipulate settings of the SSL_CTX and SSL objects.
 ! This function should never be called directly
@@ -231,7 +229,7 @@ FUNCTION: void SSL_CTX_set_default_passwd_cb ( SSL_CTX* ctx, void* cb ) ;
 FUNCTION: void SSL_CTX_set_default_passwd_cb_userdata ( SSL_CTX* ctx,
                                                         void* u ) ;
 
-FUNCTION: int SSL_CTX_use_PrivateKey_file ( SSL_CTX* ctx, char* file,
+FUNCTION: int SSL_CTX_use_PrivateKey_file ( SSL_CTX* ctx, c-string file,
                                             int type ) ;
 
 ! Sets the maximum depth for the allowed ctx certificate chain verification
@@ -254,19 +252,18 @@ FUNCTION: void* BIO_f_ssl (  ) ;
 : SSL_CTX_set_session_cache_mode ( ctx mode -- n )
     [ SSL_CTRL_SET_SESS_CACHE_MODE ] dip f SSL_CTX_ctrl ;
 
-CONSTANT: SSL_SESS_CACHE_OFF    HEX: 0000
-CONSTANT: SSL_SESS_CACHE_CLIENT HEX: 0001
-CONSTANT: SSL_SESS_CACHE_SERVER HEX: 0002
+CONSTANT: SSL_SESS_CACHE_OFF    0x0000
+CONSTANT: SSL_SESS_CACHE_CLIENT 0x0001
+CONSTANT: SSL_SESS_CACHE_SERVER 0x0002
 
-: SSL_SESS_CACHE_BOTH ( -- n )
-    { SSL_SESS_CACHE_CLIENT SSL_SESS_CACHE_SERVER } flags ; inline
+CONSTANT: SSL_SESS_CACHE_BOTH flags{ SSL_SESS_CACHE_CLIENT SSL_SESS_CACHE_SERVER }
 
-CONSTANT: SSL_SESS_CACHE_NO_AUTO_CLEAR      HEX: 0080
-CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_LOOKUP HEX: 0100
-CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_STORE  HEX: 0200
+CONSTANT: SSL_SESS_CACHE_NO_AUTO_CLEAR      0x0080
+CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100
+CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_STORE  0x0200
 
-: SSL_SESS_CACHE_NO_INTERNAL ( -- n )
-    { SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SSL_SESS_CACHE_NO_INTERNAL_STORE } flags ; inline
+CONSTANT: SSL_SESS_CACHE_NO_INTERNAL
+    flags{ SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SSL_SESS_CACHE_NO_INTERNAL_STORE }
 
 ! ===============================================
 ! x509_vfy.h
@@ -281,9 +278,9 @@ H{ } clone verify-messages set-global
 : verify-message ( n -- word ) verify-messages get-global at ;
 
 SYNTAX: X509_V_:
-    scan "X509_V_" prepend create-in
-    scan-word
-    [ 1quotation (( -- value )) define-inline ]
+    scan-token "X509_V_" prepend create-in
+    scan-number
+    [ 1quotation ( -- value ) define-inline ]
     [ verify-messages get set-at ]
     2bi ;