<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="GNetworkService">
<refmeta>
<refentrytitle role="top_of_page" id="GNetworkService.top_of_page">GNetworkService</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GIO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GNetworkService</refname>
<refpurpose>A GSocketConnectable for resolving SRV records</refpurpose>
</refnamediv>

<refsynopsisdiv id="GNetworkService.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gio/gio.h&gt;

                    <link linkend="GNetworkService-struct">GNetworkService</link>;
<link linkend="GSocketConnectable">GSocketConnectable</link> * <link linkend="g-network-service-new">g_network_service_new</link>              (const <link linkend="gchar">gchar</link> *service,
                                                         const <link linkend="gchar">gchar</link> *protocol,
                                                         const <link linkend="gchar">gchar</link> *domain);
const <link linkend="gchar">gchar</link> *       <link linkend="g-network-service-get-service">g_network_service_get_service</link>       (<link linkend="GNetworkService">GNetworkService</link> *srv);
const <link linkend="gchar">gchar</link> *       <link linkend="g-network-service-get-protocol">g_network_service_get_protocol</link>      (<link linkend="GNetworkService">GNetworkService</link> *srv);
const <link linkend="gchar">gchar</link> *       <link linkend="g-network-service-get-domain">g_network_service_get_domain</link>        (<link linkend="GNetworkService">GNetworkService</link> *srv);
</synopsis>
</refsynopsisdiv>

<refsect1 id="GNetworkService.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----GNetworkService
</synopsis>
</refsect1>



<refsect1 id="GNetworkService.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GNetworkService implements
 <link linkend="GSocketConnectable">GSocketConnectable</link>.</para>
</refsect1>


<refsect1 id="GNetworkService.properties" role="properties">
<title role="properties.title">Properties</title>
<synopsis>
  &quot;<link linkend="GNetworkService--domain">domain</link>&quot;                   <link linkend="gchar">gchar</link>*                : Read / Write / Construct Only
  &quot;<link linkend="GNetworkService--protocol">protocol</link>&quot;                 <link linkend="gchar">gchar</link>*                : Read / Write / Construct Only
  &quot;<link linkend="GNetworkService--service">service</link>&quot;                  <link linkend="gchar">gchar</link>*                : Read / Write / Construct Only
</synopsis>
</refsect1>



<refsect1 id="GNetworkService.description" role="desc">
<title role="desc.title">Description</title>
<para>
Like <link linkend="GNetworkAddress"><type>GNetworkAddress</type></link> does with hostnames, <link linkend="GNetworkService"><type>GNetworkService</type></link>
provides an easy way to resolve a SRV record, and then attempt to
connect to one of the hosts that implements that service, handling
service priority/weighting, multiple IP addresses, and multiple
address families.
</para>
<para>
See <link linkend="GSrvTarget"><type>GSrvTarget</type></link> for more information about SRV records, and see
<link linkend="GSocketConnectable"><type>GSocketConnectable</type></link> for and example of using the connectable
interface.</para>
<para>
</para>
</refsect1>

<refsect1 id="GNetworkService.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GNetworkService-struct" role="struct">
<title>GNetworkService</title>
<indexterm zone="GNetworkService-struct"><primary sortas="NetworkService">GNetworkService</primary></indexterm><programlisting>typedef struct _GNetworkService GNetworkService;</programlisting>
<para>
A <link linkend="GSocketConnectable"><type>GSocketConnectable</type></link> for resolving a SRV record and connecting to
that service.</para>
<para>
</para></refsect2>
<refsect2 id="g-network-service-new" role="function" condition="since:2.22">
<title>g_network_service_new ()</title>
<indexterm zone="g-network-service-new" role="2.22"><primary sortas="network_service_new">g_network_service_new</primary></indexterm><programlisting><link linkend="GSocketConnectable">GSocketConnectable</link> * g_network_service_new              (const <link linkend="gchar">gchar</link> *service,
                                                         const <link linkend="gchar">gchar</link> *protocol,
                                                         const <link linkend="gchar">gchar</link> *domain);</programlisting>
