mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 15:00:10 +01:00
glib-aux: make nm_utils_ipv6_{addr_set_interface_identifier,interface_identifier_get_from_addr}() inline
They are trivial wrappers around memcpy(). Make them inline.
This commit is contained in:
parent
6996fa64b6
commit
67ee711743
2 changed files with 29 additions and 35 deletions
|
|
@ -81,37 +81,6 @@ _nm_utils_inet6_is_token(const struct in6_addr *in6addr)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_utils_ipv6_addr_set_interface_identifier:
|
||||
* @addr: output token encoded as %in6_addr
|
||||
* @iid: %NMUtilsIPv6IfaceId interface identifier
|
||||
*
|
||||
* Converts the %NMUtilsIPv6IfaceId to an %in6_addr (suitable for use
|
||||
* with Linux platform). This only copies the lower 8 bytes, ignoring
|
||||
* the /64 network prefix which is expected to be all-zero for a valid
|
||||
* token.
|
||||
*/
|
||||
void
|
||||
nm_utils_ipv6_addr_set_interface_identifier(struct in6_addr *addr, const NMUtilsIPv6IfaceId *iid)
|
||||
{
|
||||
memcpy(addr->s6_addr + 8, &iid->id_u8, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_utils_ipv6_interface_identifier_get_from_addr:
|
||||
* @iid: output %NMUtilsIPv6IfaceId interface identifier set from the token
|
||||
* @addr: token encoded as %in6_addr
|
||||
*
|
||||
* Converts the %in6_addr encoded token (as used by Linux platform) to
|
||||
* the interface identifier.
|
||||
*/
|
||||
void
|
||||
nm_utils_ipv6_interface_identifier_get_from_addr(NMUtilsIPv6IfaceId *iid,
|
||||
const struct in6_addr *addr)
|
||||
{
|
||||
memcpy(iid, addr->s6_addr + 8, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_utils_ipv6_interface_identifier_get_from_token:
|
||||
* @iid: output %NMUtilsIPv6IfaceId interface identifier set from the token
|
||||
|
|
|
|||
|
|
@ -269,11 +269,36 @@ typedef struct _NMUtilsIPv6IfaceId {
|
|||
} \
|
||||
}
|
||||
|
||||
void nm_utils_ipv6_addr_set_interface_identifier(struct in6_addr *addr,
|
||||
const NMUtilsIPv6IfaceId *iid);
|
||||
/**
|
||||
* nm_utils_ipv6_addr_set_interface_identifier:
|
||||
* @addr: output token encoded as %in6_addr
|
||||
* @iid: %NMUtilsIPv6IfaceId interface identifier
|
||||
*
|
||||
* Converts the %NMUtilsIPv6IfaceId to an %in6_addr (suitable for use
|
||||
* with Linux platform). This only copies the lower 8 bytes, ignoring
|
||||
* the /64 network prefix which is expected to be all-zero for a valid
|
||||
* token.
|
||||
*/
|
||||
static inline void
|
||||
nm_utils_ipv6_addr_set_interface_identifier(struct in6_addr *addr, const NMUtilsIPv6IfaceId *iid)
|
||||
{
|
||||
memcpy(addr->s6_addr + 8, &iid->id_u8, 8);
|
||||
}
|
||||
|
||||
void nm_utils_ipv6_interface_identifier_get_from_addr(NMUtilsIPv6IfaceId *iid,
|
||||
const struct in6_addr *addr);
|
||||
/**
|
||||
* nm_utils_ipv6_interface_identifier_get_from_addr:
|
||||
* @iid: output %NMUtilsIPv6IfaceId interface identifier set from the token
|
||||
* @addr: token encoded as %in6_addr
|
||||
*
|
||||
* Converts the %in6_addr encoded token (as used by Linux platform) to
|
||||
* the interface identifier.
|
||||
*/
|
||||
static inline void
|
||||
nm_utils_ipv6_interface_identifier_get_from_addr(NMUtilsIPv6IfaceId *iid,
|
||||
const struct in6_addr *addr)
|
||||
{
|
||||
memcpy(iid, addr->s6_addr + 8, 8);
|
||||
}
|
||||
|
||||
gboolean nm_utils_ipv6_interface_identifier_get_from_token(NMUtilsIPv6IfaceId *iid,
|
||||
const char *token);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue