glibmm 2.66.10

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Symbols | List of all members
Gio::SrvTarget Class Reference
Portable Network I/O Functionality

DNS SRV record target. More...

`#include <giomm/srvtarget.h>`

## Public Member Functions
| SrvTarget ()
| SrvTarget (GSrvTarget * gobject, bool make_a_copy=true)
| SrvTarget (const SrvTarget & other)
SrvTarget & | operator= (const SrvTarget & other)
| SrvTarget (SrvTarget && other) noexcept
SrvTarget & | operator= (SrvTarget && other) noexcept
| ~SrvTarget () noexcept
void | swap (SrvTarget & other) noexcept
GSrvTarget * | gobj ()
| Provides access to the underlying C instance.
const GSrvTarget * | gobj () const
| Provides access to the underlying C instance.
GSrvTarget * | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| SrvTarget (const Glib::ustring & hostname, guint16 port, guint16 priority, guint16 weight)
Glib::ustring | get_hostname () const
| Gets target's hostname (in ASCII form; if you are going to present this to the user, you should use Glib::hostname_is_ascii_encoded() to check if it contains encoded Unicode segments, and use Glib::hostname_to_unicode() to convert it if it does.).
guint16 | get_port () const
| Gets target's port.
guint16 | get_priority () const
| Gets target's priority.
guint16 | get_weight () const
| Gets target's weight.

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Attributes
GSrvTarget * | gobject_

## Related Symbols
(Note that these are not member symbols.)
void | swap (SrvTarget & lhs, SrvTarget & rhs) noexcept
Gio::SrvTarget | wrap (GSrvTarget * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

DNS SRV record target.

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 Resolver::lookup_service() or Resolver::lookup_service_async() to find the SrvTargets 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 SrvTarget at all.

Since glibmm 2.24

## Constructor & Destructor Documentation

## ◆ SrvTarget() [1/5]

Gio::SrvTarget::SrvTarget | ( |  | ) |

## ◆ SrvTarget() [2/5]

Gio::SrvTarget::SrvTarget | ( | GSrvTarget * | gobject,
|  | bool | make_a_copy = true )
| explicit

## ◆ SrvTarget() [3/5]

Gio::SrvTarget::SrvTarget | ( | const SrvTarget & | other | ) |

## ◆ SrvTarget() [4/5]

Gio::SrvTarget::SrvTarget | ( | SrvTarget && | other | ) |
| noexcept

## ◆ ~SrvTarget()

Gio::SrvTarget::~SrvTarget | ( |  | ) |
| noexcept

## ◆ SrvTarget() [5/5]

Gio::SrvTarget::SrvTarget | ( | const Glib::ustring & | hostname,
|  | guint16 | port,
|  | guint16 | priority,
|  | guint16 | weight )

## Member Function Documentation

## ◆ get_hostname()

Glib::ustring Gio::SrvTarget::get_hostname | ( |  | ) | const

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

Since glibmm 2.22

Returns
  target's hostname.

## ◆ get_port()

guint16 Gio::SrvTarget::get_port | ( |  | ) | const

Gets target's port.

Since glibmm 2.22

Returns
  target's port.

## ◆ get_priority()

guint16 Gio::SrvTarget::get_priority | ( |  | ) | const

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 glibmm 2.22

Returns
  target's priority.

## ◆ get_type()

GType Gio::SrvTarget::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_weight()

guint16 Gio::SrvTarget::get_weight | ( |  | ) | const

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 glibmm 2.22

Returns
  target's weight.

## ◆ gobj() [1/2]

GSrvTarget * Gio::SrvTarget::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const GSrvTarget * Gio::SrvTarget::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

## ◆ gobj_copy()

GSrvTarget * Gio::SrvTarget::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

## ◆ operator=() [1/2]

SrvTarget & Gio::SrvTarget::operator= | ( | const SrvTarget & | other | ) |

## ◆ operator=() [2/2]

SrvTarget & Gio::SrvTarget::operator= | ( | SrvTarget && | other | ) |
| noexcept

## ◆ swap()

void Gio::SrvTarget::swap | ( | SrvTarget & | other | ) |
| noexcept

## Friends And Related Symbol Documentation

## ◆ swap()

void swap | ( | SrvTarget & | lhs,
|  | SrvTarget & | rhs )
| related

Parameters

  lhs | The left-hand side
  rhs | The right-hand side

## ◆ wrap()

Gio::SrvTarget wrap | ( | GSrvTarget * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.

## Member Data Documentation

## ◆ gobject_

GSrvTarget* Gio::SrvTarget::gobject_
| protected