<para>
Creates a new <link linkend="GNetworkService"><type>GNetworkService</type></link> representing the given <parameter>service</parameter>,
<parameter>protocol</parameter>, and <parameter>domain</parameter>. This will initially be unresolved; use the
<link linkend="GSocketConnectable"><type>GSocketConnectable</type></link> interface to resolve it.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>service</parameter>&#160;:</term>
<listitem><simpara> the service type to look up (eg, "ldap")
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>protocol</parameter>&#160;:</term>
<listitem><simpara> the networking protocol to use for <parameter>service</parameter> (eg, "tcp")
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>domain</parameter>&#160;:</term>
<listitem><simpara> the DNS domain to look up the service in
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GNetworkService"><type>GNetworkService</type></link>

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.22</para></refsect2>
<refsect2 id="g-network-service-get-service" role="function" condition="since:2.22">
<title>g_network_service_get_service ()</title>
<indexterm zone="g-network-service-get-service" role="2.22"><primary sortas="network_service_get_service">g_network_service_get_service</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link> *       g_network_service_get_service       (<link linkend="GNetworkService">GNetworkService</link> *srv);</programlisting>
<para>
Gets <parameter>srv</parameter>'s service name (eg, "ldap").</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>srv</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GNetworkService"><type>GNetworkService</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <parameter>srv</parameter>'s service name

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.22</para></refsect2>
<refsect2 id="g-network-service-get-protocol" role="function" condition="since:2.22">
<title>g_network_service_get_protocol ()</title>
<indexterm zone="g-network-service-get-protocol" role="2.22"><primary sortas="network_service_get_protocol">g_network_service_get_protocol</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link> *       g_network_service_get_protocol      (<link linkend="GNetworkService">GNetworkService</link> *srv);</programlisting>
<para>
Gets <parameter>srv</parameter>'s protocol name (eg, "tcp").</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>srv</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GNetworkService"><type>GNetworkService</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <parameter>srv</parameter>'s protocol name

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.22</para></refsect2>
<refsect2 id="g-network-service-get-domain" role="function" condition="since:2.22">
<title>g_network_service_get_domain ()</title>
<indexterm zone="g-network-service-get-domain" role="2.22"><primary sortas="network_service_get_domain">g_network_service_get_domain</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link> *       g_network_service_get_domain        (<link linkend="GNetworkService">GNetworkService</link> *srv);</programlisting>
<para>
Gets the domain that <parameter>srv</parameter> serves. This might be either UTF-8 or
ASCII-encoded, depending on what <parameter>srv</parameter> was created with.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>srv</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GNetworkService"><type>GNetworkService</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <parameter>srv</parameter>'s domain name

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.22</para></refsect2>

</refsect1>
<refsect1 id="GNetworkService.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GNetworkService--domain" role="property"><title>The <literal>&quot;domain&quot;</literal> property</title>
<indexterm zone="GNetworkService--domain"><primary sortas="NetworkService:domain">GNetworkService:domain</primary></indexterm><programlisting>  &quot;domain&quot;                   <link linkend="gchar">gchar</link>*                : Read / Write / Construct Only</programlisting>
<para>Network domain, eg, "example.com".</para><para>Default value: NULL</para>
</refsect2>
<refsect2 id="GNetworkService--protocol" role="property"><title>The <literal>&quot;protocol&quot;</literal> property</title>
<indexterm zone="GNetworkService--protocol"><primary sortas="NetworkService:protocol">GNetworkService:protocol</primary></indexterm><programlisting>  &quot;protocol&quot;                 <link linkend="gchar">gchar</link>*                : Read / Write / Construct Only</programlisting>
<para>Network protocol, eg "tcp".</para><para>Default value: NULL</para>
</refsect2>
<refsect2 id="GNetworkService--service" role="property"><title>The <literal>&quot;service&quot;</literal> property</title>
<indexterm zone="GNetworkService--service"><primary sortas="NetworkService:service">GNetworkService:service</primary></indexterm><programlisting>  &quot;service&quot;                  <link linkend="gchar">gchar</link>*                : Read / Write / Construct Only</programlisting>
<para>Service name, eg "ldap".</para><para>Default value: NULL</para>
</refsect2>
</refsect1>




</refentry>
