mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-19 22:56:57 +08:00
allow multicast socket options IP_MULTICAST_TTL, IP_MULTICAST_IF and IP_MULTICAST_LOOP to be used without IGMP
This commit is contained in:
@@ -128,9 +128,9 @@ err_t ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_add
|
||||
u16_t optlen);
|
||||
#endif /* IP_OPTIONS_SEND */
|
||||
|
||||
#if LWIP_IGMP
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
void ip4_set_default_multicast_netif(struct netif* default_multicast_netif);
|
||||
#endif /* LWIP_IGMP */
|
||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||
|
||||
#define ip4_netif_get_local_ip(netif) (((netif) != NULL) ? &((netif)->ip_addr) : NULL)
|
||||
|
||||
|
||||
@@ -963,11 +963,11 @@
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- IGMP options ----------
|
||||
----- Multicast/IGMP options -----
|
||||
----------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_IGMP==1: Turn on IGMP module.
|
||||
* LWIP_IGMP==1: Turn on IGMP module.
|
||||
*/
|
||||
#ifndef LWIP_IGMP
|
||||
#define LWIP_IGMP 0
|
||||
@@ -977,6 +977,14 @@
|
||||
#define LWIP_IGMP 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_MULTICAST_TX_OPTIONS==1: Enable multicast TX support like the socket options
|
||||
* IP_MULTICAST_TTL/IP_MULTICAST_IF/IP_MULTICAST_LOOP
|
||||
*/
|
||||
#ifndef LWIP_MULTICAST_TX_OPTIONS
|
||||
#define LWIP_MULTICAST_TX_OPTIONS LWIP_IGMP
|
||||
#endif
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- DNS options -----------
|
||||
|
||||
@@ -253,15 +253,21 @@ struct linger {
|
||||
#endif /* LWIP_UDP && LWIP_UDPLITE*/
|
||||
|
||||
|
||||
#if LWIP_IGMP
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
/*
|
||||
* Options and types for UDP multicast traffic handling
|
||||
*/
|
||||
#define IP_ADD_MEMBERSHIP 3
|
||||
#define IP_DROP_MEMBERSHIP 4
|
||||
#define IP_MULTICAST_TTL 5
|
||||
#define IP_MULTICAST_IF 6
|
||||
#define IP_MULTICAST_LOOP 7
|
||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||
|
||||
#if LWIP_IGMP
|
||||
/*
|
||||
* Options and types related to multicast membership
|
||||
*/
|
||||
#define IP_ADD_MEMBERSHIP 3
|
||||
#define IP_DROP_MEMBERSHIP 4
|
||||
|
||||
typedef struct ip_mreq {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
|
||||
@@ -100,12 +100,12 @@ struct udp_pcb {
|
||||
/** ports are in host byte order */
|
||||
u16_t local_port, remote_port;
|
||||
|
||||
#if LWIP_IGMP
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
/** outgoing network interface for multicast packets */
|
||||
ip4_addr_t multicast_ip;
|
||||
/** TTL for outgoing multicast packets */
|
||||
u8_t mcast_ttl;
|
||||
#endif /* LWIP_IGMP */
|
||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||
|
||||
#if LWIP_UDPLITE
|
||||
/** used for UDP_LITE only */
|
||||
@@ -168,12 +168,12 @@ void udp_init (void);
|
||||
struct udp_pcb * udp_new_ip6(void);
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
#if LWIP_IGMP
|
||||
#if LWIP_MULTICAST_TX_OPTIONS
|
||||
#define udp_set_multicast_netif_addr(pcb, ip4addr) do { (pcb)->multicast_ip = *(ip4addr); } while(0)
|
||||
#define udp_get_multicast_netif_addr(pcb) (&(pcb)->multicast_ip)
|
||||
#define udp_set_multicast_ttl(pcb, value) do { (pcb)->mcast_ttl = value; } while(0)
|
||||
#define udp_get_multicast_ttl(pcb) ((pcb)->mcast_ttl)
|
||||
#endif /* LWIP_IGMP */
|
||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||
|
||||
#if UDP_DEBUG
|
||||
void udp_debug_print(struct udp_hdr *udphdr);
|
||||
|
||||
Reference in New Issue
Block a user