Address

#SoupAddress represents the address of a TCP connection endpoint: both the IP address and the port. (It is somewhat like an object-oriented version of struct sockaddr.)

Although #SoupAddress is still used in some libsoup API's, it should not be used in new code; use GLib's #GNetworkAddress or #GSocketAddress instead.

Constructors

this
this(SoupAddress* soupAddress, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(string name, uint port)

Creates a #SoupAddress from @name and @port. The #SoupAddress's IP address may not be available right away; the caller can call soup_address_resolve_async() or soup_address_resolve_sync() to force a DNS resolution.

this
this(SoupAddressFamily family, uint port)

Returns a #SoupAddress corresponding to the "any" address for @family (or %NULL if @family isn't supported), suitable for using as a listening #SoupSocket.

this
this(sockaddr* sa, int len)

Returns a #SoupAddress equivalent to @sa (or %NULL if @sa's address family isn't supported)

Members

Functions

equalByIp
bool equalByIp(Address addr2)

Tests if @addr1 and @addr2 have the same IP address. This method can be used with soup_address_hash_by_ip() to create a #GHashTable that hashes on IP address.

equalByName
bool equalByName(Address addr2)

Tests if @addr1 and @addr2 have the same "name". This method can be used with soup_address_hash_by_name() to create a #GHashTable that hashes on address "names".

getAddressStruct
SoupAddress* getAddressStruct(bool transferOwnership)

Get the main Gtk struct

getGsockaddr
SocketAddress getGsockaddr()

Creates a new #GSocketAddress corresponding to @addr (which is assumed to only have one socket address associated with it).

getName
string getName()

Returns the hostname associated with @addr.

getPhysical
string getPhysical()

Returns the physical address associated with @addr as a string. (Eg, "127.0.0.1"). If the address is not yet known, returns %NULL.

getPort
uint getPort()

Returns the port associated with @addr.

getSockaddr
sockaddr* getSockaddr(int* len)

Returns the sockaddr associated with @addr, with its length in *@len. If the sockaddr is not yet known, returns %NULL.

getStruct
void* getStruct()

the main Gtk struct as a void*

hashByIp
uint hashByIp()

A hash function (for #GHashTable) that corresponds to soup_address_equal_by_ip(), qv

hashByName
uint hashByName()

A hash function (for #GHashTable) that corresponds to soup_address_equal_by_name(), qv

isResolved
bool isResolved()

Tests if @addr has already been resolved. Unlike the other #SoupAddress "get" methods, this is safe to call when @addr might be being resolved in another thread.

resolveAsync
void resolveAsync(MainContext asyncContext, Cancellable cancellable, SoupAddressCallback callback, void* userData)

Asynchronously resolves the missing half of @addr (its IP address if it was created with soup_address_new(), or its hostname if it was created with soup_address_new_from_sockaddr() or soup_address_new_any().)

resolveSync
uint resolveSync(Cancellable cancellable)

Synchronously resolves the missing half of @addr, as with soup_address_resolve_async().

Mixins

__anonymous
mixin SocketConnectableT!(SoupAddress)
Undocumented in source.

Static functions

getType
GType getType()

Variables

soupAddress
SoupAddress* soupAddress;

the main Gtk struct

Meta