{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Soup.Objects.Address
(
Address(..) ,
IsAddress ,
toAddress ,
#if defined(ENABLE_OVERLOADING)
ResolveAddressMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
AddressEqualByIpMethodInfo ,
#endif
addressEqualByIp ,
#if defined(ENABLE_OVERLOADING)
AddressEqualByNameMethodInfo ,
#endif
addressEqualByName ,
#if defined(ENABLE_OVERLOADING)
AddressGetGsockaddrMethodInfo ,
#endif
addressGetGsockaddr ,
#if defined(ENABLE_OVERLOADING)
AddressGetNameMethodInfo ,
#endif
addressGetName ,
#if defined(ENABLE_OVERLOADING)
AddressGetPhysicalMethodInfo ,
#endif
addressGetPhysical ,
#if defined(ENABLE_OVERLOADING)
AddressGetPortMethodInfo ,
#endif
addressGetPort ,
#if defined(ENABLE_OVERLOADING)
AddressHashByIpMethodInfo ,
#endif
addressHashByIp ,
#if defined(ENABLE_OVERLOADING)
AddressHashByNameMethodInfo ,
#endif
addressHashByName ,
#if defined(ENABLE_OVERLOADING)
AddressIsResolvedMethodInfo ,
#endif
addressIsResolved ,
addressNew ,
addressNewAny ,
addressNewFromSockaddr ,
#if defined(ENABLE_OVERLOADING)
AddressResolveAsyncMethodInfo ,
#endif
addressResolveAsync ,
#if defined(ENABLE_OVERLOADING)
AddressResolveSyncMethodInfo ,
#endif
addressResolveSync ,
#if defined(ENABLE_OVERLOADING)
AddressFamilyPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
addressFamily ,
#endif
constructAddressFamily ,
getAddressFamily ,
#if defined(ENABLE_OVERLOADING)
AddressNamePropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
addressName ,
#endif
constructAddressName ,
getAddressName ,
#if defined(ENABLE_OVERLOADING)
AddressPhysicalPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
addressPhysical ,
#endif
getAddressPhysical ,
#if defined(ENABLE_OVERLOADING)
AddressPortPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
addressPort ,
#endif
constructAddressPort ,
getAddressPort ,
#if defined(ENABLE_OVERLOADING)
AddressProtocolPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
addressProtocol ,
#endif
constructAddressProtocol ,
getAddressProtocol ,
#if defined(ENABLE_OVERLOADING)
AddressSockaddrPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
addressSockaddr ,
#endif
constructAddressSockaddr ,
getAddressSockaddr ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
newtype Address = Address (SP.ManagedPtr Address)
deriving (Address -> Address -> Bool
(Address -> Address -> Bool)
-> (Address -> Address -> Bool) -> Eq Address
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Address -> Address -> Bool
== :: Address -> Address -> Bool
$c/= :: Address -> Address -> Bool
/= :: Address -> Address -> Bool
Eq)
instance SP.ManagedPtrNewtype Address where
toManagedPtr :: Address -> ManagedPtr Address
toManagedPtr (Address ManagedPtr Address
p) = ManagedPtr Address
p
foreign import ccall "soup_address_get_type"
c_soup_address_get_type :: IO B.Types.GType
instance B.Types.TypedObject Address where
glibType :: IO GType
glibType = IO GType
c_soup_address_get_type
instance B.Types.GObject Address
class (SP.GObject o, O.IsDescendantOf Address o) => IsAddress o
instance (SP.GObject o, O.IsDescendantOf Address o) => IsAddress o
instance O.HasParentTypes Address
type instance O.ParentTypes Address = '[GObject.Object.Object, Gio.SocketConnectable.SocketConnectable]
toAddress :: (MIO.MonadIO m, IsAddress o) => o -> m Address
toAddress :: forall (m :: * -> *) o. (MonadIO m, IsAddress o) => o -> m Address
toAddress = IO Address -> m Address
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Address -> m Address) -> (o -> IO Address) -> o -> m Address
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Address -> Address) -> o -> IO Address
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Address -> Address
Address
instance B.GValue.IsGValue (Maybe Address) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_soup_address_get_type
gvalueSet_ :: Ptr GValue -> Maybe Address -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Address
P.Nothing = Ptr GValue -> Ptr Address -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Address
forall a. Ptr a
FP.nullPtr :: FP.Ptr Address)
gvalueSet_ Ptr GValue
gv (P.Just Address
obj) = Address -> (Ptr Address -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Address
obj (Ptr GValue -> Ptr Address -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Address)
gvalueGet_ Ptr GValue
gv = do
Ptr Address
ptr <- Ptr GValue -> IO (Ptr Address)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Address)
if Ptr Address
ptr Ptr Address -> Ptr Address -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Address
forall a. Ptr a
FP.nullPtr
then Address -> Maybe Address
forall a. a -> Maybe a
P.Just (Address -> Maybe Address) -> IO Address -> IO (Maybe Address)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Address -> Address
Address Ptr Address
ptr
else Maybe Address -> IO (Maybe Address)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Address
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveAddressMethod (t :: Symbol) (o :: *) :: * where
ResolveAddressMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveAddressMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveAddressMethod "enumerate" o = Gio.SocketConnectable.SocketConnectableEnumerateMethodInfo
ResolveAddressMethod "equalByIp" o = AddressEqualByIpMethodInfo
ResolveAddressMethod "equalByName" o = AddressEqualByNameMethodInfo
ResolveAddressMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveAddressMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveAddressMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveAddressMethod "hashByIp" o = AddressHashByIpMethodInfo
ResolveAddressMethod "hashByName" o = AddressHashByNameMethodInfo
ResolveAddressMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveAddressMethod "isResolved" o = AddressIsResolvedMethodInfo
ResolveAddressMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveAddressMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveAddressMethod "proxyEnumerate" o = Gio.SocketConnectable.SocketConnectableProxyEnumerateMethodInfo
ResolveAddressMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveAddressMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveAddressMethod "resolveAsync" o = AddressResolveAsyncMethodInfo
ResolveAddressMethod "resolveSync" o = AddressResolveSyncMethodInfo
ResolveAddressMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveAddressMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveAddressMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveAddressMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveAddressMethod "toString" o = Gio.SocketConnectable.SocketConnectableToStringMethodInfo
ResolveAddressMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveAddressMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveAddressMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveAddressMethod "getGsockaddr" o = AddressGetGsockaddrMethodInfo
ResolveAddressMethod "getName" o = AddressGetNameMethodInfo
ResolveAddressMethod "getPhysical" o = AddressGetPhysicalMethodInfo
ResolveAddressMethod "getPort" o = AddressGetPortMethodInfo
ResolveAddressMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveAddressMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveAddressMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveAddressMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveAddressMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveAddressMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAddressMethod t Address, O.OverloadedMethod info Address p) => OL.IsLabel t (Address -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAddressMethod t Address, O.OverloadedMethod info Address p, R.HasField t Address p) => R.HasField t Address p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveAddressMethod t Address, O.OverloadedMethodInfo info Address) => OL.IsLabel t (O.MethodProxy info Address) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getAddressFamily :: (MonadIO m, IsAddress o) => o -> m Soup.Enums.AddressFamily
getAddressFamily :: forall (m :: * -> *) o.
(MonadIO m, IsAddress o) =>
o -> m AddressFamily
getAddressFamily o
obj = IO AddressFamily -> m AddressFamily
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO AddressFamily -> m AddressFamily)
-> IO AddressFamily -> m AddressFamily
forall a b. (a -> b) -> a -> b
$ o -> String -> IO AddressFamily
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"family"
constructAddressFamily :: (IsAddress o, MIO.MonadIO m) => Soup.Enums.AddressFamily -> m (GValueConstruct o)
constructAddressFamily :: forall o (m :: * -> *).
(IsAddress o, MonadIO m) =>
AddressFamily -> m (GValueConstruct o)
constructAddressFamily AddressFamily
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> AddressFamily -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum String
"family" AddressFamily
val
#if defined(ENABLE_OVERLOADING)
data AddressFamilyPropertyInfo
instance AttrInfo AddressFamilyPropertyInfo where
type AttrAllowedOps AddressFamilyPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint AddressFamilyPropertyInfo = IsAddress
type AttrSetTypeConstraint AddressFamilyPropertyInfo = (~) Soup.Enums.AddressFamily
type AttrTransferTypeConstraint AddressFamilyPropertyInfo = (~) Soup.Enums.AddressFamily
type AttrTransferType AddressFamilyPropertyInfo = Soup.Enums.AddressFamily
type AttrGetType AddressFamilyPropertyInfo = Soup.Enums.AddressFamily
type AttrLabel AddressFamilyPropertyInfo = "family"
type AttrOrigin AddressFamilyPropertyInfo = Address
attrGet = getAddressFamily
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructAddressFamily
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.family"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#g:attr:family"
})
#endif
getAddressName :: (MonadIO m, IsAddress o) => o -> m (Maybe T.Text)
getAddressName :: forall (m :: * -> *) o.
(MonadIO m, IsAddress o) =>
o -> m (Maybe Text)
getAddressName o
obj = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"name"
constructAddressName :: (IsAddress o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructAddressName :: forall o (m :: * -> *).
(IsAddress o, MonadIO m) =>
Text -> m (GValueConstruct o)
constructAddressName Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"name" (Text -> Maybe Text
forall a. a -> Maybe a
P.Just Text
val)
#if defined(ENABLE_OVERLOADING)
data AddressNamePropertyInfo
instance AttrInfo AddressNamePropertyInfo where
type AttrAllowedOps AddressNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint AddressNamePropertyInfo = IsAddress
type AttrSetTypeConstraint AddressNamePropertyInfo = (~) T.Text
type AttrTransferTypeConstraint AddressNamePropertyInfo = (~) T.Text
type AttrTransferType AddressNamePropertyInfo = T.Text
type AttrGetType AddressNamePropertyInfo = (Maybe T.Text)
type AttrLabel AddressNamePropertyInfo = "name"
type AttrOrigin AddressNamePropertyInfo = Address
attrGet = getAddressName
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructAddressName
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.name"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#g:attr:name"
})
#endif
getAddressPhysical :: (MonadIO m, IsAddress o) => o -> m (Maybe T.Text)
getAddressPhysical :: forall (m :: * -> *) o.
(MonadIO m, IsAddress o) =>
o -> m (Maybe Text)
getAddressPhysical o
obj = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"physical"
#if defined(ENABLE_OVERLOADING)
data AddressPhysicalPropertyInfo
instance AttrInfo AddressPhysicalPropertyInfo where
type AttrAllowedOps AddressPhysicalPropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint AddressPhysicalPropertyInfo = IsAddress
type AttrSetTypeConstraint AddressPhysicalPropertyInfo = (~) ()
type AttrTransferTypeConstraint AddressPhysicalPropertyInfo = (~) ()
type AttrTransferType AddressPhysicalPropertyInfo = ()
type AttrGetType AddressPhysicalPropertyInfo = (Maybe T.Text)
type AttrLabel AddressPhysicalPropertyInfo = "physical"
type AttrOrigin AddressPhysicalPropertyInfo = Address
attrGet = getAddressPhysical
attrSet = undefined
attrTransfer _ = undefined
attrConstruct = undefined
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.physical"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#g:attr:physical"
})
#endif
getAddressPort :: (MonadIO m, IsAddress o) => o -> m Int32
getAddressPort :: forall (m :: * -> *) o. (MonadIO m, IsAddress o) => o -> m Int32
getAddressPort o
obj = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj String
"port"
constructAddressPort :: (IsAddress o, MIO.MonadIO m) => Int32 -> m (GValueConstruct o)
constructAddressPort :: forall o (m :: * -> *).
(IsAddress o, MonadIO m) =>
Int32 -> m (GValueConstruct o)
constructAddressPort Int32
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Int32 -> IO (GValueConstruct o)
forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 String
"port" Int32
val
#if defined(ENABLE_OVERLOADING)
data AddressPortPropertyInfo
instance AttrInfo AddressPortPropertyInfo where
type AttrAllowedOps AddressPortPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint AddressPortPropertyInfo = IsAddress
type AttrSetTypeConstraint AddressPortPropertyInfo = (~) Int32
type AttrTransferTypeConstraint AddressPortPropertyInfo = (~) Int32
type AttrTransferType AddressPortPropertyInfo = Int32
type AttrGetType AddressPortPropertyInfo = Int32
type AttrLabel AddressPortPropertyInfo = "port"
type AttrOrigin AddressPortPropertyInfo = Address
attrGet = getAddressPort
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructAddressPort
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.port"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#g:attr:port"
})
#endif
getAddressProtocol :: (MonadIO m, IsAddress o) => o -> m (Maybe T.Text)
getAddressProtocol :: forall (m :: * -> *) o.
(MonadIO m, IsAddress o) =>
o -> m (Maybe Text)
getAddressProtocol o
obj = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"protocol"
constructAddressProtocol :: (IsAddress o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructAddressProtocol :: forall o (m :: * -> *).
(IsAddress o, MonadIO m) =>
Text -> m (GValueConstruct o)
constructAddressProtocol Text
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyString String
"protocol" (Text -> Maybe Text
forall a. a -> Maybe a
P.Just Text
val)
#if defined(ENABLE_OVERLOADING)
data AddressProtocolPropertyInfo
instance AttrInfo AddressProtocolPropertyInfo where
type AttrAllowedOps AddressProtocolPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint AddressProtocolPropertyInfo = IsAddress
type AttrSetTypeConstraint AddressProtocolPropertyInfo = (~) T.Text
type AttrTransferTypeConstraint AddressProtocolPropertyInfo = (~) T.Text
type AttrTransferType AddressProtocolPropertyInfo = T.Text
type AttrGetType AddressProtocolPropertyInfo = (Maybe T.Text)
type AttrLabel AddressProtocolPropertyInfo = "protocol"
type AttrOrigin AddressProtocolPropertyInfo = Address
attrGet = getAddressProtocol
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructAddressProtocol
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.protocol"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#g:attr:protocol"
})
#endif
getAddressSockaddr :: (MonadIO m, IsAddress o) => o -> m (Ptr ())
getAddressSockaddr :: forall (m :: * -> *) o. (MonadIO m, IsAddress o) => o -> m (Ptr ())
getAddressSockaddr o
obj = IO (Ptr ()) -> m (Ptr ())
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Ptr ())
forall a b. GObject a => a -> String -> IO (Ptr b)
B.Properties.getObjectPropertyPtr o
obj String
"sockaddr"
constructAddressSockaddr :: (IsAddress o, MIO.MonadIO m) => Ptr () -> m (GValueConstruct o)
constructAddressSockaddr :: forall o (m :: * -> *).
(IsAddress o, MonadIO m) =>
Ptr () -> m (GValueConstruct o)
constructAddressSockaddr Ptr ()
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Ptr () -> IO (GValueConstruct o)
forall b o. String -> Ptr b -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyPtr String
"sockaddr" Ptr ()
val
#if defined(ENABLE_OVERLOADING)
data AddressSockaddrPropertyInfo
instance AttrInfo AddressSockaddrPropertyInfo where
type AttrAllowedOps AddressSockaddrPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint AddressSockaddrPropertyInfo = IsAddress
type AttrSetTypeConstraint AddressSockaddrPropertyInfo = (~) (Ptr ())
type AttrTransferTypeConstraint AddressSockaddrPropertyInfo = (~) (Ptr ())
type AttrTransferType AddressSockaddrPropertyInfo = Ptr ()
type AttrGetType AddressSockaddrPropertyInfo = (Ptr ())
type AttrLabel AddressSockaddrPropertyInfo = "sockaddr"
type AttrOrigin AddressSockaddrPropertyInfo = Address
attrGet = getAddressSockaddr
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructAddressSockaddr
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.sockaddr"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#g:attr:sockaddr"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Address
type instance O.AttributeList Address = AddressAttributeList
type AddressAttributeList = ('[ '("family", AddressFamilyPropertyInfo), '("name", AddressNamePropertyInfo), '("physical", AddressPhysicalPropertyInfo), '("port", AddressPortPropertyInfo), '("protocol", AddressProtocolPropertyInfo), '("sockaddr", AddressSockaddrPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
addressFamily :: AttrLabelProxy "family"
addressFamily = AttrLabelProxy
addressName :: AttrLabelProxy "name"
addressName = AttrLabelProxy
addressPhysical :: AttrLabelProxy "physical"
addressPhysical = AttrLabelProxy
addressPort :: AttrLabelProxy "port"
addressPort = AttrLabelProxy
addressProtocol :: AttrLabelProxy "protocol"
addressProtocol = AttrLabelProxy
addressSockaddr :: AttrLabelProxy "sockaddr"
addressSockaddr = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Address = AddressSignalList
type AddressSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "soup_address_new" soup_address_new ::
CString ->
Word32 ->
IO (Ptr Address)
addressNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Word32
-> m Address
addressNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Word32 -> m Address
addressNew Text
name Word32
port = IO Address -> m Address
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Address -> m Address) -> IO Address -> m Address
forall a b. (a -> b) -> a -> b
$ do
CString
name' <- Text -> IO CString
textToCString Text
name
Ptr Address
result <- CString -> Word32 -> IO (Ptr Address)
soup_address_new CString
name' Word32
port
Text -> Ptr Address -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"addressNew" Ptr Address
result
Address
result' <- ((ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Address -> Address
Address) Ptr Address
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
Address -> IO Address
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Address
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "soup_address_new_any" soup_address_new_any ::
CInt ->
Word32 ->
IO (Ptr Address)
addressNewAny ::
(B.CallStack.HasCallStack, MonadIO m) =>
Soup.Enums.AddressFamily
-> Word32
-> m (Maybe Address)
addressNewAny :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AddressFamily -> Word32 -> m (Maybe Address)
addressNewAny AddressFamily
family Word32
port = IO (Maybe Address) -> m (Maybe Address)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Address) -> m (Maybe Address))
-> IO (Maybe Address) -> m (Maybe Address)
forall a b. (a -> b) -> a -> b
$ do
let family' :: CInt
family' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (AddressFamily -> Int) -> AddressFamily -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AddressFamily -> Int
forall a. Enum a => a -> Int
fromEnum) AddressFamily
family
Ptr Address
result <- CInt -> Word32 -> IO (Ptr Address)
soup_address_new_any CInt
family' Word32
port
Maybe Address
maybeResult <- Ptr Address -> (Ptr Address -> IO Address) -> IO (Maybe Address)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Address
result ((Ptr Address -> IO Address) -> IO (Maybe Address))
-> (Ptr Address -> IO Address) -> IO (Maybe Address)
forall a b. (a -> b) -> a -> b
$ \Ptr Address
result' -> do
Address
result'' <- ((ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Address -> Address
Address) Ptr Address
result'
Address -> IO Address
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Address
result''
Maybe Address -> IO (Maybe Address)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Address
maybeResult
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "soup_address_new_from_sockaddr" soup_address_new_from_sockaddr ::
Ptr () ->
Int32 ->
IO (Ptr Address)
addressNewFromSockaddr ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ptr ()
-> Int32
-> m (Maybe Address)
addressNewFromSockaddr :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ptr () -> Int32 -> m (Maybe Address)
addressNewFromSockaddr Ptr ()
sa Int32
len = IO (Maybe Address) -> m (Maybe Address)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Address) -> m (Maybe Address))
-> IO (Maybe Address) -> m (Maybe Address)
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
result <- Ptr () -> Int32 -> IO (Ptr Address)
soup_address_new_from_sockaddr Ptr ()
sa Int32
len
Maybe Address
maybeResult <- Ptr Address -> (Ptr Address -> IO Address) -> IO (Maybe Address)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Address
result ((Ptr Address -> IO Address) -> IO (Maybe Address))
-> (Ptr Address -> IO Address) -> IO (Maybe Address)
forall a b. (a -> b) -> a -> b
$ \Ptr Address
result' -> do
Address
result'' <- ((ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Address -> Address
Address) Ptr Address
result'
Address -> IO Address
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Address
result''
Maybe Address -> IO (Maybe Address)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Address
maybeResult
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "soup_address_equal_by_ip" soup_address_equal_by_ip ::
Ptr Address ->
Ptr Address ->
IO CInt
addressEqualByIp ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a, IsAddress b) =>
a
-> b
-> m Bool
addressEqualByIp :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsAddress a, IsAddress b) =>
a -> b -> m Bool
addressEqualByIp a
addr1 b
addr2 = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr1' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr1
Ptr Address
addr2' <- b -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
addr2
CInt
result <- Ptr Address -> Ptr Address -> IO CInt
soup_address_equal_by_ip Ptr Address
addr1' Ptr Address
addr2'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr1
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
addr2
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data AddressEqualByIpMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsAddress a, IsAddress b) => O.OverloadedMethod AddressEqualByIpMethodInfo a signature where
overloadedMethod = addressEqualByIp
instance O.OverloadedMethodInfo AddressEqualByIpMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressEqualByIp",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressEqualByIp"
})
#endif
foreign import ccall "soup_address_equal_by_name" soup_address_equal_by_name ::
Ptr Address ->
Ptr Address ->
IO CInt
addressEqualByName ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a, IsAddress b) =>
a
-> b
-> m Bool
addressEqualByName :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsAddress a, IsAddress b) =>
a -> b -> m Bool
addressEqualByName a
addr1 b
addr2 = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr1' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr1
Ptr Address
addr2' <- b -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
addr2
CInt
result <- Ptr Address -> Ptr Address -> IO CInt
soup_address_equal_by_name Ptr Address
addr1' Ptr Address
addr2'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr1
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
addr2
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data AddressEqualByNameMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsAddress a, IsAddress b) => O.OverloadedMethod AddressEqualByNameMethodInfo a signature where
overloadedMethod = addressEqualByName
instance O.OverloadedMethodInfo AddressEqualByNameMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressEqualByName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressEqualByName"
})
#endif
foreign import ccall "soup_address_get_gsockaddr" soup_address_get_gsockaddr ::
Ptr Address ->
IO (Ptr Gio.SocketAddress.SocketAddress)
addressGetGsockaddr ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a) =>
a
-> m Gio.SocketAddress.SocketAddress
addressGetGsockaddr :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAddress a) =>
a -> m SocketAddress
addressGetGsockaddr a
addr = IO SocketAddress -> m SocketAddress
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketAddress -> m SocketAddress)
-> IO SocketAddress -> m SocketAddress
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
Ptr SocketAddress
result <- Ptr Address -> IO (Ptr SocketAddress)
soup_address_get_gsockaddr Ptr Address
addr'
Text -> Ptr SocketAddress -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"addressGetGsockaddr" Ptr SocketAddress
result
SocketAddress
result' <- ((ManagedPtr SocketAddress -> SocketAddress)
-> Ptr SocketAddress -> IO SocketAddress
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SocketAddress -> SocketAddress
Gio.SocketAddress.SocketAddress) Ptr SocketAddress
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
SocketAddress -> IO SocketAddress
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return SocketAddress
result'
#if defined(ENABLE_OVERLOADING)
data AddressGetGsockaddrMethodInfo
instance (signature ~ (m Gio.SocketAddress.SocketAddress), MonadIO m, IsAddress a) => O.OverloadedMethod AddressGetGsockaddrMethodInfo a signature where
overloadedMethod = addressGetGsockaddr
instance O.OverloadedMethodInfo AddressGetGsockaddrMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressGetGsockaddr",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressGetGsockaddr"
})
#endif
foreign import ccall "soup_address_get_name" soup_address_get_name ::
Ptr Address ->
IO CString
addressGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a) =>
a
-> m (Maybe T.Text)
addressGetName :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAddress a) =>
a -> m (Maybe Text)
addressGetName a
addr = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
CString
result <- Ptr Address -> IO CString
soup_address_get_name Ptr Address
addr'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data AddressGetNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsAddress a) => O.OverloadedMethod AddressGetNameMethodInfo a signature where
overloadedMethod = addressGetName
instance O.OverloadedMethodInfo AddressGetNameMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressGetName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressGetName"
})
#endif
foreign import ccall "soup_address_get_physical" soup_address_get_physical ::
Ptr Address ->
IO CString
addressGetPhysical ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a) =>
a
-> m (Maybe T.Text)
addressGetPhysical :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAddress a) =>
a -> m (Maybe Text)
addressGetPhysical a
addr = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
CString
result <- Ptr Address -> IO CString
soup_address_get_physical Ptr Address
addr'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data AddressGetPhysicalMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsAddress a) => O.OverloadedMethod AddressGetPhysicalMethodInfo a signature where
overloadedMethod = addressGetPhysical
instance O.OverloadedMethodInfo AddressGetPhysicalMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressGetPhysical",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressGetPhysical"
})
#endif
foreign import ccall "soup_address_get_port" soup_address_get_port ::
Ptr Address ->
IO Word32
addressGetPort ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a) =>
a
-> m Word32
addressGetPort :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAddress a) =>
a -> m Word32
addressGetPort a
addr = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
Word32
result <- Ptr Address -> IO Word32
soup_address_get_port Ptr Address
addr'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AddressGetPortMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsAddress a) => O.OverloadedMethod AddressGetPortMethodInfo a signature where
overloadedMethod = addressGetPort
instance O.OverloadedMethodInfo AddressGetPortMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressGetPort",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressGetPort"
})
#endif
foreign import ccall "soup_address_hash_by_ip" soup_address_hash_by_ip ::
Ptr Address ->
IO Word32
addressHashByIp ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a) =>
a
-> m Word32
addressHashByIp :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAddress a) =>
a -> m Word32
addressHashByIp a
addr = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
Word32
result <- Ptr Address -> IO Word32
soup_address_hash_by_ip Ptr Address
addr'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AddressHashByIpMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsAddress a) => O.OverloadedMethod AddressHashByIpMethodInfo a signature where
overloadedMethod = addressHashByIp
instance O.OverloadedMethodInfo AddressHashByIpMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressHashByIp",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressHashByIp"
})
#endif
foreign import ccall "soup_address_hash_by_name" soup_address_hash_by_name ::
Ptr Address ->
IO Word32
addressHashByName ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a) =>
a
-> m Word32
addressHashByName :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAddress a) =>
a -> m Word32
addressHashByName a
addr = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
Word32
result <- Ptr Address -> IO Word32
soup_address_hash_by_name Ptr Address
addr'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AddressHashByNameMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsAddress a) => O.OverloadedMethod AddressHashByNameMethodInfo a signature where
overloadedMethod = addressHashByName
instance O.OverloadedMethodInfo AddressHashByNameMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressHashByName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressHashByName"
})
#endif
foreign import ccall "soup_address_is_resolved" soup_address_is_resolved ::
Ptr Address ->
IO CInt
addressIsResolved ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a) =>
a
-> m Bool
addressIsResolved :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAddress a) =>
a -> m Bool
addressIsResolved a
addr = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
CInt
result <- Ptr Address -> IO CInt
soup_address_is_resolved Ptr Address
addr'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data AddressIsResolvedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsAddress a) => O.OverloadedMethod AddressIsResolvedMethodInfo a signature where
overloadedMethod = addressIsResolved
instance O.OverloadedMethodInfo AddressIsResolvedMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressIsResolved",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressIsResolved"
})
#endif
foreign import ccall "soup_address_resolve_async" soup_address_resolve_async ::
Ptr Address ->
Ptr GLib.MainContext.MainContext ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Soup.Callbacks.C_AddressCallback ->
Ptr () ->
IO ()
addressResolveAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (GLib.MainContext.MainContext)
-> Maybe (b)
-> Soup.Callbacks.AddressCallback
-> m ()
addressResolveAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsAddress a, IsCancellable b) =>
a -> Maybe MainContext -> Maybe b -> AddressCallback -> m ()
addressResolveAsync a
addr Maybe MainContext
asyncContext Maybe b
cancellable AddressCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
Ptr MainContext
maybeAsyncContext <- case Maybe MainContext
asyncContext of
Maybe MainContext
Nothing -> Ptr MainContext -> IO (Ptr MainContext)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MainContext
forall a. Ptr a
nullPtr
Just MainContext
jAsyncContext -> do
Ptr MainContext
jAsyncContext' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
jAsyncContext
Ptr MainContext -> IO (Ptr MainContext)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MainContext
jAsyncContext'
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
Ptr (FunPtr C_AddressCallback)
ptrcallback <- IO (Ptr (FunPtr C_AddressCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Soup.Callbacks.C_AddressCallback))
FunPtr C_AddressCallback
callback' <- C_AddressCallback -> IO (FunPtr C_AddressCallback)
Soup.Callbacks.mk_AddressCallback (Maybe (Ptr (FunPtr C_AddressCallback))
-> AddressCallback_WithClosures -> C_AddressCallback
Soup.Callbacks.wrap_AddressCallback (Ptr (FunPtr C_AddressCallback)
-> Maybe (Ptr (FunPtr C_AddressCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AddressCallback)
ptrcallback) (AddressCallback -> AddressCallback_WithClosures
Soup.Callbacks.drop_closures_AddressCallback AddressCallback
callback))
Ptr (FunPtr C_AddressCallback) -> FunPtr C_AddressCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AddressCallback)
ptrcallback FunPtr C_AddressCallback
callback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr Address
-> Ptr MainContext
-> Ptr Cancellable
-> FunPtr C_AddressCallback
-> Ptr ()
-> IO ()
soup_address_resolve_async Ptr Address
addr' Ptr MainContext
maybeAsyncContext Ptr Cancellable
maybeCancellable FunPtr C_AddressCallback
callback' Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
Maybe MainContext -> (MainContext -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe MainContext
asyncContext MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data AddressResolveAsyncMethodInfo
instance (signature ~ (Maybe (GLib.MainContext.MainContext) -> Maybe (b) -> Soup.Callbacks.AddressCallback -> m ()), MonadIO m, IsAddress a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod AddressResolveAsyncMethodInfo a signature where
overloadedMethod = addressResolveAsync
instance O.OverloadedMethodInfo AddressResolveAsyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressResolveAsync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressResolveAsync"
})
#endif
foreign import ccall "soup_address_resolve_sync" soup_address_resolve_sync ::
Ptr Address ->
Ptr Gio.Cancellable.Cancellable ->
IO Word32
addressResolveSync ::
(B.CallStack.HasCallStack, MonadIO m, IsAddress a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Word32
addressResolveSync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsAddress a, IsCancellable b) =>
a -> Maybe b -> m Word32
addressResolveSync a
addr Maybe b
cancellable = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Address
addr' <- a -> IO (Ptr Address)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
addr
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
Word32
result <- Ptr Address -> Ptr Cancellable -> IO Word32
soup_address_resolve_sync Ptr Address
addr' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
addr
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AddressResolveSyncMethodInfo
instance (signature ~ (Maybe (b) -> m Word32), MonadIO m, IsAddress a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod AddressResolveSyncMethodInfo a signature where
overloadedMethod = addressResolveSync
instance O.OverloadedMethodInfo AddressResolveSyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Soup.Objects.Address.addressResolveSync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-soup-2.4.26/docs/GI-Soup-Objects-Address.html#v:addressResolveSync"
})
#endif