net: Add utility function returning IPv4 broadcast address
Change-Id: Ibe4f5ad530f6a0f50137ef2cd8e64dbc9de6cba1 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
9d0de92f59
commit
af685962b6
3 changed files with 28 additions and 0 deletions
|
@ -306,6 +306,12 @@ struct in6_addr *net_if_ipv6_select_src_addr(struct net_if *iface,
|
||||||
*/
|
*/
|
||||||
struct in6_addr *net_if_ipv6_unspecified_addr(void);
|
struct in6_addr *net_if_ipv6_unspecified_addr(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return IPv4 broadcast address (all bits ones)
|
||||||
|
* @return IPv4 broadcast address with all bits set to one.
|
||||||
|
*/
|
||||||
|
const struct in_addr *net_if_ipv4_broadcast_addr(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a IPv6 link local address in a given state.
|
* @brief Get a IPv6 link local address in a given state.
|
||||||
* @param iface Interface to use. Must be a valid pointer to an interface.
|
* @param iface Interface to use. Must be a valid pointer to an interface.
|
||||||
|
|
|
@ -329,6 +329,17 @@ static inline struct in6_addr *net_ipv6_unspecified_address(void)
|
||||||
return net_if_ipv6_unspecified_addr();
|
return net_if_ipv6_unspecified_addr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern const struct in_addr *net_if_ipv4_broadcast_addr(void);
|
||||||
|
|
||||||
|
/** @brief Return pointer to broadcast (all bits ones) IPv4 address.
|
||||||
|
*
|
||||||
|
* @return Broadcast IPv4 address.
|
||||||
|
*/
|
||||||
|
static inline const struct in_addr *net_ipv4_broadcast_address(void)
|
||||||
|
{
|
||||||
|
return net_if_ipv4_broadcast_addr();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -216,6 +216,17 @@ struct in6_addr *net_if_ipv6_unspecified_addr(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const struct in_addr *net_if_ipv4_broadcast_addr(void)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_NET_IPV4)
|
||||||
|
static const struct in_addr addr = { { { 255, 255, 255, 255 } } };
|
||||||
|
|
||||||
|
return &addr;
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
struct in6_addr *net_if_ipv6_get_ll(struct net_if *iface,
|
struct in6_addr *net_if_ipv6_get_ll(struct net_if *iface,
|
||||||
enum net_addr_state addr_state)
|
enum net_addr_state addr_state)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue