Endpoint parses and stores a Unix/IPv4/IPv6 address.
It can parse an IPv4/6 string representation, or a fully-qualified Unix path; and it stores a binary representation of those. If the Endpoint is valid(), its protocol(), address() and port() are all accessible.
The OS equivalent of an Endpoint, sockaddr, is available through sockaddr() and sockaddrSize().
Finally, it can generate a correct string() representation.
There is no DNS or /etc/hosts support.
Constructs an Endpoint using configuration data. address and port are fetched using Configuration.
This constructor logs errors if anything goes wrong.
Constructs an Endpoint representing port on address. If the address is a Unix path, the port is ignored.
Constructs a copy of other.
Constructs an Endpoint corresponding to the sockaddr sa.
Creates an empty Endpoint object.
Returns a string representation of this Endpoint's address. The return value is both human-readable and uniquely parsable. For example, the Endpoint constructor can parse the result of address().
If the Endpoint isn't valid(), address() returns an empty string.
Makes this Endpoint into a copy of other and returns a reference to this Endpoint.
And what port?
Returns the protocol to be used for this Endpoint.
Returns a pointer to a static sockaddr structure filled in with this Endpoint's information. Subsequent calls to sockaddr() will overwrite the result.
If the Endpoint is not valid, this function returns a null pointer.
Returns the size of the struct to which sockaddr() returns a pointer.
Returns the string representation of an endpoint. Note that this cannot be parsed - it's strictly for human consumption.
The returned value does not contain slash, backslash or parens.
Returns true if this endpoint represents something sensible, and false if there was an error during parsing or similar.
This strange function exists only so that we can construct a valid sockaddr that has the port set to zero, so that we can pass it to bind(2) and ask it to fill in a random port for us. The calling convention is inconvenient, but makes it easy to locate callers.
This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.