mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-08 08:33:39 +08:00
raw: add core support for multicast TX options
The patch simply copies the relevant bits from the UDP implementation. Perhaps most notably, the patch does *not* copy the IPv4-only UDP support for IP_MULTICAST_IF, because that option can also be implemented using the interface index based approach. Largely thanks to this omission, at least on 32-bit platforms, this patch does not increase the RAW PCB size at all.
This commit is contained in:
committed by
Dirk Ziegelmeier
parent
ab8119360e
commit
6ce9a01c3e
@@ -986,7 +986,7 @@
|
||||
* core support for the corresponding IPv6 options.
|
||||
*/
|
||||
#if !defined LWIP_MULTICAST_TX_OPTIONS || defined __DOXYGEN__
|
||||
#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && LWIP_UDP)
|
||||
#define LWIP_MULTICAST_TX_OPTIONS ((LWIP_IGMP || LWIP_IPV6_MLD) && (LWIP_UDP || LWIP_RAW))
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -52,8 +52,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RAW_FLAGS_CONNECTED 0x01U
|
||||
#define RAW_FLAGS_HDRINCL 0x02U
|
||||
#define RAW_FLAGS_CONNECTED 0x01U
|
||||
#define RAW_FLAGS_HDRINCL 0x02U
|
||||
#define RAW_FLAGS_MULTICAST_LOOP 0x04U
|
||||
|
||||
struct raw_pcb;
|
||||
|
||||
@@ -80,6 +81,13 @@ struct raw_pcb {
|
||||
u8_t protocol;
|
||||
u8_t flags;
|
||||
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
/** outgoing network interface for multicast packets, by interface index (if nonzero) */
|
||||
u8_t mcast_ifindex;
|
||||
/** TTL for outgoing multicast packets */
|
||||
u8_t mcast_ttl;
|
||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||
|
||||
/** receive callback function */
|
||||
raw_recv_fn recv;
|
||||
/* user-supplied argument for the recv callback */
|
||||
@@ -118,6 +126,13 @@ void raw_netif_ip_addr_changed(const ip_addr_t* old_addr, const ip_addr_t* new_a
|
||||
/* for compatibility with older implementation */
|
||||
#define raw_new_ip6(proto) raw_new_ip_type(IPADDR_TYPE_V6, proto)
|
||||
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
#define raw_set_multicast_netif_index(pcb, idx) ((pcb)->mcast_ifindex = (idx))
|
||||
#define raw_get_multicast_netif_index(pcb) ((pcb)->mcast_ifindex)
|
||||
#define raw_set_multicast_ttl(pcb, value) ((pcb)->mcast_ttl = (value))
|
||||
#define raw_get_multicast_ttl(pcb) ((pcb)->mcast_ttl)
|
||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user