Initial commit
[platform/upstream/glib2.0.git] / docs / reference / gio / html / gio-GSrvTarget.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GSrvTarget</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="resolver.html" title="DNS resolution">
9 <link rel="prev" href="GNetworkService.html" title="GNetworkService">
10 <link rel="next" href="highlevel-socket.html" title="Highlevel network functionallity">
11 <meta name="generator" content="GTK-Doc V1.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="part" href="pt01.html" title="Part I. GIO Overview">
14 <link rel="chapter" href="ch01.html" title="Introduction">
15 <link rel="chapter" href="ch02.html" title="Compiling GIO applications">
16 <link rel="chapter" href="ch03.html" title="Running GIO applications">
17 <link rel="chapter" href="extending-gio.html" title="Extending GIO">
18 <link rel="part" href="pt02.html" title="Part II. API Reference">
19 <link rel="chapter" href="file_ops.html" title="File Operations">
20 <link rel="chapter" href="file_mon.html" title="File System Monitoring">
21 <link rel="chapter" href="async.html" title="Asynchronous I/O">
22 <link rel="chapter" href="conversion.html" title="Data conversion">
23 <link rel="chapter" href="streaming.html" title="Streaming I/O">
24 <link rel="chapter" href="types.html" title="File types and applications">
25 <link rel="chapter" href="volume_mon.html" title="Volumes and Drives">
26 <link rel="chapter" href="icons.html" title="Icons">
27 <link rel="chapter" href="failable_initialization.html" title="Failable Initialization">
28 <link rel="chapter" href="networking.html" title="Lowlevel platform-independent network support">
29 <link rel="chapter" href="resolver.html" title="DNS resolution">
30 <link rel="chapter" href="highlevel-socket.html" title="Highlevel network functionallity">
31 <link rel="chapter" href="utils.html" title="Utilities">
32 <link rel="chapter" href="extending.html" title="Extending GIO">
33 <link rel="part" href="migrating.html" title="Part III. Migrating to GIO">
34 <link rel="chapter" href="ch19.html" title="Migrating from POSIX to GIO">
35 <link rel="chapter" href="ch20.html" title="Migrating from GnomeVFS to GIO">
36 <link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy">
37 <link rel="index" href="api-index-full.html" title="Index">
38 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
39 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
40 <link rel="index" href="api-index-2-20.html" title="Index of new symbols in 2.20">
41 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
42 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
43 </head>
44 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
45 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
46 <tr valign="middle">
47 <td><a accesskey="p" href="GNetworkService.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
48 <td><a accesskey="u" href="resolver.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
49 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
50 <th width="100%" align="center">GIO Reference Manual</th>
51 <td><a accesskey="n" href="highlevel-socket.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
52 </tr>
53 <tr><td colspan="5" class="shortcuts">
54 <a href="#gio-GSrvTarget.synopsis" class="shortcut">Top</a>
55                    | 
56                   <a href="#gio-GSrvTarget.description" class="shortcut">Description</a>
57 </td></tr>
58 </table>
59 <div class="refentry" title="GSrvTarget">
60 <a name="gio-GSrvTarget"></a><div class="titlepage"></div>
61 <div class="refnamediv"><table width="100%"><tr>
62 <td valign="top">
63 <h2><span class="refentrytitle"><a name="gio-GSrvTarget.top_of_page"></a>GSrvTarget</span></h2>
64 <p>GSrvTarget — DNS SRV record target</p>
65 </td>
66 <td valign="top" align="right"></td>
67 </tr></table></div>
68 <div class="refsynopsisdiv" title="Synopsis">
69 <a name="gio-GSrvTarget.synopsis"></a><h2>Synopsis</h2>
70 <pre class="synopsis">
71 #include &lt;gio/gio.h&gt;
72
73                     <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget">GSrvTarget</a>;
74 <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>                    (const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *hostname,
75                                                          <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> port,
76                                                          <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> priority,
77                                                          <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> weight);
78 <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>                   (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);
79 <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>                   (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);
80 const <a href="http://library.gnome.org/devel/glib/unstable/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>           (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);
81 <a href="http://library.gnome.org/devel/glib/unstable/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>               (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);
82 <a href="http://library.gnome.org/devel/glib/unstable/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>           (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);
83 <a href="http://library.gnome.org/devel/glib/unstable/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>             (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);
84 <a href="http://library.gnome.org/devel/glib/unstable/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>              (<a href="http://library.gnome.org/devel/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *targets);
85 </pre>
86 </div>
87 <div class="refsect1" title="Description">
88 <a name="gio-GSrvTarget.description"></a><h2>Description</h2>
89 <p>
90 SRV (service) records are used by some network protocols to provide
91 service-specific aliasing and load-balancing. For example, XMPP
92 (Jabber) uses SRV records to locate the XMPP server for a domain;
93 rather than connecting directly to "example.com" or assuming a
94 specific server hostname like "xmpp.example.com", an XMPP client
95 would look up the "xmpp-client" SRV record for "example.com", and
96 then connect to whatever host was pointed to by that record.
97 </p>
98 <p>
99 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
100 <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
101 for a given service. However, if you are simply planning to connect
102 to the remote service, you can use <a class="link" href="GNetworkService.html" title="GNetworkService"><span class="type">GNetworkService</span></a>'s
103 <a class="link" href="GSocketConnectable.html" title="GSocketConnectable"><span class="type">GSocketConnectable</span></a> interface and not need to worry about
104 <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> at all.</p>
105 </div>
106 <div class="refsect1" title="Details">
107 <a name="gio-GSrvTarget.details"></a><h2>Details</h2>
108 <div class="refsect2" title="GSrvTarget">
109 <a name="GSrvTarget"></a><h3>GSrvTarget</h3>
110 <pre class="programlisting">typedef struct _GSrvTarget GSrvTarget;</pre>
111 <p>
112 A single target host/port that a network service is running on.</p>
113 </div>
114 <hr>
115 <div class="refsect2" title="g_srv_target_new ()">
116 <a name="g-srv-target-new"></a><h3>g_srv_target_new ()</h3>
117 <pre class="programlisting"><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *        g_srv_target_new                    (const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *hostname,
118                                                          <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> port,
119                                                          <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> priority,
120                                                          <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a> weight);</pre>
121 <p>
122 Creates a new <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a> with the given parameters.
123 </p>
124 <p>
125 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
126 created by <a class="link" href="GResolver.html" title="GResolver"><span class="type">GResolver</span></a>.</p>
127 <div class="variablelist"><table border="0">
128 <col align="left" valign="top">
129 <tbody>
130 <tr>
131 <td><p><span class="term"><em class="parameter"><code>hostname</code></em> :</span></p></td>
132 <td> the host that the service is running on
133 </td>
134 </tr>
135 <tr>
136 <td><p><span class="term"><em class="parameter"><code>port</code></em> :</span></p></td>
137 <td> the port that the service is running on
138 </td>
139 </tr>
140 <tr>
141 <td><p><span class="term"><em class="parameter"><code>priority</code></em> :</span></p></td>
142 <td> the target's priority
143 </td>
144 </tr>
145 <tr>
146 <td><p><span class="term"><em class="parameter"><code>weight</code></em> :</span></p></td>
147 <td> the target's weight
148 </td>
149 </tr>
150 <tr>
151 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
152 <td> a new <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>.
153
154 </td>
155 </tr>
156 </tbody>
157 </table></div>
158 <p class="since">Since 2.22</p>
159 </div>
160 <hr>
161 <div class="refsect2" title="g_srv_target_copy ()">
162 <a name="g-srv-target-copy"></a><h3>g_srv_target_copy ()</h3>
163 <pre class="programlisting"><a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *        g_srv_target_copy                   (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);</pre>
164 <p>
165 Copies <em class="parameter"><code>target</code></em></p>
166 <div class="variablelist"><table border="0">
167 <col align="left" valign="top">
168 <tbody>
169 <tr>
170 <td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
171 <td> a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
172 </td>
173 </tr>
174 <tr>
175 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
176 <td> a copy of <em class="parameter"><code>target</code></em>
177
178 </td>
179 </tr>
180 </tbody>
181 </table></div>
182 <p class="since">Since 2.22</p>
183 </div>
184 <hr>
185 <div class="refsect2" title="g_srv_target_free ()">
186 <a name="g-srv-target-free"></a><h3>g_srv_target_free ()</h3>
187 <pre class="programlisting"><span class="returnvalue">void</span>                g_srv_target_free                   (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);</pre>
188 <p>
189 Frees <em class="parameter"><code>target</code></em></p>
190 <div class="variablelist"><table border="0">
191 <col align="left" valign="top">
192 <tbody><tr>
193 <td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
194 <td> a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
195 </td>
196 </tr></tbody>
197 </table></div>
198 <p class="since">Since 2.22</p>
199 </div>
200 <hr>
201 <div class="refsect2" title="g_srv_target_get_hostname ()">
202 <a name="g-srv-target-get-hostname"></a><h3>g_srv_target_get_hostname ()</h3>
203 <pre class="programlisting">const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       g_srv_target_get_hostname           (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);</pre>
204 <p>
205 Gets <em class="parameter"><code>target</code></em>'s hostname (in ASCII form; if you are going to present
206 this to the user, you should use <a href="http://library.gnome.org/devel/glib/unstable/glib-Hostname-Utilities.html#g-hostname-is-ascii-encoded"><code class="function">g_hostname_is_ascii_encoded()</code></a> to
207 check if it contains encoded Unicode segments, and use
208 <a href="http://library.gnome.org/devel/glib/unstable/glib-Hostname-Utilities.html#g-hostname-to-unicode"><code class="function">g_hostname_to_unicode()</code></a> to convert it if it does.)</p>
209 <div class="variablelist"><table border="0">
210 <col align="left" valign="top">
211 <tbody>
212 <tr>
213 <td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
214 <td> a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
215 </td>
216 </tr>
217 <tr>
218 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
219 <td> <em class="parameter"><code>target</code></em>'s hostname
220
221 </td>
222 </tr>
223 </tbody>
224 </table></div>
225 <p class="since">Since 2.22</p>
226 </div>
227 <hr>
228 <div class="refsect2" title="g_srv_target_get_port ()">
229 <a name="g-srv-target-get-port"></a><h3>g_srv_target_get_port ()</h3>
230 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a>             g_srv_target_get_port               (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);</pre>
231 <p>
232 Gets <em class="parameter"><code>target</code></em>'s port</p>
233 <div class="variablelist"><table border="0">
234 <col align="left" valign="top">
235 <tbody>
236 <tr>
237 <td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
238 <td> a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
239 </td>
240 </tr>
241 <tr>
242 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
243 <td> <em class="parameter"><code>target</code></em>'s port
244
245 </td>
246 </tr>
247 </tbody>
248 </table></div>
249 <p class="since">Since 2.22</p>
250 </div>
251 <hr>
252 <div class="refsect2" title="g_srv_target_get_priority ()">
253 <a name="g-srv-target-get-priority"></a><h3>g_srv_target_get_priority ()</h3>
254 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a>             g_srv_target_get_priority           (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);</pre>
255 <p>
256 Gets <em class="parameter"><code>target</code></em>'s priority. You should not need to look at this;
257 <a class="link" href="GResolver.html" title="GResolver"><span class="type">GResolver</span></a> already sorts the targets according to the algorithm in
258 RFC 2782.</p>
259 <div class="variablelist"><table border="0">
260 <col align="left" valign="top">
261 <tbody>
262 <tr>
263 <td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
264 <td> a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
265 </td>
266 </tr>
267 <tr>
268 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
269 <td> <em class="parameter"><code>target</code></em>'s priority
270
271 </td>
272 </tr>
273 </tbody>
274 </table></div>
275 <p class="since">Since 2.22</p>
276 </div>
277 <hr>
278 <div class="refsect2" title="g_srv_target_get_weight ()">
279 <a name="g-srv-target-get-weight"></a><h3>g_srv_target_get_weight ()</h3>
280 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="returnvalue">guint16</span></a>             g_srv_target_get_weight             (<a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="returnvalue">GSrvTarget</span></a> *target);</pre>
281 <p>
282 Gets <em class="parameter"><code>target</code></em>'s weight. You should not need to look at this;
283 <a class="link" href="GResolver.html" title="GResolver"><span class="type">GResolver</span></a> already sorts the targets according to the algorithm in
284 RFC 2782.</p>
285 <div class="variablelist"><table border="0">
286 <col align="left" valign="top">
287 <tbody>
288 <tr>
289 <td><p><span class="term"><em class="parameter"><code>target</code></em> :</span></p></td>
290 <td> a <a class="link" href="gio-GSrvTarget.html#GSrvTarget" title="GSrvTarget"><span class="type">GSrvTarget</span></a>
291 </td>
292 </tr>
293 <tr>
294 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
295 <td> <em class="parameter"><code>target</code></em>'s weight
296
297 </td>
298 </tr>
299 </tbody>
300 </table></div>
301 <p class="since">Since 2.22</p>
302 </div>
303 <hr>
304 <div class="refsect2" title="g_srv_target_list_sort ()">
305 <a name="g-srv-target-list-sort"></a><h3>g_srv_target_list_sort ()</h3>
306 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *             g_srv_target_list_sort              (<a href="http://library.gnome.org/devel/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *targets);</pre>
307 <p>
308 Sorts <em class="parameter"><code>targets</code></em> in place according to the algorithm in RFC 2782.</p>
309 <div class="variablelist"><table border="0">
310 <col align="left" valign="top">
311 <tbody>
312 <tr>
313 <td><p><span class="term"><em class="parameter"><code>targets</code></em> :</span></p></td>
314 <td> a <a href="http://library.gnome.org/devel/glib/unstable/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>
315 </td>
316 </tr>
317 <tr>
318 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
319 <td> the head of the sorted list.
320
321 </td>
322 </tr>
323 </tbody>
324 </table></div>
325 <p class="since">Since 2.22</p>
326 </div>
327 </div>
328 </div>
329 <div class="footer">
330 <hr>
331           Generated by GTK-Doc V1.13</div>
332 </body>
333 </html>