{- | 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.Soup.Objects.Address ( -- * Exported types Address(..) , AddressK , toAddress , noAddress , -- * Methods -- ** addressEqualByIp addressEqualByIp , -- ** addressEqualByName addressEqualByName , -- ** addressGetGsockaddr addressGetGsockaddr , -- ** addressGetName addressGetName , -- ** addressGetPhysical addressGetPhysical , -- ** addressGetPort addressGetPort , -- ** addressHashByIp addressHashByIp , -- ** addressHashByName addressHashByName , -- ** addressIsResolved addressIsResolved , -- ** addressNew addressNew , -- ** addressNewAny addressNewAny , -- ** addressNewFromSockaddr addressNewFromSockaddr , -- ** addressResolveAsync addressResolveAsync , -- ** addressResolveSync addressResolveSync , -- * Properties -- ** Family AddressFamilyPropertyInfo , constructAddressFamily , getAddressFamily , -- ** Name AddressNamePropertyInfo , constructAddressName , getAddressName , -- ** Physical AddressPhysicalPropertyInfo , getAddressPhysical , -- ** Port AddressPortPropertyInfo , constructAddressPort , getAddressPort , -- ** Protocol AddressProtocolPropertyInfo , constructAddressProtocol , getAddressProtocol , -- ** Sockaddr AddressSockaddrPropertyInfo , constructAddressSockaddr , getAddressSockaddr , ) 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.Soup.Types import GI.Soup.Callbacks import qualified GI.GLib as GLib import qualified GI.GObject as GObject import qualified GI.Gio as Gio newtype Address = Address (ForeignPtr Address) foreign import ccall "soup_address_get_type" c_soup_address_get_type :: IO GType type instance ParentTypes Address = AddressParentTypes type AddressParentTypes = '[GObject.Object, Gio.SocketConnectable] instance GObject Address where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_soup_address_get_type class GObject o => AddressK o instance (GObject o, IsDescendantOf Address o) => AddressK o toAddress :: AddressK o => o -> IO Address toAddress = unsafeCastTo Address noAddress :: Maybe Address noAddress = Nothing -- VVV Prop "family" -- Type: TInterface "Soup" "AddressFamily" -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] getAddressFamily :: (MonadIO m, AddressK o) => o -> m AddressFamily getAddressFamily obj = liftIO $ getObjectPropertyEnum obj "family" constructAddressFamily :: AddressFamily -> IO ([Char], GValue) constructAddressFamily val = constructObjectPropertyEnum "family" val data AddressFamilyPropertyInfo instance AttrInfo AddressFamilyPropertyInfo where type AttrAllowedOps AddressFamilyPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint AddressFamilyPropertyInfo = (~) AddressFamily type AttrBaseTypeConstraint AddressFamilyPropertyInfo = AddressK type AttrGetType AddressFamilyPropertyInfo = AddressFamily type AttrLabel AddressFamilyPropertyInfo = "Address::family" attrGet _ = getAddressFamily attrSet _ = undefined attrConstruct _ = constructAddressFamily -- VVV Prop "name" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] getAddressName :: (MonadIO m, AddressK o) => o -> m T.Text getAddressName obj = liftIO $ getObjectPropertyString obj "name" constructAddressName :: T.Text -> IO ([Char], GValue) constructAddressName val = constructObjectPropertyString "name" val data AddressNamePropertyInfo instance AttrInfo AddressNamePropertyInfo where type AttrAllowedOps AddressNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint AddressNamePropertyInfo = (~) T.Text type AttrBaseTypeConstraint AddressNamePropertyInfo = AddressK type AttrGetType AddressNamePropertyInfo = T.Text type AttrLabel AddressNamePropertyInfo = "Address::name" attrGet _ = getAddressName attrSet _ = undefined attrConstruct _ = constructAddressName -- VVV Prop "physical" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable] getAddressPhysical :: (MonadIO m, AddressK o) => o -> m T.Text getAddressPhysical obj = liftIO $ getObjectPropertyString obj "physical" data AddressPhysicalPropertyInfo instance AttrInfo AddressPhysicalPropertyInfo where type AttrAllowedOps AddressPhysicalPropertyInfo = '[ 'AttrGet] type AttrSetTypeConstraint AddressPhysicalPropertyInfo = (~) () type AttrBaseTypeConstraint AddressPhysicalPropertyInfo = AddressK type AttrGetType AddressPhysicalPropertyInfo = T.Text type AttrLabel AddressPhysicalPropertyInfo = "Address::physical" attrGet _ = getAddressPhysical attrSet _ = undefined attrConstruct _ = undefined -- VVV Prop "port" -- Type: TBasicType TInt32 -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] getAddressPort :: (MonadIO m, AddressK o) => o -> m Int32 getAddressPort obj = liftIO $ getObjectPropertyCInt obj "port" constructAddressPort :: Int32 -> IO ([Char], GValue) constructAddressPort val = constructObjectPropertyCInt "port" val data AddressPortPropertyInfo instance AttrInfo AddressPortPropertyInfo where type AttrAllowedOps AddressPortPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint AddressPortPropertyInfo = (~) Int32 type AttrBaseTypeConstraint AddressPortPropertyInfo = AddressK type AttrGetType AddressPortPropertyInfo = Int32 type AttrLabel AddressPortPropertyInfo = "Address::port" attrGet _ = getAddressPort attrSet _ = undefined attrConstruct _ = constructAddressPort -- VVV Prop "protocol" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] getAddressProtocol :: (MonadIO m, AddressK o) => o -> m T.Text getAddressProtocol obj = liftIO $ getObjectPropertyString obj "protocol" constructAddressProtocol :: T.Text -> IO ([Char], GValue) constructAddressProtocol val = constructObjectPropertyString "protocol" val data AddressProtocolPropertyInfo instance AttrInfo AddressProtocolPropertyInfo where type AttrAllowedOps AddressProtocolPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint AddressProtocolPropertyInfo = (~) T.Text type AttrBaseTypeConstraint AddressProtocolPropertyInfo = AddressK type AttrGetType AddressProtocolPropertyInfo = T.Text type AttrLabel AddressProtocolPropertyInfo = "Address::protocol" attrGet _ = getAddressProtocol attrSet _ = undefined attrConstruct _ = constructAddressProtocol -- VVV Prop "sockaddr" -- Type: TBasicType TVoid -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] getAddressSockaddr :: (MonadIO m, AddressK o) => o -> m (Ptr ()) getAddressSockaddr obj = liftIO $ getObjectPropertyPtr obj "sockaddr" constructAddressSockaddr :: (Ptr ()) -> IO ([Char], GValue) constructAddressSockaddr val = constructObjectPropertyPtr "sockaddr" val data AddressSockaddrPropertyInfo instance AttrInfo AddressSockaddrPropertyInfo where type AttrAllowedOps AddressSockaddrPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint AddressSockaddrPropertyInfo = (~) (Ptr ()) type AttrBaseTypeConstraint AddressSockaddrPropertyInfo = AddressK type AttrGetType AddressSockaddrPropertyInfo = (Ptr ()) type AttrLabel AddressSockaddrPropertyInfo = "Address::sockaddr" attrGet _ = getAddressSockaddr attrSet _ = undefined attrConstruct _ = constructAddressSockaddr type instance AttributeList Address = AddressAttributeList type AddressAttributeList = ('[ '("family", AddressFamilyPropertyInfo), '("name", AddressNamePropertyInfo), '("physical", AddressPhysicalPropertyInfo), '("port", AddressPortPropertyInfo), '("protocol", AddressProtocolPropertyInfo), '("sockaddr", AddressSockaddrPropertyInfo)] :: [(Symbol, *)]) type instance SignalList Address = AddressSignalList type AddressSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method Address::new -- method type : Constructor -- Args : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "port", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "port", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Soup" "Address" -- throws : False -- Skip return : False foreign import ccall "soup_address_new" soup_address_new :: CString -> -- name : TBasicType TUTF8 Word32 -> -- port : TBasicType TUInt32 IO (Ptr Address) addressNew :: (MonadIO m) => T.Text -> -- name Word32 -> -- port m Address addressNew name port = liftIO $ do name' <- textToCString name result <- soup_address_new name' port checkUnexpectedReturnNULL "soup_address_new" result result' <- (wrapObject Address) result freeMem name' return result' -- method Address::new_any -- method type : Constructor -- Args : [Arg {argName = "family", argType = TInterface "Soup" "AddressFamily", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "port", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "family", argType = TInterface "Soup" "AddressFamily", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "port", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Soup" "Address" -- throws : False -- Skip return : False foreign import ccall "soup_address_new_any" soup_address_new_any :: CUInt -> -- family : TInterface "Soup" "AddressFamily" Word32 -> -- port : TBasicType TUInt32 IO (Ptr Address) addressNewAny :: (MonadIO m) => AddressFamily -> -- family Word32 -> -- port m Address addressNewAny family port = liftIO $ do let family' = (fromIntegral . fromEnum) family result <- soup_address_new_any family' port checkUnexpectedReturnNULL "soup_address_new_any" result result' <- (wrapObject Address) result return result' -- method Address::new_from_sockaddr -- method type : Constructor -- Args : [Arg {argName = "sa", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "len", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "sa", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "len", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Soup" "Address" -- throws : False -- Skip return : False foreign import ccall "soup_address_new_from_sockaddr" soup_address_new_from_sockaddr :: Ptr () -> -- sa : TBasicType TVoid Int32 -> -- len : TBasicType TInt32 IO (Ptr Address) addressNewFromSockaddr :: (MonadIO m) => Ptr () -> -- sa Int32 -> -- len m Address addressNewFromSockaddr sa len = liftIO $ do result <- soup_address_new_from_sockaddr sa len checkUnexpectedReturnNULL "soup_address_new_from_sockaddr" result result' <- (wrapObject Address) result return result' -- method Address::equal_by_ip -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "addr2", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "addr2", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "soup_address_equal_by_ip" soup_address_equal_by_ip :: Ptr Address -> -- _obj : TInterface "Soup" "Address" Ptr Address -> -- addr2 : TInterface "Soup" "Address" IO CInt addressEqualByIp :: (MonadIO m, AddressK a, AddressK b) => a -> -- _obj b -> -- addr2 m Bool addressEqualByIp _obj addr2 = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let addr2' = unsafeManagedPtrCastPtr addr2 result <- soup_address_equal_by_ip _obj' addr2' let result' = (/= 0) result touchManagedPtr _obj touchManagedPtr addr2 return result' -- method Address::equal_by_name -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "addr2", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "addr2", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "soup_address_equal_by_name" soup_address_equal_by_name :: Ptr Address -> -- _obj : TInterface "Soup" "Address" Ptr Address -> -- addr2 : TInterface "Soup" "Address" IO CInt addressEqualByName :: (MonadIO m, AddressK a, AddressK b) => a -> -- _obj b -> -- addr2 m Bool addressEqualByName _obj addr2 = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let addr2' = unsafeManagedPtrCastPtr addr2 result <- soup_address_equal_by_name _obj' addr2' let result' = (/= 0) result touchManagedPtr _obj touchManagedPtr addr2 return result' -- method Address::get_gsockaddr -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "SocketAddress" -- throws : False -- Skip return : False foreign import ccall "soup_address_get_gsockaddr" soup_address_get_gsockaddr :: Ptr Address -> -- _obj : TInterface "Soup" "Address" IO (Ptr Gio.SocketAddress) addressGetGsockaddr :: (MonadIO m, AddressK a) => a -> -- _obj m Gio.SocketAddress addressGetGsockaddr _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- soup_address_get_gsockaddr _obj' checkUnexpectedReturnNULL "soup_address_get_gsockaddr" result result' <- (wrapObject Gio.SocketAddress) result touchManagedPtr _obj return result' -- method Address::get_name -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "soup_address_get_name" soup_address_get_name :: Ptr Address -> -- _obj : TInterface "Soup" "Address" IO CString addressGetName :: (MonadIO m, AddressK a) => a -> -- _obj m T.Text addressGetName _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- soup_address_get_name _obj' checkUnexpectedReturnNULL "soup_address_get_name" result result' <- cstringToText result touchManagedPtr _obj return result' -- method Address::get_physical -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "soup_address_get_physical" soup_address_get_physical :: Ptr Address -> -- _obj : TInterface "Soup" "Address" IO CString addressGetPhysical :: (MonadIO m, AddressK a) => a -> -- _obj m T.Text addressGetPhysical _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- soup_address_get_physical _obj' checkUnexpectedReturnNULL "soup_address_get_physical" result result' <- cstringToText result touchManagedPtr _obj return result' -- method Address::get_port -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUInt32 -- throws : False -- Skip return : False foreign import ccall "soup_address_get_port" soup_address_get_port :: Ptr Address -> -- _obj : TInterface "Soup" "Address" IO Word32 addressGetPort :: (MonadIO m, AddressK a) => a -> -- _obj m Word32 addressGetPort _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- soup_address_get_port _obj' touchManagedPtr _obj return result -- method Address::hash_by_ip -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUInt32 -- throws : False -- Skip return : False foreign import ccall "soup_address_hash_by_ip" soup_address_hash_by_ip :: Ptr Address -> -- _obj : TInterface "Soup" "Address" IO Word32 addressHashByIp :: (MonadIO m, AddressK a) => a -> -- _obj m Word32 addressHashByIp _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- soup_address_hash_by_ip _obj' touchManagedPtr _obj return result -- method Address::hash_by_name -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUInt32 -- throws : False -- Skip return : False foreign import ccall "soup_address_hash_by_name" soup_address_hash_by_name :: Ptr Address -> -- _obj : TInterface "Soup" "Address" IO Word32 addressHashByName :: (MonadIO m, AddressK a) => a -> -- _obj m Word32 addressHashByName _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- soup_address_hash_by_name _obj' touchManagedPtr _obj return result -- method Address::is_resolved -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "soup_address_is_resolved" soup_address_is_resolved :: Ptr Address -> -- _obj : TInterface "Soup" "Address" IO CInt addressIsResolved :: (MonadIO m, AddressK a) => a -> -- _obj m Bool addressIsResolved _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- soup_address_is_resolved _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Address::resolve_async -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "async_context", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Soup" "AddressCallback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "async_context", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Soup" "AddressCallback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "soup_address_resolve_async" soup_address_resolve_async :: Ptr Address -> -- _obj : TInterface "Soup" "Address" Ptr GLib.MainContext -> -- async_context : TInterface "GLib" "MainContext" Ptr Gio.Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" FunPtr AddressCallbackC -> -- callback : TInterface "Soup" "AddressCallback" Ptr () -> -- user_data : TBasicType TVoid IO () addressResolveAsync :: (MonadIO m, AddressK a, Gio.CancellableK b) => a -> -- _obj Maybe (GLib.MainContext) -> -- async_context Maybe (b) -> -- cancellable AddressCallback -> -- callback m () addressResolveAsync _obj async_context cancellable callback = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeAsync_context <- case async_context of Nothing -> return nullPtr Just jAsync_context -> do let jAsync_context' = unsafeManagedPtrGetPtr jAsync_context return jAsync_context' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr AddressCallbackC)) callback' <- mkAddressCallback (addressCallbackWrapper (Just ptrcallback) callback) poke ptrcallback callback' let user_data = nullPtr soup_address_resolve_async _obj' maybeAsync_context maybeCancellable callback' user_data touchManagedPtr _obj whenJust async_context touchManagedPtr whenJust cancellable touchManagedPtr return () -- method Address::resolve_sync -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Address", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUInt32 -- throws : False -- Skip return : False foreign import ccall "soup_address_resolve_sync" soup_address_resolve_sync :: Ptr Address -> -- _obj : TInterface "Soup" "Address" Ptr Gio.Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" IO Word32 addressResolveSync :: (MonadIO m, AddressK a, Gio.CancellableK b) => a -> -- _obj Maybe (b) -> -- cancellable m Word32 addressResolveSync _obj cancellable = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' result <- soup_address_resolve_sync _obj' maybeCancellable touchManagedPtr _obj whenJust cancellable touchManagedPtr return result