mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
virsocketaddr: Introduce virSocketAddrSetIPv6Addr
This is a missing counterpart for virSocketAddrSetIPv4Addr() and is going to be needed later in the tests. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
4122137871
commit
1ca59d89c6
@ -2165,6 +2165,7 @@ virSocketAddrParseIPv4;
|
|||||||
virSocketAddrParseIPv6;
|
virSocketAddrParseIPv6;
|
||||||
virSocketAddrPrefixToNetmask;
|
virSocketAddrPrefixToNetmask;
|
||||||
virSocketAddrSetIPv4Addr;
|
virSocketAddrSetIPv4Addr;
|
||||||
|
virSocketAddrSetIPv6Addr;
|
||||||
virSocketAddrSetPort;
|
virSocketAddrSetPort;
|
||||||
|
|
||||||
# util/virstats.h
|
# util/virstats.h
|
||||||
|
@ -188,6 +188,21 @@ virSocketAddrSetIPv4Addr(virSocketAddrPtr addr, uint32_t val)
|
|||||||
addr->len = sizeof(struct sockaddr_in);
|
addr->len = sizeof(struct sockaddr_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* virSocketAddrSetIPv6Addr:
|
||||||
|
* @addr: the location to store the result
|
||||||
|
* @val: the 128bit integer in host byte order representing the IPv6 address
|
||||||
|
*
|
||||||
|
* Set the IPv6 address given an integer in host order. This function does not
|
||||||
|
* touch any previously set port.
|
||||||
|
*/
|
||||||
|
void virSocketAddrSetIPv6Addr(virSocketAddrPtr addr, uint32_t val[4])
|
||||||
|
{
|
||||||
|
addr->data.stor.ss_family = AF_INET6;
|
||||||
|
memcpy(addr->data.inet6.sin6_addr.s6_addr, val, 4 * sizeof(*val));
|
||||||
|
addr->len = sizeof(struct sockaddr_in6);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* virSocketAddrEqual:
|
* virSocketAddrEqual:
|
||||||
* @s1: the location of the one IP address
|
* @s1: the location of the one IP address
|
||||||
|
@ -85,6 +85,7 @@ int virSocketAddrParseIPv6(virSocketAddrPtr addr,
|
|||||||
const char *val);
|
const char *val);
|
||||||
|
|
||||||
void virSocketAddrSetIPv4Addr(virSocketAddrPtr s, uint32_t addr);
|
void virSocketAddrSetIPv4Addr(virSocketAddrPtr s, uint32_t addr);
|
||||||
|
void virSocketAddrSetIPv6Addr(virSocketAddrPtr s, uint32_t addr[4]);
|
||||||
|
|
||||||
char *virSocketAddrFormat(const virSocketAddr *addr);
|
char *virSocketAddrFormat(const virSocketAddr *addr);
|
||||||
char *virSocketAddrFormatFull(const virSocketAddr *addr,
|
char *virSocketAddrFormatFull(const virSocketAddr *addr,
|
||||||
|
Loading…
Reference in New Issue
Block a user