{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Gio.Interfaces.TlsClientConnection ( -- * Exported types TlsClientConnection(..) , noTlsClientConnection , TlsClientConnectionK , toTlsClientConnection , -- * Methods -- ** tlsClientConnectionGetAcceptedCas tlsClientConnectionGetAcceptedCas , -- ** tlsClientConnectionGetServerIdentity tlsClientConnectionGetServerIdentity , -- ** tlsClientConnectionGetUseSsl3 tlsClientConnectionGetUseSsl3 , -- ** tlsClientConnectionGetValidationFlags tlsClientConnectionGetValidationFlags , -- ** tlsClientConnectionSetServerIdentity tlsClientConnectionSetServerIdentity , -- ** tlsClientConnectionSetUseSsl3 tlsClientConnectionSetUseSsl3 , -- ** tlsClientConnectionSetValidationFlags tlsClientConnectionSetValidationFlags , -- * Properties -- ** AcceptedCas TlsClientConnectionAcceptedCasPropertyInfo, getTlsClientConnectionAcceptedCas , -- ** ServerIdentity TlsClientConnectionServerIdentityPropertyInfo, constructTlsClientConnectionServerIdentity, getTlsClientConnectionServerIdentity , setTlsClientConnectionServerIdentity , -- ** UseSsl3 TlsClientConnectionUseSsl3PropertyInfo , constructTlsClientConnectionUseSsl3 , getTlsClientConnectionUseSsl3 , setTlsClientConnectionUseSsl3 , -- ** ValidationFlags TlsClientConnectionValidationFlagsPropertyInfo, constructTlsClientConnectionValidationFlags, getTlsClientConnectionValidationFlags , setTlsClientConnectionValidationFlags , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Gio.Types import GI.Gio.Callbacks import qualified GI.GObject as GObject -- interface TlsClientConnection newtype TlsClientConnection = TlsClientConnection (ForeignPtr TlsClientConnection) noTlsClientConnection :: Maybe TlsClientConnection noTlsClientConnection = Nothing -- VVV Prop "accepted-cas" -- Type: TGList (TBasicType TVoid) -- Flags: [PropertyReadable] getTlsClientConnectionAcceptedCas :: (MonadIO m, TlsClientConnectionK o) => o -> m [Ptr ()] getTlsClientConnectionAcceptedCas obj = liftIO $ getObjectPropertyPtrGList obj "accepted-cas" data TlsClientConnectionAcceptedCasPropertyInfo instance AttrInfo TlsClientConnectionAcceptedCasPropertyInfo where type AttrAllowedOps TlsClientConnectionAcceptedCasPropertyInfo = '[ 'AttrGet] type AttrSetTypeConstraint TlsClientConnectionAcceptedCasPropertyInfo = (~) () type AttrBaseTypeConstraint TlsClientConnectionAcceptedCasPropertyInfo = TlsClientConnectionK type AttrGetType TlsClientConnectionAcceptedCasPropertyInfo = ([Ptr ()]) type AttrLabel TlsClientConnectionAcceptedCasPropertyInfo = "TlsClientConnection::accepted-cas" attrGet _ = getTlsClientConnectionAcceptedCas attrSet _ = undefined attrConstruct _ = undefined -- VVV Prop "server-identity" -- Type: TInterface "Gio" "SocketConnectable" -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct] getTlsClientConnectionServerIdentity :: (MonadIO m, TlsClientConnectionK o) => o -> m SocketConnectable getTlsClientConnectionServerIdentity obj = liftIO $ getObjectPropertyObject obj "server-identity" SocketConnectable setTlsClientConnectionServerIdentity :: (MonadIO m, TlsClientConnectionK o, SocketConnectableK a) => o -> a -> m () setTlsClientConnectionServerIdentity obj val = liftIO $ setObjectPropertyObject obj "server-identity" val constructTlsClientConnectionServerIdentity :: (SocketConnectableK a) => a -> IO ([Char], GValue) constructTlsClientConnectionServerIdentity val = constructObjectPropertyObject "server-identity" val data TlsClientConnectionServerIdentityPropertyInfo instance AttrInfo TlsClientConnectionServerIdentityPropertyInfo where type AttrAllowedOps TlsClientConnectionServerIdentityPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint TlsClientConnectionServerIdentityPropertyInfo = SocketConnectableK type AttrBaseTypeConstraint TlsClientConnectionServerIdentityPropertyInfo = TlsClientConnectionK type AttrGetType TlsClientConnectionServerIdentityPropertyInfo = SocketConnectable type AttrLabel TlsClientConnectionServerIdentityPropertyInfo = "TlsClientConnection::server-identity" attrGet _ = getTlsClientConnectionServerIdentity attrSet _ = setTlsClientConnectionServerIdentity attrConstruct _ = constructTlsClientConnectionServerIdentity -- VVV Prop "use-ssl3" -- Type: TBasicType TBoolean -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct] getTlsClientConnectionUseSsl3 :: (MonadIO m, TlsClientConnectionK o) => o -> m Bool getTlsClientConnectionUseSsl3 obj = liftIO $ getObjectPropertyBool obj "use-ssl3" setTlsClientConnectionUseSsl3 :: (MonadIO m, TlsClientConnectionK o) => o -> Bool -> m () setTlsClientConnectionUseSsl3 obj val = liftIO $ setObjectPropertyBool obj "use-ssl3" val constructTlsClientConnectionUseSsl3 :: Bool -> IO ([Char], GValue) constructTlsClientConnectionUseSsl3 val = constructObjectPropertyBool "use-ssl3" val data TlsClientConnectionUseSsl3PropertyInfo instance AttrInfo TlsClientConnectionUseSsl3PropertyInfo where type AttrAllowedOps TlsClientConnectionUseSsl3PropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint TlsClientConnectionUseSsl3PropertyInfo = (~) Bool type AttrBaseTypeConstraint TlsClientConnectionUseSsl3PropertyInfo = TlsClientConnectionK type AttrGetType TlsClientConnectionUseSsl3PropertyInfo = Bool type AttrLabel TlsClientConnectionUseSsl3PropertyInfo = "TlsClientConnection::use-ssl3" attrGet _ = getTlsClientConnectionUseSsl3 attrSet _ = setTlsClientConnectionUseSsl3 attrConstruct _ = constructTlsClientConnectionUseSsl3 -- VVV Prop "validation-flags" -- Type: TInterface "Gio" "TlsCertificateFlags" -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct] getTlsClientConnectionValidationFlags :: (MonadIO m, TlsClientConnectionK o) => o -> m [TlsCertificateFlags] getTlsClientConnectionValidationFlags obj = liftIO $ getObjectPropertyFlags obj "validation-flags" setTlsClientConnectionValidationFlags :: (MonadIO m, TlsClientConnectionK o) => o -> [TlsCertificateFlags] -> m () setTlsClientConnectionValidationFlags obj val = liftIO $ setObjectPropertyFlags obj "validation-flags" val constructTlsClientConnectionValidationFlags :: [TlsCertificateFlags] -> IO ([Char], GValue) constructTlsClientConnectionValidationFlags val = constructObjectPropertyFlags "validation-flags" val data TlsClientConnectionValidationFlagsPropertyInfo instance AttrInfo TlsClientConnectionValidationFlagsPropertyInfo where type AttrAllowedOps TlsClientConnectionValidationFlagsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint TlsClientConnectionValidationFlagsPropertyInfo = (~) [TlsCertificateFlags] type AttrBaseTypeConstraint TlsClientConnectionValidationFlagsPropertyInfo = TlsClientConnectionK type AttrGetType TlsClientConnectionValidationFlagsPropertyInfo = [TlsCertificateFlags] type AttrLabel TlsClientConnectionValidationFlagsPropertyInfo = "TlsClientConnection::validation-flags" attrGet _ = getTlsClientConnectionValidationFlags attrSet _ = setTlsClientConnectionValidationFlags attrConstruct _ = constructTlsClientConnectionValidationFlags type instance AttributeList TlsClientConnection = TlsClientConnectionAttributeList type TlsClientConnectionAttributeList = ('[ '("accepted-cas", TlsClientConnectionAcceptedCasPropertyInfo), '("base-io-stream", TlsConnectionBaseIoStreamPropertyInfo), '("certificate", TlsConnectionCertificatePropertyInfo), '("closed", IOStreamClosedPropertyInfo), '("database", TlsConnectionDatabasePropertyInfo), '("input-stream", IOStreamInputStreamPropertyInfo), '("interaction", TlsConnectionInteractionPropertyInfo), '("output-stream", IOStreamOutputStreamPropertyInfo), '("peer-certificate", TlsConnectionPeerCertificatePropertyInfo), '("peer-certificate-errors", TlsConnectionPeerCertificateErrorsPropertyInfo), '("rehandshake-mode", TlsConnectionRehandshakeModePropertyInfo), '("require-close-notify", TlsConnectionRequireCloseNotifyPropertyInfo), '("server-identity", TlsClientConnectionServerIdentityPropertyInfo), '("use-ssl3", TlsClientConnectionUseSsl3PropertyInfo), '("use-system-certdb", TlsConnectionUseSystemCertdbPropertyInfo), '("validation-flags", TlsClientConnectionValidationFlagsPropertyInfo)] :: [(Symbol, *)]) type instance SignalList TlsClientConnection = TlsClientConnectionSignalList type TlsClientConnectionSignalList = ('[ '("accept-certificate", TlsConnectionAcceptCertificateSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) foreign import ccall "g_tls_client_connection_get_type" c_g_tls_client_connection_get_type :: IO GType type instance ParentTypes TlsClientConnection = TlsClientConnectionParentTypes type TlsClientConnectionParentTypes = '[TlsConnection, IOStream, GObject.Object] instance GObject TlsClientConnection where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_g_tls_client_connection_get_type class GObject o => TlsClientConnectionK o instance (GObject o, IsDescendantOf TlsClientConnection o) => TlsClientConnectionK o toTlsClientConnection :: TlsClientConnectionK o => o -> IO TlsClientConnection toTlsClientConnection = unsafeCastTo TlsClientConnection -- method TlsClientConnection::get_accepted_cas -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TGList TByteArray -- throws : False -- Skip return : False foreign import ccall "g_tls_client_connection_get_accepted_cas" g_tls_client_connection_get_accepted_cas :: Ptr TlsClientConnection -> -- _obj : TInterface "Gio" "TlsClientConnection" IO (Ptr (GList (Ptr GByteArray))) tlsClientConnectionGetAcceptedCas :: (MonadIO m, TlsClientConnectionK a) => a -> -- _obj m [ByteString] tlsClientConnectionGetAcceptedCas _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_tls_client_connection_get_accepted_cas _obj' checkUnexpectedReturnNULL "g_tls_client_connection_get_accepted_cas" result result' <- unpackGList result result'' <- mapM unpackGByteArray result' mapGList unrefGByteArray result g_list_free result touchManagedPtr _obj return result'' -- method TlsClientConnection::get_server_identity -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "SocketConnectable" -- throws : False -- Skip return : False foreign import ccall "g_tls_client_connection_get_server_identity" g_tls_client_connection_get_server_identity :: Ptr TlsClientConnection -> -- _obj : TInterface "Gio" "TlsClientConnection" IO (Ptr SocketConnectable) tlsClientConnectionGetServerIdentity :: (MonadIO m, TlsClientConnectionK a) => a -> -- _obj m SocketConnectable tlsClientConnectionGetServerIdentity _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_tls_client_connection_get_server_identity _obj' checkUnexpectedReturnNULL "g_tls_client_connection_get_server_identity" result result' <- (newObject SocketConnectable) result touchManagedPtr _obj return result' -- method TlsClientConnection::get_use_ssl3 -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_tls_client_connection_get_use_ssl3" g_tls_client_connection_get_use_ssl3 :: Ptr TlsClientConnection -> -- _obj : TInterface "Gio" "TlsClientConnection" IO CInt tlsClientConnectionGetUseSsl3 :: (MonadIO m, TlsClientConnectionK a) => a -> -- _obj m Bool tlsClientConnectionGetUseSsl3 _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_tls_client_connection_get_use_ssl3 _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method TlsClientConnection::get_validation_flags -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "TlsCertificateFlags" -- throws : False -- Skip return : False foreign import ccall "g_tls_client_connection_get_validation_flags" g_tls_client_connection_get_validation_flags :: Ptr TlsClientConnection -> -- _obj : TInterface "Gio" "TlsClientConnection" IO CUInt tlsClientConnectionGetValidationFlags :: (MonadIO m, TlsClientConnectionK a) => a -> -- _obj m [TlsCertificateFlags] tlsClientConnectionGetValidationFlags _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_tls_client_connection_get_validation_flags _obj' let result' = wordToGFlags result touchManagedPtr _obj return result' -- method TlsClientConnection::set_server_identity -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "identity", argType = TInterface "Gio" "SocketConnectable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "identity", argType = TInterface "Gio" "SocketConnectable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_tls_client_connection_set_server_identity" g_tls_client_connection_set_server_identity :: Ptr TlsClientConnection -> -- _obj : TInterface "Gio" "TlsClientConnection" Ptr SocketConnectable -> -- identity : TInterface "Gio" "SocketConnectable" IO () tlsClientConnectionSetServerIdentity :: (MonadIO m, TlsClientConnectionK a, SocketConnectableK b) => a -> -- _obj b -> -- identity m () tlsClientConnectionSetServerIdentity _obj identity = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let identity' = unsafeManagedPtrCastPtr identity g_tls_client_connection_set_server_identity _obj' identity' touchManagedPtr _obj touchManagedPtr identity return () -- method TlsClientConnection::set_use_ssl3 -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "use_ssl3", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "use_ssl3", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_tls_client_connection_set_use_ssl3" g_tls_client_connection_set_use_ssl3 :: Ptr TlsClientConnection -> -- _obj : TInterface "Gio" "TlsClientConnection" CInt -> -- use_ssl3 : TBasicType TBoolean IO () tlsClientConnectionSetUseSsl3 :: (MonadIO m, TlsClientConnectionK a) => a -> -- _obj Bool -> -- use_ssl3 m () tlsClientConnectionSetUseSsl3 _obj use_ssl3 = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let use_ssl3' = (fromIntegral . fromEnum) use_ssl3 g_tls_client_connection_set_use_ssl3 _obj' use_ssl3' touchManagedPtr _obj return () -- method TlsClientConnection::set_validation_flags -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "TlsCertificateFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsClientConnection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "TlsCertificateFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_tls_client_connection_set_validation_flags" g_tls_client_connection_set_validation_flags :: Ptr TlsClientConnection -> -- _obj : TInterface "Gio" "TlsClientConnection" CUInt -> -- flags : TInterface "Gio" "TlsCertificateFlags" IO () tlsClientConnectionSetValidationFlags :: (MonadIO m, TlsClientConnectionK a) => a -> -- _obj [TlsCertificateFlags] -> -- flags m () tlsClientConnectionSetValidationFlags _obj flags = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let flags' = gflagsToWord flags g_tls_client_connection_set_validation_flags _obj' flags' touchManagedPtr _obj return ()