GNetworkService

GNetworkService — A GSocketConnectable for resolving SRV records

Functions

Properties

gchar * domain Read / Write / Construct Only
gchar * protocol Read / Write / Construct Only
gchar * scheme Read / Write
gchar * service Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── GNetworkService

Implemented Interfaces

GNetworkService implements GSocketConnectable.

Includes

#include <gio/gio.h>

Description

Like GNetworkAddress does with hostnames, GNetworkService 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.

See GSrvTarget for more information about SRV records, and see GSocketConnectable for and example of using the connectable interface.

Functions

g_network_service_new ()

GSocketConnectable *
g_network_service_new (const gchar *service,
                       const gchar *protocol,
                       const gchar *domain);

Creates a new GNetworkService representing the given service , protocol , and domain . This will initially be unresolved; use the GSocketConnectable interface to resolve it.

Parameters

service

the service type to look up (eg, "ldap")

 

protocol

the networking protocol to use for service (eg, "tcp")

 

domain

the DNS domain to look up the service in

 

Returns

a new GNetworkService.

[transfer full][type GNetworkService]

Since: 2.22


g_network_service_get_service ()

const gchar *
g_network_service_get_service (GNetworkService *srv);

Gets srv 's service name (eg, "ldap").

Parameters

srv

a GNetworkService

 

Returns

srv 's service name

Since: 2.22


g_network_service_get_protocol ()

const gchar *
g_network_service_get_protocol (GNetworkService *srv);

Gets srv 's protocol name (eg, "tcp").

Parameters

srv

a GNetworkService

 

Returns

srv 's protocol name

Since: 2.22


g_network_service_get_domain ()

const gchar *
g_network_service_get_domain (GNetworkService *srv);

Gets the domain that srv serves. This might be either UTF-8 or ASCII-encoded, depending on what srv was created with.

Parameters

srv

a GNetworkService

 

Returns

srv 's domain name

Since: 2.22


g_network_service_get_scheme ()

const gchar *
g_network_service_get_scheme (GNetworkService *srv);

Get's the URI scheme used to resolve proxies. By default, the service name is used as scheme.

Parameters

srv

a GNetworkService

 

Returns

srv 's scheme name

Since: 2.26


g_network_service_set_scheme ()

void
g_network_service_set_scheme (GNetworkService *srv,
                              const gchar *scheme);

Set's the URI scheme used to resolve proxies. By default, the service name is used as scheme.

Parameters

srv

a GNetworkService

 

scheme

a URI scheme

 

Since: 2.26

Types and Values

GNetworkService

typedef struct _GNetworkService GNetworkService;

A GSocketConnectable for resolving a SRV record and connecting to that service.

Property Details

The “domain” property

  “domain”                   gchar *

Network domain, eg, "example.com".

Flags: Read / Write / Construct Only

Default value: NULL


The “protocol” property

  “protocol”                 gchar *

Network protocol, eg "tcp".

Flags: Read / Write / Construct Only

Default value: NULL


The “scheme” property

  “scheme”                   gchar *

Network scheme (default is to use service).

Flags: Read / Write

Default value: NULL


The “service” property

  “service”                  gchar *

Service name, eg "ldap".

Flags: Read / Write / Construct Only

Default value: NULL