blob: 16ffc8ffb1d182cee996e6351a8ab0328e2e885b [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GSrvTarget</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="resolver.html" title="DNS resolution">
<link rel="prev" href="GNetworkService.html" title="GNetworkService">
<link rel="next" href="highlevel-socket.html" title="Highlevel network functionallity">
<meta name="generator" content="GTK-Doc V1.14 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="GNetworkService.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="resolver.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="highlevel-socket.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gio-GSrvTarget.synopsis" class="shortcut">Top</a>
 | 
<a href="#gio-GSrvTarget.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="GSrvTarget">
<a name="gio-GSrvTarget"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gio-GSrvTarget.top_of_page"></a>GSrvTarget</span></h2>
<p>GSrvTarget — DNS SRV record target</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="gio-GSrvTarget.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gio/gio.h&gt;
<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget">GSrvTarget</a>;
<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> * <a class="link" href="gio-GSrvTarget.html#g-srv-target-new" title="g_srv_target_new ()">g_srv_target_new</a> (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *hostname</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> port</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> priority</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> weight</code></em>);
<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> * <a class="link" href="gio-GSrvTarget.html#g-srv-target-copy" title="g_srv_target_copy ()">g_srv_target_copy</a> (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);
<span class="returnvalue">void</span> <a class="link" href="gio-GSrvTarget.html#g-srv-target-free" title="g_srv_target_free ()">g_srv_target_free</a> (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);
const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * <a class="link" href="gio-GSrvTarget.html#g-srv-target-get-hostname" title="g_srv_target_get_hostname ()">g_srv_target_get_hostname</a> (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> <a class="link" href="gio-GSrvTarget.html#g-srv-target-get-port" title="g_srv_target_get_port ()">g_srv_target_get_port</a> (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> <a class="link" href="gio-GSrvTarget.html#g-srv-target-get-priority" title="g_srv_target_get_priority ()">g_srv_target_get_priority</a> (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> <a class="link" href="gio-GSrvTarget.html#g-srv-target-get-weight" title="g_srv_target_get_weight ()">g_srv_target_get_weight</a> (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);
<a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> * <a class="link" href="gio-GSrvTarget.html#g-srv-target-list-sort" title="g_srv_target_list_sort ()">g_srv_target_list_sort</a> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> *targets</code></em>);
</pre>
</div>
<div class="refsect1" title="Description">
<a name="gio-GSrvTarget.description"></a><h2>Description</h2>
<p>
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.
</p>
<p>
You can use <a class="link" href="GResolver.html#g-resolver-lookup-service" title="g_resolver_lookup_service ()"><code class="function">g_resolver_lookup_service()</code></a> or
<a class="link" href="GResolver.html#g-resolver-lookup-service-async" title="g_resolver_lookup_service_async ()"><code class="function">g_resolver_lookup_service_async()</code></a> to find the <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>s
for a given service. However, if you are simply planning to connect
to the remote service, you can use <a class="link" href="GNetworkService.html" title="GNetworkService"><span class="type">GNetworkService</span></a>'s
<a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> interface and not need to worry about
<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> at all.
</p>
</div>
<div class="refsect1" title="Details">
<a name="gio-GSrvTarget.details"></a><h2>Details</h2>
<div class="refsect2" title="GSrvTarget">
<a name="GSrvTarget"></a><h3>GSrvTarget</h3>
<pre class="programlisting">typedef struct _GSrvTarget GSrvTarget;</pre>
<p>
A single target host/port that a network service is running on.
</p>
</div>
<hr>
<div class="refsect2" title="g_srv_target_new ()">
<a name="g-srv-target-new"></a><h3>g_srv_target_new ()</h3>
<pre class="programlisting"><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> * g_srv_target_new (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *hostname</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> port</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> priority</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> weight</code></em>);</pre>
<p>
Creates a new <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> with the given parameters.
</p>
<p>
You should not need to use this; normally <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>s are
created by <a class="link" href="GResolver.html" title="GResolver"><span class="type">GResolver</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>hostname</code></em> :</span></p></td>
<td>the host that the service is running on
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>port</code></em> :</span></p></td>
<td>the port that the service is running on
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>priority</code></em> :</span></p></td>
<td>the target's priority
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>weight</code></em> :</span></p></td>
<td>the target's weight
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a new <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_srv_target_copy ()">
<a name="g-srv-target-copy"></a><h3>g_srv_target_copy ()</h3>
<pre class="programlisting"><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> * g_srv_target_copy (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);</pre>
<p>
Copies <em class="parameter"><code>target</code></em>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a copy of <em class="parameter"><code>target</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_srv_target_free ()">
<a name="g-srv-target-free"></a><h3>g_srv_target_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span> g_srv_target_free (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);</pre>
<p>
Frees <em class="parameter"><code>target</code></em>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_srv_target_get_hostname ()">
<a name="g-srv-target-get-hostname"></a><h3>g_srv_target_get_hostname ()</h3>
<pre class="programlisting">const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * g_srv_target_get_hostname (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);</pre>
<p>
Gets <em class="parameter"><code>target</code></em>'s hostname (in ASCII form; if you are going to present
this to the user, you should use <a href="/usr/share/gtk-doc/html/glib/glib-Hostname-Utilities.html#g-hostname-is-ascii-encoded"><code class="function">g_hostname_is_ascii_encoded()</code></a> to
check if it contains encoded Unicode segments, and use
<a href="/usr/share/gtk-doc/html/glib/glib-Hostname-Utilities.html#g-hostname-to-unicode"><code class="function">g_hostname_to_unicode()</code></a> to convert it if it does.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <em class="parameter"><code>target</code></em>'s hostname
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_srv_target_get_port ()">
<a name="g-srv-target-get-port"></a><h3>g_srv_target_get_port ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> g_srv_target_get_port (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);</pre>
<p>
Gets <em class="parameter"><code>target</code></em>'s port
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <em class="parameter"><code>target</code></em>'s port
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_srv_target_get_priority ()">
<a name="g-srv-target-get-priority"></a><h3>g_srv_target_get_priority ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> g_srv_target_get_priority (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);</pre>
<p>
Gets <em class="parameter"><code>target</code></em>'s priority. You should not need to look at this;
<a class="link" href="GResolver.html" title="GResolver"><span class="type">GResolver</span></a> already sorts the targets according to the algorithm in
RFC 2782.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <em class="parameter"><code>target</code></em>'s priority
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_srv_target_get_weight ()">
<a name="g-srv-target-get-weight"></a><h3>g_srv_target_get_weight ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> g_srv_target_get_weight (<em class="parameter"><code><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> *target</code></em>);</pre>
<p>
Gets <em class="parameter"><code>target</code></em>'s weight. You should not need to look at this;
<a class="link" href="GResolver.html" title="GResolver"><span class="type">GResolver</span></a> already sorts the targets according to the algorithm in
RFC 2782.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <em class="parameter"><code>target</code></em>'s weight
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2" title="g_srv_target_list_sort ()">
<a name="g-srv-target-list-sort"></a><h3>g_srv_target_list_sort ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> * g_srv_target_list_sort (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> *targets</code></em>);</pre>
<p>
Sorts <em class="parameter"><code>targets</code></em> in place according to the algorithm in RFC 2782.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>targets</code></em> :</span></p></td>
<td>a <a href="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> of <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the head of the sorted list.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.14</div>
</body>
</html>