## SoupAddress

SoupAddress —

## Synopsis

    enum        SoupAddressFamily;
    #define     SOUP_ADDRESS_ANY_PORT
    SoupAddress* soup_address_new               (const char *name,
                                                 guint port);
    SoupAddress* soup_address_new_from_sockaddr (struct sockaddr *sa,
                                                 int len);
    SoupAddress* soup_address_new_any           (SoupAddressFamily family,
                                                 guint port);
    void        (*SoupAddressCallback)          (SoupAddress *addr,
                                                 guint status,
                                                 gpointer data);
    void        soup_address_resolve_async      (SoupAddress *addr,
                                                 SoupAddressCallback callback,
                                                 gpointer user_data);
    guint       soup_address_resolve_sync       (SoupAddress *addr);
    const char* soup_address_get_name           (SoupAddress *addr);
    const char* soup_address_get_physical       (SoupAddress *addr);
    guint       soup_address_get_port           (SoupAddress *addr);

## Description

## Details

### enum SoupAddressFamily

    typedef enum {
    	SOUP_ADDRESS_FAMILY_IPV4 = AF_INET,
    	SOUP_ADDRESS_FAMILY_IPV6 = AF_INET6
    } SoupAddressFamily;

### SOUP_ADDRESS_ANY_PORT

    #define SOUP_ADDRESS_ANY_PORT 0

### soup_address_new ()

    SoupAddress* soup_address_new               (const char *name,
                                                 guint 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.

`name` : | a hostname or physical address
`port` : | a port number
Returns : | a SoupAddress

### soup_address_new_from_sockaddr ()

    SoupAddress* soup_address_new_from_sockaddr (struct sockaddr *sa,
                                                 int len);

`sa` : | a pointer to a sockaddr
`len` : | size of `sa`
Returns : | a SoupAddress equivalent to `sa` (or `NULL` if `sa`'s address family isn't supported)

### soup_address_new_any ()

    SoupAddress* soup_address_new_any           (SoupAddressFamily family,
                                                 guint port);

`family` : | the address family
`port` : | the port number (usually 0, meaning "any port")
Returns : | a SoupAddress corresponding to the "any" address for `family` (or `NULL` if `family` isn't supported), suitable for passing to `soup_socket_server_new()`.

### SoupAddressCallback ()

    void        (*SoupAddressCallback)          (SoupAddress *addr,
                                                 guint status,
                                                 gpointer data);

`addr` : |
`status` : |
`data` : |

### soup_address_resolve_async ()

    void        soup_address_resolve_async      (SoupAddress *addr,
                                                 SoupAddressCallback callback,
                                                 gpointer user_data);

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()`.) `callback` will be called when the resolution finishes (successfully or not).

`addr` : | a SoupAddress
`callback` : | callback to call with the result
`user_data` : | data for `callback`

### soup_address_resolve_sync ()

    guint       soup_address_resolve_sync       (SoupAddress *addr);

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

`addr` : | a SoupAddress
Returns : | `SOUP_STATUS_OK` or `SOUP_STATUS_CANT_RESOLVE`

### soup_address_get_name ()

    const char* soup_address_get_name           (SoupAddress *addr);

`addr` : | a SoupAddress
Returns : | the hostname associated with `addr`, or `NULL` if it is not known.

### soup_address_get_physical ()

    const char* soup_address_get_physical       (SoupAddress *addr);

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

`addr` : | a SoupAddress
Returns : | the physical address, or `NULL`

### soup_address_get_port ()

    guint       soup_address_get_port           (SoupAddress *addr);

`addr` : | a SoupAddress
Returns : | the port associated with `addr`