Top |
Functions
GSocketConnectable * | g_network_service_new () |
const gchar * | g_network_service_get_service () |
const gchar * | g_network_service_get_protocol () |
const gchar * | g_network_service_get_domain () |
const gchar * | g_network_service_get_scheme () |
void | g_network_service_set_scheme () |
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 |
|
domain |
the DNS domain to look up the service in |
Since 2.22
g_network_service_get_service ()
const gchar *
g_network_service_get_service (GNetworkService *srv
);
Gets srv
's service name (eg, "ldap").
Since 2.22
g_network_service_get_protocol ()
const gchar *
g_network_service_get_protocol (GNetworkService *srv
);
Gets srv
's protocol name (eg, "tcp").
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.
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.
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.
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