{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) /No description available in the introspection data./ -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.WebKit2.Structs.NetworkProxySettings ( -- * Exported types NetworkProxySettings(..) , noNetworkProxySettings , -- * Methods -- ** addProxyForScheme #method:addProxyForScheme# #if ENABLE_OVERLOADING NetworkProxySettingsAddProxyForSchemeMethodInfo, #endif networkProxySettingsAddProxyForScheme , -- ** copy #method:copy# #if ENABLE_OVERLOADING NetworkProxySettingsCopyMethodInfo , #endif networkProxySettingsCopy , -- ** free #method:free# #if ENABLE_OVERLOADING NetworkProxySettingsFreeMethodInfo , #endif networkProxySettingsFree , -- ** new #method:new# networkProxySettingsNew , ) 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.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError 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.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 -- | Memory-managed wrapper type. newtype NetworkProxySettings = NetworkProxySettings (ManagedPtr NetworkProxySettings) foreign import ccall "webkit_network_proxy_settings_get_type" c_webkit_network_proxy_settings_get_type :: IO GType instance BoxedObject NetworkProxySettings where boxedType _ = c_webkit_network_proxy_settings_get_type -- | A convenience alias for `Nothing` :: `Maybe` `NetworkProxySettings`. noNetworkProxySettings :: Maybe NetworkProxySettings noNetworkProxySettings = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList NetworkProxySettings type instance O.AttributeList NetworkProxySettings = NetworkProxySettingsAttributeList type NetworkProxySettingsAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method NetworkProxySettings::new -- method type : Constructor -- Args : [Arg {argCName = "default_proxy_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the default proxy URI to use, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ignore_hosts", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "an optional list of hosts/IP addresses to not use a proxy for.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "NetworkProxySettings"})) -- throws : False -- Skip return : False foreign import ccall "webkit_network_proxy_settings_new" webkit_network_proxy_settings_new :: CString -> -- default_proxy_uri : TBasicType TUTF8 Ptr CString -> -- ignore_hosts : TCArray True (-1) (-1) (TBasicType TUTF8) IO (Ptr NetworkProxySettings) {- | Create a new 'GI.WebKit2.Structs.NetworkProxySettings.NetworkProxySettings' with the given /@defaultProxyUri@/ and /@ignoreHosts@/. The default proxy URI will be used for any URI that doesn\'t match /@ignoreHosts@/, and doesn\'t match any of the schemes added with 'GI.WebKit2.Structs.NetworkProxySettings.networkProxySettingsAddProxyForScheme'. If /@defaultProxyUri@/ starts with \"socks:\/\/\", it will be treated as referring to all three of the socks5, socks4a, and socks4 proxy types. /@ignoreHosts@/ is a list of hostnames and IP addresses that the resolver should allow direct connections to. Entries can be in one of 4 formats: \ \\ A hostname, such as \"example.com\", \".example.com\", or \"*.example.com\", any of which match \"example.com\" or any subdomain of it. \<\/para>\<\/listitem> \\ An IPv4 or IPv6 address, such as \"192.168.1.1\", which matches only that address. \<\/para>\<\/listitem> \\ A hostname or IP address followed by a port, such as \"example.com:80\", which matches whatever the hostname or IP address would match, but only for URLs with the (explicitly) indicated port. In the case of an IPv6 address, the address part must appear in brackets: \"[::1]:443\" \<\/para>\<\/listitem> \\ An IP address range, given by a base address and prefix length, such as \"fe80::\/10\", which matches any address in that range. \<\/para>\<\/listitem> \<\/itemizedlist> Note that when dealing with Unicode hostnames, the matching is done against the ASCII form of the name. Also note that hostname exclusions apply only to connections made to hosts identified by name, and IP address exclusions apply only to connections made to hosts identified by address. That is, if example.com has an address of 192.168.1.1, and /@ignoreHosts@/ contains only \"192.168.1.1\", then a connection to \"example.com\" will use the proxy, and a connection to 192.168.1.1\" will not. /Since: 2.16/ -} networkProxySettingsNew :: (B.CallStack.HasCallStack, MonadIO m) => Maybe (T.Text) {- ^ /@defaultProxyUri@/: the default proxy URI to use, or 'Nothing'. -} -> Maybe ([T.Text]) {- ^ /@ignoreHosts@/: an optional list of hosts\/IP addresses to not use a proxy for. -} -> m NetworkProxySettings {- ^ __Returns:__ A new 'GI.WebKit2.Structs.NetworkProxySettings.NetworkProxySettings'. -} networkProxySettingsNew defaultProxyUri ignoreHosts = liftIO $ do maybeDefaultProxyUri <- case defaultProxyUri of Nothing -> return nullPtr Just jDefaultProxyUri -> do jDefaultProxyUri' <- textToCString jDefaultProxyUri return jDefaultProxyUri' maybeIgnoreHosts <- case ignoreHosts of Nothing -> return nullPtr Just jIgnoreHosts -> do jIgnoreHosts' <- packZeroTerminatedUTF8CArray jIgnoreHosts return jIgnoreHosts' result <- webkit_network_proxy_settings_new maybeDefaultProxyUri maybeIgnoreHosts checkUnexpectedReturnNULL "networkProxySettingsNew" result result' <- (wrapBoxed NetworkProxySettings) result freeMem maybeDefaultProxyUri mapZeroTerminatedCArray freeMem maybeIgnoreHosts freeMem maybeIgnoreHosts return result' #if ENABLE_OVERLOADING #endif -- method NetworkProxySettings::add_proxy_for_scheme -- method type : OrdinaryMethod -- Args : [Arg {argCName = "proxy_settings", argType = TInterface (Name {namespace = "WebKit2", name = "NetworkProxySettings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitNetworkProxySettings", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI scheme to add a proxy for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "proxy_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the proxy URI to use for @uri_scheme", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "webkit_network_proxy_settings_add_proxy_for_scheme" webkit_network_proxy_settings_add_proxy_for_scheme :: Ptr NetworkProxySettings -> -- proxy_settings : TInterface (Name {namespace = "WebKit2", name = "NetworkProxySettings"}) CString -> -- scheme : TBasicType TUTF8 CString -> -- proxy_uri : TBasicType TUTF8 IO () {- | Adds a URI-scheme-specific proxy. URIs whose scheme matches /@uriScheme@/ will be proxied via /@proxyUri@/. As with the default proxy URI, if /@proxyUri@/ starts with \"socks:\/\/\", it will be treated as referring to all three of the socks5, socks4a, and socks4 proxy types. /Since: 2.16/ -} networkProxySettingsAddProxyForScheme :: (B.CallStack.HasCallStack, MonadIO m) => NetworkProxySettings {- ^ /@proxySettings@/: a 'GI.WebKit2.Structs.NetworkProxySettings.NetworkProxySettings' -} -> T.Text {- ^ /@scheme@/: the URI scheme to add a proxy for -} -> T.Text {- ^ /@proxyUri@/: the proxy URI to use for /@uriScheme@/ -} -> m () networkProxySettingsAddProxyForScheme proxySettings scheme proxyUri = liftIO $ do proxySettings' <- unsafeManagedPtrGetPtr proxySettings scheme' <- textToCString scheme proxyUri' <- textToCString proxyUri webkit_network_proxy_settings_add_proxy_for_scheme proxySettings' scheme' proxyUri' touchManagedPtr proxySettings freeMem scheme' freeMem proxyUri' return () #if ENABLE_OVERLOADING data NetworkProxySettingsAddProxyForSchemeMethodInfo instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m) => O.MethodInfo NetworkProxySettingsAddProxyForSchemeMethodInfo NetworkProxySettings signature where overloadedMethod _ = networkProxySettingsAddProxyForScheme #endif -- method NetworkProxySettings::copy -- method type : OrdinaryMethod -- Args : [Arg {argCName = "proxy_settings", argType = TInterface (Name {namespace = "WebKit2", name = "NetworkProxySettings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitNetworkProxySettings", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "NetworkProxySettings"})) -- throws : False -- Skip return : False foreign import ccall "webkit_network_proxy_settings_copy" webkit_network_proxy_settings_copy :: Ptr NetworkProxySettings -> -- proxy_settings : TInterface (Name {namespace = "WebKit2", name = "NetworkProxySettings"}) IO (Ptr NetworkProxySettings) {- | Make a copy of the 'GI.WebKit2.Structs.NetworkProxySettings.NetworkProxySettings'. /Since: 2.16/ -} networkProxySettingsCopy :: (B.CallStack.HasCallStack, MonadIO m) => NetworkProxySettings {- ^ /@proxySettings@/: a 'GI.WebKit2.Structs.NetworkProxySettings.NetworkProxySettings' -} -> m NetworkProxySettings {- ^ __Returns:__ A copy of passed in 'GI.WebKit2.Structs.NetworkProxySettings.NetworkProxySettings' -} networkProxySettingsCopy proxySettings = liftIO $ do proxySettings' <- unsafeManagedPtrGetPtr proxySettings result <- webkit_network_proxy_settings_copy proxySettings' checkUnexpectedReturnNULL "networkProxySettingsCopy" result result' <- (wrapBoxed NetworkProxySettings) result touchManagedPtr proxySettings return result' #if ENABLE_OVERLOADING data NetworkProxySettingsCopyMethodInfo instance (signature ~ (m NetworkProxySettings), MonadIO m) => O.MethodInfo NetworkProxySettingsCopyMethodInfo NetworkProxySettings signature where overloadedMethod _ = networkProxySettingsCopy #endif -- method NetworkProxySettings::free -- method type : OrdinaryMethod -- Args : [Arg {argCName = "proxy_settings", argType = TInterface (Name {namespace = "WebKit2", name = "NetworkProxySettings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitNetworkProxySettings", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "webkit_network_proxy_settings_free" webkit_network_proxy_settings_free :: Ptr NetworkProxySettings -> -- proxy_settings : TInterface (Name {namespace = "WebKit2", name = "NetworkProxySettings"}) IO () {- | Free the 'GI.WebKit2.Structs.NetworkProxySettings.NetworkProxySettings'. /Since: 2.16/ -} networkProxySettingsFree :: (B.CallStack.HasCallStack, MonadIO m) => NetworkProxySettings {- ^ /@proxySettings@/: A 'GI.WebKit2.Structs.NetworkProxySettings.NetworkProxySettings' -} -> m () networkProxySettingsFree proxySettings = liftIO $ do proxySettings' <- unsafeManagedPtrGetPtr proxySettings webkit_network_proxy_settings_free proxySettings' touchManagedPtr proxySettings return () #if ENABLE_OVERLOADING data NetworkProxySettingsFreeMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo NetworkProxySettingsFreeMethodInfo NetworkProxySettings signature where overloadedMethod _ = networkProxySettingsFree #endif #if ENABLE_OVERLOADING type family ResolveNetworkProxySettingsMethod (t :: Symbol) (o :: *) :: * where ResolveNetworkProxySettingsMethod "addProxyForScheme" o = NetworkProxySettingsAddProxyForSchemeMethodInfo ResolveNetworkProxySettingsMethod "copy" o = NetworkProxySettingsCopyMethodInfo ResolveNetworkProxySettingsMethod "free" o = NetworkProxySettingsFreeMethodInfo ResolveNetworkProxySettingsMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveNetworkProxySettingsMethod t NetworkProxySettings, O.MethodInfo info NetworkProxySettings p) => OL.IsLabel t (NetworkProxySettings -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif #endif