diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2010-11-24 08:30:47 -0800 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2010-11-24 08:30:47 -0800 |
commit | 50eef01259415a59067de542a21f30f6f4b829d0 (patch) | |
tree | 0f7daf78e6bd8c84dbf88a7ec8a57adf5db5f2ed /sockets.h | |
parent | 3a21de8e50f7c4a3dae578ee428f9aad363183c0 (diff) | |
download | external_qemu-50eef01259415a59067de542a21f30f6f4b829d0.zip external_qemu-50eef01259415a59067de542a21f30f6f4b829d0.tar.gz external_qemu-50eef01259415a59067de542a21f30f6f4b829d0.tar.bz2 |
Implement sock_address_list_create2 routine.
This routine takes socket address in the form of [host:]port and creates array of SockAddress for it.
Change-Id: Ib2d4c1035d109d9d3df100961c4eec728d15e485
Diffstat (limited to 'sockets.h')
-rw-r--r-- | sockets.h | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -280,6 +280,28 @@ SockAddress** sock_address_list_create( const char* hostname, const char* port, unsigned flags ); +/* resolve a string containing host and port name into a list of SockAddress + * objects. Parameter host_and_port should be in format [host:]port, where + * 'host' addresses the machine and must be resolvable into an IP address, and + * 'port' is a decimal numeric value for the port. 'host' is optional, and if + * ommited, localhost will be used. + * returns a NULL-terminated array of SockAddress pointers on success, + * or NULL in case of failure, with the value of errno set to one of the + * following: + * + * EINVAL : invalid argument + * EHOSTDOWN : could not reach DNS server + * ENOENT : no host with this name, or host doesn't have IP address + * ENOMEM : not enough memory to perform request + * + * other system-level errors can also be set depending on the host sockets + * implementation. + * + * This function loops on EINTR so the caller shouldn't have to check for it. + */ +SockAddress** sock_address_list_create2(const char* host_and_port, + unsigned flags ); + void sock_address_list_free( SockAddress** list ); /* create a new socket, return the socket number of -1 on failure */ |