Name resolution v0.1.0
getaddrinfo and the list of addresses it returns.
AddressInfo
pub struct AddressInfo {
pub flags: int32;
pub family: int32;
pub socketType: int32;
pub protocol: int32;
pub addressLength: uint32;
pub canonicalName: *char8;
pub address: *opaque;
pub next: *var AddressInfo;
}
The C library's addrinfo: one result of getaddrinfo, linked to the next.
Fields
| Name | Type | Description |
|---|---|---|
flags | int32 | Flags such as AI_PASSIVE. |
family | int32 | The address family, or zero for any. |
socketType | int32 | The socket type, or zero for any. |
protocol | int32 | The protocol, or zero for any. |
addressLength | uint32 | The size of address in bytes. |
canonicalName | *char8 | The host's canonical name, or null. |
address | *opaque | The address, a sockaddr. |
next | *var AddressInfo | The next result, or null after the last. |
getaddrinfo
pub extern func getaddrinfo(
node: *char8,
service: *char8,
hints: *AddressInfo,
result: *var *var AddressInfo
) -> int32
Looks up the addresses of a host and service.
See also: https://keith.github.io/xcode-man-pages/getaddrinfo.3.html
Parameters
| Name | Type | Description |
|---|---|---|
node | *char8 | the host name or numeric address, NUL-terminated, or null |
service | *char8 | the service name or port number, NUL-terminated, or null |
hints | *AddressInfo | what kind of results are wanted, or null for every kind |
result | *var *var AddressInfo | receives the first result, freed with freeaddrinfo |
Returns: zero, or an EAI_* code
freeaddrinfo
pub extern func freeaddrinfo(info: *var AddressInfo)
Frees the results of getaddrinfo.
See also: https://keith.github.io/xcode-man-pages/freeaddrinfo.3.html
Parameters
| Name | Type | Description |
|---|---|---|
info | *var AddressInfo | the first result |