Specification of package Tgx.Openssl







with Tgx.System_Ios;
with  Ada.Finalization;
with System.Storage_Elements;
package Tgx.Openssl is

   OpenSSL specific declarations

        type SSL_st is private;
        type SSL is access SSL_st;

        type SSL_ctx_st is private;
        type SSL_CTX is access SSL_ctx_st;
   

        function SSL_new (Ctx : in SSL_CTX) return SSL;
        pragma Import (C, SSL_new, "SSL_new");

        function SSL_set_fd (S : in SSL; Fd : in Tgx.System_Ios.Handle) return Tgx.System_Ios.Integer_32;
        pragma Import (C, SSL_set_fd, "SSL_set_fd");

        function SSL_connect (SSLst : in SSL) return Tgx.System_Ios.Integer_32;
        pragma Import (C, SSL_connect, "SSL_connect");

        function SSL_accept (SSLst : in SSL) return Tgx.System_Ios.Integer_32;
        pragma Import (C, SSL_accept, "SSL_accept");

        function SSL_get_error (SSLst : in SSL; Ret : in Tgx.System_Ios.Integer_32) return Tgx.System_Ios.Integer_32;
        pragma Import (C, SSL_get_error, "SSL_get_error");

        procedure SSL_shutdown (SSLst : in SSL) ;
        pragma Import (C, SSL_shutdown, "SSL_shutdown");

        procedure SSL_free (SSLst : in SSL) ;
        pragma Import (C, SSL_free, "SSL_free");

        procedure SSL_library_init;
        pragma Import (C, SSL_library_init, "SSL_library_init");
        procedure SSLeay_add_ssl_algorithms renames SSL_library_init;

        procedure SSL_load_error_strings;
        pragma Import (C, SSL_load_error_strings, "SSL_load_error_strings");

         type Method_Ptr is access procedure SSL_Method;
        type Method_Ptr is access function return System.Address ;
        pragma Convention (C, Method_Ptr);

        function SSLv23_method return System.Address;
        pragma Import (C, SSLv23_method, "SSLv23_method");
        function SSLv23_server_method return System.Address;
        pragma Import (C, SSLv23_server_method, "SSLv23_server_method");
        function SSLv23_client_method return System.Address;
        pragma Import (C, SSLv23_client_method, "SSLv23_client_method");
        
        function SSL_CTX_new (Meth : in System.Address) return SSL_CTX;
        pragma Import (C, SSL_CTX_new, "SSL_CTX_new");
        procedure SSL_CTX_free (Ctx : in SSL_CTX) ;
        pragma Import (C, SSL_CTX_free, "SSL_CTX_free");

 SSL_get_cipher
        type X509_Certificate is new System.Address;
        function SSL_get_peer_certificate ( Sslst : in SSL) return X509_Certificate;
        pragma Import (C, SSL_get_peer_certificate, "SSL_get_peer_certificate");

        function X509_NAME_oneline ( Certif : in Sslst;
        OPENSSL_free

        X509_FILETYPE_PEM     : constant := 1;
        X509_FILETYPE_ASN1    : constant := 2;
        X509_FILETYPE_DEFAULT : constant := 3;

        SSL_FILETYPE_PEM     : constant := X509_FILETYPE_PEM;
        SSL_FILETYPE_ASN1    : constant := X509_FILETYPE_ASN1;

        function SSL_CTX_use_certificate_file (Ctx : in SSL_CTX; File : in System.Address; SSL_FILETYPE : in Natural) return Tgx.System_Ios.Integer_32;
        pragma Import (C, SSL_CTX_use_certificate_file, "SSL_CTX_use_certificate_file");

        function SSL_CTX_use_PrivateKey_file (Ctx : in SSL_CTX; File : in System.Address; SSL_FILETYPE : in Natural) return Tgx.System_Ios.Integer_32;
        pragma Import (C, SSL_CTX_use_PrivateKey_file, "SSL_CTX_use_PrivateKey_file");

        function SSL_CTX_check_private_key (Ctx : in SSL_CTX) return Tgx.System_Ios.Integer_32;
        pragma Import (C, SSL_CTX_check_private_key, "SSL_CTX_check_private_key");

        type Access_Print is access procedure (Str: in System.Address; Len : in Natural; Fd : in System.Address);  Fd ignored but API matches C
        pragma convention (C, Access_Print);

        procedure Ada_print_fp (Str: in System.Address; Len : in Natural; Fd : in System.Address);  Fd ignored but API matches C
        pragma convention (C, Ada_print_fp);

        procedure ERR_print_errors_cb (Cb : in Access_Print; Fd : in System.Address);
        pragma Import (C, ERR_print_errors_cb, "ERR_print_errors_cb");

        procedure ERR_print_errors_fp ;

   function SSL_read ( The_Fd           : in Ssl ;
                     The_Address      : in System.Address ;
                     The_Length       : in Tgx.System_Ios.Integer_32
     ) return Tgx.System_Ios.Integer_32 ;
   pragma Import (C, SSL_read, "SSL_read" ) ;

   function SSL_write ( The_Fd           : in Ssl ;
                        The_Address      : in System.Address ;
                        The_Length       : in Tgx.System_Ios.Integer_32
     ) return Tgx.System_Ios.Integer_32 ;
   pragma Import (C, SSL_write, "SSL_write" ) ;

   type SSL_Context is new Ada.Finalization.Controlled with
   record
      Ctx : SSL_CTX := null;
      Ref_Count : Natural := 0;
   end record;
   procedure Initialize (Object : in out SSL_Context) ;
   procedure Adjust (Object : in out SSL_Context) ;
   procedure Finalize (Object : in out SSL_Context) ;


private
         we do not care of what in inside SSL structures.
        type SSL_st is new Integer;
        type SSL_ctx_st is new Integer;
end Tgx.Openssl;



List of definition uses










This page was generated by PrismTech's ada2html on Friday Mai 12 2006 16:18