diff --git a/protocols/sacn/sacn.h b/protocols/sacn/sacn.h index b50c7c8..d93b90c 100644 --- a/protocols/sacn/sacn.h +++ b/protocols/sacn/sacn.h @@ -117,4 +117,37 @@ using ipAddress = ACN::SDT::UDP::ipAddress; /// > through labelling, manufacturer documentation, or other means, which IP /// > transports they support. using ip_addr_spec = ACN::SDT::ip_addr_spec; + + +/** + * @brief \cite sACN 9.3.1 Allocation of IPv4 Multicast Addresses + * + * > Multicast addresses are from the IPv4 Local Scope and will be managed by + * > routers in conformance with RFC 2365 \cite ASIPM. + */ +static inline ipAddress IPv4MulticastAddress(universe_number universe) { + ipAddress addr; + addr.type = ACN::SDT::SDT_ADDR_IPV4; + addr.address.ipv4.bytes[3] = 239; + addr.address.ipv4.bytes[2] = 255; + addr.address.ipv4.bytes[1] = universe >> 8; + addr.address.ipv4.bytes[0] = universe & 0xff; + return addr; +}; + + +/** + * @brief \cite sACN 9.3.2 Allocation of IPv6 Multicast Addresses + * @param universe + * @return + */ +static inline ipAddress IPv6MulticastAddress(universe_number universe) { + ipAddress addr; + addr.type = ACN::SDT::SDT_ADDR_IPV6; + addr.address.ipv6.group[3] = 131; + addr.address.ipv6.group[1] = universe >> 8; + addr.address.ipv6.group[0] = universe & 0xff; + return addr; +} + } // SACN