gi-gio-2.0.32: Gio bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | Safe-Inferred
Language | Haskell2010

GI.Gio.Structs.SrvTarget

Contents

- Exported types
- Methods
  - copy
  - free
  - getHostname
  - getPort
  - getPriority
  - getWeight
  - new

Description

A single target host/port that a network service is running on.

SRV (service) records are used by some network protocols to provide service-specific aliasing and load-balancing. For example, XMPP (Jabber) uses SRV records to locate the XMPP server for a domain; rather than connecting directly to ‘example.com’ or assuming a specific server hostname like ‘xmpp.example.com’, an XMPP client would look up the `xmpp-client` SRV record for ‘example.com’, and then connect to whatever host was pointed to by that record.

You can use `resolverLookupService` or `resolverLookupServiceAsync` to find the `GSrvTarget`s for a given service. However, if you are simply planning to connect to the remote service, you can use `NetworkService`’s `SocketConnectable` interface and not need to worry about `GSrvTarget` at all.

Synopsis

- newtype SrvTarget = SrvTarget (ManagedPtr SrvTarget)
- srvTargetCopy :: (HasCallStack, MonadIO m) => SrvTarget -> m SrvTarget
- srvTargetFree :: (HasCallStack, MonadIO m) => SrvTarget -> m ()
- srvTargetGetHostname :: (HasCallStack, MonadIO m) => SrvTarget -> m Text
- srvTargetGetPort :: (HasCallStack, MonadIO m) => SrvTarget -> m Word16
- srvTargetGetPriority :: (HasCallStack, MonadIO m) => SrvTarget -> m Word16
- srvTargetGetWeight :: (HasCallStack, MonadIO m) => SrvTarget -> m Word16
- srvTargetNew :: (HasCallStack, MonadIO m) => Text -> Word16 -> Word16 -> Word16 -> m SrvTarget

# Exported types

newtype SrvTarget Source #

Memory-managed wrapper type.

Constructors

SrvTarget (ManagedPtr SrvTarget) |

#### Instances

Instances details

Eq SrvTarget Source # |
Instance details Defined in GI.Gio.Structs.SrvTarget Methods (==) :: SrvTarget -> SrvTarget -> Bool Source # (/=) :: SrvTarget -> SrvTarget -> Bool Source #
GBoxed SrvTarget Source # |
Instance details Defined in GI.Gio.Structs.SrvTarget
ManagedPtrNewtype SrvTarget Source # |
Instance details Defined in GI.Gio.Structs.SrvTarget Methods toManagedPtr :: SrvTarget -> ManagedPtr SrvTarget Source #
TypedObject SrvTarget Source # |
Instance details Defined in GI.Gio.Structs.SrvTarget Methods glibType :: IO GType Source #
HasParentTypes SrvTarget Source # |
Instance details Defined in GI.Gio.Structs.SrvTarget
IsGValue (Maybe SrvTarget) Source # | Convert `SrvTarget` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Structs.SrvTarget Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe SrvTarget -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe SrvTarget) Source #
type ParentTypes SrvTarget Source # |
Instance details Defined in GI.Gio.Structs.SrvTarget type ParentTypes SrvTarget = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

copy, free.

#### Getters

getHostname, getPort, getPriority, getWeight.

#### Setters

None.

## copy

srvTargetCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SrvTarget | `target`: a `SrvTarget`
-> m SrvTarget | Returns: a copy of `target`

Copies `target`

Since: 2.22

## free

srvTargetFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SrvTarget | `target`: a `SrvTarget`
-> m () |

Frees `target`

Since: 2.22

## getHostname

srvTargetGetHostname Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SrvTarget | `target`: a `SrvTarget`
-> m Text | Returns: `target`'s hostname

Gets `target`'s hostname (in ASCII form; if you are going to present this to the user, you should use `hostnameIsAsciiEncoded` to check if it contains encoded Unicode segments, and use `hostnameToUnicode` to convert it if it does.)

Since: 2.22

## getPort

srvTargetGetPort Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SrvTarget | `target`: a `SrvTarget`
-> m Word16 | Returns: `target`'s port

Gets `target`'s port

Since: 2.22

## getPriority

srvTargetGetPriority Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SrvTarget | `target`: a `SrvTarget`
-> m Word16 | Returns: `target`'s priority

Gets `target`'s priority. You should not need to look at this; `Resolver` already sorts the targets according to the algorithm in RFC 2782.

Since: 2.22

## getWeight

srvTargetGetWeight Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SrvTarget | `target`: a `SrvTarget`
-> m Word16 | Returns: `target`'s weight

Gets `target`'s weight. You should not need to look at this; `Resolver` already sorts the targets according to the algorithm in RFC 2782.

Since: 2.22

## new

srvTargetNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `hostname`: the host that the service is running on
-> Word16 | `port`: the port that the service is running on
-> Word16 | `priority`: the target's priority
-> Word16 | `weight`: the target's weight
-> m SrvTarget | Returns: a new `SrvTarget`.

Creates a new `SrvTarget` with the given parameters.

You should not need to use this; normally `GSrvTargets` are created by `Resolver`.

Since: 2.22